本文整理汇总了Java中com.intellij.xml.util.XmlStringUtil类的典型用法代码示例。如果您正苦于以下问题:Java XmlStringUtil类的具体用法?Java XmlStringUtil怎么用?Java XmlStringUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlStringUtil类属于com.intellij.xml.util包,在下文中一共展示了XmlStringUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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/>") : ""
);
}
示例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;
}
示例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;
}
示例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;
}
示例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()));
}
示例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));
}
示例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));
}
示例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);
}
}
示例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);
}
示例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);
}
示例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>"));
}
示例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);
}
});
}
示例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;
}
示例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());
}
}
}