mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git@git.labs.intellij.net:idea/community
This commit is contained in:
Generated
+30
-26
@@ -2,12 +2,12 @@
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/InspectionGadgets/InspectionGadgetsPlugin.iml" filepath="$PROJECT_DIR$/plugins/InspectionGadgets/InspectionGadgetsPlugin.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/InspectionGadgets/InspectionGadgetsPlugin.iml" filepath="$PROJECT_DIR$/plugins/InspectionGadgets/InspectionGadgetsPlugin.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-java.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-java.iml" group="plugins/IntelliLang" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-javaee.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-javaee.iml" group="plugins/IntelliLang" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-xml.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-xml.iml" group="plugins/IntelliLang" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLangJava.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLangJava.iml" group="plugins/IntelliLang" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/IntentionPowerPak/IntentionPowerPackPlugin.iml" filepath="$PROJECT_DIR$/plugins/IntentionPowerPak/IntentionPowerPackPlugin.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/IntentionPowerPak/IntentionPowerPackPlugin.iml" filepath="$PROJECT_DIR$/plugins/IntentionPowerPak/IntentionPowerPackPlugin.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/RegExpSupport/RegExpSupport.iml" filepath="$PROJECT_DIR$/RegExpSupport/RegExpSupport.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/annotations/annotations.iml" filepath="$PROJECT_DIR$/platform/annotations/annotations.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/ant/ant.iml" filepath="$PROJECT_DIR$/plugins/ant/ant.iml" group="plugins" />
|
||||
@@ -20,46 +20,50 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/java/compiler/impl/compiler-impl.iml" filepath="$PROJECT_DIR$/java/compiler/impl/compiler-impl.iml" group="java/compiler" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/compiler/openapi/compiler-openapi.iml" filepath="$PROJECT_DIR$/java/compiler/openapi/compiler-openapi.iml" group="java/compiler" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/copyright/copyright.iml" filepath="$PROJECT_DIR$/plugins/copyright/copyright.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/cvs-core/cvs-core.iml" filepath="$PROJECT_DIR$/plugins/cvs/cvs-core/cvs-core.iml" group="plugins/cvs" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/cvs-plugin/cvs-plugin.iml" filepath="$PROJECT_DIR$/plugins/cvs/cvs-plugin/cvs-plugin.iml" group="plugins/cvs" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/cvs-core/cvs-core.iml" filepath="$PROJECT_DIR$/plugins/cvs/cvs-core/cvs-core.iml" group="plugins/VCS/cvs" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/cvs-plugin/cvs-plugin.iml" filepath="$PROJECT_DIR$/plugins/cvs/cvs-plugin/cvs-plugin.iml" group="plugins/VCS/cvs" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/debugger/impl/debugger-impl.iml" filepath="$PROJECT_DIR$/java/debugger/impl/debugger-impl.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/debugger/openapi/debugger-openapi.iml" filepath="$PROJECT_DIR$/java/debugger/openapi/debugger-openapi.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/devkit/devkit.iml" filepath="$PROJECT_DIR$/plugins/devkit/devkit.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/devkit/devkit.iml" filepath="$PROJECT_DIR$/plugins/devkit/devkit.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/xml/dom-impl/dom-impl.iml" filepath="$PROJECT_DIR$/xml/dom-impl/dom-impl.iml" group="xml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/xml/dom-openapi/dom-openapi.iml" filepath="$PROJECT_DIR$/xml/dom-openapi/dom-openapi.iml" group="xml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/eclipse/eclipse.iml" filepath="$PROJECT_DIR$/plugins/eclipse/eclipse.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/eclipse/eclipse.iml" filepath="$PROJECT_DIR$/plugins/eclipse/eclipse.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/execution/impl/execution-impl.iml" filepath="$PROJECT_DIR$/java/execution/impl/execution-impl.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/execution/openapi/execution-openapi.iml" filepath="$PROJECT_DIR$/java/execution/openapi/execution-openapi.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/extensions/extensions.iml" filepath="$PROJECT_DIR$/platform/extensions/extensions.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/compiler/forms-compiler/forms-compiler.iml" filepath="$PROJECT_DIR$/java/compiler/forms-compiler/forms-compiler.iml" group="java/compiler" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/forms_rt/forms_rt.iml" filepath="$PROJECT_DIR$/platform/forms_rt/forms_rt.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/generate-tostring/generate-tostring.iml" filepath="$PROJECT_DIR$/plugins/generate-tostring/generate-tostring.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/git4idea/git4idea.iml" filepath="$PROJECT_DIR$/plugins/git4idea/git4idea.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/rt/groovy-rt.iml" filepath="$PROJECT_DIR$/plugins/groovy/rt/groovy-rt.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/groovypp/groovypp.iml" filepath="$PROJECT_DIR$/plugins/groovy/groovypp/groovypp.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/generate-tostring/generate-tostring.iml" filepath="$PROJECT_DIR$/plugins/generate-tostring/generate-tostring.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/git4idea/git4idea.iml" filepath="$PROJECT_DIR$/plugins/git4idea/git4idea.iml" group="plugins/VCS" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/grape/grape.iml" filepath="$PROJECT_DIR$/plugins/groovy/grape/grape.iml" group="plugins/Groovy" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/grape/grape-rt.iml" filepath="$PROJECT_DIR$/plugins/groovy/grape/grape-rt.iml" group="plugins/Groovy" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/hotswap/groovy-hotswap.iml" filepath="$PROJECT_DIR$/plugins/groovy/hotswap/groovy-hotswap.iml" group="plugins/Groovy" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/rt/groovy-rt.iml" filepath="$PROJECT_DIR$/plugins/groovy/rt/groovy-rt.iml" group="plugins/Groovy" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/groovypp/groovypp.iml" filepath="$PROJECT_DIR$/plugins/groovy/groovypp/groovypp.iml" group="plugins/Groovy" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/hg4idea/hg4idea.iml" filepath="$PROJECT_DIR$/plugins/hg4idea/hg4idea.iml" group="plugins/VCS" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/icons/icons.iml" filepath="$PROJECT_DIR$/platform/icons/icons.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/idea-ui/idea-ui.iml" filepath="$PROJECT_DIR$/java/idea-ui/idea-ui.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/images/images.iml" filepath="$PROJECT_DIR$/images/images.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/java-i18n/java-i18n.iml" filepath="$PROJECT_DIR$/plugins/java-i18n/java-i18n.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/java-impl/java-impl.iml" filepath="$PROJECT_DIR$/java/java-impl/java-impl.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/java-runtime/java-runtime.iml" filepath="$PROJECT_DIR$/java/java-runtime/java-runtime.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/java-tests/java-tests.iml" filepath="$PROJECT_DIR$/java/java-tests/java-tests.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/java-tests/java-tests.iml" filepath="$PROJECT_DIR$/java/java-tests/java-tests.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/compiler/javac2/javac2.iml" filepath="$PROJECT_DIR$/java/compiler/javac2/javac2.iml" group="java/compiler" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml" filepath="$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml" group="plugins/cvs" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/jetgroovy.iml" filepath="$PROJECT_DIR$/plugins/groovy/jetgroovy.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/jetgroovy-tests.iml" filepath="$PROJECT_DIR$/plugins/groovy/jetgroovy-tests.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml" filepath="$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml" group="plugins/VCS/cvs" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/jetgroovy.iml" filepath="$PROJECT_DIR$/plugins/groovy/jetgroovy.iml" group="plugins/Groovy" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/jetgroovy-tests.iml" filepath="$PROJECT_DIR$/plugins/groovy/jetgroovy-tests.iml" group="plugins/Groovy" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/jsp-base-openapi/jsp-base-openapi.iml" filepath="$PROJECT_DIR$/java/jsp-base-openapi/jsp-base-openapi.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/jsp-openapi/jsp-openapi.iml" filepath="$PROJECT_DIR$/java/jsp-openapi/jsp-openapi.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/jsp-spi/jsp-spi.iml" filepath="$PROJECT_DIR$/java/jsp-spi/jsp-spi.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/junit/junit.iml" filepath="$PROJECT_DIR$/plugins/junit/junit.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/junit_rt/junit_rt.iml" filepath="$PROJECT_DIR$/plugins/junit_rt/junit_rt.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/junit/junit.iml" filepath="$PROJECT_DIR$/plugins/junit/junit.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/junit_rt/junit_rt.iml" filepath="$PROJECT_DIR$/plugins/junit_rt/junit_rt.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/lang-api/lang-api.iml" filepath="$PROJECT_DIR$/platform/lang-api/lang-api.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/lang-impl/lang-impl.iml" filepath="$PROJECT_DIR$/platform/lang-impl/lang-impl.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/lvcs-api/lvcs-api.iml" filepath="$PROJECT_DIR$/platform/lvcs-api/lvcs-api.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/lvcs-impl/lvcs-impl.iml" filepath="$PROJECT_DIR$/platform/lvcs-impl/lvcs-impl.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/maven/maven.iml" filepath="$PROJECT_DIR$/plugins/maven/maven.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/maven/facade-api/maven-facade-api.iml" filepath="$PROJECT_DIR$/plugins/maven/facade-api/maven-facade-api.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/maven/facade-impl/maven-facade-impl.iml" filepath="$PROJECT_DIR$/plugins/maven/facade-impl/maven-facade-impl.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/maven/maven.iml" filepath="$PROJECT_DIR$/plugins/maven/maven.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/maven/facade-api/maven-facade-api.iml" filepath="$PROJECT_DIR$/plugins/maven/facade-api/maven-facade-api.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/maven/facade-impl/maven-facade-impl.iml" filepath="$PROJECT_DIR$/plugins/maven/facade-impl/maven-facade-impl.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/compiler/notNull/notNull.iml" filepath="$PROJECT_DIR$/java/compiler/notNull/notNull.iml" group="java/compiler" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/openapi/openapi.iml" filepath="$PROJECT_DIR$/java/openapi/openapi.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/platform-api/platform-api.iml" filepath="$PROJECT_DIR$/platform/platform-api/platform-api.iml" group="platform" />
|
||||
@@ -71,15 +75,15 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/resources/resources.iml" filepath="$PROJECT_DIR$/resources/resources.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/resources-en/resources-en.iml" filepath="$PROJECT_DIR$/resources-en/resources-en.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/smRunner/smRunner.iml" filepath="$PROJECT_DIR$/platform/smRunner/smRunner.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/smartcvs-src/smartcvs-src.iml" filepath="$PROJECT_DIR$/plugins/cvs/smartcvs-src/smartcvs-src.iml" group="plugins/cvs" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/smartcvs-src/smartcvs-src.iml" filepath="$PROJECT_DIR$/plugins/cvs/smartcvs-src/smartcvs-src.iml" group="plugins/VCS/cvs" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/spellchecker/spellchecker.iml" filepath="$PROJECT_DIR$/plugins/spellchecker/spellchecker.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/svn4idea/svn4idea.iml" filepath="$PROJECT_DIR$/plugins/svn4idea/svn4idea.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/svn4idea/svn4idea-tests.iml" filepath="$PROJECT_DIR$/plugins/svn4idea/svn4idea-tests.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/svn4idea/svn4idea.iml" filepath="$PROJECT_DIR$/plugins/svn4idea/svn4idea.iml" group="plugins/VCS" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/svn4idea/svn4idea-tests.iml" filepath="$PROJECT_DIR$/plugins/svn4idea/svn4idea-tests.iml" group="plugins/VCS" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/testFramework/testFramework.iml" filepath="$PROJECT_DIR$/platform/testFramework/testFramework.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/testFramework/testFramework-java.iml" filepath="$PROJECT_DIR$/java/testFramework/testFramework-java.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/testRunner/testRunner.iml" filepath="$PROJECT_DIR$/platform/testRunner/testRunner.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/testng/testng.iml" filepath="$PROJECT_DIR$/plugins/testng/testng.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/testng_rt/testng_rt.iml" filepath="$PROJECT_DIR$/plugins/testng_rt/testng_rt.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/testng/testng.iml" filepath="$PROJECT_DIR$/plugins/testng/testng.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/testng_rt/testng_rt.iml" filepath="$PROJECT_DIR$/plugins/testng_rt/testng_rt.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/testFramework/bootstrap/tests_bootstrap.iml" filepath="$PROJECT_DIR$/platform/testFramework/bootstrap/tests_bootstrap.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/ui-designer/ui-designer.iml" filepath="$PROJECT_DIR$/plugins/ui-designer/ui-designer.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/usageView/usageView.iml" filepath="$PROJECT_DIR$/platform/usageView/usageView.iml" group="platform" />
|
||||
@@ -90,8 +94,8 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/xdebugger-impl/xdebugger-impl.iml" filepath="$PROJECT_DIR$/platform/xdebugger-impl/xdebugger-impl.iml" group="platform" />
|
||||
<module fileurl="file://$PROJECT_DIR$/xml/impl/xml.iml" filepath="$PROJECT_DIR$/xml/impl/xml.iml" group="xml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/xml/openapi/xml-openapi.iml" filepath="$PROJECT_DIR$/xml/openapi/xml-openapi.iml" group="xml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/xpath/xpath.iml" filepath="$PROJECT_DIR$/plugins/xpath/xpath.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/xpath/xslt-rt/xslt-rt.iml" filepath="$PROJECT_DIR$/plugins/xpath/xslt-rt/xslt-rt.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/xpath/xpath.iml" filepath="$PROJECT_DIR$/plugins/xpath/xpath.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/xpath/xslt-rt/xslt-rt.iml" filepath="$PROJECT_DIR$/plugins/xpath/xslt-rt/xslt-rt.iml" group="plugins" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
+14
-10
@@ -529,6 +529,7 @@ public class HighlightMethodUtil {
|
||||
return containingClass == null ? method.getContainingFile().getName() : HighlightUtil.formatClass(containingClass, false);
|
||||
}
|
||||
|
||||
@Language("HTML")
|
||||
private static String createAmbiguousMethodHtmlTooltipMethodRow(final MethodCandidateInfo methodCandidate) {
|
||||
PsiMethod method = methodCandidate.getElement();
|
||||
PsiParameter[] parameters = method.getParameterList().getParameters();
|
||||
@@ -565,6 +566,7 @@ public class HighlightMethodUtil {
|
||||
PsiExpression[] expressions = list.getExpressions();
|
||||
int cols = Math.max(parameters.length, expressions.length);
|
||||
|
||||
@Language("HTML")
|
||||
@NonNls String parensizedName = methodName + (parameters.length == 0 ? "( ) " : "");
|
||||
return JavaErrorMessages.message(
|
||||
"argument.mismatch.html.tooltip",
|
||||
@@ -576,7 +578,7 @@ public class HighlightMethodUtil {
|
||||
}
|
||||
|
||||
private static String esctrim(@NotNull String s) {
|
||||
return StringUtil.first(XmlStringUtil.escapeString(s), 40, true);
|
||||
return XmlStringUtil.escapeString(StringUtil.first(s, 40, true));
|
||||
}
|
||||
|
||||
private static String createMismatchedArgumentsHtmlTooltip(PsiExpressionList list,
|
||||
@@ -592,6 +594,7 @@ public class HighlightMethodUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@Language("HTML")
|
||||
private static String createLongMismatchedArgumentsHtmlTooltip(PsiExpressionList list,
|
||||
PsiParameter[] parameters,
|
||||
String methodName,
|
||||
@@ -599,22 +602,21 @@ public class HighlightMethodUtil {
|
||||
PsiClass aClass) {
|
||||
PsiExpression[] expressions = list.getExpressions();
|
||||
|
||||
@NonNls @Language("HTML")
|
||||
@NonNls
|
||||
String s = "<html><body><table border=0>" +
|
||||
" <caption align=top><nobr><b>" + methodName + "() </b> in <b>" + HighlightUtil.formatClass(aClass, false) +"</b> cannot be applied to:</nobr></caption>"+
|
||||
" <tr><th colspan=2 align=left>Expected<br>Parameters:</th><th align=left>Actual<br>Arguments:</th></tr>"
|
||||
+" <tr><td colspan=3><hr></td></tr>"
|
||||
"<tr><td colspan=3>" +
|
||||
"<nobr><b>" + methodName + "()</b> in <b>" + HighlightUtil.formatClass(aClass, false) +"</b> cannot be applied to:</nobr>" +
|
||||
"</td></tr>"+
|
||||
"<tr><td colspan=2 align=left>Expected<br>Parameters:</td><td align=left>Actual<br>Arguments:</td></tr>"+
|
||||
"<tr><td colspan=3><hr></td></tr>"
|
||||
;
|
||||
|
||||
|
||||
for (int i = 0; i < Math.max(parameters.length,expressions.length); i++) {
|
||||
PsiParameter parameter = i < parameters.length ? parameters[i] : null;
|
||||
PsiExpression expression = i < expressions.length ? expressions[i] : null;
|
||||
@NonNls String mismatchColor = showShortType(i, parameters, expressions, substitutor) ? null : "red";
|
||||
|
||||
s += "<tr" +
|
||||
(i%2 == 0 ? " style='background-color: #eeeeee'" : "") +
|
||||
">";
|
||||
s += "<tr" + (i % 2 == 0 ? " style='background-color: #eeeeee'" : "") + ">";
|
||||
s += "<td><b><nobr>";
|
||||
if (parameter != null) {
|
||||
String name = parameter.getName();
|
||||
@@ -651,10 +653,11 @@ public class HighlightMethodUtil {
|
||||
s += "</tr>";
|
||||
}
|
||||
|
||||
s+= " </table></body></html>";
|
||||
s+= "</table></body></html>";
|
||||
return s;
|
||||
}
|
||||
|
||||
@Language("HTML")
|
||||
private static String createMismatchedArgsHtmlTooltipArgumentsRow(final PsiExpression[] expressions, final PsiParameter[] parameters,
|
||||
final PsiSubstitutor substitutor, final int cols) {
|
||||
@NonNls String ms = "";
|
||||
@@ -678,6 +681,7 @@ public class HighlightMethodUtil {
|
||||
return ms;
|
||||
}
|
||||
|
||||
@Language("HTML")
|
||||
private static String createMismatchedArgsHtmlTooltipParamsRow(final PsiParameter[] parameters,
|
||||
final PsiSubstitutor substitutor,
|
||||
final PsiExpression[] expressions) {
|
||||
|
||||
+11
-11
@@ -636,11 +636,7 @@ public class ExtractMethodProcessor implements MatchProvider {
|
||||
if (myNullConditionalCheck) {
|
||||
final String varName = myOutputVariable.getName();
|
||||
if (isDeclaredInside(myOutputVariable)) {
|
||||
PsiDeclarationStatement statement = (PsiDeclarationStatement)myElementFactory
|
||||
.createStatementFromText(myOutputVariable.getType().getCanonicalText() + " " + varName + "=x;", null);
|
||||
statement = (PsiDeclarationStatement)addToMethodCallLocation(statement);
|
||||
myMethodCall =
|
||||
(PsiMethodCallExpression)((PsiLocalVariable)statement.getDeclaredElements()[0]).getInitializer().replace(myMethodCall);
|
||||
declareVariableAtMethodCallLocation(varName);
|
||||
}
|
||||
else {
|
||||
PsiExpressionStatement assignmentExpression =
|
||||
@@ -676,12 +672,7 @@ public class ExtractMethodProcessor implements MatchProvider {
|
||||
myMethodCall = (PsiMethodCallExpression)assignment.getRExpression().replace(myMethodCall);
|
||||
}
|
||||
else {
|
||||
PsiDeclarationStatement statement =
|
||||
myElementFactory.createVariableDeclarationStatement(name, myOutputVariable.getType(), myMethodCall);
|
||||
statement = (PsiDeclarationStatement)addToMethodCallLocation(statement);
|
||||
PsiVariable var = (PsiVariable)statement.getDeclaredElements()[0];
|
||||
myMethodCall = (PsiMethodCallExpression)var.getInitializer();
|
||||
var.getModifierList().replace(myOutputVariable.getModifierList());
|
||||
declareVariableAtMethodCallLocation(name);
|
||||
}
|
||||
}
|
||||
else if (myHasReturnStatementOutput) {
|
||||
@@ -737,6 +728,15 @@ public class ExtractMethodProcessor implements MatchProvider {
|
||||
|
||||
}
|
||||
|
||||
private void declareVariableAtMethodCallLocation(String name) {
|
||||
PsiDeclarationStatement statement =
|
||||
myElementFactory.createVariableDeclarationStatement(name, myOutputVariable.getType(), myMethodCall);
|
||||
statement = (PsiDeclarationStatement)addToMethodCallLocation(statement);
|
||||
PsiVariable var = (PsiVariable)statement.getDeclaredElements()[0];
|
||||
myMethodCall = (PsiMethodCallExpression)var.getInitializer();
|
||||
var.getModifierList().replace(myOutputVariable.getModifierList());
|
||||
}
|
||||
|
||||
private void adjustFinalParameters(final PsiMethod method) throws IncorrectOperationException {
|
||||
final IncorrectOperationException[] exc = new IncorrectOperationException[1];
|
||||
exc[0] = null;
|
||||
|
||||
+2
-2
@@ -133,8 +133,8 @@ public class ExtractSuperclassHandler implements RefactoringActionHandler, Extra
|
||||
else {
|
||||
targetPackage = null;
|
||||
}
|
||||
MultiMap<PsiElement,String> conflicts =
|
||||
PullUpConflictsUtil.checkConflicts(infos, mySubclass, null, targetPackage, targetDirectory, dialog.getContainmentVerifier());
|
||||
final MultiMap<PsiElement,String> conflicts =
|
||||
PullUpConflictsUtil.checkConflicts(infos, mySubclass, mySubclass.getSuperClass(), targetPackage, targetDirectory, dialog.getContainmentVerifier());
|
||||
if (!conflicts.isEmpty()) {
|
||||
ConflictsDialog conflictsDialog = new ConflictsDialog(myProject, conflicts);
|
||||
conflictsDialog.show();
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.intellij.codeInsight.PsiEquivalenceUtil;
|
||||
import com.intellij.codeInsight.intention.AddAnnotationFix;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
@@ -60,6 +61,7 @@ import java.util.*;
|
||||
|
||||
public class PullUpHelper extends BaseRefactoringProcessor{
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.memberPullUp.PullUpHelper");
|
||||
private static final Key<Boolean> PRESERVE_QUALIFIER = Key.<Boolean>create("PRESERVE_QUALIFIER");
|
||||
private final PsiClass mySourceClass;
|
||||
private final PsiClass myTargetSuperClass;
|
||||
private final boolean myIsTargetInterface;
|
||||
@@ -234,6 +236,20 @@ public class PullUpHelper extends BaseRefactoringProcessor{
|
||||
ChangeContextUtil.decodeContextInfo(myTargetSuperClass, null, null);
|
||||
|
||||
for (final PsiMember movedMember : myMembersAfterMove) {
|
||||
movedMember.accept(new JavaRecursiveElementWalkingVisitor() {
|
||||
@Override
|
||||
public void visitReferenceExpression(PsiReferenceExpression expression) {
|
||||
final PsiExpression qualifierExpression = expression.getQualifierExpression();
|
||||
if (qualifierExpression != null) {
|
||||
final Boolean preserveQualifier = qualifierExpression.getCopyableUserData(PRESERVE_QUALIFIER);
|
||||
if (preserveQualifier != null && !preserveQualifier) {
|
||||
qualifierExpression.delete();
|
||||
return;
|
||||
}
|
||||
}
|
||||
super.visitReferenceExpression(expression);
|
||||
}
|
||||
});
|
||||
final JavaRefactoringListenerManager listenerManager = JavaRefactoringListenerManager.getInstance(movedMember.getProject());
|
||||
((JavaRefactoringListenerManagerImpl)listenerManager).fireMemberMoved(mySourceClass, movedMember);
|
||||
}
|
||||
@@ -632,7 +648,7 @@ public class PullUpHelper extends BaseRefactoringProcessor{
|
||||
}
|
||||
|
||||
private void fixReferencesToStatic(PsiElement classMember, Set<PsiMember> movedMembers) throws IncorrectOperationException {
|
||||
StaticReferencesCollector collector = new StaticReferencesCollector(movedMembers);
|
||||
final StaticReferencesCollector collector = new StaticReferencesCollector(movedMembers);
|
||||
classMember.accept(collector);
|
||||
ArrayList<PsiJavaCodeReferenceElement> refs = collector.getReferences();
|
||||
ArrayList<PsiElement> members = collector.getReferees();
|
||||
@@ -649,18 +665,19 @@ public class PullUpHelper extends BaseRefactoringProcessor{
|
||||
(PsiReferenceExpression) factory.createExpressionFromText
|
||||
("a." + ((PsiNamedElement) namedElement).getName(),
|
||||
null);
|
||||
final PsiExpression qualifierExpression = newRef.getQualifierExpression();
|
||||
PsiExpression qualifierExpression = newRef.getQualifierExpression();
|
||||
assert qualifierExpression != null;
|
||||
qualifierExpression.replace(factory.createReferenceExpression(aClass));
|
||||
qualifierExpression = (PsiExpression)qualifierExpression.replace(factory.createReferenceExpression(aClass));
|
||||
qualifierExpression.putCopyableUserData(PRESERVE_QUALIFIER, ref.isQualified());
|
||||
ref.replace(newRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class StaticReferencesCollector extends ClassMemberReferencesVisitor {
|
||||
ArrayList<PsiJavaCodeReferenceElement> myReferences;
|
||||
ArrayList<PsiElement> myReferees;
|
||||
ArrayList<PsiClass> myRefereeClasses;
|
||||
private ArrayList<PsiJavaCodeReferenceElement> myReferences;
|
||||
private ArrayList<PsiElement> myReferees;
|
||||
private ArrayList<PsiClass> myRefereeClasses;
|
||||
private final Set<PsiMember> myMovedMembers;
|
||||
|
||||
private StaticReferencesCollector(Set<PsiMember> movedMembers) {
|
||||
@@ -684,7 +701,6 @@ public class PullUpHelper extends BaseRefactoringProcessor{
|
||||
}
|
||||
|
||||
protected void visitClassMemberReferenceElement(PsiMember classMember, PsiJavaCodeReferenceElement classMemberReference) {
|
||||
if (classMember instanceof PsiClass) return;
|
||||
if (classMember.hasModifierProperty(PsiModifier.STATIC)) {
|
||||
if (!myMovedMembers.contains(classMember) &&
|
||||
RefactoringHierarchyUtil.isMemberBetween(myTargetSuperClass, mySourceClass, classMember)) {
|
||||
@@ -692,7 +708,7 @@ public class PullUpHelper extends BaseRefactoringProcessor{
|
||||
myReferees.add(classMember);
|
||||
myRefereeClasses.add(classMember.getContainingClass());
|
||||
}
|
||||
else if ((myMovedMembers.contains(classMember) || myMembersAfterMove.contains(classMember)) && classMemberReference.isQualified()) {
|
||||
else if (myMovedMembers.contains(classMember) || myMembersAfterMove.contains(classMember)) {
|
||||
myReferences.add(classMemberReference);
|
||||
myReferees.add(classMember);
|
||||
myRefereeClasses.add(myTargetSuperClass);
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ public class ReplaceConstructorWithBuilderProcessor extends FixableUsagesRefacto
|
||||
final PsiElement element = reference.getElement();
|
||||
final PsiNewExpression newExpression = PsiTreeUtil.getParentOfType(element, PsiNewExpression.class);
|
||||
if (newExpression != null && !PsiTreeUtil.isAncestor(builderClass, element, false)) {
|
||||
usages.add(new ReplaceConstructorWithSettersChainInfo(newExpression, myClassName, myParametersMap));
|
||||
usages.add(new ReplaceConstructorWithSettersChainInfo(newExpression, StringUtil.getQualifiedName(myPackageName, myClassName), myParametersMap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ public class ReplaceConstructorWithSettersChainInfo extends FixableUsageInfo {
|
||||
"new " + myBuilderClass + "()." + buf.toString() + "create" + StringUtil.capitalize(constructor.getName()) + "()",
|
||||
null);
|
||||
|
||||
expr.replace(settersChain);
|
||||
styleManager.shortenClassReferences(expr.replace(settersChain));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
class Test {
|
||||
void foo() {
|
||||
<selection>final String str = "";
|
||||
if (str == "") {
|
||||
return;
|
||||
}</selection>
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
System.out.println(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
class Test {
|
||||
void foo() {
|
||||
final String str = newMethod();
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
System.out.println(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String newMethod() {
|
||||
final String str = "";
|
||||
if (str == "") {
|
||||
return;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
public class A extends AA {
|
||||
<caret>
|
||||
static class C extends D {}
|
||||
static class D extends B {}
|
||||
static class B {}
|
||||
}
|
||||
|
||||
class AA {}
|
||||
@@ -0,0 +1,10 @@
|
||||
public class A extends AA {
|
||||
|
||||
static class B {}
|
||||
}
|
||||
|
||||
class AA {
|
||||
static class C extends D {}
|
||||
|
||||
static class D extends A.B {}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import foo.Builder;
|
||||
|
||||
public class Bar {
|
||||
final Test foo = new Builder().setBar("bar").createTest();
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
public class Test {
|
||||
private final String bar;
|
||||
|
||||
public Test(final String bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package foo;
|
||||
|
||||
public class Builder {
|
||||
private String bar;
|
||||
|
||||
public Builder setBar(String bar) {
|
||||
this.bar = bar;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Test createTest() {
|
||||
return new Test(bar);
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public class Bar {
|
||||
final Test foo = new Test("bar");
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
public class Test {
|
||||
private final String bar;
|
||||
|
||||
public Test(final String bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
}
|
||||
@@ -400,6 +400,10 @@ public class ExtractMethodTest extends LightCodeInsightTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNullableCheckDontMissFinal() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSimpleArrayAccess() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@@ -36,6 +36,11 @@ public class PullUpTest extends LightCodeInsightTestCase {
|
||||
new RefactoringTestUtil.MemberDescriptor("setX", PsiMethod.class));
|
||||
|
||||
}
|
||||
|
||||
public void testPullUpInheritedStaticClasses() throws Exception {
|
||||
doTest(new RefactoringTestUtil.MemberDescriptor("C", PsiClass.class),
|
||||
new RefactoringTestUtil.MemberDescriptor("D", PsiClass.class));
|
||||
}
|
||||
|
||||
public void testPullUpAndAbstractize() throws Exception {
|
||||
doTest(new RefactoringTestUtil.MemberDescriptor("a", PsiMethod.class),
|
||||
|
||||
+12
-1
@@ -58,6 +58,10 @@ public class ReplaceConstructorWithBuilderTest extends MultiFileTestCase {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
public void testImports() throws Exception {
|
||||
doTest(true, null, null, "foo");
|
||||
}
|
||||
|
||||
private void doTest(final boolean createNewBuilderClass) throws Exception {
|
||||
doTest(createNewBuilderClass, null);
|
||||
}
|
||||
@@ -67,6 +71,13 @@ public class ReplaceConstructorWithBuilderTest extends MultiFileTestCase {
|
||||
}
|
||||
|
||||
private void doTest(final boolean createNewBuilderClass, final Map<String, String> expectedDefaults, final String conflicts) throws Exception {
|
||||
doTest(createNewBuilderClass, expectedDefaults, conflicts, "");
|
||||
}
|
||||
|
||||
private void doTest(final boolean createNewBuilderClass,
|
||||
final Map<String, String> expectedDefaults,
|
||||
final String conflicts,
|
||||
final String packageName) throws Exception {
|
||||
doTest(new PerformAction() {
|
||||
public void performAction(final VirtualFile rootDir, final VirtualFile rootAfter) throws Exception {
|
||||
final PsiClass aClass = myJavaFacade.findClass("Test", GlobalSearchScope.projectScope(getProject()));
|
||||
@@ -85,7 +96,7 @@ public class ReplaceConstructorWithBuilderTest extends MultiFileTestCase {
|
||||
}
|
||||
}
|
||||
try {
|
||||
new ReplaceConstructorWithBuilderProcessor(getProject(), constructors, map, "Builder", "", createNewBuilderClass).run();
|
||||
new ReplaceConstructorWithBuilderProcessor(getProject(), constructors, map, "Builder", packageName, createNewBuilderClass).run();
|
||||
if (conflicts != null) {
|
||||
fail("Conflicts were not detected:" + conflicts);
|
||||
}
|
||||
|
||||
+1
-20
@@ -380,7 +380,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
final Set<TextRange> emptyActionRegistered) {
|
||||
PsiElement psiElement = descriptor.getPsiElement();
|
||||
if (psiElement == null) return null;
|
||||
@NonNls String message = renderDescriptionMessage(descriptor);
|
||||
@NonNls String message = ProblemDescriptionNode.renderDescriptionMessage(descriptor);
|
||||
|
||||
final HighlightDisplayKey key = HighlightDisplayKey.find(tool.getShortName());
|
||||
final InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(myProject).getInspectionProfile();
|
||||
@@ -432,25 +432,6 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
}
|
||||
}
|
||||
|
||||
private static String renderDescriptionMessage(ProblemDescriptor descriptor) {
|
||||
PsiElement psiElement = descriptor.getPsiElement();
|
||||
String message = descriptor.getDescriptionTemplate();
|
||||
|
||||
// no message. Should not be the case if inspection correctly implemented.
|
||||
// noinspection ConstantConditions
|
||||
if (message == null) return "";
|
||||
|
||||
message = StringUtil.replace(message, "<code>", "'");
|
||||
message = StringUtil.replace(message, "</code>", "'");
|
||||
//message = message.replaceAll("<[^>]*>", "");
|
||||
String ref = ProblemDescriptionNode.extractHighlightedText(descriptor, psiElement);
|
||||
message = StringUtil.replace(message, "#loc", "");
|
||||
message = StringUtil.replace(message, "#ref", ref);
|
||||
|
||||
message = StringUtil.unescapeXml(message).trim();
|
||||
return message;
|
||||
}
|
||||
|
||||
public static PsiElement[] getElementsIntersectingRange(PsiFile file, final int startOffset, final int endOffset) {
|
||||
final FileViewProvider viewProvider = file.getViewProvider();
|
||||
final Set<PsiElement> result = new LinkedHashSet<PsiElement>();
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vcs.FileStatus;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -44,8 +43,7 @@ public class ProblemDescriptionNode extends InspectionTreeNode {
|
||||
private CommonProblemDescriptor myDescriptor;
|
||||
protected DescriptorProviderInspection myTool;
|
||||
|
||||
public ProblemDescriptionNode(final Object userObject,
|
||||
final DescriptorProviderInspection tool) {
|
||||
public ProblemDescriptionNode(final Object userObject, final DescriptorProviderInspection tool) {
|
||||
super(userObject);
|
||||
myTool = tool;
|
||||
}
|
||||
@@ -60,9 +58,14 @@ public class ProblemDescriptionNode extends InspectionTreeNode {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public RefEntity getElement() { return myElement; }
|
||||
public RefEntity getElement() {
|
||||
return myElement;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public CommonProblemDescriptor getDescriptor() { return myDescriptor; }
|
||||
public CommonProblemDescriptor getDescriptor() {
|
||||
return myDescriptor;
|
||||
}
|
||||
|
||||
public Icon getIcon(boolean expanded) {
|
||||
if (myDescriptor instanceof ProblemDescriptorImpl) {
|
||||
@@ -78,7 +81,7 @@ public class ProblemDescriptionNode extends InspectionTreeNode {
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
if (myElement instanceof RefElement && !((RefElement)myElement).isValid()) return false;
|
||||
if (myElement instanceof RefElement && !myElement.isValid()) return false;
|
||||
final CommonProblemDescriptor descriptor = getDescriptor();
|
||||
if (descriptor instanceof ProblemDescriptor) {
|
||||
final PsiElement psiElement = ((ProblemDescriptor)descriptor).getPsiElement();
|
||||
@@ -108,34 +111,50 @@ public class ProblemDescriptionNode extends InspectionTreeNode {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return renderDescriptionMessage(getDescriptor());
|
||||
return renderDescriptionMessage(getDescriptor()).replaceAll("<[^>]*>", "");
|
||||
}
|
||||
|
||||
private static String renderDescriptionMessage(@Nullable CommonProblemDescriptor descriptor) {
|
||||
public static String renderDescriptionMessage(CommonProblemDescriptor descriptor) {
|
||||
PsiElement psiElement = descriptor instanceof ProblemDescriptor ? ((ProblemDescriptor)descriptor).getPsiElement() : null;
|
||||
@NonNls String message = descriptor != null ? descriptor.getDescriptionTemplate().replaceAll("<[^>]*>", "") : "";
|
||||
String message = descriptor.getDescriptionTemplate();
|
||||
|
||||
// no message. Should not be the case if inspection correctly implemented.
|
||||
// noinspection ConstantConditions
|
||||
if (message == null) return "";
|
||||
|
||||
message = StringUtil.replace(message, "<code>", "'");
|
||||
message = StringUtil.replace(message, "</code>", "'");
|
||||
message = StringUtil.replace(message, "#loc", "");
|
||||
message = StringUtil.replace(message, "#ref", extractHighlightedText(descriptor, psiElement));
|
||||
if (message.contains("#ref")) {
|
||||
String ref = extractHighlightedText(descriptor, psiElement);
|
||||
message = StringUtil.replace(message, "#ref", ref);
|
||||
}
|
||||
final int endIndex = message.indexOf("#end");
|
||||
if (endIndex > 0) {
|
||||
message = message.substring(0, endIndex);
|
||||
}
|
||||
message = StringUtil.unescapeXml(message);
|
||||
|
||||
message = StringUtil.unescapeXml(message).trim();
|
||||
return message;
|
||||
}
|
||||
|
||||
public static String extractHighlightedText(CommonProblemDescriptor descriptor, PsiElement psiElement) {
|
||||
if (psiElement == null || !psiElement.isValid()) return "";
|
||||
String ref = psiElement.getText();
|
||||
if(descriptor instanceof ProblemDescriptorImpl) {
|
||||
if (descriptor instanceof ProblemDescriptorImpl) {
|
||||
TextRange textRange = ((ProblemDescriptorImpl)descriptor).getTextRange();
|
||||
final TextRange elementRange = psiElement.getTextRange();
|
||||
if (textRange!=null && elementRange!=null) {
|
||||
if (textRange != null && elementRange != null) {
|
||||
textRange = textRange.shiftRight(-elementRange.getStartOffset());
|
||||
if(textRange.getStartOffset() >= 0 && textRange.getEndOffset() <= ref.length())
|
||||
if (textRange.getStartOffset() >= 0 && textRange.getEndOffset() <= ref.length()) {
|
||||
ref = textRange.substring(ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
ref = ref.replaceAll("\n", " ").trim();
|
||||
if (ref.length() > 100) {
|
||||
ref = ref.substring(0, 100).trim() + "...";
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,11 +83,17 @@ public class ProgramRunnerUtil {
|
||||
|
||||
public static Icon getConfigurationIcon(final Project project, final RunnerAndConfigurationSettings settings, final boolean invalid) {
|
||||
final RunManager runManager = RunManager.getInstance(project);
|
||||
return getConfigurationIcon(settings, invalid, runManager.isTemporary(settings.getConfiguration()));
|
||||
}
|
||||
|
||||
public static Icon getConfigurationIcon(final RunnerAndConfigurationSettings settings,
|
||||
final boolean invalid,
|
||||
boolean isTemporary) {
|
||||
RunConfiguration configuration = settings.getConfiguration();
|
||||
final Icon icon = settings.getFactory().getIcon(configuration);
|
||||
LOG.assertTrue(icon != null, "Icon should not be null!");
|
||||
|
||||
final Icon configurationIcon = runManager.isTemporary(configuration) ? IconLoader.getTransparentIcon(icon, 0.3f) : icon;
|
||||
final Icon configurationIcon = isTemporary ? IconLoader.getTransparentIcon(icon, 0.3f) : icon;
|
||||
if (invalid) {
|
||||
return LayeredIcon.create(configurationIcon, INVALID_CONFIGURATION);
|
||||
}
|
||||
|
||||
@@ -129,9 +129,9 @@ class RunConfigurable extends BaseConfigurable {
|
||||
catch (ConfigurationException e) {
|
||||
snapshot = settings.getSettings();
|
||||
}
|
||||
setIcon(ProgramRunnerUtil.getConfigurationIcon(getProject(), snapshot, !settings.isValid()));
|
||||
configuration = settings.getConfiguration();
|
||||
name = settings.getNameText();
|
||||
setIcon(ProgramRunnerUtil.getConfigurationIcon(snapshot, !settings.isValid(), runManager.isTemporary(configuration)));
|
||||
}
|
||||
else if (userObject instanceof RunnerAndConfigurationSettingsImpl) {
|
||||
RunnerAndConfigurationSettings settings = (RunnerAndConfigurationSettings)userObject;
|
||||
|
||||
@@ -93,8 +93,14 @@ public abstract class TreeElement extends ElementBase implements ASTNode, Clonea
|
||||
}
|
||||
|
||||
public int getStartOffset() {
|
||||
if (myParent == null) return 0;
|
||||
return myParent.getStartOffset() + getStartOffsetInParent();
|
||||
int result = 0;
|
||||
TreeElement current = this;
|
||||
while(current.myParent != null) {
|
||||
result += current.getStartOffsetInParent();
|
||||
current = current.myParent;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public final int getStartOffsetInParent() {
|
||||
|
||||
+21
-14
@@ -19,12 +19,14 @@ package com.intellij.refactoring.move.moveFilesOrDirectories;
|
||||
import com.intellij.ide.util.DirectoryUtil;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
import com.intellij.openapi.help.HelpManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.ComponentWithBrowseButton;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.TextComponentAccessor;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -32,14 +34,15 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.refactoring.RefactoringBundle;
|
||||
import com.intellij.refactoring.util.CommonRefactoringUtil;
|
||||
import com.intellij.ui.EditorComboBox;
|
||||
import com.intellij.ui.EditorComboWithBrowseButton;
|
||||
import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.ui.RecentsManager;
|
||||
import com.intellij.ui.TextFieldWithStoredHistory;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
|
||||
@@ -51,7 +54,7 @@ public class MoveFilesOrDirectoriesDialog extends DialogWrapper{
|
||||
}
|
||||
|
||||
private JLabel myNameLabel;
|
||||
private EditorComboWithBrowseButton myTargetDirectoryField;
|
||||
private ComponentWithBrowseButton<TextFieldWithStoredHistory> myTargetDirectoryField;
|
||||
private String myHelpID;
|
||||
private final Project myProject;
|
||||
private final Callback myCallback;
|
||||
@@ -89,18 +92,21 @@ public class MoveFilesOrDirectoriesDialog extends DialogWrapper{
|
||||
panel.add(new JLabel(RefactoringBundle.message("move.files.to.directory.label")),
|
||||
new GridBagConstraints(0,1,1,1,0,0,GridBagConstraints.WEST,GridBagConstraints.HORIZONTAL,new Insets(4,8,4,8),0,0));
|
||||
|
||||
myTargetDirectoryField = new EditorComboWithBrowseButton(null, "", myProject, RECENT_KEYS);
|
||||
myTargetDirectoryField = new ComponentWithBrowseButton<TextFieldWithStoredHistory>(new TextFieldWithStoredHistory(RECENT_KEYS), null);
|
||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
myTargetDirectoryField.addBrowseFolderListener(RefactoringBundle.message("select.target.directory"),
|
||||
RefactoringBundle.message("the.file.will.be.moved.to.this.directory"),
|
||||
myProject,
|
||||
FileChooserDescriptorFactory.createSingleFolderDescriptor(),
|
||||
EditorComboBox.COMPONENT_ACCESSOR);
|
||||
descriptor,
|
||||
TextComponentAccessor.TEXT_FIELD_WITH_STORED_HISTORY_WHOLE_TEXT);
|
||||
final TextFieldWithStoredHistory textFieldWithStoredHistory = myTargetDirectoryField.getChildComponent();
|
||||
FileChooserFactory.getInstance().installFileCompletion(textFieldWithStoredHistory.getTextEditor(), descriptor, true, getDisposable());
|
||||
myTargetDirectoryField.setTextFieldPreferredWidth(60);
|
||||
panel.add(myTargetDirectoryField, new GridBagConstraints(1,1,1,1,1,0,GridBagConstraints.WEST,GridBagConstraints.HORIZONTAL,new Insets(4,0,4,8),0,0));
|
||||
|
||||
myTargetDirectoryField.getChildComponent().getDocument().addDocumentListener(new DocumentAdapter() {
|
||||
textFieldWithStoredHistory.addDocumentListener(new DocumentAdapter(){
|
||||
@Override
|
||||
public void documentChanged(DocumentEvent e) {
|
||||
protected void textChanged(DocumentEvent e) {
|
||||
validateOKButton();
|
||||
}
|
||||
});
|
||||
@@ -135,7 +141,8 @@ public class MoveFilesOrDirectoriesDialog extends DialogWrapper{
|
||||
RefactoringBundle.message("move.specified.directories") :
|
||||
RefactoringBundle.message("move.specified.elements"));
|
||||
}
|
||||
myTargetDirectoryField.prependItem(initialTargetDirectory == null ? "" : initialTargetDirectory.getVirtualFile().getPresentableUrl());
|
||||
|
||||
myTargetDirectoryField.getChildComponent().setText(initialTargetDirectory == null ? "" : initialTargetDirectory.getVirtualFile().getPresentableUrl());
|
||||
|
||||
validateOKButton();
|
||||
myHelpID = helpID;
|
||||
@@ -146,16 +153,16 @@ public class MoveFilesOrDirectoriesDialog extends DialogWrapper{
|
||||
}
|
||||
|
||||
private void validateOKButton() {
|
||||
setOKActionEnabled(myTargetDirectoryField.getText().length() > 0);
|
||||
setOKActionEnabled(myTargetDirectoryField.getChildComponent().getText().length() > 0);
|
||||
}
|
||||
|
||||
protected void doOKAction() {
|
||||
RecentsManager.getInstance(myProject).registerRecentEntry(RECENT_KEYS, myTargetDirectoryField.getText());
|
||||
myTargetDirectoryField.getChildComponent().addCurrentTextToHistory();
|
||||
CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
|
||||
public void run() {
|
||||
final Runnable action = new Runnable() {
|
||||
public void run() {
|
||||
String directoryName = myTargetDirectoryField.getText().replace(File.separatorChar, '/');
|
||||
String directoryName = myTargetDirectoryField.getChildComponent().getText().replace(File.separatorChar, '/');
|
||||
try {
|
||||
myTargetDirectory = DirectoryUtil.mkdirs(PsiManager.getInstance(myProject), directoryName);
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public abstract class Language extends UserDataHolderBase {
|
||||
}
|
||||
|
||||
public boolean isCaseSensitive() {
|
||||
return false;
|
||||
return myBaseLanguage != null ? myBaseLanguage.isCaseSensitive() : false;
|
||||
}
|
||||
|
||||
public final boolean isKindOf(Language another) {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.openapi.ui;
|
||||
|
||||
import com.intellij.ui.TextFieldWithHistory;
|
||||
import com.intellij.ui.TextFieldWithStoredHistory;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -82,6 +83,19 @@ public interface TextComponentAccessor<T extends Component> {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The accessor that gets and changes whole text
|
||||
*/
|
||||
TextComponentAccessor<TextFieldWithStoredHistory> TEXT_FIELD_WITH_STORED_HISTORY_WHOLE_TEXT = new TextComponentAccessor<TextFieldWithStoredHistory>() {
|
||||
public String getText(TextFieldWithStoredHistory textField) {
|
||||
return textField.getText();
|
||||
}
|
||||
|
||||
public void setText(TextFieldWithStoredHistory textField, String text) {
|
||||
textField.setText(text);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get text from component
|
||||
* @param component a component to examine
|
||||
|
||||
@@ -81,14 +81,14 @@ public class LineTooltipRenderer implements TooltipRenderer {
|
||||
int height = expanded ? Math.max(pane.getPreferredSize().height, 150) : pane.getPreferredSize().height;
|
||||
|
||||
if (alignToRight) {
|
||||
p.x -= width;
|
||||
p.x = Math.max(0, p.x - width);
|
||||
}
|
||||
|
||||
// try to make cursor outside tooltip. SCR 15038
|
||||
p.x += 3;
|
||||
p.y += 3;
|
||||
|
||||
if (p.x + width >= widthLimit) {
|
||||
if (p.x >= widthLimit - width) {
|
||||
p.x = widthLimit - width;
|
||||
width = Math.min(width, widthLimit);
|
||||
height += 20;
|
||||
@@ -98,7 +98,7 @@ public class LineTooltipRenderer implements TooltipRenderer {
|
||||
p.x = 3;
|
||||
}
|
||||
|
||||
if (p.y + height > heightLimit) {
|
||||
if (p.y > heightLimit - height) {
|
||||
p.y = heightLimit - height;
|
||||
height = Math.min(heightLimit, height);
|
||||
}
|
||||
@@ -107,7 +107,9 @@ public class LineTooltipRenderer implements TooltipRenderer {
|
||||
p.y = 3;
|
||||
}
|
||||
|
||||
//in order to restrict tooltip size
|
||||
locateOutsideMouseCursor(editor, layeredPane, p, width, height, heightLimit);
|
||||
|
||||
// in order to restrict tooltip size
|
||||
pane.setSize(width, height);
|
||||
pane.setMaximumSize(new Dimension(width, height));
|
||||
pane.setMinimumSize(new Dimension(width, height));
|
||||
@@ -116,7 +118,6 @@ public class LineTooltipRenderer implements TooltipRenderer {
|
||||
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
|
||||
|
||||
final Ref<AnAction> anAction = new Ref<AnAction>();
|
||||
final LightweightHint hint = new LightweightHint(scrollPane) {
|
||||
public void hide() {
|
||||
@@ -197,6 +198,27 @@ public class LineTooltipRenderer implements TooltipRenderer {
|
||||
return hint;
|
||||
}
|
||||
|
||||
private static void locateOutsideMouseCursor(Editor editor,
|
||||
JComponent editorComponent,
|
||||
Point p,
|
||||
int width,
|
||||
int height,
|
||||
int heightLimit) {
|
||||
Point mouse = MouseInfo.getPointerInfo().getLocation();
|
||||
SwingUtilities.convertPointFromScreen(mouse, editorComponent);
|
||||
Rectangle tooltipRect = new Rectangle(p, new Dimension(width, height));
|
||||
// should show at least one line apart
|
||||
tooltipRect.setBounds(tooltipRect.x, tooltipRect.y - editor.getLineHeight(), width, height + 2 * editor.getLineHeight());
|
||||
if (tooltipRect.contains(mouse)) {
|
||||
if (mouse.y + height + editor.getLineHeight() > heightLimit && mouse.y - height - editor.getLineHeight() > 0) {
|
||||
p.y = mouse.y - height - editor.getLineHeight();
|
||||
}
|
||||
else {
|
||||
p.y = mouse.y + editor.getLineHeight();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected String convertTextOnLinkHandled(String text) {
|
||||
return text;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.ui.LightweightHint;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.util.Alarm;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -49,10 +50,11 @@ public class TooltipController {
|
||||
}
|
||||
}
|
||||
|
||||
public void showTooltipByMouseMove(final Editor editor,
|
||||
MouseEvent e,
|
||||
public void showTooltipByMouseMove(@NotNull final Editor editor,
|
||||
@NotNull MouseEvent e,
|
||||
final TooltipRenderer tooltipObject,
|
||||
final boolean alignToRight, final TooltipGroup group) {
|
||||
final boolean alignToRight,
|
||||
@NotNull final TooltipGroup group) {
|
||||
myTooltipAlarm.cancelAllRequests();
|
||||
if (myCurrentTooltip == null || !myCurrentTooltip.isVisible()) {
|
||||
myCurrentTooltipObject = null;
|
||||
@@ -95,11 +97,13 @@ public class TooltipController {
|
||||
}
|
||||
|
||||
public void showTooltip(final Editor editor, Point p, String text, boolean alignToRight, TooltipGroup group) {
|
||||
showTooltip(editor, p, ((EditorMarkupModel)editor.getMarkupModel()).getErrorStripTooltipRendererProvider().calcTooltipRenderer(text), alignToRight, group);
|
||||
TooltipRenderer tooltipRenderer = ((EditorMarkupModel)editor.getMarkupModel()).getErrorStripTooltipRendererProvider().calcTooltipRenderer(text);
|
||||
showTooltip(editor, p, tooltipRenderer, alignToRight, group);
|
||||
}
|
||||
|
||||
public void showTooltip(final Editor editor, Point p, String text, int currentWidth, boolean alignToRight, TooltipGroup group) {
|
||||
showTooltip(editor, p, ((EditorMarkupModel)editor.getMarkupModel()).getErrorStripTooltipRendererProvider().calcTooltipRenderer(text, currentWidth), alignToRight, group);
|
||||
TooltipRenderer tooltipRenderer = ((EditorMarkupModel)editor.getMarkupModel()).getErrorStripTooltipRendererProvider().calcTooltipRenderer(text, currentWidth);
|
||||
showTooltip(editor, p, tooltipRenderer, alignToRight, group);
|
||||
}
|
||||
|
||||
public void showTooltip(final Editor editor, Point p, TooltipRenderer tooltipRenderer, boolean alignToRight, TooltipGroup group) {
|
||||
@@ -133,4 +137,4 @@ public class TooltipController {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@
|
||||
|
||||
<typedHandler implementation="com.intellij.codeInsight.editorActions.XmlSlashTypedHandler" id="xmlSlash"/>
|
||||
<typedHandler implementation="com.intellij.codeInsight.editorActions.XmlGtTypedHandler" id="xmlGt"/>
|
||||
<typedHandler implementation="com.intellij.codeInsight.editorActions.XmlAutoPopupHandler"/>
|
||||
<typedHandler implementation="com.intellij.codeInsight.editorActions.XmlAutoPopupHandler" id="xmlAuto"/>
|
||||
|
||||
<!--
|
||||
<copyPastePreProcessor implementation="com.intellij.codeInsight.editorActions.XmlCopyPastePreProcessor"/>
|
||||
|
||||
@@ -67,6 +67,15 @@ public abstract class ParsingTestCase extends LightPlatformTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
protected void doTest(String suffix) throws Exception{
|
||||
String name = getTestName(false);
|
||||
String text = loadFile(name + "." + myFileExt);
|
||||
myFile = createPsiFile(name, text);
|
||||
myFile.accept(new PsiRecursiveElementVisitor(){});
|
||||
assertEquals(text, myFile.getText());
|
||||
checkResult(name + suffix + ".txt", myFile);
|
||||
}
|
||||
|
||||
protected PsiFile createPsiFile(String name, String text) {
|
||||
return createFile(name + "." + myFileExt, text);
|
||||
}
|
||||
|
||||
@@ -1132,7 +1132,6 @@ public class UIUtil {
|
||||
super.completeUIInstall();
|
||||
|
||||
tree.setOpaque(false);
|
||||
tree.setLargeModel(true);
|
||||
tree.setShowsRootHandles(true);
|
||||
|
||||
tree.addMouseListener(mySelectionListener);
|
||||
|
||||
+3
-1
@@ -174,7 +174,9 @@ public class PatternBasedInjectionHelper {
|
||||
final char ch = curPos++ < text.length()? text.charAt(curPos-1) : 0;
|
||||
switch (curFrame.state) {
|
||||
case init:
|
||||
if (Character.isJavaIdentifierStart(ch)) {
|
||||
if (Character.isWhitespace(ch)) {
|
||||
}
|
||||
else if (Character.isJavaIdentifierStart(ch)) {
|
||||
curString.append(ch);
|
||||
curFrame.state = State.name;
|
||||
}
|
||||
|
||||
+5
-4
@@ -87,7 +87,7 @@ public abstract class AbstractLanguageInjectionSupport extends LanguageInjection
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
if (!ApplicationManagerEx.getApplicationEx().isInternal()) return;
|
||||
final BaseInjection originalInjection = producer.create();
|
||||
final BaseInjection newInjection = showInjectionUI(project, originalInjection.copy());
|
||||
final BaseInjection newInjection = showDefaultInjectionUI(project, originalInjection.copy());
|
||||
if (newInjection != null) {
|
||||
originalInjection.copyFrom(newInjection);
|
||||
originalInjection.initializePlaces(true);
|
||||
@@ -103,8 +103,8 @@ public abstract class AbstractLanguageInjectionSupport extends LanguageInjection
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final BaseInjection injection = new BaseInjection(support.getId());
|
||||
injection.setDisplayName("New "+support.getId()+" Injection");
|
||||
final BaseInjection newInjection = showInjectionUI(project, injection);
|
||||
injection.setDisplayName("New "+ StringUtil.capitalize(support.getId())+" Injection");
|
||||
final BaseInjection newInjection = showDefaultInjectionUI(project, injection);
|
||||
if (newInjection != null) {
|
||||
consumer.consume(injection);
|
||||
}
|
||||
@@ -113,7 +113,8 @@ public abstract class AbstractLanguageInjectionSupport extends LanguageInjection
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static BaseInjection showInjectionUI(Project project, BaseInjection injection) {
|
||||
protected static BaseInjection showDefaultInjectionUI(Project project, BaseInjection injection) {
|
||||
if (!ApplicationManagerEx.getApplicationEx().isInternal()) return null;
|
||||
final BaseInjectionPanel panel = new BaseInjectionPanel(injection, project);
|
||||
panel.reset();
|
||||
final DialogBuilder builder = new DialogBuilder(project);
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ public class BaseInjectionPanel extends AbstractInjectionPanel<BaseInjection> {
|
||||
s = s.substring(1).trim();
|
||||
}
|
||||
else {
|
||||
sb.append(s);
|
||||
sb.append(s.trim());
|
||||
continue;
|
||||
}
|
||||
if (sb.length() > 0) {
|
||||
|
||||
+6
-9
@@ -124,12 +124,11 @@ public class XmlLanguageInjectionSupport extends AbstractLanguageInjectionSuppor
|
||||
final Project project = host.getProject();
|
||||
final BaseInjection originalInjection = injections.get(0);
|
||||
final BaseInjection xmlInjection = createFrom(originalInjection, host);
|
||||
if (xmlInjection == null) return false;
|
||||
final AbstractTagInjection newInjection = showInjectionUI(project, xmlInjection);
|
||||
final BaseInjection newInjection =
|
||||
xmlInjection == null? showDefaultInjectionUI(project, originalInjection.copy()) : showInjectionUI(project, xmlInjection);
|
||||
if (newInjection != null) {
|
||||
newInjection.mergeOriginalPlacesFrom(originalInjection, true);
|
||||
Configuration.getInstance().replaceInjectionsWithUndo(
|
||||
project, Collections.singletonList(xmlInjection),
|
||||
project, Collections.singletonList(newInjection),
|
||||
Collections.singletonList(originalInjection),
|
||||
Collections.<PsiElement>emptyList());
|
||||
}
|
||||
@@ -137,7 +136,7 @@ public class XmlLanguageInjectionSupport extends AbstractLanguageInjectionSuppor
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private AbstractTagInjection showInjectionUI(final Project project, final BaseInjection xmlInjection) {
|
||||
private static AbstractTagInjection showInjectionUI(final Project project, final BaseInjection xmlInjection) {
|
||||
final DialogBuilder builder = new DialogBuilder(project);
|
||||
final AbstractInjectionPanel panel;
|
||||
if (xmlInjection instanceof XmlTagInjection) {
|
||||
@@ -169,6 +168,8 @@ public class XmlLanguageInjectionSupport extends AbstractLanguageInjectionSuppor
|
||||
|
||||
@Nullable
|
||||
private static BaseInjection createFrom(final BaseInjection injection, final PsiLanguageInjectionHost host) {
|
||||
if (injection.getInjectionPlaces().size() > 1) return null;
|
||||
|
||||
final PsiElement element;
|
||||
AbstractTagInjection result;
|
||||
if (host instanceof XmlText) {
|
||||
@@ -217,10 +218,6 @@ public class XmlLanguageInjectionSupport extends AbstractLanguageInjectionSuppor
|
||||
result.setTagNamespace(StringUtil.notNullize(pair1.second));
|
||||
}
|
||||
else continue;
|
||||
// for debugging
|
||||
//result.initializePlaces(false);
|
||||
//if (!place.getText().equals(result.getInjectionPlaces().get(0).getText())) {
|
||||
//}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
AntFile[Dirname.ant]
|
||||
AntProject[project]
|
||||
AntProperty[prop = /]
|
||||
AntElement[PsiElement(XML_ATTRIBUTE_VALUE)]('prop')
|
||||
AntTarget:[A]
|
||||
AntElement[PsiElement(XML_ATTRIBUTE_VALUE)]('A')
|
||||
@@ -0,0 +1,57 @@
|
||||
XmlFile:Dirname.ant
|
||||
PsiElement(XML_DOCUMENT)
|
||||
PsiElement(XML_PROLOG)
|
||||
<empty list>
|
||||
XmlTag:project
|
||||
XmlToken:XML_START_TAG_START('<')
|
||||
XmlToken:XML_NAME('project')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(XML_ATTRIBUTE)
|
||||
XmlToken:XML_NAME('default')
|
||||
XmlToken:XML_EQ('=')
|
||||
PsiElement(XML_ATTRIBUTE_VALUE)
|
||||
XmlToken:XML_ATTRIBUTE_VALUE_START_DELIMITER('"')
|
||||
XmlToken:XML_ATTRIBUTE_VALUE_TOKEN('A')
|
||||
XmlToken:XML_ATTRIBUTE_VALUE_END_DELIMITER('"')
|
||||
XmlToken:XML_TAG_END('>')
|
||||
XmlText
|
||||
PsiWhiteSpace('\n ')
|
||||
XmlTag:dirname
|
||||
XmlToken:XML_START_TAG_START('<')
|
||||
XmlToken:XML_NAME('dirname')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(XML_ATTRIBUTE)
|
||||
XmlToken:XML_NAME('property')
|
||||
XmlToken:XML_EQ('=')
|
||||
PsiElement(XML_ATTRIBUTE_VALUE)
|
||||
XmlToken:XML_ATTRIBUTE_VALUE_START_DELIMITER('"')
|
||||
XmlToken:XML_ATTRIBUTE_VALUE_TOKEN('prop')
|
||||
XmlToken:XML_ATTRIBUTE_VALUE_END_DELIMITER('"')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(XML_ATTRIBUTE)
|
||||
XmlToken:XML_NAME('file')
|
||||
XmlToken:XML_EQ('=')
|
||||
PsiElement(XML_ATTRIBUTE_VALUE)
|
||||
XmlToken:XML_ATTRIBUTE_VALUE_START_DELIMITER('"')
|
||||
XmlToken:XML_ATTRIBUTE_VALUE_TOKEN('${ant.file}')
|
||||
XmlToken:XML_ATTRIBUTE_VALUE_END_DELIMITER('"')
|
||||
XmlToken:XML_EMPTY_ELEMENT_END('/>')
|
||||
XmlText
|
||||
PsiWhiteSpace('\n ')
|
||||
XmlTag:target
|
||||
XmlToken:XML_START_TAG_START('<')
|
||||
XmlToken:XML_NAME('target')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(XML_ATTRIBUTE)
|
||||
XmlToken:XML_NAME('name')
|
||||
XmlToken:XML_EQ('=')
|
||||
PsiElement(XML_ATTRIBUTE_VALUE)
|
||||
XmlToken:XML_ATTRIBUTE_VALUE_START_DELIMITER('"')
|
||||
XmlToken:XML_ATTRIBUTE_VALUE_TOKEN('A')
|
||||
XmlToken:XML_ATTRIBUTE_VALUE_END_DELIMITER('"')
|
||||
XmlToken:XML_EMPTY_ELEMENT_END('/>')
|
||||
XmlText
|
||||
PsiWhiteSpace('\n')
|
||||
XmlToken:XML_END_TAG_START('</')
|
||||
XmlToken:XML_NAME('project')
|
||||
XmlToken:XML_TAG_END('>')
|
||||
@@ -1,5 +1,5 @@
|
||||
<project default="main">
|
||||
<target name="main">
|
||||
<echo message="p1=${<ref>env.ComSpec}"/>
|
||||
<echo message="p1=${<ref>env.PATH}"/>
|
||||
</target>
|
||||
</project>
|
||||
@@ -1,6 +1,6 @@
|
||||
<project default="main">
|
||||
<property environment="myenv"/>
|
||||
<target name="main">
|
||||
<echo message="p1=${<ref>myenv.ComSpec}"/>
|
||||
<echo message="p1=${<ref>myenv.PATH}"/>
|
||||
</target>
|
||||
</project>
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.intellij.lang.ant;
|
||||
|
||||
import com.intellij.openapi.application.PluginPathManager;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.testFramework.ParsingTestCase;
|
||||
|
||||
public class AntParsingTest extends ParsingTestCase {
|
||||
@@ -110,7 +111,7 @@ public class AntParsingTest extends ParsingTestCase {
|
||||
}
|
||||
|
||||
public void testDirname() throws Exception {
|
||||
doTest(true);
|
||||
doTest(SystemInfo.isWindows ? "_w" : "_u");
|
||||
}
|
||||
|
||||
public void testBasename() throws Exception {
|
||||
|
||||
@@ -28,5 +28,9 @@ public class GroovyLanguage extends Language {
|
||||
public GroovyLanguage() {
|
||||
super("Groovy");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCaseSensitive() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<orderEntry type="module" module-name="idea-tests" scope="TEST" />
|
||||
<orderEntry type="module" module-name="testFramework-java" exported="" scope="TEST" />
|
||||
<orderEntry type="module" module-name="jetgroovy" scope="TEST" />
|
||||
<orderEntry type="module" module-name="FlexSupport" scope="TEST" />
|
||||
</component>
|
||||
<component name="copyright">
|
||||
<Base>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationInfo;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
@@ -36,6 +37,7 @@ import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
|
||||
import org.jetbrains.idea.maven.project.*;
|
||||
import org.jetbrains.idea.maven.utils.MavenProgressIndicator;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
@@ -157,15 +159,28 @@ public abstract class MavenTestCase extends UsefulTestCase {
|
||||
|
||||
@Override
|
||||
protected void runTest() throws Throwable {
|
||||
if (runInWriteAction()) {
|
||||
new WriteAction() {
|
||||
protected void run(Result result) throws Throwable {
|
||||
MavenTestCase.super.runTest();
|
||||
}
|
||||
}.executeSilently().throwException();
|
||||
try {
|
||||
if (runInWriteAction()) {
|
||||
new WriteAction() {
|
||||
protected void run(Result result) throws Throwable {
|
||||
MavenTestCase.super.runTest();
|
||||
}
|
||||
}.executeSilently().throwException();
|
||||
}
|
||||
else {
|
||||
MavenTestCase.super.runTest();
|
||||
}
|
||||
}
|
||||
else {
|
||||
MavenTestCase.super.runTest();
|
||||
catch (Exception throwable) {
|
||||
Throwable each = throwable;
|
||||
do {
|
||||
if (each instanceof HeadlessException) {
|
||||
printIgnoredMessage("Doesn't work in Headless environment");
|
||||
return;
|
||||
}
|
||||
}
|
||||
while ((each = each.getCause()) != null);
|
||||
throw throwable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,16 +465,31 @@ public abstract class MavenTestCase extends UsefulTestCase {
|
||||
}
|
||||
|
||||
protected boolean ignore() {
|
||||
System.out.println("Ignored: " + getClass().getSimpleName() + "." + getName());
|
||||
printIgnoredMessage(null);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean checkUltimate() {
|
||||
if ("IU".equals(ApplicationInfo.getInstance().getBuild().getProductCode())) return true;
|
||||
printIgnoredMessage("Ultimate edition is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean hasMavenInstallation() {
|
||||
boolean result = getTestMavenHome() != null;
|
||||
if (!result) System.out.println("Ignored, because Maven installation not found: " + getClass().getSimpleName() + "." + getName());
|
||||
if (!result) printIgnoredMessage("Maven installation not found");
|
||||
return result;
|
||||
}
|
||||
|
||||
private void printIgnoredMessage(String message) {
|
||||
String toPrint = "Ignored";
|
||||
if (message != null) {
|
||||
toPrint += ", beacuse " + message;
|
||||
}
|
||||
toPrint += ": " + getClass().getSimpleName() + "." + getName();
|
||||
System.out.println(toPrint);
|
||||
}
|
||||
|
||||
private String getTestMavenHome() {
|
||||
return System.getProperty("idea.maven.test.home");
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ import com.intellij.usages.UsageTargetUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import gnu.trove.THashMap;
|
||||
import junit.framework.AssertionFailedError;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.idea.maven.MavenImportingTestCase;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel;
|
||||
@@ -279,7 +280,7 @@ public abstract class MavenDomTestCase extends MavenImportingTestCase {
|
||||
invokeRename(context, renameHandler);
|
||||
}
|
||||
|
||||
protected void assertCannotRename() throws IOException {
|
||||
protected void assertCannotRename() throws Exception {
|
||||
MapDataContext context = createRenameDataContext(myProjectPom, "new name");
|
||||
RenameHandler handler = RenameHandlerRegistry.getInstance().getRenameHandler(context);
|
||||
if (handler == null) return;
|
||||
@@ -287,7 +288,9 @@ public abstract class MavenDomTestCase extends MavenImportingTestCase {
|
||||
invokeRename(context, handler);
|
||||
}
|
||||
catch (Exception e) {
|
||||
assertTrue(e.getMessage(), e.getMessage().startsWith("Cannot perform refactoring."));
|
||||
if (!e.getMessage().startsWith("Cannot perform refactoring.")) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -21,6 +21,9 @@ import com.intellij.psi.PsiManager;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomProfilesModel;
|
||||
import org.jetbrains.idea.maven.dom.references.MavenPropertyPsiReference;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
|
||||
public class MavenFilteredPropertiesCompletionAndResolutionTest extends MavenDomTestCase {
|
||||
public void testBasic() throws Exception {
|
||||
createProjectSubDir("res");
|
||||
|
||||
+2
@@ -147,6 +147,8 @@ public class ArtifactsDownloadingTest extends MavenImportingTestCase {
|
||||
}
|
||||
|
||||
public void testCustomDocsAndSources() throws Exception {
|
||||
if (!checkUltimate()) return;
|
||||
|
||||
String remoteRepo = FileUtil.toSystemIndependentName(myDir.getPath() + "/repo");
|
||||
updateSettingsXmlFully("<settings>" +
|
||||
"<mirrors>" +
|
||||
|
||||
+2
@@ -1500,6 +1500,8 @@ public class DependenciesImportingTest extends MavenImportingTestCase {
|
||||
}
|
||||
|
||||
public void testCustomSourcesAndJavadocPaths() throws Exception {
|
||||
if (!checkUltimate()) return;
|
||||
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
@@ -94,6 +94,7 @@ public class XMLLanguage extends CompositeLanguage {
|
||||
super(name, mime);
|
||||
}
|
||||
|
||||
|
||||
public XmlPsiPolicy getPsiPolicy() {
|
||||
return CDATA_ON_ANY_ENCODED_POLICY;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.psi.formatter.xml;
|
||||
|
||||
import com.intellij.formatting.*;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.xml.XMLLanguage;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiErrorElement;
|
||||
@@ -111,7 +112,7 @@ public class XmlBlock extends AbstractXmlBlock {
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Block> splitAttribute(ASTNode node, XmlFormattingPolicy formattingPolicy) {
|
||||
private List<Block> splitAttribute(ASTNode node, XmlFormattingPolicy formattingPolicy) {
|
||||
final ArrayList<Block> result = new ArrayList<Block>(3);
|
||||
ASTNode child = node.getFirstChildNode();
|
||||
while (child != null) {
|
||||
@@ -119,6 +120,12 @@ public class XmlBlock extends AbstractXmlBlock {
|
||||
child.getElementType() == XmlElementType.XML_ATTRIBUTE_VALUE_END_DELIMITER) {
|
||||
result.add(new XmlBlock(child, null, null, formattingPolicy, null, null));
|
||||
}
|
||||
else if (!child.getPsi().getLanguage().isKindOf(XMLLanguage.INSTANCE) && containsOuterLanguageElement(child)) {
|
||||
// Fix for EA-20311:
|
||||
// In case of another embedded language create a splittable XML block which can be
|
||||
// merged with other language's code blocks.
|
||||
result.add(new XmlBlock(child, null, null, myXmlFormattingPolicy, getChildIndent(), null));
|
||||
}
|
||||
else if (child.getElementType() != TokenType.ERROR_ELEMENT) {
|
||||
result.add(new ReadOnlyBlock(child));
|
||||
}
|
||||
@@ -128,6 +135,18 @@ public class XmlBlock extends AbstractXmlBlock {
|
||||
}
|
||||
|
||||
|
||||
private static boolean containsOuterLanguageElement(ASTNode node) {
|
||||
ASTNode child = node.getFirstChildNode();
|
||||
while (child != null) {
|
||||
if (child instanceof OuterLanguageElement) {
|
||||
return true;
|
||||
}
|
||||
child = child.getTreeNext();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private List<Block> splitComment() {
|
||||
if (myNode.getElementType() != XmlElementType.XML_COMMENT) return EMPTY;
|
||||
final ArrayList<Block> result = new ArrayList<Block>(3);
|
||||
|
||||
Reference in New Issue
Block a user