mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
notnull
This commit is contained in:
@@ -52,7 +52,7 @@ public final class RegExpDocumentationProvider extends AbstractDocumentationProv
|
||||
public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) {
|
||||
if (element instanceof RegExpGroup) {
|
||||
final RegExpGroup group = (RegExpGroup)element;
|
||||
return StringUtil.escapeXml(group.getUnescapedText());
|
||||
return StringUtil.escapeXmlEntities(group.getUnescapedText());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,10 @@
|
||||
package org.intellij.lang.regexp.psi;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface RegExpElement extends PsiElement {
|
||||
|
||||
@NotNull
|
||||
String getUnescapedText();
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ public abstract class RegExpElementImpl extends ASTWrapperPsiElement implements
|
||||
getNode().getTreeParent().removeChild(getNode());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public final String getUnescapedText() {
|
||||
if (InjectedLanguageUtil.isInInjectedLanguagePrefixSuffix(this)) {
|
||||
|
||||
@@ -65,6 +65,7 @@ public class ModuleSourceSet {
|
||||
return getDisplayName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
return (myType == Type.PRODUCTION ? "" : "Tests of ") + "'" + myModule.getName() + "' module";
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Tag extends CompositeGenerator {
|
||||
}
|
||||
out.print((String)option.getFirst());
|
||||
out.print("=\"");
|
||||
out.print(StringUtil.escapeXml((String)option.getSecond()));
|
||||
out.print(StringUtil.escapeXmlEntities((String)option.getSecond()));
|
||||
out.print("\"");
|
||||
generated += 1;
|
||||
}
|
||||
|
||||
@@ -121,6 +121,7 @@ public abstract class CompilingEvaluator implements ExpressionEvaluator {
|
||||
return classWriter.toByteArray();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getGeneratedClassName() {
|
||||
return GEN_CLASS_NAME;
|
||||
}
|
||||
|
||||
@@ -82,18 +82,23 @@ public class AntTestContentHandler extends DefaultHandler {
|
||||
@Override
|
||||
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
|
||||
if (TESTSUITE.equals(qName)) {
|
||||
final String suiteName = StringUtil.unescapeXml(attributes.getValue(NAME));
|
||||
final String packageName = StringUtil.unescapeXml(attributes.getValue(PACKAGE));
|
||||
String nameValue = attributes.getValue(NAME);
|
||||
final String suiteName = nameValue == null ? null : StringUtil.unescapeXmlEntities(nameValue);
|
||||
String packageValue = attributes.getValue(PACKAGE);
|
||||
final String packageName = packageValue == null ? null : StringUtil.unescapeXmlEntities(packageValue);
|
||||
myProcessor
|
||||
.onSuiteStarted(new TestSuiteStartedEvent(suiteName, "java:suite://" + StringUtil.getQualifiedName(packageName, suiteName)));
|
||||
.onSuiteStarted(new TestSuiteStartedEvent(suiteName, "java:suite://" + StringUtil.getQualifiedName(packageName,
|
||||
StringUtil.notNullize(suiteName))));
|
||||
mySuites.push(suiteName);
|
||||
}
|
||||
else if (TESTCASE.equals(qName)) {
|
||||
final String name = StringUtil.unescapeXml(attributes.getValue(NAME));
|
||||
String nameValue = attributes.getValue(NAME);
|
||||
final String name = nameValue == null ? null : StringUtil.unescapeXmlEntities(nameValue);
|
||||
myCurrentTest = name;
|
||||
myStatus = null;
|
||||
myDuration = attributes.getValue(DURATION);
|
||||
String classname = StringUtil.unescapeXml(attributes.getValue(CLASSNAME));
|
||||
String classNameValue = attributes.getValue(CLASSNAME);
|
||||
String classname = classNameValue == null ? null : StringUtil.unescapeXmlEntities(classNameValue);
|
||||
String location = StringUtil.isEmpty(classname) ? name : classname + "/" + name;
|
||||
final TestStartedEvent startedEvent = new TestStartedEvent(name, "java:test://" + location);
|
||||
myProcessor.onTestStarted(startedEvent);
|
||||
@@ -117,7 +122,7 @@ public class AntTestContentHandler extends DefaultHandler {
|
||||
|
||||
@Override
|
||||
public void endElement(String uri, String localName, String qName) throws SAXException {
|
||||
final String currentText = StringUtil.unescapeXml(currentValue.toString());
|
||||
final String currentText = StringUtil.unescapeXmlEntities(currentValue.toString());
|
||||
currentValue.setLength(0);
|
||||
if (TESTSUITE.equals(qName)) {
|
||||
myProcessor.onSuiteFinished(new TestSuiteFinishedEvent(mySuites.pop()));
|
||||
|
||||
@@ -98,8 +98,8 @@ public class RepositoryAttachDialog extends DialogWrapper {
|
||||
myProject = project;
|
||||
myProgressIcon.suspend();
|
||||
myCaptionLabel.setText(
|
||||
XmlStringUtil.wrapInHtml(StringUtil.escapeXml("keyword or class name to search by or exact Maven coordinates, " +
|
||||
"i.e. 'spring', 'Logger' or 'ant:ant-junit:1.6.5'")
|
||||
XmlStringUtil.wrapInHtml(StringUtil.escapeXmlEntities("keyword or class name to search by or exact Maven coordinates, " +
|
||||
"i.e. 'spring', 'Logger' or 'ant:ant-junit:1.6.5'")
|
||||
));
|
||||
myInfoLabel.setPreferredSize(
|
||||
new Dimension(myInfoLabel.getFontMetrics(myInfoLabel.getFont()).stringWidth("Showing: 1000"), myInfoLabel.getPreferredSize().height));
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ public class ErrorPaneConfigurable extends JPanel implements Configurable, Dispo
|
||||
final String host = url.getHost();
|
||||
String path = url.getPath();
|
||||
if (path != null && path.startsWith("/")) {
|
||||
path = StringUtil.unescapeXml(path.substring(1));
|
||||
path = StringUtil.unescapeXmlEntities(path.substring(1));
|
||||
}
|
||||
if (path != null) {
|
||||
if ("fix".equals(host)) {
|
||||
|
||||
+1
@@ -45,6 +45,7 @@ public class GeneralProjectSettingsElement extends ProjectStructureElement {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getPresentableText() {
|
||||
return "Project";
|
||||
|
||||
+1
@@ -43,6 +43,7 @@ public class FacetProjectStructureElement extends ProjectStructureElement {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getPresentableText() {
|
||||
return "Facet '" + myFacet.getName() + "' in module '" + myFacet.getModule().getName() + "'";
|
||||
|
||||
+2
-2
@@ -95,7 +95,7 @@ public class LibraryProjectStructureElement extends ProjectStructureElement {
|
||||
|
||||
private static String createInvalidRootsDescription(List<String> invalidClasses, String rootName, String libraryName) {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
final String name = StringUtil.escapeXml(libraryName);
|
||||
final String name = StringUtil.escapeXmlEntities(libraryName);
|
||||
buffer.append("Library ");
|
||||
buffer.append("<a href='http://library/").append(name).append("'>").append(name).append("</a>");
|
||||
buffer.append(" has broken " + rootName + " " + StringUtil.pluralize("path", invalidClasses.size()) + ":");
|
||||
@@ -153,7 +153,7 @@ public class LibraryProjectStructureElement extends ProjectStructureElement {
|
||||
@Override
|
||||
public ProjectStructureProblemDescription createUnusedElementWarning() {
|
||||
final List<ConfigurationErrorQuickFix> fixes = Arrays.asList(new AddLibraryToDependenciesFix(), new RemoveLibraryFix(), new RemoveAllUnusedLibrariesFix());
|
||||
final String name = StringUtil.escapeXml(myLibrary.getName());
|
||||
final String name = StringUtil.escapeXmlEntities(myLibrary.getName());
|
||||
String libraryName = "<a href='http://library/" + name + "'>" + name + "</a>";
|
||||
return new ProjectStructureProblemDescription(XmlStringUtil.wrapInHtml("Library " + libraryName + " is not used"), null, createPlace(),
|
||||
ProjectStructureProblemType.unused("unused-library"), ProjectStructureProblemDescription.ProblemLevel.PROJECT,
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class ProjectConfigurationProblem extends ConfigurationError {
|
||||
private final Project myProject;
|
||||
|
||||
public ProjectConfigurationProblem(ProjectStructureProblemDescription description, Project project) {
|
||||
super(StringUtil.unescapeXml(description.getMessage(true)), computeDescription(description),
|
||||
super(StringUtil.unescapeXmlEntities(description.getMessage(true)), computeDescription(description),
|
||||
getSettings(project, description.getProblemLevel()).isIgnored(description));
|
||||
myDescription = description;
|
||||
myProject = project;
|
||||
|
||||
+1
@@ -16,6 +16,7 @@ public abstract class ProjectStructureElement {
|
||||
myContext = context;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getPresentableText() {
|
||||
return getTypeName() + " '" + getPresentableName() + "'";
|
||||
}
|
||||
|
||||
+2
@@ -26,6 +26,7 @@ import java.util.List;
|
||||
*/
|
||||
public class ProjectStructureProblemDescription {
|
||||
public enum ProblemLevel {PROJECT, GLOBAL}
|
||||
@NotNull
|
||||
private final String myMessage;
|
||||
private final String myDescription;
|
||||
private final PlaceInProjectStructure myPlace;
|
||||
@@ -61,6 +62,7 @@ public class ProjectStructureProblemDescription {
|
||||
return myProblemLevel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getMessage(final boolean includePlace) {
|
||||
if (includePlace && myCanShowPlace) {
|
||||
return myPlace.getContainingElement().getPresentableText() + ": " + StringUtil.decapitalize(myMessage);
|
||||
|
||||
@@ -252,15 +252,17 @@ public abstract class DfaFactType<T> extends Key<T> {
|
||||
}
|
||||
};
|
||||
|
||||
@NotNull
|
||||
private final String myName;
|
||||
|
||||
private DfaFactType(String name) {
|
||||
private DfaFactType(@NotNull String name) {
|
||||
super("DfaFactType: " + name);
|
||||
myName = name;
|
||||
// Thread-safe as all DfaFactType instances are created only from DfaFactType class static initializer
|
||||
ourFactTypes.add(this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ public class ExternalAnnotationsManagerImpl extends ReadableExternalAnnotationsM
|
||||
XmlTag rootTag = extractRootTag(annotationsFile);
|
||||
|
||||
TreeMap<String, List<ExternalAnnotation>> ownerToAnnotations = StreamEx.of(annotations)
|
||||
.mapToEntry(annotation -> StringUtil.escapeXml(getExternalName(annotation.getOwner())), Function.identity())
|
||||
.mapToEntry(annotation -> StringUtil.escapeXmlEntities(getExternalName(annotation.getOwner())), Function.identity())
|
||||
.distinct()
|
||||
.grouping(() -> new TreeMap<>(Comparator.nullsFirst(Comparator.naturalOrder())));
|
||||
|
||||
@@ -511,13 +511,15 @@ public class ExternalAnnotationsManagerImpl extends ReadableExternalAnnotationsM
|
||||
}
|
||||
|
||||
for (XmlTag tag : rootTag.getSubTags()) {
|
||||
String className = StringUtil.unescapeXml(tag.getAttributeValue("name"));
|
||||
String nameValue = tag.getAttributeValue("name");
|
||||
String className = nameValue == null ? null : StringUtil.unescapeXmlEntities(nameValue);
|
||||
if (Comparing.strEqual(className, oldExternalName)) {
|
||||
WriteCommandAction
|
||||
.runWriteCommandAction(myPsiManager.getProject(), ExternalAnnotationsManagerImpl.class.getName(), null, () -> {
|
||||
PsiDocumentManager.getInstance(myPsiManager.getProject()).commitAllDocuments();
|
||||
try {
|
||||
tag.setAttribute("name", StringUtil.escapeXml(getExternalName(element)));
|
||||
String name = getExternalName(element);
|
||||
tag.setAttribute("name", name == null ? null : StringUtil.escapeXmlEntities(name));
|
||||
commitChanges(file);
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
@@ -576,7 +578,8 @@ public class ExternalAnnotationsManagerImpl extends ReadableExternalAnnotationsM
|
||||
|
||||
final List<XmlTag> tagsToProcess = new ArrayList<>();
|
||||
for (XmlTag tag : rootTag.getSubTags()) {
|
||||
String className = StringUtil.unescapeXml(tag.getAttributeValue("name"));
|
||||
String nameValue = tag.getAttributeValue("name");
|
||||
String className = nameValue == null ? null : StringUtil.unescapeXmlEntities(nameValue);
|
||||
if (!Comparing.strEqual(className, externalName)) {
|
||||
continue;
|
||||
}
|
||||
@@ -765,8 +768,8 @@ public class ExternalAnnotationsManagerImpl extends ReadableExternalAnnotationsM
|
||||
if (values != null && values.length != 0) {
|
||||
text = " <annotation name=\'" + annotationFQName + "\'>\n";
|
||||
text += StringUtil.join(values, pair -> "<val" +
|
||||
(pair.getName() != null ? " name=\"" + pair.getName() + "\"" : "") +
|
||||
" val=\"" + StringUtil.escapeXml(pair.getValue().getText()) + "\"/>", " \n");
|
||||
(pair.getName() != null ? " name=\"" + pair.getName() + "\"" : "") +
|
||||
" val=\"" + StringUtil.escapeXmlEntities(pair.getValue().getText()) + "\"/>", " \n");
|
||||
text += " </annotation>";
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -909,9 +909,10 @@ public class JavaCompletionUtil {
|
||||
};
|
||||
}
|
||||
|
||||
public static String escapeXmlIfNeeded(InsertionContext context, String generics) {
|
||||
@NotNull
|
||||
public static String escapeXmlIfNeeded(InsertionContext context, @NotNull String generics) {
|
||||
if (context.getFile().getViewProvider().getBaseLanguage() == StdLanguages.JSPX) {
|
||||
return StringUtil.escapeXml(generics);
|
||||
return StringUtil.escapeXmlEntities(generics);
|
||||
}
|
||||
return generics;
|
||||
}
|
||||
|
||||
+3
-2
@@ -370,8 +370,9 @@ public class ChangeMethodSignatureFromUsageFix implements IntentionAction/*, Hig
|
||||
return result.toArray(new ParameterInfoImpl[0]);
|
||||
}
|
||||
|
||||
protected static String escapePresentableType(PsiType exprType) {
|
||||
return StringUtil.escapeXml(exprType.getPresentableText());
|
||||
@NotNull
|
||||
protected static String escapePresentableType(@NotNull PsiType exprType) {
|
||||
return StringUtil.escapeXmlEntities(exprType.getPresentableText());
|
||||
}
|
||||
|
||||
protected boolean findNewParamsPlace(PsiExpression[] expressions,
|
||||
|
||||
@@ -44,7 +44,7 @@ public class JavaTypeProvider extends ExpressionTypeProvider<PsiExpression> {
|
||||
type = ((PsiMethodReferenceType)type).getExpression().getFunctionalInterfaceType();
|
||||
}
|
||||
String text = type == null ? "<unknown>" : type.getPresentableText();
|
||||
return StringUtil.escapeXml(text);
|
||||
return StringUtil.escapeXmlEntities(text);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -98,12 +98,12 @@ public class JavaTypeProvider extends ExpressionTypeProvider<PsiExpression> {
|
||||
|
||||
private static <T> String formatFact(@NotNull DfaFactType<T> factType, @NotNull T value, @Nullable PsiType type) {
|
||||
String presentationText = factType.getPresentationText(value, type);
|
||||
return presentationText.isEmpty() ? "" : makeHtmlRow(factType.getName(), StringUtil.escapeXml(presentationText));
|
||||
return presentationText.isEmpty() ? "" : makeHtmlRow(factType.getName(), StringUtil.escapeXmlEntities(presentationText));
|
||||
}
|
||||
|
||||
private static String makeHtmlRow(String titleText, String contentHtml) {
|
||||
private static String makeHtmlRow(@NotNull String titleText, String contentHtml) {
|
||||
String titleCell = "<td align='left' valign='top' style='color:" +
|
||||
ColorUtil.toHtmlColor(DocumentationComponent.SECTION_COLOR) + "'>" + StringUtil.escapeXml(titleText) + ":</td>";
|
||||
ColorUtil.toHtmlColor(DocumentationComponent.SECTION_COLOR) + "'>" + StringUtil.escapeXmlEntities(titleText) + ":</td>";
|
||||
String contentCell = "<td>" + contentHtml + "</td>";
|
||||
return "<tr>" + titleCell + contentCell + "</tr>";
|
||||
}
|
||||
|
||||
+1
-1
@@ -693,7 +693,7 @@ public class MethodParameterInfoHandler implements ParameterInfoHandlerWithTabAc
|
||||
if (context.isSingleParameterInfo()) buffer.append("<b>");
|
||||
appendModifierList(buffer, param);
|
||||
String type = paramType.getPresentableText(true);
|
||||
buffer.append(context.isSingleParameterInfo() ? StringUtil.escapeXml(type) : type);
|
||||
buffer.append(context.isSingleParameterInfo() ? StringUtil.escapeXmlEntities(type) : type);
|
||||
String name = param.getName();
|
||||
if (name != null && !context.isSingleParameterInfo()) {
|
||||
buffer.append(" ");
|
||||
|
||||
+1
-1
@@ -29,6 +29,6 @@ public class AssignmentTooltipLinkHandler extends TooltipLinkHandler {
|
||||
@Nullable
|
||||
@Override
|
||||
public String getDescription(@NotNull String refSuffix, @NotNull Editor editor) {
|
||||
return StringUtil.unescapeXml(refSuffix);
|
||||
return StringUtil.unescapeXmlEntities(refSuffix);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -815,7 +815,7 @@ public class JavaDocInfoGenerator {
|
||||
boolean trunc = index < text.length();
|
||||
text = text.substring(0, index);
|
||||
buffer.append(" = ");
|
||||
buffer.append(StringUtil.escapeXml(text));
|
||||
buffer.append(StringUtil.escapeXmlEntities(text));
|
||||
if (trunc) {
|
||||
buffer.append("...");
|
||||
}
|
||||
@@ -836,7 +836,7 @@ public class JavaDocInfoGenerator {
|
||||
boolean trunc = index < text.length();
|
||||
if (trunc) {
|
||||
text = text.substring(0, index);
|
||||
buffer.append(StringUtil.escapeXml(text));
|
||||
buffer.append(StringUtil.escapeXmlEntities(text));
|
||||
buffer.append("...");
|
||||
}
|
||||
else {
|
||||
@@ -1069,7 +1069,7 @@ public class JavaDocInfoGenerator {
|
||||
}
|
||||
|
||||
final String typeParamsString = generateTypeParameters(method, useShortNames);
|
||||
indent += StringUtil.unescapeXml(StringUtil.stripHtml(typeParamsString, true)).length();
|
||||
indent += StringUtil.unescapeXmlEntities(StringUtil.stripHtml(typeParamsString, true)).length();
|
||||
if (!typeParamsString.isEmpty()) {
|
||||
buffer.append(typeParamsString);
|
||||
buffer.append(NBSP);
|
||||
@@ -1282,7 +1282,7 @@ public class JavaDocInfoGenerator {
|
||||
int pos = elementText.lastIndexOf('\n');
|
||||
if (pos >= 0) elementText = elementText.substring(0, pos + 1); // skip whitespace before leading asterisk
|
||||
}
|
||||
appendPlainText(StringUtil.escapeXml(elementText), tmpBuffer);
|
||||
appendPlainText(StringUtil.escapeXmlEntities(elementText), tmpBuffer);
|
||||
}
|
||||
if ((mySdkVersion == null || mySdkVersion.isAtLeast(JavaSdkVersion.JDK_1_8)) && isInPre(tag)) {
|
||||
buffer.append(tmpBuffer);
|
||||
@@ -1357,7 +1357,7 @@ public class JavaDocInfoGenerator {
|
||||
}
|
||||
|
||||
if (value != null) {
|
||||
String valueText = StringUtil.escapeXml(value.toString());
|
||||
String valueText = StringUtil.escapeXmlEntities(value.toString());
|
||||
if (value instanceof String) valueText = '"' + valueText + '"';
|
||||
if (valueField.equals(myElement)) buffer.append(valueText); // don't generate link to itself
|
||||
else generateLink(buffer, valueField, valueText, true);
|
||||
@@ -1524,7 +1524,7 @@ public class JavaDocInfoGenerator {
|
||||
if (spaceIndex < 0) {
|
||||
spaceIndex = text.length();
|
||||
}
|
||||
buffer.append(StringUtil.escapeXml(tag.name));
|
||||
buffer.append(StringUtil.escapeXmlEntities(tag.name));
|
||||
buffer.append(" – ");
|
||||
buffer.append(text.substring(spaceIndex));
|
||||
generateValue(buffer, elements, 1, mapProvider(tag.inheritDocTagProvider, true));
|
||||
@@ -1778,7 +1778,7 @@ public class JavaDocInfoGenerator {
|
||||
*/
|
||||
public static int generateType(StringBuilder buffer, PsiType type, PsiElement context, boolean generateLink, boolean useShortNames) {
|
||||
if (type instanceof PsiPrimitiveType) {
|
||||
String text = StringUtil.escapeXml(type.getCanonicalText());
|
||||
String text = StringUtil.escapeXmlEntities(type.getCanonicalText());
|
||||
buffer.append(text);
|
||||
return text.length();
|
||||
}
|
||||
@@ -1821,7 +1821,7 @@ public class JavaDocInfoGenerator {
|
||||
catch (IndexNotReadyException e) {
|
||||
LOG.debug(e);
|
||||
String text = ((PsiClassType)type).getClassName();
|
||||
buffer.append(StringUtil.escapeXml(text));
|
||||
buffer.append(StringUtil.escapeXmlEntities(text));
|
||||
return text.length();
|
||||
}
|
||||
PsiClass psiClass = result.getElement();
|
||||
@@ -1829,7 +1829,7 @@ public class JavaDocInfoGenerator {
|
||||
|
||||
if (psiClass == null) {
|
||||
String canonicalText = type.getCanonicalText();
|
||||
String text = "<font color=red>" + StringUtil.escapeXml(canonicalText) + "</font>";
|
||||
String text = "<font color=red>" + StringUtil.escapeXmlEntities(canonicalText) + "</font>";
|
||||
buffer.append(text);
|
||||
return canonicalText.length();
|
||||
}
|
||||
@@ -1837,7 +1837,7 @@ public class JavaDocInfoGenerator {
|
||||
String qName = psiClass.getQualifiedName();
|
||||
|
||||
if (qName == null || psiClass instanceof PsiTypeParameter) {
|
||||
String text = StringUtil.escapeXml(useShortNames ? type.getPresentableText() : type.getCanonicalText());
|
||||
String text = StringUtil.escapeXmlEntities(useShortNames ? type.getPresentableText() : type.getCanonicalText());
|
||||
buffer.append(text);
|
||||
return text.length();
|
||||
}
|
||||
@@ -1891,7 +1891,7 @@ public class JavaDocInfoGenerator {
|
||||
if (type instanceof PsiDisjunctionType || type instanceof PsiIntersectionType) {
|
||||
if (!generateLink) {
|
||||
String canonicalText = useShortNames ? type.getPresentableText() : type.getCanonicalText();
|
||||
final String text = StringUtil.escapeXml(canonicalText);
|
||||
final String text = StringUtil.escapeXmlEntities(canonicalText);
|
||||
buffer.append(text);
|
||||
return canonicalText.length();
|
||||
}
|
||||
@@ -2155,18 +2155,18 @@ public class JavaDocInfoGenerator {
|
||||
|
||||
@Override
|
||||
public void visitMethodCallExpression(PsiMethodCallExpression expression) {
|
||||
myBuffer.append(StringUtil.escapeXml(expression.getMethodExpression().getText()));
|
||||
myBuffer.append(StringUtil.escapeXmlEntities(expression.getMethodExpression().getText()));
|
||||
expression.getArgumentList().accept(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitExpression(PsiExpression expression) {
|
||||
myBuffer.append(StringUtil.escapeXml(expression.getText()));
|
||||
myBuffer.append(StringUtil.escapeXmlEntities(expression.getText()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitReferenceExpression(PsiReferenceExpression expression) {
|
||||
myBuffer.append(StringUtil.escapeXml(expression.getText()));
|
||||
myBuffer.append(StringUtil.escapeXmlEntities(expression.getText()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,6 +134,7 @@ public class PsiTypeLookupItem extends LookupItem implements TypedLookupItem {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String calcGenerics(@NotNull PsiElement context, InsertionContext insertionContext) {
|
||||
if (insertionContext.getCompletionChar() == '<') {
|
||||
return "";
|
||||
|
||||
@@ -79,6 +79,7 @@ public class CreateClassAction extends JavaCreateTemplateInPackageAction<PsiClas
|
||||
return StringUtil.trimEnd(className, ".java");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getErrorTitle() {
|
||||
return IdeBundle.message("title.cannot.create.class");
|
||||
@@ -86,7 +87,7 @@ public class CreateClassAction extends JavaCreateTemplateInPackageAction<PsiClas
|
||||
|
||||
|
||||
@Override
|
||||
protected String getActionName(PsiDirectory directory, String newName, String templateName) {
|
||||
protected String getActionName(PsiDirectory directory, @NotNull String newName, String templateName) {
|
||||
return IdeBundle.message("progress.creating.class", StringUtil.getQualifiedName(JavaDirectoryService.getInstance().getPackage(directory).getQualifiedName(), newName));
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ public class JavaDocumentationProvider extends DocumentationProviderEx implement
|
||||
if (index.isInLibrarySource(file) || index.isInLibraryClasses(file)) {
|
||||
index.getOrderEntriesForFile(file).stream()
|
||||
.filter(LibraryOrSdkOrderEntry.class::isInstance).findFirst()
|
||||
.ifPresent(entry -> buffer.append('[').append(StringUtil.escapeXml(entry.getPresentableName())).append("] "));
|
||||
.ifPresent(entry -> buffer.append('[').append(StringUtil.escapeXmlEntities(entry.getPresentableName())).append("] "));
|
||||
}
|
||||
else {
|
||||
Module module = index.getModuleForFile(file);
|
||||
@@ -551,7 +551,7 @@ public class JavaDocumentationProvider extends DocumentationProviderEx implement
|
||||
PsiFormatUtilBase.SHOW_TYPE |
|
||||
PsiFormatUtilBase.SHOW_PARAMETERS,
|
||||
PsiFormatUtilBase.SHOW_TYPE | PsiFormatUtilBase.SHOW_NAME);
|
||||
createElementLink(sb, constructor, StringUtil.escapeXml(str));
|
||||
createElementLink(sb, constructor, StringUtil.escapeXmlEntities(str));
|
||||
}
|
||||
|
||||
return CodeInsightBundle.message("javadoc.constructor.candidates", targetClass.getName(), sb);
|
||||
@@ -624,7 +624,7 @@ public class JavaDocumentationProvider extends DocumentationProviderEx implement
|
||||
PsiFormatUtilBase.SHOW_TYPE |
|
||||
PsiFormatUtilBase.SHOW_PARAMETERS,
|
||||
PsiFormatUtilBase.SHOW_TYPE);
|
||||
createElementLink(sb, element, StringUtil.escapeXml(str));
|
||||
createElementLink(sb, element, StringUtil.escapeXmlEntities(str));
|
||||
}
|
||||
|
||||
return CodeInsightBundle.message("javadoc.candidates", text, sb);
|
||||
|
||||
@@ -1839,7 +1839,7 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
|
||||
private static String unescapeTokenText(ASTNode token, IElementType type) {
|
||||
String text = token.getText();
|
||||
if (ESCAPED_TOKENS.contains(type) && StringUtil.startsWithChar(text, '&')) {
|
||||
text = StringUtil.unescapeXml(text);
|
||||
text = StringUtil.unescapeXmlEntities(text);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class JavaTreeCopyHandler implements TreeCopyHandler {
|
||||
else if (shallDecodeEscapedTexts && element instanceof LeafElement && !(element instanceof OuterLanguageElement)) {
|
||||
if (!isInCData(element)) {
|
||||
String original = element.getText();
|
||||
String escaped = StringUtil.escapeXml(original);
|
||||
String escaped = StringUtil.escapeXmlEntities(original);
|
||||
if (!Comparing.equal(original, escaped) && element.getCopyableUserData(ALREADY_ESCAPED) == null) {
|
||||
LeafElement copy = ((LeafElement)element).replaceWithText(escaped);
|
||||
copy.putCopyableUserData(ALREADY_ESCAPED, Boolean.TRUE);
|
||||
@@ -168,7 +168,7 @@ public class JavaTreeCopyHandler implements TreeCopyHandler {
|
||||
!(original instanceof OuterLanguageElement) &&
|
||||
!isInCData(original)) {
|
||||
String originalText = element.getText();
|
||||
String unescapedText = StringUtil.unescapeXml(originalText);
|
||||
String unescapedText = StringUtil.unescapeXmlEntities(originalText);
|
||||
if (!Comparing.equal(originalText, unescapedText)) {
|
||||
LeafElement replaced = ((LeafElement)element).rawReplaceWithText(unescapedText);
|
||||
element.putCopyableUserData(ALREADY_ESCAPED, null);
|
||||
|
||||
+1
@@ -46,6 +46,7 @@ public class ChangeSignatureViewDescriptor implements UsageViewDescriptor {
|
||||
return myProcessedElementsHeader;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getCodeReferencesText(int usagesCount, int filesCount) {
|
||||
return RefactoringBundle.message("references.to.be.changed",
|
||||
|
||||
+1
@@ -44,6 +44,7 @@ class EncapsulateFieldsViewDescriptor implements UsageViewDescriptor {
|
||||
return myFields;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getCodeReferencesText(int usagesCount, int filesCount) {
|
||||
return RefactoringBundle.message("references.to.be.changed", UsageViewBundle.getReferencesString(usagesCount, filesCount));
|
||||
|
||||
+2
@@ -29,6 +29,7 @@ import com.intellij.refactoring.ui.MemberSelectionPanel;
|
||||
import com.intellij.refactoring.util.DocCommentPolicy;
|
||||
import com.intellij.refactoring.util.classMembers.MemberInfo;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -87,6 +88,7 @@ class ExtractInterfaceDialog extends JavaExtractSuperBaseDialog {
|
||||
: RefactoringBundle.message("package.for.original.class");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getEntityName() {
|
||||
return RefactoringBundle.message("extractSuperInterface.interface");
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface AbstractExtractDialog {
|
||||
|
||||
@NotNull
|
||||
String getChosenMethodName();
|
||||
VariableData[] getChosenParameters();
|
||||
@PsiModifier.ModifierConstant
|
||||
|
||||
@@ -151,6 +151,7 @@ public class ExtractMethodDialog extends RefactoringDialog implements AbstractEx
|
||||
return getHelpId() != null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getChosenMethodName() {
|
||||
return myNameField.getEnteredName().trim();
|
||||
|
||||
+4
-2
@@ -80,7 +80,7 @@ public class ExtractLightMethodObjectHandler {
|
||||
public static ExtractedData extractLightMethodObject(final Project project,
|
||||
@Nullable PsiElement originalContext,
|
||||
@NotNull final PsiCodeFragment fragment,
|
||||
final String methodName,
|
||||
@NotNull String methodName,
|
||||
@Nullable JavaSdkVersion javaVersion) throws PrepareFailedException {
|
||||
final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project);
|
||||
PsiElement[] elements = completeToStatementArray(fragment, elementFactory);
|
||||
@@ -325,13 +325,15 @@ public class ExtractLightMethodObjectHandler {
|
||||
|
||||
private static class LightExtractMethodObjectDialog implements AbstractExtractDialog {
|
||||
private final ExtractMethodObjectProcessor myProcessor;
|
||||
@NotNull
|
||||
private final String myMethodName;
|
||||
|
||||
LightExtractMethodObjectDialog(ExtractMethodObjectProcessor processor, String methodName) {
|
||||
LightExtractMethodObjectDialog(ExtractMethodObjectProcessor processor, @NotNull String methodName) {
|
||||
myProcessor = processor;
|
||||
myMethodName = methodName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getChosenMethodName() {
|
||||
return myMethodName;
|
||||
|
||||
+1
@@ -117,6 +117,7 @@ public class ExtractMethodObjectDialog extends DialogWrapper implements Abstract
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getChosenMethodName() {
|
||||
return myCreateInnerClassRb.isSelected() ? myInnerClassName.getText() : myMethodName.getText();
|
||||
|
||||
+3
-1
@@ -74,6 +74,7 @@ public class ExtractMethodObjectProcessor extends BaseRefactoringProcessor {
|
||||
|
||||
protected final MyExtractMethodProcessor myExtractProcessor;
|
||||
private boolean myCreateInnerClass = true;
|
||||
@NotNull
|
||||
private String myInnerClassName;
|
||||
|
||||
private boolean myMultipleExitPoints;
|
||||
@@ -91,7 +92,7 @@ public class ExtractMethodObjectProcessor extends BaseRefactoringProcessor {
|
||||
|
||||
private static final Key<Boolean> GENERATED_RETURN = new Key<>("GENERATED_RETURN");
|
||||
|
||||
public ExtractMethodObjectProcessor(Project project, Editor editor, PsiElement[] elements, final String innerClassName) {
|
||||
public ExtractMethodObjectProcessor(Project project, Editor editor, PsiElement[] elements, @NotNull String innerClassName) {
|
||||
super(project);
|
||||
myInnerClassName = innerClassName;
|
||||
myExtractProcessor = new MyExtractMethodProcessor(project, editor, elements, null, REFACTORING_NAME, innerClassName, HelpID.EXTRACT_METHOD_OBJECT);
|
||||
@@ -695,6 +696,7 @@ public class ExtractMethodObjectProcessor extends BaseRefactoringProcessor {
|
||||
return myExtractProcessor.getExtractedMethod();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getInnerClassName() {
|
||||
return myInnerClassName;
|
||||
}
|
||||
|
||||
+1
@@ -39,6 +39,7 @@ public class ExtractMethodObjectViewDescriptor implements UsageViewDescriptor {
|
||||
return "Method to be converted";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getCodeReferencesText(final int usagesCount, final int filesCount) {
|
||||
return "References to be changed";
|
||||
|
||||
+2
@@ -31,6 +31,7 @@ import com.intellij.refactoring.util.classMembers.InterfaceContainmentVerifier;
|
||||
import com.intellij.refactoring.util.classMembers.MemberInfo;
|
||||
import com.intellij.refactoring.util.classMembers.UsesAndInterfacesDependencyMemberInfoModel;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -74,6 +75,7 @@ class ExtractSuperclassDialog extends JavaExtractSuperBaseDialog {
|
||||
: RefactoringBundle.message("package.for.original.class");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getEntityName() {
|
||||
return RefactoringBundle.message("ExtractSuperClass.superclass");
|
||||
|
||||
+2
-1
@@ -36,6 +36,7 @@ import com.intellij.refactoring.util.RefactoringMessageUtil;
|
||||
import com.intellij.refactoring.util.classMembers.MemberInfo;
|
||||
import com.intellij.ui.EditorComboBox;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -180,7 +181,7 @@ public abstract class JavaExtractSuperBaseDialog extends ExtractSuperBaseDialog<
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected String validateQualifiedName(String packageName, String extractedSuperName) {
|
||||
protected String validateQualifiedName(String packageName, @NotNull String extractedSuperName) {
|
||||
return StringUtil.getQualifiedName(packageName, extractedSuperName).equals(mySourceClass.getQualifiedName()) ? "Different name expected"
|
||||
: null;
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ public class ExtractClassProcessor extends FixableUsagesRefactoringProcessor {
|
||||
private final String myNewVisibility;
|
||||
private final boolean myGenerateAccessors;
|
||||
private final List<PsiField> enumConstants;
|
||||
@NotNull
|
||||
private final String newClassName;
|
||||
private final String delegateFieldName;
|
||||
private final boolean requiresBackpointer;
|
||||
@@ -89,7 +90,7 @@ public class ExtractClassProcessor extends FixableUsagesRefactoringProcessor {
|
||||
List<? extends PsiMethod> methods,
|
||||
List<? extends PsiClass> innerClasses,
|
||||
String newPackageName,
|
||||
String newClassName) {
|
||||
@NotNull String newClassName) {
|
||||
this(sourceClass, fields, methods, innerClasses, newPackageName, null, newClassName, null, false, Collections.emptyList(), false);
|
||||
}
|
||||
|
||||
@@ -99,7 +100,7 @@ public class ExtractClassProcessor extends FixableUsagesRefactoringProcessor {
|
||||
List<? extends PsiClass> classes,
|
||||
String packageName,
|
||||
MoveDestination moveDestination,
|
||||
String newClassName,
|
||||
@NotNull String newClassName,
|
||||
String newVisibility,
|
||||
boolean generateAccessors,
|
||||
List<? extends MemberInfo> enumConstants,
|
||||
@@ -186,6 +187,7 @@ public class ExtractClassProcessor extends FixableUsagesRefactoringProcessor {
|
||||
return showConflicts(conflicts, refUsages.get());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getQualifiedName() {
|
||||
return extractInnerClass ? newClassName : StringUtil.getQualifiedName(newPackageName, newClassName);
|
||||
}
|
||||
|
||||
+1
@@ -31,6 +31,7 @@ class ExtractClassUsageViewDescriptor implements UsageViewDescriptor {
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getCodeReferencesText(int usagesCount, int filesCount) {
|
||||
return RefactorJBundle.message("references.to.extract") + MyUsageViewUtil.getUsageCountInfo(usagesCount, filesCount, "reference");
|
||||
|
||||
+1
-1
@@ -251,7 +251,7 @@ class InlineToAnonymousConstructorProcessor {
|
||||
private PsiVariable generateOuterClassLocal() {
|
||||
PsiClass outerClass = myClass.getContainingClass();
|
||||
assert outerClass != null;
|
||||
return generateLocal(StringUtil.decapitalize(outerClass.getName()),
|
||||
return generateLocal(StringUtil.decapitalize(StringUtil.notNullize(outerClass.getName())),
|
||||
myElementFactory.createType(outerClass), myNewExpression.getQualifier());
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ class InlineViewDescriptor implements UsageViewDescriptor{
|
||||
return "Unknown element";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getCodeReferencesText(int usagesCount, int filesCount) {
|
||||
return RefactoringBundle.message("invocations.to.be.inlined", UsageViewBundle.getReferencesString(usagesCount, filesCount));
|
||||
|
||||
+1
@@ -764,6 +764,7 @@ public class IntroduceParameterHandler extends IntroduceHandlerBase {
|
||||
}
|
||||
|
||||
private class MyAbstractExtractDialog implements AbstractExtractDialog {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getChosenMethodName() {
|
||||
return "name";
|
||||
|
||||
+1
@@ -226,6 +226,7 @@ public class IntroduceParameterObjectDialog extends AbstractIntroduceParameterOb
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getInnerClassName() {
|
||||
return myInnerClassNameTextField.getText().trim();
|
||||
}
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class JavaIntroduceParameterObjectClassDescriptor extends IntroduceParame
|
||||
private final Map<ParameterInfoImpl, ParameterBean> myExistingClassProperties = new HashMap<>();
|
||||
private final MoveDestination myMoveDestination;
|
||||
|
||||
public JavaIntroduceParameterObjectClassDescriptor(String className,
|
||||
public JavaIntroduceParameterObjectClassDescriptor(@NotNull String className,
|
||||
String packageName,
|
||||
MoveDestination moveDestination,
|
||||
boolean useExistingClass,
|
||||
|
||||
+1
@@ -49,6 +49,7 @@ public class MakeMethodOrClassStaticViewDescriptor implements UsageViewDescripto
|
||||
return myProcessedElementsHeader;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getCodeReferencesText(int usagesCount, int filesCount) {
|
||||
return RefactoringBundle.message("references.to.be.changed", UsageViewBundle.getReferencesString(usagesCount, filesCount));
|
||||
|
||||
@@ -318,6 +318,7 @@ public class PullUpProcessor extends BaseRefactoringProcessor implements PullUpD
|
||||
return ContainerUtil.map(myMembersToMove, info -> info.getMember(), PsiElement.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getCodeReferencesText(int usagesCount, int filesCount) {
|
||||
return "Class to pull up members to \"" + RefactoringUIUtil.getDescription(myTargetSuperClass, true) + "\"";
|
||||
|
||||
+1
@@ -46,6 +46,7 @@ class MigrationUsagesViewDescriptor implements UsageViewDescriptor {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getCodeReferencesText(int usagesCount, int filesCount) {
|
||||
return RefactoringBundle.message("references.in.code.to.elements.from.migration.map", myMigrationMap.getName(),
|
||||
|
||||
+2
-2
@@ -408,10 +408,10 @@ public class MoveClassesOrPackagesProcessor extends BaseRefactoringProcessor {
|
||||
private String getNewQName(PsiElement element) {
|
||||
final String qualifiedName = myTargetPackage.getQualifiedName();
|
||||
if (element instanceof PsiClass) {
|
||||
return StringUtil.getQualifiedName(qualifiedName, ((PsiClass)element).getName());
|
||||
return StringUtil.getQualifiedName(qualifiedName, StringUtil.notNullize(((PsiClass)element).getName()));
|
||||
}
|
||||
else if (element instanceof PsiPackage) {
|
||||
return StringUtil.getQualifiedName(qualifiedName, ((PsiPackage)element).getName());
|
||||
return StringUtil.getQualifiedName(qualifiedName, StringUtil.notNullize(((PsiPackage)element).getName()));
|
||||
}
|
||||
else if (element instanceof PsiClassOwner) {
|
||||
return ((PsiClassOwner)element).getName();
|
||||
|
||||
+2
-1
@@ -59,7 +59,8 @@ public class MoveJavaFileHandler extends MoveFileHandler {
|
||||
final String qualifiedName = newParentPackage == null ? "" : newParentPackage.getQualifiedName();
|
||||
for (PsiClass aClass : ((PsiJavaFile)psiFile).getClasses()) {
|
||||
Collections.addAll(result, MoveClassesOrPackagesUtil.findUsages(aClass, searchInComments, searchInNonJavaFiles,
|
||||
StringUtil.getQualifiedName(qualifiedName, aClass.getName())));
|
||||
StringUtil.getQualifiedName(qualifiedName,
|
||||
StringUtil.notNullize(aClass.getName()))));
|
||||
}
|
||||
return result.isEmpty() ? null : result;
|
||||
}
|
||||
|
||||
+1
@@ -42,6 +42,7 @@ class MoveInnerViewDescriptor implements UsageViewDescriptor {
|
||||
return RefactoringBundle.message("move.inner.class.to.be.moved");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getCodeReferencesText(int usagesCount, int filesCount) {
|
||||
return RefactoringBundle.message("references.to.be.changed", UsageViewBundle.getReferencesString(usagesCount, filesCount));
|
||||
|
||||
+1
@@ -30,6 +30,7 @@ class RemoveMiddlemanUsageViewDescriptor implements UsageViewDescriptor {
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getCodeReferencesText(int usagesCount, int filesCount) {
|
||||
return RefactorJBundle
|
||||
|
||||
@@ -54,6 +54,7 @@ public class RenamePsiPackageProcessor extends RenamePsiElementProcessor {
|
||||
return new String[]{((PsiPackage)element).getQualifiedName()};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getNewName() {
|
||||
final PsiPackage psiPackage = (PsiPackage)element;
|
||||
|
||||
+2
-1
@@ -57,6 +57,7 @@ public class ReplaceConstructorWithBuilderProcessor extends FixableUsagesRefacto
|
||||
public static final String REFACTORING_NAME = "Replace Constructor with Builder";
|
||||
private final PsiMethod[] myConstructors;
|
||||
private final Map<String, ParameterData> myParametersMap;
|
||||
@NotNull
|
||||
private final String myClassName;
|
||||
private final String myPackageName;
|
||||
private final boolean myCreateNewBuilderClass;
|
||||
@@ -67,7 +68,7 @@ public class ReplaceConstructorWithBuilderProcessor extends FixableUsagesRefacto
|
||||
public ReplaceConstructorWithBuilderProcessor(Project project,
|
||||
PsiMethod[] constructors,
|
||||
Map<String, ParameterData> parametersMap,
|
||||
String className,
|
||||
@NotNull String className,
|
||||
String packageName,
|
||||
MoveDestination moveDestination, boolean createNewBuilderClass) {
|
||||
super(project);
|
||||
|
||||
+1
@@ -46,6 +46,7 @@ class RefsToSuperViewDescriptor implements UsageViewDescriptor{
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getCodeReferencesText(int usagesCount, int filesCount) {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
|
||||
@@ -39,6 +39,7 @@ class TypeCookViewDescriptor implements UsageViewDescriptor {
|
||||
return RefactoringBundle.message("type.cook.elements.header");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getCodeReferencesText(int usagesCount, int filesCount) {
|
||||
return RefactoringBundle.message("declaration.s.to.be.generified", UsageViewBundle.getReferencesString(usagesCount, filesCount));
|
||||
|
||||
@@ -111,10 +111,10 @@ public class TypeMigrationLabeler {
|
||||
final PsiExpression element = p.getFirst().getElement();
|
||||
LOG.assertTrue(element != null);
|
||||
final PsiType type = element.getType();
|
||||
report[j++] = "Cannot convert type of expression <b>" + StringUtil.escapeXml(element.getText()) + "</b>" +
|
||||
report[j++] = "Cannot convert type of expression <b>" + StringUtil.escapeXmlEntities(element.getText()) + "</b>" +
|
||||
(type != null
|
||||
? " from <b>" + StringUtil.escapeXml(type.getCanonicalText()) + "</b>" +
|
||||
" to <b>" + StringUtil.escapeXml(p.getSecond().getCanonicalText()) + "</b>"
|
||||
? " from <b>" + StringUtil.escapeXmlEntities(type.getCanonicalText()) + "</b>" +
|
||||
" to <b>" + StringUtil.escapeXmlEntities(p.getSecond().getCanonicalText()) + "</b>"
|
||||
: "")
|
||||
+ "<br>";
|
||||
}
|
||||
|
||||
+1
@@ -40,6 +40,7 @@ class TypeMigrationViewDescriptor implements UsageViewDescriptor {
|
||||
return "Root for type migration";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getCodeReferencesText(int usagesCount, int filesCount) {
|
||||
return RefactoringBundle.message("occurences.to.be.migrated", UsageViewBundle.getReferencesString(usagesCount, filesCount));
|
||||
|
||||
@@ -123,6 +123,7 @@ class WrapReturnValueDialog extends RefactoringDialog {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getInnerClassName() {
|
||||
return myInnerClassNameTextField.getText().trim();
|
||||
}
|
||||
|
||||
+2
-1
@@ -59,6 +59,7 @@ public class WrapReturnValueProcessor extends FixableUsagesRefactoringProcessor
|
||||
|
||||
private final MoveDestination myMoveDestination;
|
||||
private final PsiMethod myMethod;
|
||||
@NotNull
|
||||
private final String myClassName;
|
||||
private final String myPackageName;
|
||||
private final boolean myCreateInnerClass;
|
||||
@@ -68,7 +69,7 @@ public class WrapReturnValueProcessor extends FixableUsagesRefactoringProcessor
|
||||
private final List<PsiTypeParameter> myTypeParameters;
|
||||
private final String myUnwrapMethodName;
|
||||
|
||||
public WrapReturnValueProcessor(String className,
|
||||
public WrapReturnValueProcessor(@NotNull String className,
|
||||
String packageName,
|
||||
MoveDestination moveDestination,
|
||||
PsiMethod method,
|
||||
|
||||
+1
@@ -45,6 +45,7 @@ class WrapReturnValueUsageViewDescriptor implements UsageViewDescriptor {
|
||||
return RefactorJBundle.message("method.whose.return.are.to.wrapped");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getCodeReferencesText(int usagesCount, int filesCount){
|
||||
return RefactorJBundle.message("references.to.be.modified.usage.view",
|
||||
|
||||
@@ -70,12 +70,14 @@ public class TestIntegrationUtils {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@NotNull
|
||||
private final String myDefaultName;
|
||||
|
||||
MethodKind(String defaultName) {
|
||||
MethodKind(@NotNull String defaultName) {
|
||||
myDefaultName = defaultName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getDefaultName() {
|
||||
return myDefaultName;
|
||||
}
|
||||
|
||||
@@ -170,12 +170,12 @@ public class PsiClassImpl extends JavaStubPsiElement<PsiClassStub<?>> implements
|
||||
|
||||
PsiElement parent = getParent();
|
||||
if (parent instanceof PsiJavaFile) {
|
||||
return StringUtil.getQualifiedName(((PsiJavaFile)parent).getPackageName(), getName());
|
||||
return StringUtil.getQualifiedName(((PsiJavaFile)parent).getPackageName(), StringUtil.notNullize(getName()));
|
||||
}
|
||||
if (parent instanceof PsiClass) {
|
||||
String parentQName = ((PsiClass)parent).getQualifiedName();
|
||||
if (parentQName == null) return null;
|
||||
return StringUtil.getQualifiedName(parentQName, getName());
|
||||
return StringUtil.getQualifiedName(parentQName, StringUtil.notNullize(getName()));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
+2
-2
@@ -127,7 +127,7 @@ public class ExternalAnnotationsManagerTest extends IdeaTestCase {
|
||||
}
|
||||
|
||||
@Contract("_,_,_-> fail")
|
||||
private static void fail(String error, PsiFile psiFile, String externalName) {
|
||||
private static void fail(String error, PsiFile psiFile, @NotNull String externalName) {
|
||||
int offset = psiFile.getText().indexOf(XmlUtil.escape(externalName));
|
||||
int line = PsiDocumentManager.getInstance(psiFile.getProject()).getDocument(psiFile).getLineNumber(offset);
|
||||
fail(error + "\nFile: " + psiFile.getVirtualFile().getPath() + ":" + (line+1) + " (offset: "+offset+")");
|
||||
@@ -135,7 +135,7 @@ public class ExternalAnnotationsManagerTest extends IdeaTestCase {
|
||||
|
||||
private void checkExternalName(@NotNull PsiFile psiFile, @NotNull String externalName, @NotNull String assumedPackage) {
|
||||
// 'item name="java.lang.ClassLoader java.net.URL getResource(java.lang.String) 0"' should have all FQNs
|
||||
String unescaped = StringUtil.unescapeXml(externalName);
|
||||
String unescaped = StringUtil.unescapeXmlEntities(externalName);
|
||||
List<String> words = StringUtil.split(unescaped, " ");
|
||||
String className = words.get(0);
|
||||
PsiClass aClass = assertClassFqn(className, psiFile, externalName, assumedPackage);
|
||||
|
||||
+1
-1
@@ -270,7 +270,7 @@ public class BytecodeAnalysisIntegrationTest extends LightCodeInsightFixtureTest
|
||||
if (annotations.isEmpty()) return;
|
||||
String xmlContent = EntryStream.of(annotations)
|
||||
.mapValues(map -> EntryStream.of(map).mapKeyValue(ExternalAnnotationsManagerImpl::createAnnotationTag).joining())
|
||||
.mapKeyValue((externalName, content) -> "<item name=\'" + StringUtil.escapeXml(externalName) + "\'>\n" + content.trim() + "\n</item>\n")
|
||||
.mapKeyValue((externalName, content) -> "<item name=\'" + StringUtil.escapeXmlEntities(externalName) + "\'>\n" + content.trim() + "\n</item>\n")
|
||||
.joining("", "<root>\n", "</root>");
|
||||
WriteCommandAction.runWriteCommandAction(getProject(), () -> {
|
||||
XmlFile xml = ExternalAnnotationsManagerImpl.createAnnotationsXml(root, packageName, getPsiManager());
|
||||
|
||||
+4
-4
@@ -196,17 +196,17 @@ public class IntroduceParameterObjectTest extends MultiFileTestCase {
|
||||
doTest(true, false);
|
||||
}
|
||||
|
||||
private void doTestExistingClass(final String existingClassName, final String existingClassPackage, final boolean generateAccessors) {
|
||||
private void doTestExistingClass(@NotNull String existingClassName, final String existingClassPackage, final boolean generateAccessors) {
|
||||
doTestExistingClass(existingClassName, existingClassPackage, generateAccessors, null);
|
||||
}
|
||||
|
||||
private void doTestExistingClass(final String existingClassName, final String existingClassPackage, final boolean generateAccessors,
|
||||
private void doTestExistingClass(@NotNull String existingClassName, final String existingClassPackage, final boolean generateAccessors,
|
||||
final String newVisibility) {
|
||||
doTestExistingClass(existingClassName, existingClassPackage, generateAccessors, newVisibility,
|
||||
IntroduceParameterObjectTest::generateParams);
|
||||
}
|
||||
|
||||
private void doTestExistingClass(final String existingClassName,
|
||||
private void doTestExistingClass(@NotNull String existingClassName,
|
||||
final String existingClassPackage,
|
||||
final boolean generateAccessors,
|
||||
final String newVisibility,
|
||||
@@ -243,7 +243,7 @@ public class IntroduceParameterObjectTest extends MultiFileTestCase {
|
||||
checkExceptionThrown("Integer", "java.lang", "Setter for field 'value' is required");
|
||||
}
|
||||
|
||||
private void checkExceptionThrown(String existingClassName, String existingClassPackage, String exceptionMessage) {
|
||||
private void checkExceptionThrown(@NotNull String existingClassName, String existingClassPackage, String exceptionMessage) {
|
||||
try {
|
||||
doTestExistingClass(existingClassName, existingClassPackage, false);
|
||||
}
|
||||
|
||||
@@ -171,8 +171,8 @@ public class JsonSchemaDocumentationProvider implements DocumentationProvider {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String plainTextPostProcess(String text) {
|
||||
return StringUtil.escapeXml(text).replace("\\n", "<br/>");
|
||||
private static String plainTextPostProcess(@NotNull String text) {
|
||||
return StringUtil.escapeXmlEntities(text).replace("\\n", "<br/>");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -121,7 +121,7 @@ public class HighlightInfo implements Segment {
|
||||
|
||||
private static String encodeTooltip(String toolTip, String description) {
|
||||
if (toolTip == null || description == null) return toolTip;
|
||||
String unescaped = StringUtil.unescapeXml(XmlStringUtil.stripHtml(toolTip));
|
||||
String unescaped = StringUtil.unescapeXmlEntities(XmlStringUtil.stripHtml(toolTip));
|
||||
|
||||
String encoded = description.isEmpty() ? unescaped : StringUtil.replace(unescaped, description, DESCRIPTION_PLACEHOLDER);
|
||||
//noinspection StringEquality
|
||||
|
||||
@@ -101,7 +101,7 @@ public class ProblemDescriptorUtil {
|
||||
public static String unescapeTags(String message) {
|
||||
message = StringUtil.replace(message, "<code>", "'");
|
||||
message = StringUtil.replace(message, "</code>", "'");
|
||||
message = message.contains(XML_CODE_MARKER.first) ? unescapeXmlCode(message) : StringUtil.unescapeXml(message);
|
||||
message = message.contains(XML_CODE_MARKER.first) ? unescapeXmlCode(message) : StringUtil.unescapeXmlEntities(message);
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class ProblemDescriptorUtil {
|
||||
if (string.contains(XML_CODE_MARKER.second)) {
|
||||
builder.append(string.replace(XML_CODE_MARKER.second, ""));
|
||||
} else {
|
||||
builder.append(StringUtil.unescapeXml(string));
|
||||
builder.append(StringUtil.unescapeXmlEntities(string));
|
||||
}
|
||||
}
|
||||
return builder.toString();
|
||||
|
||||
@@ -40,7 +40,7 @@ public class AliasingPsiTarget extends DelegatePsiTarget implements PomRenameabl
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return StringUtil.notNullize(getNameAlias(((PsiNamedElement)getNavigationElement()).getName()));
|
||||
return StringUtil.notNullize(getNameAlias(StringUtil.notNullize(((PsiNamedElement)getNavigationElement()).getName())));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -49,7 +49,7 @@ public class AliasingPsiTarget extends DelegatePsiTarget implements PomRenameabl
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getNameAlias(@Nullable String delegatePsiTargetName) {
|
||||
public String getNameAlias(@NotNull String delegatePsiTargetName) {
|
||||
return delegatePsiTargetName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,8 @@ public abstract class Executor {
|
||||
@NonNls
|
||||
public abstract String getHelpId();
|
||||
|
||||
public String getStartActionText(String configurationName) {
|
||||
@NotNull
|
||||
public String getStartActionText(@NotNull String configurationName) {
|
||||
return getStartActionText() + (StringUtil.isEmpty(configurationName) ? "" : " '" + shortenNameIfNeed(configurationName) + "'");
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public abstract class CreateElementActionBase extends CreateInDirectoryActionBas
|
||||
* @return created elements. Never null.
|
||||
*/
|
||||
@NotNull
|
||||
protected abstract PsiElement[] create(String newName, PsiDirectory directory) throws Exception;
|
||||
protected abstract PsiElement[] create(@NotNull String newName, PsiDirectory directory) throws Exception;
|
||||
|
||||
protected abstract String getErrorTitle();
|
||||
|
||||
@@ -106,7 +106,7 @@ public abstract class CreateElementActionBase extends CreateInDirectoryActionBas
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement[] create(String newName) throws Exception {
|
||||
public PsiElement[] create(@NotNull String newName) throws Exception {
|
||||
return CreateElementActionBase.this.create(newName, myDirectory);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public abstract class ElementCreator implements WriteActionAware {
|
||||
myErrorTitle = errorTitle;
|
||||
}
|
||||
|
||||
protected abstract PsiElement[] create(String newName) throws Exception;
|
||||
protected abstract PsiElement[] create(@NotNull String newName) throws Exception;
|
||||
protected abstract String getActionName(String newName);
|
||||
|
||||
public PsiElement[] tryCreate(@NotNull final String inputString) {
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.List;
|
||||
public abstract class ExpressionTypeProvider<T extends PsiElement> {
|
||||
/**
|
||||
* Returns HTML string for type info hint.
|
||||
* @see com.intellij.openapi.util.text.StringUtil#escapeXml(String)
|
||||
* @see com.intellij.openapi.util.text.StringUtil#escapeXmlEntities(String)
|
||||
*/
|
||||
@NotNull
|
||||
public abstract String getInformationHint(@NotNull T element);
|
||||
|
||||
@@ -42,6 +42,7 @@ public class BaseUsageViewDescriptor implements UsageViewDescriptor {
|
||||
return "Element(s) to be refactored:";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getCodeReferencesText(int usagesCount, int filesCount) {
|
||||
return RefactoringBundle.message("references.to.be.changed", UsageViewBundle.getReferencesString(usagesCount, filesCount));
|
||||
|
||||
@@ -31,6 +31,7 @@ public interface UsageViewDescriptor {
|
||||
|
||||
String getProcessedElementsHeader();
|
||||
|
||||
@NotNull
|
||||
String getCodeReferencesText(int usagesCount, int filesCount);
|
||||
|
||||
@Nullable
|
||||
|
||||
+1
-1
@@ -787,7 +787,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
final MessageBusConnection connection = project.getMessageBus().connect();
|
||||
connection.subscribe(EditorHintListener.TOPIC, listener);
|
||||
assert text != null;
|
||||
HintManager.getInstance().showErrorHint(editor, StringUtil.escapeXml(text), HintManager.UNDER);
|
||||
HintManager.getInstance().showErrorHint(editor, StringUtil.escapeXmlEntities(text), HintManager.UNDER);
|
||||
connection.disconnect();
|
||||
return result[0];
|
||||
}
|
||||
|
||||
+1
-1
@@ -506,7 +506,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
if (!inspectionProfile.isToolEnabled(key, getFile())) return;
|
||||
|
||||
HighlightInfoType type = new InspectionHighlightInfoType(level, element);
|
||||
final String plainMessage = message.startsWith("<html>") ? StringUtil.unescapeXml(XmlStringUtil.stripHtml(message).replaceAll("<[^>]*>", "")) : message;
|
||||
final String plainMessage = message.startsWith("<html>") ? StringUtil.unescapeXmlEntities(XmlStringUtil.stripHtml(message).replaceAll("<[^>]*>", "")) : message;
|
||||
@NonNls String link = "";
|
||||
if (showToolDescription(toolWrapper)) {
|
||||
link = " <a "
|
||||
|
||||
+1
-1
@@ -46,6 +46,6 @@ public abstract class HighlightHandlerBase {
|
||||
if (lineFragmentEndOffset != lineEndOffset) {
|
||||
lineText = lineText.trim() + "...";
|
||||
}
|
||||
return " " + (escape ? StringUtil.escapeXml(lineText.trim()) : lineText.trim()) + " ";
|
||||
return " " + (escape ? StringUtil.escapeXmlEntities(lineText.trim()) : lineText.trim()) + " ";
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -35,8 +35,8 @@ public class LiveTemplateDocumentationProvider extends AbstractDocumentationProv
|
||||
}
|
||||
|
||||
TemplateImpl template = ((LiveTemplateElement)element).getTemplate();
|
||||
return DocumentationMarkup.DEFINITION_START + StringUtil.escapeXml(template.getString()) + DocumentationMarkup.DEFINITION_END +
|
||||
DocumentationMarkup.CONTENT_START + StringUtil.escapeXml(StringUtil.notNullize(template.getDescription())) +
|
||||
return DocumentationMarkup.DEFINITION_START + StringUtil.escapeXmlEntities(template.getString()) + DocumentationMarkup.DEFINITION_END +
|
||||
DocumentationMarkup.CONTENT_START + StringUtil.escapeXmlEntities(StringUtil.notNullize(template.getDescription())) +
|
||||
DocumentationMarkup.CONTENT_END;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ public class InspectionDescriptionDocumentationProvider extends AbstractDocument
|
||||
}
|
||||
|
||||
InspectionToolWrapper toolWrapper = ((InspectionElement)element).getToolWrapper();
|
||||
return DocumentationMarkup.DEFINITION_START + StringUtil.escapeXml(toolWrapper.getDisplayName()) + DocumentationMarkup.DEFINITION_END +
|
||||
return DocumentationMarkup.DEFINITION_START + StringUtil.escapeXmlEntities(toolWrapper.getDisplayName()) + DocumentationMarkup.DEFINITION_END +
|
||||
DocumentationMarkup.CONTENT_START + toolWrapper.loadDescription() +
|
||||
DocumentationMarkup.CONTENT_END;
|
||||
}
|
||||
|
||||
@@ -75,8 +75,8 @@ public class DescriptorComposer extends HTMLComposerImpl {
|
||||
return ArrayUtil.toStringArray(texts);
|
||||
}
|
||||
|
||||
private static String escapeQuickFixText(String text) {
|
||||
return XmlStringUtil.isWrappedInHtml(text) ? XmlStringUtil.stripHtml(text) : StringUtil.escapeXml(text);
|
||||
private static String escapeQuickFixText(@NotNull String text) {
|
||||
return XmlStringUtil.isWrappedInHtml(text) ? XmlStringUtil.stripHtml(text) : StringUtil.escapeXmlEntities(text);
|
||||
}
|
||||
|
||||
protected void composeAdditionalDescription(@NotNull StringBuffer buf, @NotNull RefEntity refEntity) {}
|
||||
|
||||
+1
-1
@@ -175,6 +175,6 @@ public class InspectionTreeHtmlWriter {
|
||||
}
|
||||
|
||||
private static String escapeNonBreakingSymbols(@NotNull Object source) {
|
||||
return StringUtil.replace(StringUtil.escapeXml(source.toString()), Arrays.asList(" ", "-"), Arrays.asList(" ", "‑"));
|
||||
return StringUtil.replace(StringUtil.escapeXmlEntities(source.toString()), Arrays.asList(" ", "-"), Arrays.asList(" ", "‑"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ProgramRunnerUtil {
|
||||
|
||||
@NotNull
|
||||
public static String getCannotRunOnErrorMessage(@NotNull RunProfile profile, @NotNull ExecutionTarget target) {
|
||||
return StringUtil.escapeXml("Cannot run '" + profile.getName() + "' on '" + target.getDisplayName() + "'");
|
||||
return StringUtil.escapeXmlEntities("Cannot run '" + profile.getName() + "' on '" + target.getDisplayName() + "'");
|
||||
}
|
||||
|
||||
public static void executeConfigurationAsync(@NotNull final ExecutionEnvironment environment, boolean showSettings, boolean assignNewId, ProgramRunner.Callback callback) {
|
||||
@@ -201,10 +201,12 @@ public class ProgramRunnerUtil {
|
||||
return icon == null ? AllIcons.Actions.Help : icon;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Icon getTemporaryIcon(@NotNull Icon rawIcon) {
|
||||
return IconLoader.getTransparentIcon(rawIcon, 0.3f);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String shortenName(@Nullable String name, final int toBeAdded) {
|
||||
if (name == null) {
|
||||
return "";
|
||||
|
||||
@@ -214,6 +214,7 @@ public abstract class BaseRunConfigurationAction extends ActionGroup {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String suggestRunActionName(final LocatableConfiguration configuration) {
|
||||
if (configuration instanceof LocatableConfigurationBase && configuration.isGeneratedName()) {
|
||||
String actionName = ((LocatableConfigurationBase)configuration).getActionName();
|
||||
|
||||
@@ -58,7 +58,8 @@ public class StopAction extends DumbAwareAction implements AnAction.TransparentU
|
||||
}
|
||||
else if (stopCount == 1) {
|
||||
presentation.setText(ExecutionBundle.message("stop.configuration.action.name",
|
||||
StringUtil.escapeMnemonics(stoppableDescriptors.get(0).getDisplayName())));
|
||||
StringUtil.escapeMnemonics(
|
||||
StringUtil.notNullize(stoppableDescriptors.get(0).getDisplayName()))));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -81,7 +82,9 @@ public class StopAction extends DumbAwareAction implements AnAction.TransparentU
|
||||
}
|
||||
else {
|
||||
presentation.setText(ExecutionBundle.message("stop.configuration.action.name",
|
||||
StringUtil.escapeMnemonics(runProfile == null ? contentDescriptor.getDisplayName() : runProfile.getName())));
|
||||
StringUtil.escapeMnemonics(runProfile == null
|
||||
? StringUtil.notNullize(contentDescriptor.getDisplayName())
|
||||
: runProfile.getName())));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -698,7 +698,7 @@ public class ShowUsagesAction extends AnAction implements PopupAction {
|
||||
}
|
||||
data.addAll(visibleNodes);
|
||||
if (data.isEmpty()) {
|
||||
String progressText = StringUtil.escapeXml(UsageViewManagerImpl.getProgressTitle(presentation));
|
||||
String progressText = StringUtil.escapeXmlEntities(UsageViewManagerImpl.getProgressTitle(presentation));
|
||||
data.add(createStringNode(progressText));
|
||||
}
|
||||
Collections.sort(data, USAGE_NODE_COMPARATOR);
|
||||
|
||||
+2
-2
@@ -233,8 +233,8 @@ public class ReplaceInProjectManager {
|
||||
public boolean showReplaceAllConfirmDialog(@NotNull String usagesCount, @NotNull String stringToFind, @NotNull String filesCount, @NotNull String stringToReplace) {
|
||||
return Messages.YES == MessageDialogBuilder.yesNo(
|
||||
FindBundle.message("find.replace.all.confirmation.title"),
|
||||
FindBundle.message("find.replace.all.confirmation", usagesCount, StringUtil.escapeXml(stringToFind), filesCount,
|
||||
StringUtil.escapeXml(stringToReplace)))
|
||||
FindBundle.message("find.replace.all.confirmation", usagesCount, StringUtil.escapeXmlEntities(stringToFind), filesCount,
|
||||
StringUtil.escapeXmlEntities(stringToReplace)))
|
||||
.yesText(FindBundle.message("find.replace.command"))
|
||||
.project(myProject)
|
||||
.noText(Messages.CANCEL_BUTTON).show();
|
||||
|
||||
@@ -78,7 +78,7 @@ public class CreateFileAction extends CreateElementActionBase implements DumbAwa
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected PsiElement[] create(String newName, PsiDirectory directory) throws Exception {
|
||||
protected PsiElement[] create(@NotNull String newName, PsiDirectory directory) throws Exception {
|
||||
MkDirs mkdirs = new MkDirs(newName, directory);
|
||||
return new PsiElement[]{WriteAction.compute(() -> mkdirs.directory.createFile(getFileName(mkdirs.newName)))};
|
||||
}
|
||||
@@ -217,7 +217,7 @@ public class CreateFileAction extends CreateElementActionBase implements DumbAwa
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement[] create(String newName) throws Exception {
|
||||
public PsiElement[] create(@NotNull String newName) throws Exception {
|
||||
return super.create(newName);
|
||||
}
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ public class CreateFileFromTemplateDialog extends DialogWrapper {
|
||||
myDialog.myCreator = new ElementCreator(myProject, errorTitle) {
|
||||
|
||||
@Override
|
||||
protected PsiElement[] create(String newName) {
|
||||
protected PsiElement[] create(@NotNull String newName) {
|
||||
T element = creator.createFile(myDialog.getEnteredName(), myDialog.getKindCombo().getSelectedName());
|
||||
if (element != null) {
|
||||
created.set(SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(element));
|
||||
|
||||
@@ -126,8 +126,9 @@ public abstract class CreateFromTemplateAction<T extends PsiElement> extends AnA
|
||||
return project != null && view != null && view.getDirectories().length != 0;
|
||||
}
|
||||
|
||||
protected abstract String getActionName(PsiDirectory directory, String newName, String templateName);
|
||||
protected abstract String getActionName(PsiDirectory directory, @NotNull String newName, String templateName);
|
||||
|
||||
@NotNull
|
||||
protected String getErrorTitle() {
|
||||
return CommonBundle.getErrorTitle();
|
||||
}
|
||||
|
||||
@@ -1294,7 +1294,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
if (hit == null) {
|
||||
hit = value.getOption();
|
||||
}
|
||||
hit = StringUtil.unescapeXml(hit);
|
||||
hit = StringUtil.unescapeXmlEntities(hit);
|
||||
if (hit.length() > 60) {
|
||||
hit = hit.substring(0, 60) + "...";
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class RunAnythingUtil {
|
||||
if (hit == null) {
|
||||
hit = value.getOption();
|
||||
}
|
||||
hit = StringUtil.unescapeXml(hit);
|
||||
hit = StringUtil.unescapeXmlEntities(hit);
|
||||
if (hit.length() > 60) {
|
||||
hit = hit.substring(0, 60) + "...";
|
||||
}
|
||||
|
||||
+1
-1
@@ -322,7 +322,7 @@ public class TopHitSEContributor implements SearchEverywhereContributor<Void> {
|
||||
if (hit == null) {
|
||||
hit = value.getOption();
|
||||
}
|
||||
hit = StringUtil.unescapeXml(hit);
|
||||
hit = StringUtil.unescapeXmlEntities(hit);
|
||||
if (hit.length() > 60) {
|
||||
hit = hit.substring(0, 60) + "...";
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ public class Bookmark implements Navigatable, Comparable<Bookmark> {
|
||||
private final Project myProject;
|
||||
private Reference<RangeHighlighterEx> myHighlighterRef;
|
||||
|
||||
@NotNull
|
||||
private String myDescription;
|
||||
private char myMnemonic;
|
||||
int index; // index in the list of bookmarks in the Navigate|Bookmarks|show
|
||||
@@ -207,6 +208,7 @@ public class Bookmark implements Navigatable, Comparable<Bookmark> {
|
||||
return myMnemonic == 0 ? DEFAULT_ICON : MnemonicIcon.getIcon(myMnemonic);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getDescription() {
|
||||
return myDescription;
|
||||
}
|
||||
@@ -288,7 +290,8 @@ public class Bookmark implements Navigatable, Comparable<Bookmark> {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder result = new StringBuilder(getQualifiedName());
|
||||
String description = StringUtil.escapeXml(nullizeEmptyDescription());
|
||||
String text = nullizeEmptyDescription();
|
||||
String description = text == null ? null : StringUtil.escapeXmlEntities(text);
|
||||
if (description != null) {
|
||||
result.append(": ").append(description);
|
||||
}
|
||||
@@ -331,7 +334,8 @@ public class Bookmark implements Navigatable, Comparable<Bookmark> {
|
||||
if (myMnemonic != 0) {
|
||||
result.append(" ").append(myMnemonic);
|
||||
}
|
||||
String description = StringUtil.escapeXml(nullizeEmptyDescription());
|
||||
String text = nullizeEmptyDescription();
|
||||
String description = text == null ? null : StringUtil.escapeXmlEntities(text);
|
||||
if (description != null) {
|
||||
result.append(": ").append(description);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.intellij.ide.favoritesTreeView;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class NoteNode {
|
||||
@@ -22,10 +24,11 @@ public class NoteNode {
|
||||
private Set<Flag> myFlags;
|
||||
private Set<Concept> myConcepts;
|
||||
|
||||
@NotNull
|
||||
private String myText;
|
||||
private final boolean myReadonly;
|
||||
|
||||
public NoteNode(String text, boolean readonly) {
|
||||
public NoteNode(@NotNull String text, boolean readonly) {
|
||||
myText = text;
|
||||
myReadonly = readonly;
|
||||
}
|
||||
@@ -54,11 +57,12 @@ public class NoteNode {
|
||||
myConcepts = concepts;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getText() {
|
||||
return myText;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
public void setText(@NotNull String text) {
|
||||
myText = text;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class NoteSerializable implements WorkingSetSerializable<NoteNode, NoteNo
|
||||
|
||||
@Override
|
||||
public void serializeMe(NoteNode t, StringBuilder oos) throws IOException {
|
||||
oos.append(StringUtil.escapeXml(t.getText()));
|
||||
oos.append(StringUtil.escapeXmlEntities(t.getText()));
|
||||
oos.append("<>");
|
||||
oos.append(t.isReadonly());
|
||||
oos.append("<>");
|
||||
@@ -45,7 +45,7 @@ public class NoteSerializable implements WorkingSetSerializable<NoteNode, NoteNo
|
||||
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 new NoteNode(StringUtil.unescapeXmlEntities(strings.get(0)), Boolean.parseBoolean(strings.get(1)));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.usages.UsageInfo2UsageAdapter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -53,7 +54,7 @@ public class UsageSerializable implements WorkingSetSerializable<UsageInfo, Inva
|
||||
final String signature = provider.getSignature(element);
|
||||
append(os, virtualFile.getPath());
|
||||
os.append(separator);
|
||||
append(os, signature);
|
||||
append(os, StringUtil.notNullize(signature));
|
||||
os.append(separator);
|
||||
final ProperTextRange rangeInElement = info.getRangeInElement();
|
||||
if (rangeInElement == null) {
|
||||
@@ -77,8 +78,8 @@ public class UsageSerializable implements WorkingSetSerializable<UsageInfo, Inva
|
||||
os.append(separator);
|
||||
}
|
||||
|
||||
private static void append(final StringBuilder sb, final String s) {
|
||||
sb.append(StringUtil.escapeXml(s));
|
||||
private static void append(final StringBuilder sb, @NotNull String s) {
|
||||
sb.append(StringUtil.escapeXmlEntities(s));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,7 +100,7 @@ public class UsageSerializable implements WorkingSetSerializable<UsageInfo, Inva
|
||||
int idxNext = is.indexOf(separator, idx);
|
||||
if (idxNext == -1) {
|
||||
if (allowEnd) {
|
||||
return StringUtil.unescapeXml(is.substring(idx));
|
||||
return StringUtil.unescapeXmlEntities(is.substring(idx));
|
||||
}
|
||||
}
|
||||
final String s = is.substring(idx, idxNext);
|
||||
|
||||
@@ -772,7 +772,7 @@ public class GotoActionModel implements ChooseByNameModel, Comparator<Object>, D
|
||||
if (hit == null) {
|
||||
hit = ((OptionDescription)value).getOption();
|
||||
}
|
||||
hit = StringUtil.unescapeXml(hit);
|
||||
hit = StringUtil.unescapeXmlEntities(hit);
|
||||
hit = hit.replace(" ", " "); // avoid extra spaces from mnemonics and xml conversion
|
||||
String fullHit = hit;
|
||||
Color fg = UIUtil.getListForeground(isSelected);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user