本文整理汇总了Java中com.intellij.xml.util.XmlStringUtil类的典型用法代码示例。如果您正苦于以下问题:Java XmlStringUtil类的具体用法?Java XmlStringUtil怎么用?Java XmlStringUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlStringUtil类属于com.intellij.xml.util包,在下文中一共展示了XmlStringUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createAmbiguousMethodHtmlTooltipMethodRow
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
@Language("HTML")
private static String createAmbiguousMethodHtmlTooltipMethodRow(final MethodCandidateInfo methodCandidate) {
PsiMethod method = methodCandidate.getElement();
PsiParameter[] parameters = method.getParameterList().getParameters();
PsiSubstitutor substitutor = methodCandidate.getSubstitutor();
@NonNls @Language("HTML") String ms = "<td><b>" + method.getName() + "</b></td>";
for (int j = 0; j < parameters.length; j++) {
PsiParameter parameter = parameters[j];
PsiType type = substitutor.substitute(parameter.getType());
ms += "<td><b>" + (j == 0 ? "(" : "") +
XmlStringUtil.escapeString(type.getPresentableText())
+ (j == parameters.length - 1 ? ")" : ",") + "</b></td>";
}
if (parameters.length == 0) {
ms += "<td><b>()</b></td>";
}
return ms;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:HighlightMethodUtil.java
示例2: createShortMismatchedArgumentsHtmlTooltip
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
private static String createShortMismatchedArgumentsHtmlTooltip(PsiExpressionList list,
PsiParameter[] parameters,
String methodName,
PsiSubstitutor substitutor,
PsiClass aClass) {
PsiExpression[] expressions = list.getExpressions();
int cols = Math.max(parameters.length, expressions.length);
@Language("HTML")
@NonNls String parensizedName = methodName + (parameters.length == 0 ? "( ) " : "");
final String errorMessage = InferenceSession.getInferenceErrorMessage(list.getParent());
return JavaErrorMessages.message(
"argument.mismatch.html.tooltip",
Integer.valueOf(cols - parameters.length + 1), parensizedName,
HighlightUtil.formatClass(aClass, false),
createMismatchedArgsHtmlTooltipParamsRow(parameters, substitutor, expressions),
createMismatchedArgsHtmlTooltipArgumentsRow(expressions, parameters, substitutor, cols),
errorMessage != null ? "<br/>reason: " + XmlStringUtil.escapeString(errorMessage).replaceAll("\n", "<br/>") : ""
);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:HighlightMethodUtil.java
示例3: createMismatchedArgsHtmlTooltipArgumentsRow
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
@SuppressWarnings("StringContatenationInLoop")
@Language("HTML")
private static String createMismatchedArgsHtmlTooltipArgumentsRow(final PsiExpression[] expressions, final PsiParameter[] parameters,
final PsiSubstitutor substitutor, final int cols) {
@Language("HTML")
@NonNls String ms = "";
for (int i = 0; i < expressions.length; i++) {
PsiExpression expression = expressions[i];
PsiType type = expression.getType();
boolean showShort = showShortType(i, parameters, expressions, substitutor);
@NonNls String mismatchColor = showShort ? null : MISMATCH_COLOR;
ms += "<td> " + "<b><nobr>" + (i == 0 ? "(" : "")
+ "<font " + (showShort ? "" : "color=" + mismatchColor) + ">" +
XmlStringUtil.escapeString(showShort ? type.getPresentableText() : JavaHighlightUtil.formatType(type))
+ "</font>"
+ (i == expressions.length - 1 ? ")" : ",") + "</nobr></b></td>";
}
for (int i = expressions.length; i < cols + 1; i++) {
ms += "<td>" + (i == 0 ? "<b>()</b>" : "") +
" </td>";
}
return ms;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:HighlightMethodUtil.java
示例4: createMismatchedArgsHtmlTooltipParamsRow
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
@SuppressWarnings("StringContatenationInLoop")
@Language("HTML")
private static String createMismatchedArgsHtmlTooltipParamsRow(final PsiParameter[] parameters,
final PsiSubstitutor substitutor,
final PsiExpression[] expressions) {
@NonNls String ms = "";
for (int i = 0; i < parameters.length; i++) {
PsiParameter parameter = parameters[i];
PsiType type = substitutor.substitute(parameter.getType());
ms += "<td><b><nobr>" + (i == 0 ? "(" : "") +
XmlStringUtil.escapeString(showShortType(i, parameters, expressions, substitutor)
? type.getPresentableText()
: JavaHighlightUtil.formatType(type))
+ (i == parameters.length - 1 ? ")" : ",") + "</nobr></b></td>";
}
return ms;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:HighlightMethodUtil.java
示例5: getQualifiedName
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
@Override
@Nullable
public String getQualifiedName(final RefEntity refEntity) {
if (refEntity instanceof RefJavaElement && ((RefJavaElement)refEntity).isSyntheticJSP()) {
return XmlStringUtil.escapeString(refEntity.getName());
}
else if (refEntity instanceof RefMethod) {
PsiMethod psiMethod = (PsiMethod)((RefMethod)refEntity).getElement();
if (psiMethod != null) {
return psiMethod.getName();
}
else {
return refEntity.getName();
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:HTMLJavaHTMLComposerImpl.java
示例6: appendLinkOrText
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
private static void appendLinkOrText(StringBuilder buffer,
PsiAnnotationMemberValue memberValue,
boolean generateLink) {
if (generateLink && memberValue instanceof PsiQualifiedReferenceElement) {
String text = ((PsiQualifiedReferenceElement)memberValue).getCanonicalText();
PsiElement resolve = ((PsiQualifiedReferenceElement)memberValue).resolve();
if (resolve instanceof PsiField) {
PsiField field = (PsiField)resolve;
PsiClass aClass = field.getContainingClass();
int startOfPropertyNamePosition = text.lastIndexOf('.');
if (startOfPropertyNamePosition != -1) {
text = text.substring(0, startOfPropertyNamePosition) + '#' + text.substring(startOfPropertyNamePosition + 1);
}
else {
if (aClass != null) text = aClass.getQualifiedName() + '#' + field.getName();
}
generateLink(buffer, text, aClass != null? aClass.getName() + '.' + field.getName():null, memberValue, false);
return;
}
}
buffer.append(XmlStringUtil.escapeString(memberValue.getText()));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:JavaDocInfoGenerator.java
示例7: fun
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
@Override
public String fun(PsiElement nameIdentifier) {
PsiModifierListOwner owner = (PsiModifierListOwner)nameIdentifier.getParent();
boolean hasInferred = false;
boolean hasExternal = false;
for (PsiAnnotation annotation : findSignatureNonCodeAnnotations(owner, true)) {
hasExternal |= AnnotationUtil.isExternalAnnotation(annotation);
hasInferred |= AnnotationUtil.isInferredAnnotation(annotation);
}
String header;
if (hasInferred && hasExternal) {
header = "External and <i>inferred</i>";
} else if (hasInferred) {
header = "<i>Inferred</i>";
} else {
header = "External";
}
return XmlStringUtil.wrapInHtml(header + " annotations available. Full signature:<p>\n" + JavaDocInfoGenerator.generateSignature(owner));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ExternalAnnotationsLineMarkerProvider.java
示例8: TypeCookDialog
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
@SuppressWarnings({"HardCodedStringLiteral"})
public TypeCookDialog(Project project, PsiElement[] elements) {
super(project, true);
setTitle(REFACTORING_NAME);
init();
StringBuffer name = new StringBuffer();
myElements = elements;
for (int i = 0; i < elements.length; i++) {
PsiElement element = elements[i];
name.append(StringUtil.capitalize(UsageViewUtil.getType(element)));
name.append(" ");
name.append(DescriptiveNameUtil.getDescriptiveName(element));
if (i < elements.length - 1) {
name.append("<br>");
}
}
myClassNameLabel.setText(XmlStringUtil.wrapInHtml(name));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:TypeCookDialog.java
示例9: composeTooltipMessage
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
public String composeTooltipMessage() {
final StringBuilder buf = StringBuilderSpinAllocator.alloc();
try {
buf.append("<html><body>");
if (myProblemDescriptions != null) {
int problems = 0;
for (ProjectStructureProblemDescription problemDescription : myProblemDescriptions) {
buf.append(XmlStringUtil.escapeString(problemDescription.getMessage(false))).append("<br>");
problems++;
if (problems >= 10 && myProblemDescriptions.size() > 12) {
buf.append(myProblemDescriptions.size() - problems).append(" more problems...<br>");
break;
}
}
}
buf.append("</body></html>");
return buf.toString();
}
finally {
StringBuilderSpinAllocator.dispose(buf);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ProjectStructureProblemsHolderImpl.java
示例10: createInvalidRootsDescription
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
private static String createInvalidRootsDescription(List<String> invalidClasses, String rootName, String libraryName) {
StringBuilder buffer = new StringBuilder();
final String name = StringUtil.escapeXml(libraryName);
buffer.append("Library ");
if (Registry.is("ide.new.project.settings")) {
buffer.append("<a href='http://library/").append(name).append("'>").append(name).append("</a>");
} else {
buffer.append("'").append(name).append("'");
}
buffer.append(" has broken " + rootName + " " + StringUtil.pluralize("path", invalidClasses.size()) + ":");
for (String url : invalidClasses) {
buffer.append("<br> ");
buffer.append(PathUtil.toPresentableUrl(url));
}
return XmlStringUtil.wrapInHtml(buffer);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:LibraryProjectStructureElement.java
示例11: update
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
@Override
protected void update(PresentationData presentation) {
final Collection<ArtifactProblemDescription> problems = ((ArtifactEditorImpl)myContext.getThisArtifactEditor()).getValidationManager().getProblems(this);
if (problems == null || problems.isEmpty()) {
super.update(presentation);
return;
}
StringBuilder buffer = StringBuilderSpinAllocator.alloc();
final String tooltip;
boolean isError = false;
try {
for (ArtifactProblemDescription problem : problems) {
isError |= problem.getSeverity() == ProjectStructureProblemType.Severity.ERROR;
buffer.append(problem.getMessage(false)).append("<br>");
}
tooltip = XmlStringUtil.wrapInHtml(buffer);
}
finally {
StringBuilderSpinAllocator.dispose(buffer);
}
getElementPresentation().render(presentation, addErrorHighlighting(isError, SimpleTextAttributes.REGULAR_ATTRIBUTES),
addErrorHighlighting(isError, SimpleTextAttributes.GRAY_ATTRIBUTES));
presentation.setTooltip(tooltip);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:PackagingElementNode.java
示例12: getTooltipText
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
@Override
public String getTooltipText() {
if (myEntry == null) return null;
final Library library = myEntry.getLibrary();
if (library == null) return null;
final String name = library.getName();
if (name != null) {
final List<String> invalidUrls = ((LibraryEx)library).getInvalidRootUrls(OrderRootType.CLASSES);
if (!invalidUrls.isEmpty()) {
return ProjectBundle.message("project.roots.tooltip.library.has.broken.paths", name, invalidUrls.size());
}
}
final List<String> descriptions = LibraryPresentationManager.getInstance().getDescriptions(library, myContext);
if (descriptions.isEmpty()) return null;
return XmlStringUtil.wrapInHtml(StringUtil.join(descriptions, "<br>"));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LibraryItem.java
示例13: CompilerUIConfigurable
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
public CompilerUIConfigurable(@NotNull final Project project) {
myProject = project;
myPatternLegendLabel.setText(XmlStringUtil.wrapInHtml(
"Use <b>;</b> to separate patterns and <b>!</b> to negate a pattern. " +
"Accepted wildcards: <b>?</b> — exactly one symbol; <b>*</b> — zero or more symbols; " +
"<b>/</b> — path separator; <b>/**/</b> — any number of directories; " +
"<i><dir_name></i>:<i><pattern></i> — restrict to source roots with the specified name"
));
myPatternLegendLabel.setForeground(new JBColor(Gray._50, Gray._130));
tweakControls(project);
myVMOptionsField.getDocument().addDocumentListener(new DocumentAdapter() {
protected void textChanged(DocumentEvent e) {
mySharedVMOptionsField.setEnabled(e.getDocument().getLength() == 0);
myHeapSizeField.setEnabled(ContainerUtil.find(ParametersListUtil.parse(myVMOptionsField.getText()), new Condition<String>() {
@Override
public boolean value(String s) {
return StringUtil.startsWithIgnoreCase(s, "-Xmx");
}
}) == null);
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:CompilerUIConfigurable.java
示例14: ensureForcePushIsNeeded
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
public boolean ensureForcePushIsNeeded() {
Collection<MyRepoModel<?, ?, ?>> selectedNodes = getSelectedRepoNode();
MyRepoModel<?, ?, ?> selectedModel = ContainerUtil.getFirstItem(selectedNodes);
if (selectedModel == null) return false;
final PushSupport activePushSupport = selectedModel.getSupport();
final PushTarget commonTarget = getCommonTarget(selectedNodes);
if (commonTarget != null && activePushSupport.isSilentForcePushAllowed(commonTarget)) return true;
return Messages.showOkCancelDialog(myProject, XmlStringUtil.wrapInHtml(DvcsBundle.message("push.force.confirmation.text",
commonTarget != null
? " to <b>" +
commonTarget.getPresentation() + "</b>"
: "")),
"Force Push", "&Force Push",
CommonBundle.getCancelButtonText(),
Messages.getWarningIcon(),
commonTarget != null ? new MyDoNotAskOptionForPush(activePushSupport, commonTarget) : null) == OK;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PushController.java
示例15: updateCommitDetails
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
public void updateCommitDetails() {
if (myBalloon != null && myBalloon.isVisible()) {
TreePath[] selectionPaths = myTree.getSelectionPaths();
if (selectionPaths == null || selectionPaths.length != 1) {
myBalloon.cancel();
}
else {
Object node = selectionPaths[0].getLastPathComponent();
myEditorPane.setText(
XmlStringUtil.wrapInHtml(node instanceof TooltipNode ? ((TooltipNode)node).getTooltip().replaceAll("\n", "<br>") :
EMPTY_COMMIT_INFO));
//workaround: fix initial size for JEditorPane
RepaintManager rp = RepaintManager.currentManager(myEditorPane);
rp.markCompletelyDirty(myEditorPane);
rp.validateInvalidComponents();
rp.paintDirtyRegions();
//
myBalloon.setSize(myWrapper.getPreferredSize());
myBalloon.setLocation(calculateBestPopupLocation());
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:VcsCommitInfoBalloon.java
示例16: setup
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
private String setup(@NotNull String text, @NotNull Map<TextRange, ParameterInfoUIContextEx.Flag> flagsMap, @NotNull Color background) {
myLabel.setBackground(background);
setBackground(background);
myLabel.setForeground(JBColor.foreground());
if (flagsMap.isEmpty()) {
myLabel.setText(XmlStringUtil.wrapInHtml(text));
}
else {
String labelText = buildLabelText(text, flagsMap);
myLabel.setText(labelText);
}
//IDEA-95904 Darcula parameter info pop-up colors hard to read
if (UIUtil.isUnderDarcula()) {
myLabel.setText(myLabel.getText().replace("<b>", "<b color=ffC800>"));
}
return myLabel.getText();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ParameterInfoComponent.java
示例17: createCompositeTooltip
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
@Nullable
private static String createCompositeTooltip(List<HighlightInfo> infos) {
StringBuilder result = new StringBuilder();
for (HighlightInfo info : infos) {
String toolTip = info.getToolTip();
if (toolTip != null) {
if (result.length() != 0) {
result.append(LINE_BREAK);
}
toolTip = XmlStringUtil.stripHtml(toolTip);
result.append(toolTip);
}
}
if (result.length() == 0) {
return null;
}
return XmlStringUtil.wrapInHtml(result);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:HighlightInfoComposite.java
示例18: dressDescription
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
@Override
protected boolean dressDescription(@NotNull final Editor editor) {
final List<String> problems = StringUtil.split(UIUtil.getHtmlBody(new Html(myText).setKeepFont(true)), UIUtil.BORDER_LINE);
String text = "";
for (String problem : problems) {
final String ref = getLinkRef(problem);
if (ref != null) {
String description = TooltipLinkHandlerEP.getDescription(ref, editor);
if (description != null) {
description = DefaultInspectionToolPresentation.stripUIRefsFromInspectionDescription(UIUtil.getHtmlBody(new Html(description).setKeepFont(true)));
text += UIUtil.getHtmlBody(new Html(problem).setKeepFont(true)).replace(DaemonBundle.message("inspection.extended.description"),
DaemonBundle.message("inspection.collapse.description")) +
END_MARKER + "<p>" + description + UIUtil.BORDER_LINE;
}
}
else {
text += UIUtil.getHtmlBody(new Html(problem).setKeepFont(true)) + UIUtil.BORDER_LINE;
}
}
if (!text.isEmpty()) { //otherwise do not change anything
myText = XmlStringUtil.wrapInHtml(StringUtil.trimEnd(text, UIUtil.BORDER_LINE));
return true;
}
return false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:DaemonTooltipRendererProvider.java
示例19: explainTrailingSpaces
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
private void explainTrailingSpaces(@NotNull @EditorSettingsExternalizable.StripTrailingSpaces String stripTrailingSpaces) {
if(EditorSettingsExternalizable.STRIP_TRAILING_SPACES_NONE.equals(stripTrailingSpaces)) {
myStripTrailingSpacesExplanationLabel.setVisible(false);
return;
}
myStripTrailingSpacesExplanationLabel.setVisible(true);
boolean isVirtualSpace = myCbVirtualSpace.isSelected();
String text;
String virtSpaceText = myCbVirtualSpace.getText();
if (isVirtualSpace) {
text = "Trailing spaces will be trimmed even in the line under caret.<br>To disable trimming in that line uncheck the '<b>"+virtSpaceText+"</b>' above.";
}
else {
text = "Trailing spaces will <b><font color=red>NOT</font></b> be trimmed in the line under caret.<br>To enable trimming in that line too check the '<b>"+virtSpaceText+"</b>' above.";
}
myStripTrailingSpacesExplanationLabel.setText(XmlStringUtil.wrapInHtml(text));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:EditorOptionsPanel.java
示例20: validate
import com.intellij.xml.util.XmlStringUtil; //导入依赖的package包/类
@Override
public void validate() {
for (FacetEditorValidator validator : myValidators) {
ValidationResult validationResult = validator.check();
if (!validationResult.isOk()) {
myMainPanel.setVisible(true);
myWarningLabel.setText(XmlStringUtil.wrapInHtml(validationResult.getErrorMessage()));
myWarningLabel.setVisible(true);
myCurrentQuickFix = validationResult.getQuickFix();
myQuickFixButton.setVisible(myCurrentQuickFix != null);
if (myCurrentQuickFix != null) {
String buttonText = myCurrentQuickFix.getFixButtonText();
myQuickFixButton.setText(buttonText != null ? buttonText : IdeBundle.message("button.facet.quickfix.text"));
}
changeValidity(false);
return;
}
}
myCurrentQuickFix = null;
setNoErrors();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:FacetErrorPanel.java
注:本文中的com.intellij.xml.util.XmlStringUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论