Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
17,900
void (final PsiFile file, final XSourcePosition position) { assert myTempBreakpoint == null; final int lineNumber = XsltBreakpointHandler.getActualLineNumber(myProject, position); final String uri = XsltBreakpointHandler.getFileURL(file.getVirtualFile()); myTempBreakpoint = myClient.getBreakpointManager().setBreakpoint(uri, lineNumber); resume(); }
runTo
17,901
Editor (Project project, @NotNull String uri, int lineNumber) { try { final VirtualFile file = VfsUtil.findFileByURL(new URI(uri).toURL()); final OpenFileDescriptor descriptor = new OpenFileDescriptor(project, file, lineNumber, 0); descriptor.navigate(true); return FileEditorManager.getInstance(project).openTextEditor(descriptor, true); } catch (MalformedURLException | URISyntaxException e) { LOG.warn(e); return null; } }
openLocation
17,902
void () { detach(myProcess); }
dispose
17,903
XsltDebuggerSession (Project project, @NotNull ProcessHandler process, Debugger client) { final XsltDebuggerSession session = new XsltDebuggerSession(project, process, client); process.putUserData(DEBUGGER_SESSION, session); return session; }
create
17,904
XsltDebuggerSession (@NotNull ProcessHandler process) { return process.getUserData(DEBUGGER_SESSION); }
getInstance
17,905
void (ProcessHandler processHandler) { processHandler.putUserData(DEBUGGER_SESSION, null); }
detach
17,906
XPathQuickFixFactory () { return XPathQuickFixFactoryImpl.INSTANCE; }
getQuickFixFactory
17,907
PsiFile[] (XPathFile file) { return PsiFile.EMPTY_ARRAY; }
getRelatedFiles
17,908
VariableContext () { return new XsltVariableContext() { @Override @Nullable protected XmlTag getContextTagImpl(XPathElement element) { return PsiTreeUtil.getParentOfType(getContextElement(), XmlTag.class, false); } @Override public IntentionAction @NotNull [] getUnresolvedVariableFixes(XPathVariableReference reference) { return IntentionAction.EMPTY_ARRAY; } }; }
getVariableContext
17,909
XmlTag (XPathElement element) { return PsiTreeUtil.getParentOfType(getContextElement(), XmlTag.class, false); }
getContextTagImpl
17,910
String () { return "XsltDebuggerRunner"; }
getRunnerId
17,911
boolean (@NotNull String executorId, @NotNull RunProfile profile) { return executorId.equals("Debug") && profile instanceof XsltRunConfiguration; }
canRun
17,912
boolean (@NotNull VirtualFile file, int line, @NotNull Project project) { final Document document = FileDocumentManager.getInstance().getDocument(file); if (document == null) return false; final PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document); if (psiFile == null) { return false; } final FileType fileType = psiFile.getFileType(); if (fileType != XmlFileType.INSTANCE || !XsltSupport.isXsltFile(psiFile)) { return false; } return true; }
canPutAt
17,913
XDebuggerEditorsProvider (@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint, @NotNull Project project) { final XSourcePosition position = breakpoint.getSourcePosition(); if (position == null) { return null; } final PsiFile file = PsiManager.getInstance(project).findFile(position.getFile()); if (file == null) { return null; } final XsltChecker.LanguageLevel level = XsltSupport.getXsltLanguageLevel(file); if (level == XsltChecker.LanguageLevel.V1) { return myMyEditorsProvider1; } else if (level == XsltChecker.LanguageLevel.V2) { return myMyEditorsProvider2; } return null; }
getEditorsProvider
17,914
XBreakpointProperties (@NotNull VirtualFile file, int line) { return null; }
createBreakpointProperties
17,915
Object (@Nullable Object o) { if (o != null && !(o instanceof Serializable)) { synchronized (myInstanceCache) { Object instance = myInstanceCache.get(o); if (instance == null) { final ClassLoader loader = o.getClass().getClassLoader(); final Class<?>[] interfaces = o.getClass().getInterfaces(); final EDTGuard guard = new EDTGuard(o, myQueue, myPausedRef); myInstanceCache.put(o, instance = Proxy.newProxyInstance(loader, interfaces, guard)); } return instance; } } else if (o instanceof List) { final List<Object> list = (List<Object>)o; for (int i = 0; i < list.size(); i++) { final Object e = list.remove(i); list.add(i, convert(e)); } } else if (o instanceof Set) { final Set<Object> set = (Set<Object>)o; final List<Object> s2 = new ArrayList<>(); for (Iterator<Object> iterator = set.iterator(); iterator.hasNext(); ) { Object o1 = iterator.next(); final Object o2 = convert(o1); if (o1 != o2) { iterator.remove(); s2.add(o2); } } set.addAll(s2); } return o; }
convert
17,916
void () { try { while (!Thread.currentThread().isInterrupted()) { final Call call = queue.first.take(); queue.second.offer(call.invoke()); } } catch (InterruptedException e) { // break } }
run
17,917
void () { if (!disposed) { disposed = true; ref.set(true); thread.interrupt(); } }
dispose
17,918
void (@NotNull ProcessEvent event) { synchronized (d) { Disposer.dispose(d); } }
processTerminated
17,919
void (@NotNull ProcessEvent event, boolean willBeDestroyed) { if (!willBeDestroyed) { synchronized (d) { Disposer.dispose(d); } } }
processWillTerminate
17,920
void () { synchronized (d) { if (alarm.isDisposed()) { return; } alarm2.addRequest(watchdog, 200); try { ref.set(!target.ping()); } catch (Exception e) { ref.set(true); } finally { alarm2.cancelRequest(watchdog); alarm.addRequest(this, 500); } } }
run
17,921
boolean (Call call) { return call == Call.this; }
isFromCall
17,922
Result () { try { return new Result(EDTGuard.this.invoke(myMethod, myArguments)); } catch (Throwable e) { return new Result(e); } }
invoke
17,923
void (@NotNull ProcessEvent event) { final DebuggerConnector connector = new DebuggerConnector(myProject, event.getProcessHandler(), myPort, myAccessToken); ApplicationManager.getApplication().executeOnPooledThread(connector); }
startNotified
17,924
void (@NotNull ProcessEvent event, boolean willBeDestroyed) { try { final XsltDebuggerSession session = XsltDebuggerSession.getInstance(event.getProcessHandler()); if (session != null) { session.stop(); } } catch (VMPausedException e) { // VM is paused, no way for a "clean" shutdown } catch (DebuggerStoppedException e) { // OK } super.processWillTerminate(event, willBeDestroyed); }
processWillTerminate
17,925
void (@NotNull ProcessEvent event) { super.processTerminated(event); final XsltDebuggerSession session = XsltDebuggerSession.getInstance(event.getProcessHandler()); if (session != null) { session.close(); } }
processTerminated
17,926
boolean (XsltRunConfiguration config, boolean debugger) { return (debugger || XsltDebuggerRunner.ACTIVE.get() == Boolean.TRUE) && config.getOutputType() == XsltRunConfiguration.OutputType.CONSOLE; // ? }
supports
17,927
ProcessListener (Project project, UserDataHolder extensionData) { final Integer port = extensionData.getUserData(PORT); assert port != null; return new DebugProcessListener(project, port, extensionData.getUserData(ACCESS_TOKEN)); }
createProcessListener
17,928
boolean (Project project, AdditionalTabComponentManager manager, @NotNull AdditionalTabComponent outputConsole, ProcessHandler process) { if (manager instanceof RunTab) { LogConsoleManagerBase runTab = ((RunTab)manager).getLogConsoleManager(); runTab.addAdditionalTabComponent(new OutputTabComponent(outputConsole), "XSLT-Output", AllIcons.Debugger.Console); runTab.addAdditionalTabComponent(StructureTabComponent.create(process, outputConsole), "XSLT-Structure", PlatformIcons.FLATTEN_PACKAGES_ICON); } else { manager.addAdditionalTabComponent(new OutputTabComponent(outputConsole), "XSLT-Output"); manager.addAdditionalTabComponent(StructureTabComponent.create(process, outputConsole), "XSLT-Structure"); } return true; }
createTabs
17,929
void (SimpleJavaParameters parameters, Path path) { Path absolutePath = path.toAbsolutePath(); assert Files.exists(absolutePath) : absolutePath.toString(); parameters.getClassPath().addTail(absolutePath.toString()); }
addPathToClasspath
17,930
Boolean (SimpleJavaParameters parameters) { final List<VirtualFile> files = parameters.getClassPath().getVirtualFiles(); for (VirtualFile file : files) { if (file.getName().matches(".*xalan.*\\.jar")) { final VirtualFile root = JarFileSystem.getInstance().getJarRootForLocalFile(file); final VirtualFile manifestFile = root != null ? root.findFileByRelativePath("META-INF/MANIFEST.MF") : null; if (manifestFile != null) { try { Manifest manifest = manifestFile.getUserData(MANIFEST); if (manifest == null) { manifest = new Manifest(manifestFile.getInputStream()); manifestFile.putUserData(MANIFEST, manifest); } Attributes attributes = manifest.getAttributes("org/apache/xalan/"); if (attributes == null) { attributes = manifest.getAttributes("org/apache/xalan"); } if (attributes == null) { LOG.info("No manifest attributes for 'org/apache/xalan/' in " + manifestFile.getPresentableUrl()); continue; } final String version = attributes.getValue("Implementation-Version"); if (version != null) { final String[] parts = version.split("\\."); if (parts.length >= 2) { if (Integer.parseInt(parts[0]) >= 2 && Integer.parseInt(parts[1]) >= 6) { return true; } } LOG.info("Unsupported Xalan version: " + version); } else { LOG.info("No Xalan version information in " + file.getPath()); } } catch (IOException e) { LOG.warn("Unable to read manifest from " + file.getName(), e); } } else { LOG.info("No manifest file in " + file.getPath()); } return false; } } return null; }
isValidXalanPresent
17,931
void (SimpleJavaParameters parameters, Path xsltDebuggerClassesRoot) { if (!Files.isDirectory(xsltDebuggerClassesRoot)) { Path rtDir = xsltDebuggerClassesRoot.getParent().resolve("rt"); addPathToClasspath(parameters, rtDir.resolve("xalan-2.7.2.jar")); } else { //running from sources Path xalanInM2 = Paths.get(SystemProperties.getUserHome(), ".m2", "repository", "xalan"); addPathToClasspath(parameters, xalanInM2.resolve("xalan/2.7.2/xalan-2.7.2.jar")); addPathToClasspath(parameters, xalanInM2.resolve("serializer/2.7.2/serializer-2.7.2.jar")); } }
addXalan
17,932
Path (Path xsltDebuggerClassesRoot, String jarFile) { Path transformerFile = xsltDebuggerClassesRoot.getParent().resolve("rt").resolve(jarFile); if (!Files.exists(transformerFile)) { //running from sources Path libDir = getPluginEngineDirInSources().resolve("impl/lib"); transformerFile = libDir.resolve(jarFile); assert Files.exists(transformerFile) : transformerFile.toAbsolutePath().toString(); } return transformerFile; }
findSaxonJar
17,933
Path () { Path path = PluginPathManager.getPluginHome("xslt-debugger").toPath().resolve("engine"); assert Files.isDirectory(path) : path.toString(); return path; }
getPluginEngineDirInSources
17,934
void (@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode)value; final Object o = node.getUserObject(); setToolTipText(null); if (o == null || "ROOT".equals(o)) { // invisible } else if (o instanceof String) { // "..." node append((String)o, SimpleTextAttributes.SYNTHETIC_ATTRIBUTES); setToolTipText(XsltDebuggerBundle.message("tooltip.element.is.not.finished.yet")); } else if (o instanceof OutputEventQueue.NodeEvent event) { final OutputEventQueue.NodeEvent.QName qname = event.getQName(); switch (event.getType()) { case OutputEventQueue.START_ELEMENT -> { setIcon(PlatformIcons.XML_TAG_ICON); append(qname.getQName(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES); //NON-NLS if (qname.myURI != null && qname.myURI.length() > 0) { append(" {", SimpleTextAttributes.GRAYED_ATTRIBUTES); append(qname.myURI, SimpleTextAttributes.GRAYED_ATTRIBUTES); //NON-NLS append("}", SimpleTextAttributes.GRAYED_ATTRIBUTES); } } case OutputEventQueue.ATTRIBUTE -> { setIcon(PlatformIcons.ANNOTATION_TYPE_ICON); append(qname.getQName(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES); //NON-NLS if (qname.myURI != null && qname.myURI.length() > 0) { append(" {" + qname.myURI + "}", SimpleTextAttributes.GRAYED_ATTRIBUTES); //NON-NLS } append(" = \"", SimpleTextAttributes.REGULAR_ATTRIBUTES); append(event.getValue(), SimpleTextAttributes.REGULAR_ATTRIBUTES); //NON-NLS append("\"", SimpleTextAttributes.REGULAR_ATTRIBUTES); } case OutputEventQueue.CHARACTERS -> { append("#text ", SimpleTextAttributes.GRAYED_ATTRIBUTES); //NON-NLS append(clipValue(event.getValue()), SimpleTextAttributes.REGULAR_ATTRIBUTES); } case OutputEventQueue.COMMENT -> { setIcon(XsltDebuggerIcons.XmlComment); append("#comment ", SimpleTextAttributes.GRAYED_ATTRIBUTES); //NON-NLS append(event.getValue(), SimpleTextAttributes.REGULAR_ATTRIBUTES); //NON-NLS } case OutputEventQueue.PI -> { append("#processing-instruction ", SimpleTextAttributes.GRAYED_ATTRIBUTES); //NON-NLS append(qname.myLocalName, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES); //NON-NLS append(" " + event.getValue(), SimpleTextAttributes.REGULAR_ATTRIBUTES); //NON-NLS } case OutputEventQueue.TRACE_POINT -> { setIcon(AllIcons.Debugger.Db_set_breakpoint); append(XsltDebuggerBundle.message("tracepoint.at.line.0", event.getLineNumber()), SimpleTextAttributes.GRAY_ATTRIBUTES); if (event.getValue() != null) { append(" " + event.getValue(), SimpleTextAttributes.REGULAR_ATTRIBUTES); //NON-NLS } } } if (node instanceof GeneratedStructureModel.StructureNode) { if (((GeneratedStructureModel.StructureNode)node).isNew()) { append(" *", SimpleTextAttributes.SYNTHETIC_ATTRIBUTES); } } } }
customizeCellRenderer
17,935
Object (@NotNull String dataId) { if (CommonDataKeys.NAVIGATABLE.is(dataId)) { TreePath selection = getSelectionPath(); Object o = selection == null ? null : selection.getLastPathComponent(); return o instanceof Navigatable ? o : null; } else if (CopyValueAction.SELECTED_NODE.is(dataId)) { TreePath selection = getSelectionPath(); return selection == null ? null : selection.getLastPathComponent(); } return null; }
getData
17,936
void (TreeModelEvent e) { final TreePath path = e.getTreePath(); final Object child = e.getChildren()[0]; if (path != null && child != null) { myAlarm.cancelAllRequests(); final Runnable runnable = () -> { myEventTree.expandPath(path); TreeUtil.showRowCentered(myEventTree, myEventTree.getRowForPath(TreeUtil.getPathFromRoot((TreeNode)child)), false); }; myAlarm.addRequest(runnable, 300); } }
treeNodesInserted
17,937
void (TreeModelEvent e) { final TreePath p = e.getTreePath(); if (p != null) { if (p.getPathCount() > 1) { final Runnable runnable = () -> { DefaultMutableTreeNode last = (DefaultMutableTreeNode)p.getLastPathComponent(); if (last.getChildCount() > 0) { DefaultMutableTreeNode next = (DefaultMutableTreeNode)last.getFirstChild(); while (next != null) { myEventTree.collapsePath(TreeUtil.getPathFromRoot(next)); next = next.getNextSibling(); } } }; ApplicationManager.getApplication().invokeLater(runnable); } } }
treeNodesRemoved
17,938
GeneratedStructureModel () { return myEventModel; }
getEventModel
17,939
StructureTabComponent (ProcessHandler process, @NotNull Disposable disposable) { final StructureTabComponent component = new StructureTabComponent(disposable); process.putUserData(KEY, component); return component; }
create
17,940
StructureTabComponent (ProcessHandler process) { return process.getUserData(KEY); }
getInstance
17,941
JComponent () { return myComponent; }
getComponent
17,942
JComponent () { return getComponent(); }
getPreferredFocusableComponent
17,943
ActionGroup () { return myToolbarActions; }
getToolbarActions
17,944
JComponent () { return myOutputConsole; }
getComponent
17,945
JComponent () { return myOutputConsole.getPreferredFocusableComponent(); }
getPreferredFocusableComponent
17,946
ActionGroup () { return myOutputActions; }
getToolbarActions
17,947
Interner<String> () { Interner<String> interner = SoftReference.dereference(ourSharedInterner); if (interner == null) { interner = Interner.createStringInterner(); ourSharedInterner = new WeakReference<>(interner); } return interner; }
getInterner
17,948
void (final List<OutputEventQueue.NodeEvent> eventQueue) { if (!SwingUtilities.isEventDispatchThread()) { ApplicationManager.getApplication().invokeLater(() -> updateImpl(eventQueue)); return; } updateImpl(eventQueue); }
update
17,949
Object (Object parent, int index) { if (!myFilterWhitespace) { return super.getChild(parent, index); } return getFilteredChildren((DefaultMutableTreeNode)parent, false).get(index); }
getChild
17,950
int (Object parent) { if (!myFilterWhitespace) { return super.getChildCount(parent); } return getFilteredChildren((DefaultMutableTreeNode)parent, false).size(); }
getChildCount
17,951
boolean (Object node) { if (!myFilterWhitespace) { return super.isLeaf(node); } return super.isLeaf(node) || getFilteredChildren((DefaultMutableTreeNode)node, true).size() == 0; }
isLeaf
17,952
List (DefaultMutableTreeNode node, boolean checkOnly) { if (node.getChildCount() == 0) { return Collections.emptyList(); } final List<DefaultMutableTreeNode> nodes = checkOnly ? new SmartList<>() : new ArrayList<>(node.getChildCount()); DefaultMutableTreeNode child = (DefaultMutableTreeNode)node.getFirstChild(); while (child != null) { if (child instanceof StructureNode) { final OutputEventQueue.NodeEvent event = (OutputEventQueue.NodeEvent)child.getUserObject(); if (event != null && event.getType() == OutputEventQueue.CHARACTERS) { if (event.getValue().trim().length() == 0) { child = child.getNextSibling(); continue; } } } nodes.add(child); if (checkOnly) return nodes; child = child.getNextSibling(); } return nodes; }
getFilteredChildren
17,953
void (List<OutputEventQueue.NodeEvent> nodeEvents) { if (nodeEvents.size() > 0) { for (DefaultMutableTreeNode node : myLastNodes) { if (node instanceof StructureNode) { ((StructureNode)node).refresh(); } } myLastNodes.clear(); } for (OutputEventQueue.NodeEvent event : nodeEvents) { event = intern(event); final DefaultMutableTreeNode node = myCurrentPath.getFirst(); switch (event.getType()) { case OutputEventQueue.START_DOCUMENT: break; case OutputEventQueue.START_ELEMENT: final StructureNode child = new StructureNode(event); myLastNodes.add(child); final int index = getChildCount(node) - 1; node.insert(child, node.getChildCount() - 1); child.add(new DefaultMutableTreeNode(PENDING)); myCurrentPath.addFirst(child); nodesWereInserted(node, new int[]{ index }); break; case OutputEventQueue.END_ELEMENT: if (node instanceof MyRootNode) { // unknown xalan bug: start/end is sometimes unbalanced. should be fixed somewhere else... continue; } case OutputEventQueue.END_DOCUMENT: final DefaultMutableTreeNode c = myCurrentPath.removeFirst(); final int childIndex = getChildCount(c) - 1; final int realChildIndex = c.getChildCount() - 1; if (realChildIndex >= 0) { final DefaultMutableTreeNode childNode = (DefaultMutableTreeNode)c.getChildAt(realChildIndex); assert childNode.getUserObject() == PENDING; c.remove(realChildIndex); nodesWereRemoved(c, new int[]{ childIndex }, new Object[]{ childNode }); } break; case OutputEventQueue.TRACE_POINT: case OutputEventQueue.ATTRIBUTE: case OutputEventQueue.CHARACTERS: case OutputEventQueue.COMMENT: case OutputEventQueue.PI: final StructureNode ch = new StructureNode(event); myLastNodes.add(ch); final int i = getChildCount(node) - 1; node.insert(ch, node.getChildCount() - 1); nodesWereInserted(node, new int[]{ i }); } } }
updateImpl
17,954
String (String s) { if (s != null) { if (s.length() == 0) return s.intern(); return myInterner.intern(s); } else { return null; } }
intern
17,955
boolean () { return myFilterWhitespace; }
isFilterWhitespace
17,956
void (boolean b) { final boolean old = myFilterWhitespace; myFilterWhitespace = b; if (b != old) { nodeStructureChanged((TreeNode)getRoot()); } }
setFilterWhitespace
17,957
void (final List<OutputEventQueue.NodeEvent> events) { Runnable runnable = () -> { myListenersDisabled = true; try { updateImpl(events); } finally { myListenersDisabled = false; nodeStructureChanged((TreeNode)getRoot()); } }; ApplicationManager.getApplication().invokeLater(runnable); }
finalUpdate
17,958
void (Object source, Object[] path, int[] childIndices, Object[] children) { if (myListenersDisabled) return; super.fireTreeNodesChanged(source, path, childIndices, children); }
fireTreeNodesChanged
17,959
void (Object source, Object[] path, int[] childIndices, Object[] children) { if (myListenersDisabled) return; super.fireTreeNodesInserted(source, path, childIndices, children); }
fireTreeNodesInserted
17,960
void (Object source, Object[] path, int[] childIndices, Object[] children) { if (myListenersDisabled) return; super.fireTreeNodesRemoved(source, path, childIndices, children); }
fireTreeNodesRemoved
17,961
void (Object source, Object[] path, int[] childIndices, Object[] children) { if (myListenersDisabled) return; super.fireTreeStructureChanged(source, path, childIndices, children); }
fireTreeStructureChanged
17,962
void () { isNew = false; }
refresh
17,963
boolean () { return isNew; }
isNew
17,964
void (boolean requestFocus) { final OutputEventQueue.NodeEvent event = getUserObject(); final Project project = DataManager.getInstance().getDataContext().getData(CommonDataKeys.PROJECT); XsltDebuggerSession.openLocation(project, event.getURI(), event.getLineNumber() - 1); }
navigate
17,965
boolean () { return getUserObject().getLineNumber() > 0; }
canNavigate
17,966
boolean () { return canNavigate(); }
canNavigateToSource
17,967
String () { return myTabTitle; }
getTabTitle
17,968
JComponent () { return null; }
getSearchComponent
17,969
String () { return null; }
getToolbarPlace
17,970
JComponent () { return null; }
getToolbarContextComponent
17,971
boolean () { return false; }
isContentBuiltIn
17,972
void () { }
dispose
17,973
void (@NotNull AnActionEvent e) { e.getPresentation().setEnabled(isEnabled(e)); }
update
17,974
void (@NotNull AnActionEvent e) { final DefaultMutableTreeNode node = e.getData(SELECTED_NODE); if (node instanceof GeneratedStructureModel.StructureNode structureNode) { final OutputEventQueue.NodeEvent event = structureNode.getUserObject(); setClipboardData(event.getValue()); } }
actionPerformed
17,975
void (String value) { CopyPasteManager.getInstance().setContents(new StringSelection(value)); }
setClipboardData
17,976
boolean (AnActionEvent e) { final DefaultMutableTreeNode node = e.getData(SELECTED_NODE); if (node instanceof GeneratedStructureModel.StructureNode structureNode) { final OutputEventQueue.NodeEvent event = structureNode.getUserObject(); return event != null && event.getValue() != null; } return false; }
isEnabled
17,977
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
17,978
boolean (@NotNull AnActionEvent e) { return myEventModel.isFilterWhitespace(); }
isSelected
17,979
void (@NotNull AnActionEvent e, boolean state) { final TreeState treeState = TreeState.createOn(myStructureTree); myEventModel.setFilterWhitespace(state); treeState.applyTo(myStructureTree); }
setSelected
17,980
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
17,981
AnAction () { return ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE); }
getInstance
17,982
void (@NotNull AnActionEvent e) { final Editor editor = CommonDataKeys.EDITOR.getData(DataManager.getInstance().getDataContext(myConsole.getComponent())); if (editor != null) { final String extension = "xml"; // TODO: get from output type final VirtualFile file = new LightVirtualFile("XSLT Output." + extension, editor.getDocument().getText()) { @NotNull @Override public Charset getCharset() { return StandardCharsets.UTF_8; } }; FileEditorManager.getInstance(e.getProject()).openFile(file, true); } }
actionPerformed
17,983
Charset () { return StandardCharsets.UTF_8; }
getCharset
17,984
void (@NotNull AnActionEvent e) { final Editor editor = CommonDataKeys.EDITOR.getData(DataManager.getInstance().getDataContext(myConsole.getComponent())); e.getPresentation().setEnabled(editor != null && editor.getDocument().getTextLength() > 0); }
update
17,985
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
17,986
void (@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint) { final XSourcePosition sourcePosition = breakpoint.getSourcePosition(); if (sourcePosition == null || !sourcePosition.getFile().exists() || !sourcePosition.getFile().isValid()) { // ??? return; } final VirtualFile file = sourcePosition.getFile(); final Project project = myXsltDebugProcess.getSession().getProject(); final String fileURL = getFileURL(file); final int lineNumber = getActualLineNumber(breakpoint, project); if (lineNumber == -1) { myXsltDebugProcess.getSession().setBreakpointInvalid(breakpoint, "Unsupported breakpoint position"); return; } try { final BreakpointManager manager = myXsltDebugProcess.getBreakpointManager(); Breakpoint bp; if ((bp = manager.getBreakpoint(fileURL, lineNumber)) != null) { bp.setEnabled(true); } else { manager.setBreakpoint(fileURL, lineNumber); } } catch (DebuggerStoppedException ignore) { } catch (VMPausedException e) { final XDebugSession session = myXsltDebugProcess.getSession(); session.reportMessage(XsltDebuggerBundle.message("notification.content.target.vm.not.responding.breakpoint.can.not.be.set"), MessageType.ERROR); session.setBreakpointInvalid(breakpoint, "Target VM is not responding. Breakpoint can not be set"); } }
registerBreakpoint
17,987
String (VirtualFile file) { return VfsUtil.virtualToIoFile(file).toURI().toASCIIString(); }
getFileURL
17,988
void (@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint, final boolean temporary) { final XSourcePosition sourcePosition = breakpoint.getSourcePosition(); if (sourcePosition == null || !sourcePosition.getFile().exists() || !sourcePosition.getFile().isValid()) { // ??? return; } final VirtualFile file = sourcePosition.getFile(); final Project project = myXsltDebugProcess.getSession().getProject(); final String fileURL = getFileURL(file); final int lineNumber = getActualLineNumber(breakpoint, project); try { final BreakpointManager manager = myXsltDebugProcess.getBreakpointManager(); if (temporary) { final Breakpoint bp = manager.getBreakpoint(fileURL, lineNumber); if (bp != null) { bp.setEnabled(false); } } else { manager.removeBreakpoint(fileURL, lineNumber); } } catch (DebuggerStoppedException ignore) { } catch (VMPausedException e) { myXsltDebugProcess.getSession().reportMessage( XsltDebuggerBundle.message("notification.content.target.vm.not.responding.breakpoint.can.not.be.removed"), MessageType.ERROR); } }
unregisterBreakpoint
17,989
int (XLineBreakpoint breakpoint, Project project) { return getActualLineNumber(project, breakpoint.getSourcePosition()); }
getActualLineNumber
17,990
int (Project project, @Nullable XSourcePosition position) { if (position == null) { return -1; } final PsiElement element = findContextElement(project, position); if (element == null) { return -1; } if (element instanceof XmlToken) { final IElementType tokenType = ((XmlToken)element).getTokenType(); if (tokenType == XmlTokenType.XML_START_TAG_START || tokenType == XmlTokenType.XML_NAME) { final PsiManager psiManager = PsiManager.getInstance(project); final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project); final PsiFile psiFile = psiManager.findFile(position.getFile()); if (psiFile == null) { return -1; } final Document document = documentManager.getDocument(psiFile); if (document == null) { return -1; } if (document.getLineNumber(element.getTextRange().getStartOffset()) == position.getLine()) { final XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class, false); if (tag != null) { final ASTNode node = tag.getNode(); assert node != null; // TODO: re-check if/when Xalan is supported final ASTNode end = XmlChildRole.START_TAG_END_FINDER.findChild(node); if (end != null) { return document.getLineNumber(end.getTextRange().getEndOffset()) + 1; } else { final ASTNode end2 = XmlChildRole.EMPTY_TAG_END_FINDER.findChild(node); if (end2 != null) { return document.getLineNumber(end2.getTextRange().getEndOffset()) + 1; } } } } } } return -1; }
getActualLineNumber
17,991
PsiElement (Project project, @Nullable XSourcePosition position) { if (position == null) { return null; } final PsiFile file = PsiManager.getInstance(project).findFile(position.getFile()); if (file == null) { return null; } int offset = -1; final Document document = PsiDocumentManager.getInstance(project).getDocument(file); if (document != null && document.getLineCount() > position.getLine() && position.getLine() >= 0) { offset = document.getLineStartOffset(position.getLine()); } if (offset < 0) { offset = position.getOffset(); } PsiElement contextElement = file.findElementAt(offset); while (contextElement != null && !(contextElement instanceof XmlElement)) { contextElement = PsiTreeUtil.nextLeaf(contextElement); } return contextElement; }
findContextElement
17,992
FileType () { return myFileType; }
getFileType
17,993
Document (@NotNull Project project, @NotNull XExpression expression, @Nullable XSourcePosition sourcePosition, @NotNull EvaluationMode mode) { final PsiFile psiFile = PsiFileFactory.getInstance(project) .createFileFromText("XPathExpr." + myFileType.getDefaultExtension(), myFileType, expression.getExpression(), LocalTimeCounter.currentTime(), true); if (sourcePosition instanceof XsltSourcePosition && ((XsltSourcePosition)sourcePosition).getLocation() instanceof Debugger.StyleFrame) { final Debugger.Locatable location = ((XsltSourcePosition)sourcePosition).getLocation(); final EvalContextProvider context = new EvalContextProvider(((Debugger.StyleFrame)location).getVariables()); context.attachTo(psiFile); } else { final PsiElement contextElement = XsltBreakpointHandler.findContextElement(project, sourcePosition); if (contextElement != null) { final BreakpointContext context = new BreakpointContext(contextElement); context.attachTo(psiFile); } } final Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile); assert document != null; return document; }
createDocument
17,994
Object () { return XsltStackFrame.class; }
getEqualityObject
17,995
XDebuggerEvaluator () { return myFrame instanceof Debugger.StyleFrame ? new MyEvaluator((Debugger.StyleFrame)myFrame) : null; }
getEvaluator
17,996
XSourcePosition () { return myPosition; }
getSourcePosition
17,997
void (@NotNull ColoredTextContainer component) { if (myDebuggerSession.getCurrentState() == Debugger.State.SUSPENDED) { try { _customizePresentation(component); } catch (VMPausedException | DebuggerStoppedException ignore) { } } }
customizePresentation
17,998
void (ColoredTextContainer component) { final Debugger.Frame frame = myFrame; if (frame instanceof Debugger.StyleFrame) { component.append(((Debugger.StyleFrame)frame).getInstruction(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES); //NON-NLS } else if (frame instanceof Debugger.SourceFrame) { component.append(((Debugger.SourceFrame)frame).getXPath(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES); //NON-NLS } component.append(" ", SimpleTextAttributes.REGULAR_ATTRIBUTES); try { final VirtualFile file = VfsUtil.findFileByURL(new URI(frame.getURI()).toURL()); if (file != null) { component.append(file.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES); if (frame.getLineNumber() > 0) { component.append(":" + frame.getLineNumber(), SimpleTextAttributes.REGULAR_ATTRIBUTES); } component.setToolTipText(file.getPresentableUrl()); } else { component.append(frame.getURI() + ":" + frame.getLineNumber(), SimpleTextAttributes.REGULAR_ATTRIBUTES); //NON-NLS } } catch (Exception ignored) { component.append(frame.getURI() + ":" + frame.getLineNumber(), SimpleTextAttributes.REGULAR_ATTRIBUTES); //NON-NLS } }
_customizePresentation
17,999
void (@NotNull XCompositeNode node) { try { if (myFrame instanceof Debugger.StyleFrame) { final List<Debugger.Variable> variables = ((Debugger.StyleFrame)myFrame).getVariables(); final XValueChildrenList list = new XValueChildrenList(); for (final Debugger.Variable variable : variables) { list.add(variable.getName(), new MyValue(variable)); } node.addChildren(list, true); } else { super.computeChildren(node); } } catch (VMPausedException ignored) { node.setErrorMessage(XsltDebuggerBundle.message("dialog.message.target.vm.not.responding")); } }
computeChildren