move properties file tests to community

This commit is contained in:
Dmitry Batkovich
2017-10-09 12:27:26 +03:00
parent f2df8dce37
commit eacfa9d97f
17 changed files with 993 additions and 0 deletions
@@ -0,0 +1,7 @@
class Test {
void m() {
String xxx = "qwe.asd.zxc";
String yyy = 1 == 1 ? "qwe.asd.zxc" : "";
String zzz = (1 == 1 ? "qwe.asd.zxc" : "") + "qwe";
}
}
@@ -0,0 +1,3 @@
class X {
String f = "x.y";
}
@@ -0,0 +1,2 @@
class Y<caret> {
}
@@ -0,0 +1 @@
qwe.asd<caret>.zxc=1234567890
@@ -0,0 +1,442 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>fmt</short-name>
<uri>http://java.sun.com/jstl/fmt</uri>
<display-name>JSTL fmt</display-name>
<description>JSTL 1.0 i18n-capable formatting library</description>
<validator>
<validator-class>
org.apache.taglibs.standard.tlv.JstlFmtTLV
</validator-class>
<init-param>
<param-name>expressionAttributes</param-name>
<param-value>
requestEncoding:value
setLocale:value
setLocale:variant
timeZone:value
setTimeZone:value
bundle:basename
bundle:prefix
setBundle:basename
message:key
message:bundle
param:value
formatNumber:value
formatNumber:pattern
formatNumber:currencyCode
formatNumber:currencySymbol
formatNumber:groupingUsed
formatNumber:maxIntegerDigits
formatNumber:minIntegerDigits
formatNumber:maxFractionDigits
formatNumber:minFractionDigits
parseNumber:value
parseNumber:pattern
parseNumber:parseLocale
parseNumber:integerOnly
formatDate:value
formatDate:pattern
formatDate:timeZone
parseDate:value
parseDate:pattern
parseDate:timeZone
parseDate:parseLocale
</param-value>
<description>
Whitespace-separated list of colon-separated token pairs
describing tag:attribute combinations that accept expressions.
The validator uses this information to determine which
attributes need their syntax validated.
</description>
</init-param>
</validator>
<tag>
<name>requestEncoding</name>
<tag-class>org.apache.taglibs.standard.tag.el.fmt.RequestEncodingTag</tag-class>
<body-content>empty</body-content>
<description>
Sets the request character encoding
</description>
<attribute>
<name>value</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>setLocale</name>
<tag-class>org.apache.taglibs.standard.tag.el.fmt.SetLocaleTag</tag-class>
<body-content>empty</body-content>
<description>
Stores the given locale in the locale configuration variable
</description>
<attribute>
<name>value</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>variant</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>timeZone</name>
<tag-class>org.apache.taglibs.standard.tag.el.fmt.TimeZoneTag</tag-class>
<body-content>JSP</body-content>
<description>
Specifies the time zone for any time formatting or parsing actions
nested in its body
</description>
<attribute>
<name>value</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>setTimeZone</name>
<tag-class>org.apache.taglibs.standard.tag.el.fmt.SetTimeZoneTag</tag-class>
<body-content>empty</body-content>
<description>
Stores the given time zone in the time zone configuration variable
</description>
<attribute>
<name>value</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>bundle</name>
<tag-class>org.apache.taglibs.standard.tag.el.fmt.BundleTag</tag-class>
<body-content>JSP</body-content>
<description>
Loads a resource bundle to be used by its tag body
</description>
<attribute>
<name>basename</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>prefix</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>setBundle</name>
<tag-class>org.apache.taglibs.standard.tag.el.fmt.SetBundleTag</tag-class>
<body-content>empty</body-content>
<description>
Loads a resource bundle and stores it in the named scoped variable or
the bundle configuration variable
</description>
<attribute>
<name>basename</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>message</name>
<tag-class>org.apache.taglibs.standard.tag.el.fmt.MessageTag</tag-class>
<body-content>JSP</body-content>
<description>
Maps key to localized message and performs parametric replacement
</description>
<attribute>
<name>key</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>bundle</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>param</name>
<tag-class>org.apache.taglibs.standard.tag.el.fmt.ParamTag</tag-class>
<body-content>JSP</body-content>
<description>
Supplies an argument for parametric replacement to a containing
&lt;message&gt; tag
</description>
<attribute>
<name>value</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>formatNumber</name>
<tag-class>org.apache.taglibs.standard.tag.el.fmt.FormatNumberTag</tag-class>
<body-content>JSP</body-content>
<description>
Formats a numeric value as a number, currency, or percentage
</description>
<attribute>
<name>value</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>type</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>pattern</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>currencyCode</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>currencySymbol</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>groupingUsed</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>maxIntegerDigits</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>minIntegerDigits</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>maxFractionDigits</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>minFractionDigits</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>parseNumber</name>
<tag-class>org.apache.taglibs.standard.tag.el.fmt.ParseNumberTag</tag-class>
<body-content>JSP</body-content>
<description>
Parses the string representation of a number, currency, or percentage
</description>
<attribute>
<name>value</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>type</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>pattern</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>parseLocale</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>integerOnly</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>formatDate</name>
<tag-class>org.apache.taglibs.standard.tag.el.fmt.FormatDateTag</tag-class>
<body-content>empty</body-content>
<description>
Formats a date and/or time using the supplied styles and pattern
</description>
<attribute>
<name>value</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>type</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>dateStyle</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>timeStyle</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>pattern</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>timeZone</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>parseDate</name>
<tag-class>org.apache.taglibs.standard.tag.el.fmt.ParseDateTag</tag-class>
<body-content>JSP</body-content>
<description>
Parses the string representation of a date and/or time
</description>
<attribute>
<name>value</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>type</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>dateStyle</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>timeStyle</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>pattern</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>timeZone</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>parseLocale</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
</taglib>
@@ -0,0 +1,4 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/tags/fmt" prefix="fmt" %>
<fmt:message bundle="${bundle}" key="find.this.property"/>
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<taglib>
<taglib-uri>/tags/fmt</taglib-uri>
<taglib-location>/WEB-INF/fmt.tld</taglib-location>
</taglib>
</web-app>
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="ModuleRootManager" />
<component inherit-compiler-output="true" name="NewModuleRootManager">
<exclude-output />
<exploded url="file://$MODULE_DIR$/exploded" />
<exclude-exploded />
<content url="file://$MODULE_DIR$">
<sourceFolder isTestSource="false" url="file://$MODULE_DIR$/src" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry forTests="false" type="sourceFolder" />
<orderEntryProperties />
</component>
<component name="FacetManager">
<facet type="web" name="prop-bug">
<configuration>
<webroots>
<root relative="/" url="file://$MODULE_DIR$/resources" />
<root relative="/WEB-INF" url="file://$MODULE_DIR$/WEB-INF" />
</webroots>
<packaging />
<descriptors>
<deploymentDescriptor name="web.xml" optional="false" url="file://$MODULE_DIR$/WEB-INF/web.xml" version="2.4" />
</descriptors>
<building>
<setting name="EXPLODED_URL" value="file://$MODULE_DIR$/exploded" />
<setting name="EXPLODED_ENABLED" value="true" />
<setting name="JAR_URL" value="file://" />
<setting name="JAR_ENABLED" value="false" />
<setting name="BUILD_MODULE_ON_FRAME_DEACTIVATION" value="false" />
<setting name="BUILD_EXTERNAL_DEPENDENCIES" value="false" />
<setting name="RUN_JASPER_VALIDATION" value="true" />
</building>
<validators />
</configuration>
</facet>
</component>
</module>
@@ -0,0 +1,290 @@
<?xml version="1.0" encoding="UTF-8"?>
<project relativePaths="false" version="4">
<component name="AntConfiguration">
<defaultAnt bundledAnt="true" />
</component>
<component name="BuildJarProjectSettings">
<option name="BUILD_JARS_ON_MAKE" value="false" />
</component>
<component name="CodeStyleProjectProfileManger">
<option name="PROJECT_PROFILE" />
<option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
</component>
<component name="CodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS" />
<option name="USE_PER_PROJECT_SETTINGS" value="false" />
</component>
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<option name="DEPLOY_AFTER_MAKE" value="0" />
<resourceExtensions>
<entry name=".+\.(properties|xml|html|dtd|tld)" />
<entry name=".+\.(gif|png|jpeg|jpg)" />
</resourceExtensions>
<wildcardResourcePatterns>
<entry name="?*.properties" />
<entry name="?*.xml" />
<entry name="?*.gif" />
<entry name="?*.png" />
<entry name="?*.jpeg" />
<entry name="?*.jpg" />
<entry name="?*.html" />
<entry name="?*.dtd" />
<entry name="?*.tld" />
</wildcardResourcePatterns>
</component>
<component name="DataSourceManagerImpl" />
<component name="DependenciesAnalyzeManager">
<option name="myForwardDirection" value="false" />
</component>
<component name="DependencyValidationManager" />
<component name="EclipseCompilerSettings">
<option name="DEBUGGING_INFO" value="true" />
<option name="GENERATE_NO_WARNINGS" value="true" />
<option name="DEPRECATION" value="false" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
<option name="MAXIMUM_HEAP_SIZE" value="128" />
</component>
<component name="EclipseEmbeddedCompilerSettings">
<option name="DEBUGGING_INFO" value="true" />
<option name="GENERATE_NO_WARNINGS" value="true" />
<option name="DEPRECATION" value="false" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
<option name="MAXIMUM_HEAP_SIZE" value="128" />
</component>
<component name="EntryPointsManager">
<entry_points />
</component>
<component name="ExportToHTMLSettings">
<option name="PRINT_LINE_NUMBERS" value="false" />
<option name="OPEN_IN_BROWSER" value="false" />
<option name="OUTPUT_DIRECTORY" />
</component>
<component name="GUI Designer component loader factory" />
<component name="InspectionProjectProfileManager">
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
<scopes />
<profiles>
<profile is_locked="false" version="1.0">
<option name="myName" value="Project Default" />
<option name="myLocal" value="false" />
<used_levels>
<error>
<option name="myName" value="ERROR" />
<option name="myVal" value="400" />
</error>
<warning>
<option name="myName" value="WARNING" />
<option name="myVal" value="300" />
</warning>
<information>
<option name="myName" value="INFO" />
<option name="myVal" value="200" />
</information>
<server>
<option name="myName" value="SERVER PROBLEM" />
<option name="myVal" value="100" />
</server>
</used_levels>
</profile>
</profiles>
</component>
<component name="JavacSettings">
<option name="DEBUGGING_INFO" value="true" />
<option name="GENERATE_NO_WARNINGS" value="false" />
<option name="DEPRECATION" value="true" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
<option name="MAXIMUM_HEAP_SIZE" value="128" />
</component>
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" />
<option name="OPTION_SCOPE" value="protected" />
<option name="OPTION_HIERARCHY" value="true" />
<option name="OPTION_NAVIGATOR" value="true" />
<option name="OPTION_INDEX" value="true" />
<option name="OPTION_SEPARATE_INDEX" value="true" />
<option name="OPTION_DOCUMENT_TAG_USE" value="false" />
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
<option name="OPTION_DEPRECATED_LIST" value="true" />
<option name="OTHER_OPTIONS" value="" />
<option name="HEAP_SIZE" />
<option name="LOCALE" />
<option name="OPEN_IN_BROWSER" value="true" />
</component>
<component name="JikesSettings">
<option name="JIKES_PATH" value="" />
<option name="DEBUGGING_INFO" value="true" />
<option name="DEPRECATION" value="true" />
<option name="GENERATE_NO_WARNINGS" value="false" />
<option name="IS_EMACS_ERRORS_MODE" value="true" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
</component>
<component name="LogConsolePreferences">
<option name="FILTER_ERRORS" value="false" />
<option name="FILTER_WARNINGS" value="false" />
<option name="FILTER_INFO" value="true" />
<option name="CUSTOM_FILTER" />
</component>
<component name="Palette2">
<group name="Swing">
<item auto-create-binding="false" can-attach-label="false" class="com.intellij.uiDesigner.HSpacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" tooltip-text="Horizontal Spacer">
<default-constraints anchor="0" fill="1" hsize-policy="6" vsize-policy="1" />
</item>
<item auto-create-binding="false" can-attach-label="false" class="com.intellij.uiDesigner.VSpacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" tooltip-text="Vertical Spacer">
<default-constraints anchor="0" fill="2" hsize-policy="1" vsize-policy="6" />
</item>
<item auto-create-binding="false" can-attach-label="false" class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false">
<default-constraints anchor="0" fill="3" hsize-policy="3" vsize-policy="3" />
</item>
<item auto-create-binding="false" can-attach-label="true" class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false">
<default-constraints anchor="0" fill="3" hsize-policy="7" vsize-policy="7" />
</item>
<item auto-create-binding="true" can-attach-label="false" class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false">
<default-constraints anchor="0" fill="1" hsize-policy="3" vsize-policy="0" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item auto-create-binding="true" can-attach-label="false" class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false">
<default-constraints anchor="8" fill="0" hsize-policy="3" vsize-policy="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item auto-create-binding="true" can-attach-label="false" class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false">
<default-constraints anchor="8" fill="0" hsize-policy="3" vsize-policy="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item auto-create-binding="false" can-attach-label="false" class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false">
<default-constraints anchor="8" fill="0" hsize-policy="0" vsize-policy="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item auto-create-binding="true" can-attach-label="true" class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false">
<default-constraints anchor="8" fill="1" hsize-policy="6" vsize-policy="0">
<preferred-size height="-1" width="150" />
</default-constraints>
</item>
<item auto-create-binding="true" can-attach-label="true" class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false">
<default-constraints anchor="8" fill="1" hsize-policy="6" vsize-policy="0">
<preferred-size height="-1" width="150" />
</default-constraints>
</item>
<item auto-create-binding="true" can-attach-label="true" class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false">
<default-constraints anchor="8" fill="1" hsize-policy="6" vsize-policy="0">
<preferred-size height="-1" width="150" />
</default-constraints>
</item>
<item auto-create-binding="true" can-attach-label="true" class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false">
<default-constraints anchor="0" fill="3" hsize-policy="6" vsize-policy="6">
<preferred-size height="50" width="150" />
</default-constraints>
</item>
<item auto-create-binding="true" can-attach-label="true" class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false">
<default-constraints anchor="0" fill="3" hsize-policy="6" vsize-policy="6">
<preferred-size height="50" width="150" />
</default-constraints>
</item>
<item auto-create-binding="true" can-attach-label="true" class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false">
<default-constraints anchor="0" fill="3" hsize-policy="6" vsize-policy="6">
<preferred-size height="50" width="150" />
</default-constraints>
</item>
<item auto-create-binding="true" can-attach-label="true" class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false">
<default-constraints anchor="8" fill="1" hsize-policy="2" vsize-policy="0" />
</item>
<item auto-create-binding="true" can-attach-label="false" class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false">
<default-constraints anchor="0" fill="3" hsize-policy="6" vsize-policy="6">
<preferred-size height="50" width="150" />
</default-constraints>
</item>
<item auto-create-binding="true" can-attach-label="false" class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false">
<default-constraints anchor="0" fill="3" hsize-policy="2" vsize-policy="6">
<preferred-size height="50" width="150" />
</default-constraints>
</item>
<item auto-create-binding="true" can-attach-label="false" class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false">
<default-constraints anchor="0" fill="3" hsize-policy="6" vsize-policy="6">
<preferred-size height="50" width="150" />
</default-constraints>
</item>
<item auto-create-binding="true" can-attach-label="false" class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false">
<default-constraints anchor="0" fill="3" hsize-policy="3" vsize-policy="3">
<preferred-size height="200" width="200" />
</default-constraints>
</item>
<item auto-create-binding="false" can-attach-label="false" class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false">
<default-constraints anchor="0" fill="3" hsize-policy="3" vsize-policy="3">
<preferred-size height="200" width="200" />
</default-constraints>
</item>
<item auto-create-binding="true" can-attach-label="true" class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false">
<default-constraints anchor="8" fill="1" hsize-policy="6" vsize-policy="0" />
</item>
<item auto-create-binding="true" can-attach-label="false" class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false">
<default-constraints anchor="8" fill="1" hsize-policy="6" vsize-policy="0" />
</item>
<item auto-create-binding="false" can-attach-label="false" class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false">
<default-constraints anchor="0" fill="3" hsize-policy="6" vsize-policy="6" />
</item>
<item auto-create-binding="true" can-attach-label="false" class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false">
<default-constraints anchor="0" fill="1" hsize-policy="6" vsize-policy="0" />
</item>
<item auto-create-binding="false" can-attach-label="false" class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false">
<default-constraints anchor="0" fill="1" hsize-policy="6" vsize-policy="0">
<preferred-size height="20" width="-1" />
</default-constraints>
</item>
<item auto-create-binding="false" can-attach-label="false" class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false">
<default-constraints anchor="0" fill="1" hsize-policy="0" vsize-policy="0" />
</item>
<item auto-create-binding="true" can-attach-label="false" class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false">
<default-constraints anchor="0" fill="2" hsize-policy="0" vsize-policy="6" />
</item>
</group>
</component>
<component name="ProjectModuleManager">
<modules>
<module filepath="$PROJECT_DIR$/prop-bug.iml" fileurl="file://$PROJECT_DIR$/prop-bug.iml" />
</modules>
</component>
<component assert-keyword="true" jdk-15="true" name="ProjectRootManager" project-jdk-name="Sun JDK 1.5.0_07" project-jdk-type="JavaSDK" version="2">
<output url="file://$PROJECT_DIR$/classes" />
</component>
<component name="ProjectRunConfigurationManager" />
<component name="ResourceManagerContainer">
<option name="myResourceBundles">
<value>
<list size="0" />
</value>
</option>
</component>
<component name="RmicSettings">
<option name="IS_EANABLED" value="false" />
<option name="DEBUGGING_INFO" value="true" />
<option name="GENERATE_NO_WARNINGS" value="false" />
<option name="GENERATE_IIOP_STUBS" value="false" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
</component>
<component name="com.intellij.jsf.UserDefinedFacesConfigs">
<option name="USER_DEFINED_CONFIGS">
<value>
<list size="0" />
</value>
</option>
</component>
<component name="libraryTable" />
<component name="uidesigner-configuration">
<option name="INSTRUMENT_CLASSES" value="true" />
<option name="COPY_FORMS_RUNTIME_TO_OUTPUT" value="true" />
<option name="DEFAULT_LAYOUT_MANAGER" value="GridLayoutManager" />
</component>
<UsedPathMacros />
</project>
@@ -0,0 +1 @@
find.this.property=Duplicate Results
@@ -0,0 +1 @@
x.<caret>y=Y
@@ -0,0 +1,2 @@
<error descr="Duplicate property key">xxx</error>=aaa
<error descr="Duplicate property key">xxx</error>=bbb
@@ -0,0 +1,5 @@
\ a\ b\ =x<warning descr="Invalid string escape">\x</warning>
a\n\r\b2 = x\\\n\r v
spaceinthemiddle=a<warning descr="Invalid string escape">\ </warning>b
ii<warning descr="Invalid string escape">\d</warning>nnvalidkey
framingSpaces = \ xxx\ \ \
@@ -0,0 +1,3 @@
ddd=ss
eee=ff
@@ -0,0 +1,2 @@
<warning descr="Unused property">abcd.esadfdsaf</warning>=ddd
used.prop=xcxcd
@@ -0,0 +1,103 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.lang.properties;
import com.intellij.codeInsight.CodeInsightTestCase;
import com.intellij.find.FindManager;
import com.intellij.find.findUsages.FindUsagesHandler;
import com.intellij.find.findUsages.FindUsagesManager;
import com.intellij.find.findUsages.FindUsagesOptions;
import com.intellij.find.findUsages.JavaClassFindUsagesOptions;
import com.intellij.find.impl.FindManagerImpl;
import com.intellij.ide.startup.impl.StartupManagerImpl;
import com.intellij.lang.findUsages.FindUsagesProvider;
import com.intellij.lang.findUsages.LanguageFindUsages;
import com.intellij.lang.properties.psi.Property;
import com.intellij.openapi.application.PluginPathManager;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiNamedElement;
import com.intellij.psi.PsiReference;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.usageView.UsageInfo;
import com.intellij.util.CommonProcessors;
import com.intellij.util.Processor;
/**
* @author Maxim.Mossienko
*/
public class PropertiesFindUsagesTest extends CodeInsightTestCase {
private static final String BASE_PATH = "testData/findUsages/";
@Override
protected String getTestDataPath() {
return PluginPathManager.getPluginHomePath("java-i18n") + "/";
}
private void initProperties() {
((StartupManagerImpl)StartupManager.getInstance(myProject)).runPostStartupActivities();
}
public void testFindUsages() throws Exception {
configureByFile(BASE_PATH+"xx.properties", BASE_PATH);
initProperties();
PsiReference[] references = findReferences();
assertEquals(1, references.length);
assertEquals("X.java", references[0].getElement().getContainingFile().getName());
}
public void testFindUsagesInPropValue() throws Exception {
configureByFile(BASE_PATH+"Y.java", BASE_PATH);
initProperties();
UsageInfo[] usages = findUsages();
assertEquals(1, usages.length);
PsiElement element = usages[0].getElement();
assertEquals("xx.properties", element.getContainingFile().getName());
}
public void testFindUsagesInConditionalExpression() {
configureByFiles(BASE_PATH, BASE_PATH + "conditional.properties", BASE_PATH + "Conditional.java");
initProperties();
PsiElement element = myFile.findElementAt(myEditor.getCaretModel().getOffset());
Property prop = PsiTreeUtil.getNonStrictParentOfType(element, Property.class);
PsiReference[] usages = ReferencesSearch.search(prop).toArray(PsiReference.EMPTY_ARRAY);
assertEquals(2, usages.length);
}
private static void processUsages(final PsiElement element,
final FindUsagesOptions options,
final Processor<UsageInfo> processor) {
FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(element.getProject())).getFindUsagesManager();
FindUsagesHandler handler = findUsagesManager.getFindUsagesHandler(element, false);
assertNotNull(handler);
handler.processElementUsages(element, processor, options);
}
private PsiReference[] findReferences() {
PsiNamedElement namedElement = getElementAtCaret();
GlobalSearchScope searchScope = GlobalSearchScope.allScope(myProject);
return ReferencesSearch.search(namedElement, searchScope, false).toArray(PsiReference.EMPTY_ARRAY);
}
private UsageInfo[] findUsages() {
PsiNamedElement namedElement = getElementAtCaret();
JavaClassFindUsagesOptions options = new JavaClassFindUsagesOptions(getProject());
options.isFieldsUsages=true;
options.isMethodsUsages=true;
options.isUsages=true;
CommonProcessors.CollectProcessor<UsageInfo> processor = new CommonProcessors.CollectProcessor<>();
processUsages(namedElement, options, processor);
return processor.toArray(UsageInfo.EMPTY_ARRAY);
}
private PsiNamedElement getElementAtCaret() {
PsiElement element = myFile.findElementAt(myEditor.getCaretModel().getOffset());
PsiNamedElement namedElement = PsiTreeUtil.getParentOfType(element, PsiNamedElement.class);
FindUsagesProvider provider = LanguageFindUsages.INSTANCE.forLanguage(namedElement.getLanguage());
assertTrue("Cannot find element in caret",provider.canFindUsagesFor(namedElement));
return namedElement;
}
}
@@ -0,0 +1,76 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.lang.properties;
import com.intellij.codeInspection.unused.UnusedPropertyInspection;
import com.intellij.lang.FileASTNode;
import com.intellij.lang.properties.psi.PropertiesFile;
import com.intellij.openapi.application.PluginPathManager;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileFilter;
import com.intellij.psi.PsiManager;
import com.intellij.psi.PsiReference;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.testFramework.PsiTestUtil;
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
import java.io.IOException;
import java.util.Collection;
/**
* @author max
*/
public class PropertiesHighlightingTest extends JavaCodeInsightFixtureTestCase {
@Override
protected String getTestDataPath() {
return PluginPathManager.getPluginHomePath("java-i18n") + "/testData/highlighting";
}
private void doTest(boolean checkWarnings, boolean checkInfos) {
myFixture.configureByFile(getTestName(false) + ".properties");
((CodeInsightTestFixtureImpl)myFixture).setVirtualFileFilter(VirtualFileFilter.NONE);
myFixture.checkHighlighting(checkWarnings, checkInfos, false);
}
public void testDuplicate() { doTest(false, false); }
public void testUnused() {
myFixture.enableInspections(new UnusedPropertyInspection());
myFixture.addClass("class C { String s = \"used.prop\"; }");
doTest(true, false);
}
public void testPropertyUsedInLibrary() throws IOException {
myFixture.enableInspections(new UnusedPropertyInspection());
PsiTestUtil.removeAllRoots(myModule, ModuleRootManager.getInstance(myModule).getSdk());
String libDir = myFixture.getTempDirFixture().findOrCreateDir("lib").getPath();
PsiTestUtil.addLibrary(myModule, "someLib", libDir, new String[]{""}, new String[]{""});
PsiTestUtil.addSourceContentToRoots(myModule, myFixture.getTempDirFixture().findOrCreateDir("src"));
VirtualFile usage = myFixture.addFileToProject("lib/C.java", "class C { String s = \"used.prop\"; }").getVirtualFile();
myFixture.addFileToProject("lib/original.properties", "used.prop=xxx");
ProjectFileIndex index = ProjectFileIndex.SERVICE.getInstance(getProject());
assertTrue(index.isInLibrarySource(usage));
assertTrue(index.isInLibraryClasses(usage));
assertFalse(index.isInSourceContent(usage));
//noinspection UnusedDeclaration,ConstantConditions
FileASTNode node = PsiManager.getInstance(getProject()).findFile(usage).getNode(); // load tree before assertions are enabled
myFixture.configureFromExistingVirtualFile(myFixture.copyFileToProject("Unused.properties", "src/a.properties"));
myFixture.checkHighlighting(true, false, false);
IProperty property = ((PropertiesFile)myFixture.getFile()).getProperties().get(1);
assertEquals("used.prop", property.getName());
Collection<PsiReference> references = ReferencesSearch.search(property.getPsiElement()).findAll();
assertEquals(usage, assertOneElement(references).getElement().getContainingFile().getVirtualFile());
}
public void testOk() { doTest(false, false); }
public void testInvalidEscape() { doTest(true, false); }
}