Java Code Examples for com.intellij.openapi.util.text.StringUtil#unescapeXml()
The following examples show how to use
com.intellij.openapi.util.text.StringUtil#unescapeXml() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImportedTestContentHandler.java From consulo with Apache License 2.0 | 5 votes |
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (TestResultsXmlFormatter.ELEM_SUITE.equals(qName)) { final String suiteName = StringUtil.unescapeXml(attributes.getValue(TestResultsXmlFormatter.ATTR_NAME)); myProcessor.onSuiteStarted(new TestSuiteStartedEvent(suiteName, StringUtil.unescapeXml(attributes.getValue(TestResultsXmlFormatter.ATTR_LOCATION)), StringUtil.unescapeXml(attributes.getValue(TestResultsXmlFormatter.ATTR_METAINFO)))); mySuites.push(suiteName); } else if (TestResultsXmlFormatter.ELEM_TEST.equals(qName)) { final String name = StringUtil.unescapeXml(attributes.getValue(TestResultsXmlFormatter.ATTR_NAME)); myCurrentTest = name; myDuration = attributes.getValue(TestResultsXmlFormatter.ATTR_DURATION); myStatus = attributes.getValue(TestResultsXmlFormatter.ATTR_STATUS); final String isConfig = attributes.getValue(TestResultsXmlFormatter.ATTR_CONFIG); final TestStartedEvent startedEvent = new TestStartedEvent(name, StringUtil.unescapeXml(attributes.getValue(TestResultsXmlFormatter.ATTR_LOCATION)), StringUtil.unescapeXml(attributes.getValue(TestResultsXmlFormatter.ATTR_METAINFO))); if (isConfig != null && Boolean.valueOf(isConfig)) { startedEvent.setConfig(true); } myProcessor.onTestStarted(startedEvent); currentValue.setLength(0); } else if (TestResultsXmlFormatter.ELEM_OUTPUT.equals(qName)) { myErrorOutput = Comparing.equal(attributes.getValue(TestResultsXmlFormatter.ATTR_OUTPUT_TYPE), "stderr"); currentValue.setLength(0); } else if (TestResultsXmlFormatter.ROOT_ELEM.equals(qName)) { myProcessor.onRootPresentationAdded(attributes.getValue("name"), attributes.getValue("comment"), attributes.getValue("location")); } }
Example 2
Source File: ImportedTestContentHandler.java From consulo with Apache License 2.0 | 5 votes |
@Override public void endElement(String uri, String localName, String qName) throws SAXException { final String currentText = StringUtil.unescapeXml(currentValue.toString()); final boolean isTestOutput = myCurrentTest == null || TestResultsXmlFormatter.STATUS_PASSED.equals(myStatus) || myErrorOutput; if (isTestOutput) { currentValue.setLength(0); } if (TestResultsXmlFormatter.ELEM_SUITE.equals(qName)) { myProcessor.onSuiteFinished(new TestSuiteFinishedEvent(mySuites.pop())); } else if (TestResultsXmlFormatter.ELEM_TEST.equals(qName)) { final boolean isError = TestResultsXmlFormatter.STATUS_ERROR.equals(myStatus); if (TestResultsXmlFormatter.STATUS_FAILED.equals(myStatus) || isError) { myProcessor.onTestFailure(new TestFailedEvent(myCurrentTest, "", currentText, isError, null, null)); } else if (TestResultsXmlFormatter.STATUS_IGNORED.equals(myStatus) || TestResultsXmlFormatter.STATUS_SKIPPED.equals(myStatus)) { myProcessor.onTestIgnored(new TestIgnoredEvent(myCurrentTest, "", currentText) { @Nonnull @Override public String getIgnoreComment() { return ""; } }); } myProcessor.onTestFinished(new TestFinishedEvent(myCurrentTest, myDuration != null ? Long.parseLong(myDuration) : -1)); if (!TestResultsXmlFormatter.STATUS_PASSED.equals(myStatus)) { currentValue.setLength(0); } myCurrentTest = null; } else if (TestResultsXmlFormatter.ELEM_OUTPUT.equals(qName) && !StringUtil.isEmpty(currentText) && isTestOutput) { if (myCurrentTest != null) { myProcessor.onTestOutput(new TestOutputEvent(myCurrentTest, currentText, !myErrorOutput)); } else { myProcessor.onUncapturedOutput(currentText, myErrorOutput ? ProcessOutputTypes.STDERR : ProcessOutputTypes.STDOUT); } } }
Example 3
Source File: LocalInspectionsPass.java From consulo with Apache License 2.0 | 5 votes |
@Nullable private HighlightInfo createHighlightInfo(@Nonnull ProblemDescriptor descriptor, @Nonnull LocalInspectionToolWrapper tool, @Nonnull HighlightInfoType level, @Nonnull Set<Pair<TextRange, String>> emptyActionRegistered, @Nonnull PsiElement element) { @NonNls String message = ProblemDescriptorUtil.renderDescriptionMessage(descriptor, element); final HighlightDisplayKey key = HighlightDisplayKey.find(tool.getShortName()); final InspectionProfile inspectionProfile = myProfileWrapper.getInspectionProfile(); if (!inspectionProfile.isToolEnabled(key, getFile())) return null; HighlightInfoType type = new HighlightInfoType.HighlightInfoTypeImpl(level.getSeverity(element), level.getAttributesKey()); final String plainMessage = message.startsWith("<html>") ? StringUtil.unescapeXml(XmlStringUtil.stripHtml(message).replaceAll("<[^>]*>", "")) : message; @NonNls final String link = " <a " + "href=\"#inspection/" + tool.getShortName() + "\"" + (UIUtil.isUnderDarcula() ? " color=\"7AB4C9\" " : "") + ">" + DaemonBundle.message("inspection.extended.description") + "</a> " + myShortcutText; @NonNls String tooltip = null; if (descriptor.showTooltip()) { tooltip = XmlStringUtil.wrapInHtml((message.startsWith("<html>") ? XmlStringUtil.stripHtml(message) : XmlStringUtil.escapeString(message)) + link); } HighlightInfo highlightInfo = highlightInfoFromDescriptor(descriptor, type, plainMessage, tooltip, element); if (highlightInfo != null) { registerQuickFixes(tool, descriptor, highlightInfo, emptyActionRegistered); } return highlightInfo; }
Example 4
Source File: NoteSerializable.java From consulo with Apache License 2.0 | 5 votes |
@Override public NoteNode deserializeMe(Project project, String ois) throws IOException { final List<String> strings = StringUtil.split(ois, "<>", true); if (strings.size() == 2) { return new NoteNode(StringUtil.unescapeXml(strings.get(0)), Boolean.parseBoolean(strings.get(1))); } return null; }
Example 5
Source File: UsageSerializable.java From consulo with Apache License 2.0 | 5 votes |
private String readNext(final boolean allowEnd) { int idxNext = is.indexOf(separator, idx); if (idxNext == -1) { if (allowEnd) { return StringUtil.unescapeXml(new String(is.substring(idx))); } } final String s = new String(is.substring(idx, idxNext)); idx = idxNext + separator.length(); return s; }
Example 6
Source File: ProjectConfigurationProblem.java From consulo with Apache License 2.0 | 4 votes |
public ProjectConfigurationProblem(@Nonnull ProjectStructureProblemDescription description, @Nonnull Project project) { super(StringUtil.unescapeXml(description.getMessage(true)), computeDescription(description), getSettings(project, description.getProblemLevel()).isIgnored(description)); myDescription = description; myProject = project; }