Merge postfix completion plugin
13
plugins/postfix/.gitignore
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
*.class
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
.idea/workspace.xml
|
||||
.idea/tasks.xml
|
||||
.idea/vcs.xml
|
||||
.DS_Store
|
||||
|
||||
out/
|
||||
1
plugins/postfix/.idea/.name
generated
Normal file
@@ -0,0 +1 @@
|
||||
intellij-postfix
|
||||
422
plugins/postfix/.idea/codeStyleSettings.xml
generated
Normal file
@@ -0,0 +1,422 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectCodeStyleSettingsManager">
|
||||
<option name="PER_PROJECT_SETTINGS">
|
||||
<value>
|
||||
<option name="OTHER_INDENT_OPTIONS">
|
||||
<value>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
<option name="TAB_SIZE" value="8" />
|
||||
<option name="USE_TAB_CHARACTER" value="false" />
|
||||
<option name="SMART_TABS" value="false" />
|
||||
<option name="LABEL_INDENT_SIZE" value="0" />
|
||||
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
|
||||
<option name="USE_RELATIVE_INDENTS" value="false" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="LINE_SEPARATOR" value=" " />
|
||||
<option name="FIELD_NAME_PREFIX" value="my" />
|
||||
<option name="STATIC_FIELD_NAME_PREFIX" value="our" />
|
||||
<option name="PREFER_LONGER_NAMES" value="false" />
|
||||
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
|
||||
<value>
|
||||
<package name="java.awt" withSubpackages="false" static="false" />
|
||||
<package name="javax.tools" withSubpackages="true" static="false" />
|
||||
<package name="javax.swing" withSubpackages="false" static="false" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="STATIC_METHODS_ORDER_WEIGHT" value="5" />
|
||||
<option name="METHODS_ORDER_WEIGHT" value="4" />
|
||||
<option name="RIGHT_MARGIN" value="140" />
|
||||
<XML>
|
||||
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
||||
</XML>
|
||||
<codeStyleSettings language="CFML">
|
||||
<option name="ELSE_ON_NEW_LINE" value="true" />
|
||||
<option name="WHILE_ON_NEW_LINE" value="true" />
|
||||
<option name="CATCH_ON_NEW_LINE" value="true" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
||||
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
|
||||
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="5" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="5" />
|
||||
<option name="ASSIGNMENT_WRAP" value="1" />
|
||||
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="ECMA Script Level 4">
|
||||
<option name="ELSE_ON_NEW_LINE" value="true" />
|
||||
<option name="WHILE_ON_NEW_LINE" value="true" />
|
||||
<option name="CATCH_ON_NEW_LINE" value="true" />
|
||||
<option name="FINALLY_ON_NEW_LINE" value="true" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
||||
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
|
||||
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
|
||||
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="5" />
|
||||
<option name="EXTENDS_LIST_WRAP" value="1" />
|
||||
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="5" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||
<option name="ASSIGNMENT_WRAP" value="1" />
|
||||
<option name="IF_BRACE_FORCE" value="1" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="1" />
|
||||
<option name="WHILE_BRACE_FORCE" value="1" />
|
||||
<option name="FOR_BRACE_FORCE" value="1" />
|
||||
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Groovy">
|
||||
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
|
||||
<option name="ELSE_ON_NEW_LINE" value="true" />
|
||||
<option name="CATCH_ON_NEW_LINE" value="true" />
|
||||
<option name="FINALLY_ON_NEW_LINE" value="true" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
||||
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
|
||||
<option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" />
|
||||
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
|
||||
<option name="ALIGN_MULTILINE_THROWS_LIST" value="true" />
|
||||
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
|
||||
<option name="SPACE_AFTER_TYPE_CAST" value="false" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="5" />
|
||||
<option name="EXTENDS_LIST_WRAP" value="1" />
|
||||
<option name="THROWS_LIST_WRAP" value="5" />
|
||||
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
|
||||
<option name="THROWS_KEYWORD_WRAP" value="1" />
|
||||
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="5" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="5" />
|
||||
<option name="ASSIGNMENT_WRAP" value="1" />
|
||||
<option name="IF_BRACE_FORCE" value="1" />
|
||||
<option name="WHILE_BRACE_FORCE" value="1" />
|
||||
<option name="FOR_BRACE_FORCE" value="1" />
|
||||
<option name="FIELD_ANNOTATION_WRAP" value="0" />
|
||||
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="8" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="HTML">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
<option name="TAB_SIZE" value="8" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JAVA">
|
||||
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
|
||||
<option name="BLOCK_COMMENT_AT_FIRST_COLUMN" value="false" />
|
||||
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
|
||||
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
|
||||
<option name="ELSE_ON_NEW_LINE" value="true" />
|
||||
<option name="WHILE_ON_NEW_LINE" value="true" />
|
||||
<option name="CATCH_ON_NEW_LINE" value="true" />
|
||||
<option name="FINALLY_ON_NEW_LINE" value="true" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
||||
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
|
||||
<option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" />
|
||||
<option name="ALIGN_MULTILINE_THROWS_LIST" value="true" />
|
||||
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
|
||||
<option name="ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION" value="true" />
|
||||
<option name="SPACE_WITHIN_BRACES" value="true" />
|
||||
<option name="SPACE_AFTER_TYPE_CAST" value="false" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="5" />
|
||||
<option name="EXTENDS_LIST_WRAP" value="1" />
|
||||
<option name="THROWS_LIST_WRAP" value="5" />
|
||||
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
|
||||
<option name="THROWS_KEYWORD_WRAP" value="1" />
|
||||
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="5" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="5" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||
<option name="ASSIGNMENT_WRAP" value="1" />
|
||||
<option name="IF_BRACE_FORCE" value="1" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="1" />
|
||||
<option name="WHILE_BRACE_FORCE" value="1" />
|
||||
<option name="FOR_BRACE_FORCE" value="1" />
|
||||
<option name="FIELD_ANNOTATION_WRAP" value="0" />
|
||||
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="8" />
|
||||
</indentOptions>
|
||||
<arrangement>
|
||||
<groups>
|
||||
<group>
|
||||
<type>GETTERS_AND_SETTERS</type>
|
||||
<order>KEEP</order>
|
||||
</group>
|
||||
</groups>
|
||||
<rules>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD />
|
||||
<FINAL />
|
||||
<PUBLIC />
|
||||
<STATIC />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD />
|
||||
<FINAL />
|
||||
<PROTECTED />
|
||||
<STATIC />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD />
|
||||
<FINAL />
|
||||
<PACKAGE_PRIVATE />
|
||||
<STATIC />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD />
|
||||
<FINAL />
|
||||
<PRIVATE />
|
||||
<STATIC />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD />
|
||||
<PUBLIC />
|
||||
<STATIC />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD />
|
||||
<PROTECTED />
|
||||
<STATIC />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD />
|
||||
<PACKAGE_PRIVATE />
|
||||
<STATIC />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD />
|
||||
<PRIVATE />
|
||||
<STATIC />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD />
|
||||
<FINAL />
|
||||
<PUBLIC />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD />
|
||||
<FINAL />
|
||||
<PROTECTED />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD />
|
||||
<FINAL />
|
||||
<PACKAGE_PRIVATE />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD />
|
||||
<FINAL />
|
||||
<PRIVATE />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD />
|
||||
<PUBLIC />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD />
|
||||
<PROTECTED />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD />
|
||||
<PACKAGE_PRIVATE />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD />
|
||||
<PRIVATE />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<FIELD />
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<CONSTRUCTOR />
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<METHOD />
|
||||
<STATIC />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<METHOD />
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<ENUM />
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<INTERFACE />
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<CLASS />
|
||||
<STATIC />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
<rule>
|
||||
<match>
|
||||
<CLASS />
|
||||
</match>
|
||||
</rule>
|
||||
</rules>
|
||||
</arrangement>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JavaScript">
|
||||
<option name="ELSE_ON_NEW_LINE" value="true" />
|
||||
<option name="WHILE_ON_NEW_LINE" value="true" />
|
||||
<option name="CATCH_ON_NEW_LINE" value="true" />
|
||||
<option name="FINALLY_ON_NEW_LINE" value="true" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
||||
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
|
||||
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="5" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="5" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||
<option name="ASSIGNMENT_WRAP" value="1" />
|
||||
<option name="IF_BRACE_FORCE" value="1" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="1" />
|
||||
<option name="WHILE_BRACE_FORCE" value="1" />
|
||||
<option name="FOR_BRACE_FORCE" value="1" />
|
||||
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="PHP">
|
||||
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
|
||||
<option name="CLASS_BRACE_STYLE" value="1" />
|
||||
<option name="METHOD_BRACE_STYLE" value="1" />
|
||||
<option name="ELSE_ON_NEW_LINE" value="true" />
|
||||
<option name="WHILE_ON_NEW_LINE" value="true" />
|
||||
<option name="CATCH_ON_NEW_LINE" value="true" />
|
||||
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
|
||||
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="5" />
|
||||
<option name="EXTENDS_LIST_WRAP" value="1" />
|
||||
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||
<option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="5" />
|
||||
<option name="IF_BRACE_FORCE" value="1" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="1" />
|
||||
<option name="WHILE_BRACE_FORCE" value="1" />
|
||||
<option name="FOR_BRACE_FORCE" value="1" />
|
||||
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Python">
|
||||
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="XML">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
<option name="TAB_SIZE" value="8" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
</value>
|
||||
</option>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
27
plugins/postfix/.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
<excludeFromCompile>
|
||||
<directory url="file://$PROJECT_DIR$/testData" includeSubdirectories="true" />
|
||||
</excludeFromCompile>
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
<entry name="!?*.class" />
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.scala" />
|
||||
<entry name="!?*.flex" />
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel target="1.6" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
3
plugins/postfix/.idea/copyright/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,3 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="" />
|
||||
</component>
|
||||
7
plugins/postfix/.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
817
plugins/postfix/.idea/inspectionProfiles/idea_default.xml
generated
Normal file
@@ -0,0 +1,817 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0" is_locked="false">
|
||||
<option name="myName" value="idea.default" />
|
||||
<option name="myLocal" value="false" />
|
||||
<inspection_tool class="AbstractMethodCallInConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AndroidDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidElementNotAllowed" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintAdapterViewChildren" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintAllowBackup" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintAlwaysShowAction" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintButtonCase" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintButtonOrder" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintButtonStyle" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintCommitPrefEdits" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintContentDescription" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintCutPasteId" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintDisableBaselineAlignment" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintDrawAllocation" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintDuplicateActivity" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintDuplicateDefinition" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintDuplicateIds" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintDuplicateIncludedIds" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintDuplicateUsesFeature" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintEnforceUTF8" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintExportedContentProvider" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintExportedReceiver" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintExportedService" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintExtraText" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintExtraTranslation" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintGifUsage" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintGrantAllUris" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintGridLayout" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintHardcodedDebugMode" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintHardcodedText" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintIconColors" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintIconDensities" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintIconDipSize" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintIconDuplicates" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintIconDuplicatesConfig" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintIconExtension" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintIconLauncherShape" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintIconLocation" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintIconMissingDensityFolder" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintIconMixedNinePatch" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintIconNoDpi" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintIconXmlAndPng" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintIllegalResourceRef" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintInOrMmUsage" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintInconsistentArrays" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintInconsistentLayout" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintInefficientWeight" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintInlinedApi" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintInnerclassSeparator" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintInvalidId" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintLabelFor" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintLibraryCustomView" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintLocalSuppress" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintMangledCRLF" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintManifestOrder" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintMenuTitle" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintMergeRootFrame" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintMissingApplicationIcon" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintMissingId" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintMissingPrefix" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintMissingQuantity" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintMissingTranslation" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintMissingVersion" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintMultipleUsesSdk" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintNestedScrolling" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintNestedWeights" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintNewApi" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintNotSibling" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintObsoleteLayoutParam" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintOldTargetApi" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintOrientation" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintOverdraw" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintOverride" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintPackagedPrivateKey" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintPrivateResource" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintProguard" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintProguardSplit" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintProtectedPermissions" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintPxUsage" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintRegistered" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintRequiredSize" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintResAuto" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintResourceAsColor" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintScrollViewCount" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintScrollViewSize" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintSdCardPath" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintServiceCast" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintSetJavaScriptEnabled" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintShowToast" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintSmallSp" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintSpUsage" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintStateListReachable" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintStringFormatCount" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintStringFormatInvalid" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintStringFormatMatches" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintStyleCycle" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintSuspicious0dp" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintSuspiciousImport" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintTextFields" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintTextViewEdits" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintTooDeepLayout" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintTooManyViews" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintTypographyDashes" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintTypographyEllipsis" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintTypographyFractions" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintTypographyOther" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintTypos" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintUniquePermission" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintUnknownId" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintUnknownIdInLayout" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintUnlocalizedSms" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintUnusedQuantity" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintUnusedResources" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintUseCompoundDrawables" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintUseSparseArrays" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintUseValueOf" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintUselessLeaf" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintUselessParent" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintUsesMinSdkAttributes" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintWorldReadableFiles" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintWorldWriteableFiles" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintWrongCase" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintWrongFolder" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintWrongViewCast" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidMissingOnClickHandler" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidNonConstantResIdsInSwitch" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidUnknownAttribute" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AppEngineForbiddenCode" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="ArchaicSystemPropertyAccess" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="ArgNamesErrorsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="ArgNamesWarningsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AroundAdviceStyleInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AssignmentToForLoopParameter" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="m_checkForeachParameters" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="AssignmentToStaticFieldFromInstanceMethod" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<scope name="Tests" level="WARNING" enabled="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="AssignmentUsedAsCondition" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="AutoBoxing" enabled="true" level="WARNING" enabled_by_default="false">
|
||||
<scope name="runtime.classes" level="WARNING" enabled="true">
|
||||
<option name="ignoreAddedToCollection" value="false" />
|
||||
</scope>
|
||||
<option name="ignoreAddedToCollection" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="AutoUnboxing" enabled="true" level="WARNING" enabled_by_default="false">
|
||||
<scope name="runtime.classes" level="WARNING" enabled="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="BadExpressionStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="BeforeClassOrAfterClassIsPublicStaticVoidNoArg" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="BeforeOrAfterIsPublicVoidNoArg" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="BindingAnnotationWithoutInject" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="BooleanMethodIsAlwaysInverted" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="BpmnConfigDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="BuildoutUnresolvedPartInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="BusyWait" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="BvConfigDomInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="BvConstraintMappingsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="CStyleArrayDeclaration" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="CallerJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="CastConflictsWithInstanceof" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="CastToIncompatibleInterface" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="CdiDecoratorInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="CdiDisposerMethodInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="CdiDomBeans" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="CdiInjectInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="CdiInjectionPointsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="CdiInterceptorInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="CdiManagedBeanInconsistencyInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="CdiNormalScopeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="CdiObservesInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="CdiSpecializesInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="CdiStereotypeInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="CdiStereotypeRestrictionsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="CdiTypedAnnotationInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="CdiUnproxyableBeanTypesInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="CfmlFileReference" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="CfmlReferenceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ChainedEquality" enabled="false" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="CheckNodeTest" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ClassNameSameAsAncestorName" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="CloneCallsSuperClone" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="CloneDeclaresCloneNotSupported" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="CommaExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ComparisonOfShortAndChar" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="ConditionalExpressionWithIdenticalBranches" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="ConflictingAnnotations" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ConfusingOctalEscape" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="ConstantConditionalExpression" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<scope name="Tests" level="WARNING" enabled="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="ConstantConditionalExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ConstantConditions" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<scope name="runtime.classes" level="WARNING" enabled="false">
|
||||
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" />
|
||||
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
|
||||
</scope>
|
||||
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" />
|
||||
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="ConstantIfStatement" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<scope name="Tests" level="WARNING" enabled="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="ConstantIfStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ConstraintValidatorCreator" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ContinueOrBreakFromFinallyBlock" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ContinueOrBreakFromFinallyBlockJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="CovariantCompareTo" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="CovariantEquals" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="DeclareParentsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="DeprecatedGemInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DjangoBrokenLineCommentInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DjangoCloseTagInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DjangoUnresolvedFilterInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DjangoUnresolvedLoadInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DjangoUnresolvedStaticReferenceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DjangoUnresolvedTagInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DjangoUnresolvedTemplateReferenceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DoubleCheckedLocking" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoreOnVolatileVariables" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="DuplicateCaseLabelJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DuplicateCondition" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoreMethodCalls" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="DuplicatedBlockNamesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="EmptyStatementBodyJS" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="m_reportEmptyBlocks" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="EmptySynchronizedStatement" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="EnumSwitchStatementWhichMissesCases" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoreSwitchStatementsWithDefault" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="ExceptionCaughtLocallyJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ExceptionNameDoesntEndWithException" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="ExtendsTagPositionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="FallthroughInSwitchStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="FieldAccessedSynchronizedAndUnsynchronized" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="countGettersAndSetters" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="FieldMayBeStatic" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="Finalize" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoreTrivialFinalizers" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="FinalizeNotProtected" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="ForLoopReplaceableByWhile" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="m_ignoreLoopsWithoutConditions" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="ForLoopThatDoesntUseLoopVariable" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="FunctionWithInconsistentReturnsJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="GemInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="Geronimo" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="GlassFish" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="HardcodedActionUrl" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="HardwiredNamespacePrefix" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IOResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredTypesString" value="java.io.ByteArrayOutputStream,java.io.ByteArrayInputStream,java.io.StringBufferInputStream,java.io.CharArrayWriter,java.io.CharArrayReader,java.io.StringWriter,java.io.StringReader" />
|
||||
<option name="insideTryAllowed" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="IfStatementWithIdenticalBranches" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="ImplicitTypeConversion" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="BITS" value="1720" />
|
||||
<option name="FLAG_EXPLICIT_CONVERSION" value="true" />
|
||||
<option name="IGNORE_NODESET_TO_BOOLEAN_VIA_STRING" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="IncompatibleMaskJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="IndexZeroUsage" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="InfiniteLoopJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="InfiniteRecursionJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="InnerClassMayBeStatic" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="InspectionDescriptionNotFoundInspection" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="InstanceofCatchParameter" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="InstanceofIncompatibleInterface" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="InterceptionAnnotationWithoutRuntimeRetention" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="InvalidImplementedBy" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="InvalidProvidedBy" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="InvalidRequestParameters" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JBoss" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="JSDeprecatedSymbols" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSDuplicatedDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSFieldCanBeLocal" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSImplicitlyInternalDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSLastCommaInArrayLiteral" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSLastCommaInObjectLiteral" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="JSMethodCanBeStatic" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSMismatchedCollectionQueryUpdate" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="queries" value="trace,write" />
|
||||
<option name="updates" value="pop,push,shift,splice,unshift" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="JSPotentiallyInvalidConstructorUsage" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="myConsiderUppercaseFunctionsToBeConstructors" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="JSPotentiallyInvalidTargetOfIndexedPropertyAccess" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSPotentiallyInvalidUsageOfThis" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSReferencingMutableVariableFromClosure" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSSuspiciousNameCombination" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<group names="x,width,left,right" />
|
||||
<group names="y,height,top,bottom" />
|
||||
<exclude classes="Math" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="JSUndeclaredVariable" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSUnfilteredForInLoop" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSUnnecessarySemicolon" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSUnresolvedFunction" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSUnresolvedLibraryURL" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSUnresolvedVariable" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSUntypedDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSUnusedGlobalSymbols" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSUnusedLocalSymbols" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSValidateJSON" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="JSValidateTypes" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JUnitTestClassNamingConvention" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="m_regex" value="[A-Z][A-Za-z0-9]*Test" />
|
||||
<option name="m_minLength" value="8" />
|
||||
<option name="m_maxLength" value="64" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="false">
|
||||
<scope name="Tests" level="WARNING" enabled="false">
|
||||
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="INNER_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="METHOD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="FIELD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="IGNORE_DEPRECATED" value="false" />
|
||||
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||
<option name="myAdditionalJavadocTags" value="" />
|
||||
</scope>
|
||||
<scope name="idea openapi" level="WARNING" enabled="true">
|
||||
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="INNER_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="METHOD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="FIELD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="IGNORE_DEPRECATED" value="true" />
|
||||
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||
<option name="myAdditionalJavadocTags" value="" />
|
||||
</scope>
|
||||
<scope name="runtime.classes" level="WARNING" enabled="true">
|
||||
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="INNER_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="METHOD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="FIELD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="IGNORE_DEPRECATED" value="false" />
|
||||
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||
<option name="myAdditionalJavadocTags" value="" />
|
||||
</scope>
|
||||
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="INNER_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="METHOD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="FIELD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="IGNORE_DEPRECATED" value="false" />
|
||||
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||
<option name="myAdditionalJavadocTags" value="" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="JavaFxDefaultTag" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JavaFxUnresolvedFxIdReference" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JavaFxUnresolvedStyleClassReference" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JavaFxUnusedImports" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JavadocReference" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<scope name="Tests" level="ERROR" enabled="false" />
|
||||
<scope name="idea openapi" level="WARNING" enabled="true" />
|
||||
<scope name="runtime.classes" level="ERROR" enabled="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="LoopStatementThatDoesntLoopJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MakoArgumentListInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MavenDuplicateDependenciesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MavenModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="MethodMayBeStatic" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="m_onlyPrivateOrFinal" value="true" />
|
||||
<option name="m_ignoreEmptyMethods" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="MethodNamesDifferOnlyByCase" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="MethodOverloadsParentMethod" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="MethodOverridesStaticMethod" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="MinMaxValuesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MinitestFrameworkSupportInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MisspelledCompareTo" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="MisspelledEquals" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="MisspelledHashcode" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="MisspelledSetUp" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="MisspelledTearDown" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="MisspelledToString" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="MultipleBindingAnnotations" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MultipleInjectedConstructorsForClass" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MultipleTypedDeclaration" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="NestedSynchronizedStatement" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="NoExplicitFinalizeCalls" enabled="true" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="NonExceptionNameEndsWithException" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="NonStaticFinalLogger" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<scope name="Tests" level="WARNING" enabled="false">
|
||||
<option name="loggerClassName" value="java.util.logging.Logger" />
|
||||
</scope>
|
||||
<option name="loggerClassName" value="java.util.logging.Logger" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="NonSynchronizedMethodOverridesSynchronizedMethod" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="ObjectEqualsNull" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ObjectNotify" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="ObsoleteCollection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoreRequiredObsoleteCollectionTypes" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="OctalIntegerJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PageflowModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="PagesModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="PointcutMethodStyleInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PointlessArithmeticExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PointlessBinding" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PointlessBitwiseExpressionJS" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="m_ignoreExpressionsContainingConstants" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PointlessBooleanExpression" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="m_ignoreExpressionsContainingConstants" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PointlessBooleanExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ProtectedMemberInFinalClass" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="PublicFieldAccessedInSynchronizedContext" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="PyArgumentEqualDefaultInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyArgumentListInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyAugmentAssignmentInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyBroadExceptionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyByteLiteralInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyCallByClassInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyCallingNonCallableInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyChainedComparisonsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyComparisonWithNoneInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyCompatibilityInspection" enabled="false" level="ERROR" enabled_by_default="false">
|
||||
<option name="ourVersions">
|
||||
<value>
|
||||
<list size="0" />
|
||||
</value>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyDecoratorInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyDefaultArgumentInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyDeprecatedModulesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyDeprecationInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyDictCreationInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyDictDuplicateKeysInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyExceptClausesOrderInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyExceptionInheritInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyFromFutureImportInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyInconsistentIndentationInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyInitNewSignatureInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyListCreationInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyMethodFirstArgAssignmentInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyMethodOverridingInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyMethodParametersInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyMissingConstructorInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyNestedDecoratorsInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyOldStyleClassesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyPropertyAccessInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyPropertyDefinitionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyRaisingNewStyleClassInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyRedundantParenthesesInspection" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="myIgnorePercOperator" value="false" />
|
||||
<option name="myIgnoreTupleInReturn" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyReturnFromInitInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PySetFunctionToLiteralInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PySimplifyBooleanCheckInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PySingleQuotedDocstringInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyStatementEffectInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyStringExceptionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyStringFormatInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PySuperArgumentsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyTrailingSemicolonInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyTupleAssignmentBalanceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyTupleItemAssignmentInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyTypeCheckerInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyUnboundLocalVariableInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyUnnecessaryBackslashInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyUnreachableCodeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="ignoredIdentifiers">
|
||||
<value>
|
||||
<list size="0" />
|
||||
</value>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyUnusedLocalInspection" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="ignoreTupleUnpacking" value="true" />
|
||||
<option name="ignoreLambdaParameters" value="true" />
|
||||
<option name="ignoreLoopIterationVariables" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="Query_bound_parameters" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="Query_index_required" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="Query_restricted" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="RedundantCast" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="IGNORE_ANNOTATED_METHODS" value="true" />
|
||||
<option name="IGNORE_SUSPICIOUS_METHOD_CALLS" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="RedundantScopeBinding" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="RedundantToBinding" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="RedundantToProviderBinding" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="RedundantTypeConversion" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="CHECK_ANY" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="ReplaceAssignmentWithOperatorAssignment" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoreLazyOperators" value="true" />
|
||||
<option name="ignoreObscureOperators" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="ReservedWordUsedAsNameJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="Restricted_Python_calls" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ReturnFromFinallyBlockJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SSBasedInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<searchConfiguration name="SwingUtilities.invokeLater" text="SwingUtilities.invokeLater($runnable$)" recursive="false" caseInsensitive="false" type="JAVA">
|
||||
<constraint name="Instance" regexp="SwingUtilities" minCount="0" target="true" within="" contains="" />
|
||||
<constraint name="MethodCall" within="" contains="" />
|
||||
<constraint name="Parameter" minCount="0" maxCount="2147483647" within="" contains="" />
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="runnable" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
<replaceConfiguration name="DirectCallOfDispose" text="$Instance$.dispose()" recursive="false" caseInsensitive="false" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="Disposer.dispose($Instance$)">
|
||||
<constraint name="Instance" regexp="super" nameOfExprType="Disposable" withinHierarchy="true" exprTypeWithinHierarchy="true" minCount="0" negateName="true" within="" contains="" />
|
||||
<constraint name="MethodCall" target="true" within="" contains="" />
|
||||
<constraint name="Parameter" minCount="0" maxCount="2147483647" within="" contains="" />
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
</replaceConfiguration>
|
||||
<replaceConfiguration name="new Object[0]" text="new Object[0]" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.EMPTY_OBJECT_ARRAY" />
|
||||
<replaceConfiguration name="new String[0]" text="new String[0]" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.EMPTY_STRING_ARRAY" />
|
||||
<replaceConfiguration name="new Class[0]" text="new Class[0]" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.EMPTY_CLASS_ARRAY" />
|
||||
<replaceConfiguration name="Log.error" text="$LOG$.assertTrue(false, $e$)" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="$LOG$.error($e$)">
|
||||
<constraint name="e" within="" contains="" />
|
||||
<constraint name="LOG" within="" contains="" />
|
||||
</replaceConfiguration>
|
||||
<replaceConfiguration name="toStringArray" text="$collection$.toArray(new String[$collection$.size()])" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.toStringArray($collection$)">
|
||||
<constraint name="collection" within="" contains="" />
|
||||
</replaceConfiguration>
|
||||
<replaceConfiguration name="toObjectArray" text="$collection$.toArray(new Object[$collection$.size()])" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.toObjectArray($collection$)">
|
||||
<constraint name="collection" within="" contains="" />
|
||||
</replaceConfiguration>
|
||||
<replaceConfiguration name="toStringArray0" text="$collection$.toArray(new String[0])" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.toStringArray($collection$)">
|
||||
<constraint name="collection" within="" contains="" />
|
||||
</replaceConfiguration>
|
||||
<replaceConfiguration name="toObjectArray0" text="$collection$.toArray(new Object[0])" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.toObjectArray($collection$)">
|
||||
<constraint name="collection" within="" contains="" />
|
||||
</replaceConfiguration>
|
||||
<replaceConfiguration name="toStringArray00" text="$collection$.toArray(ArrayUtil.EMPTY_STRING_ARRAY)" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.toStringArray($collection$)">
|
||||
<constraint name="collection" within="" contains="" />
|
||||
</replaceConfiguration>
|
||||
<replaceConfiguration name="toObjectArray00" text="$collection$.toArray(ArrayUtil.EMPTY_OBJECT_ARRAY)" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.util.ArrayUtil.toObjectArray($collection$)">
|
||||
<constraint name="collection" within="" contains="" />
|
||||
</replaceConfiguration>
|
||||
<replaceConfiguration name="File.createTempFile" text="java.io.File.createTempFile($prefix$, $suffix$)" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.openapi.util.io.FileUtil.createTempFile($prefix$, $suffix$)">
|
||||
<constraint name="prefix" within="" contains="" />
|
||||
<constraint name="suffix" within="" contains="" />
|
||||
</replaceConfiguration>
|
||||
<replaceConfiguration name="File.createTempFile(dir)" text="java.io.File.createTempFile($prefix$, $suffix$, $dir$)" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="com.intellij.openapi.util.io.FileUtil.createTempFile($dir$, $prefix$, $suffix$, true)">
|
||||
<constraint name="prefix" within="" contains="" />
|
||||
<constraint name="suffix" within="" contains="" />
|
||||
<constraint name="dir" within="" contains="" />
|
||||
</replaceConfiguration>
|
||||
<searchConfiguration name="Use RecursionManager?" text="class $Class$ { ThreadLocal<$FieldType$> $FieldName$ = $Init$; }" recursive="false" caseInsensitive="false" type="JAVA">
|
||||
<constraint name="Class" script="""" within="" contains="" />
|
||||
<constraint name="FieldType" script="""" regexp="Collection" withinHierarchy="true" maxCount="2147483647" target="true" wholeWordsOnly="true" within="" contains="" />
|
||||
<constraint name="FieldName" script="""" maxCount="2147483647" within="" contains="" />
|
||||
<constraint name="Init" script="""" minCount="0" maxCount="2147483647" within="" contains="" />
|
||||
<constraint name="__context__" script="""" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
<searchConfiguration name="use NotificationGroup.toolWindowGroup().createNotification().notify() instead" text="$Instance$.notifyByBalloon($Parameter$)" recursive="false" caseInsensitive="false" type="JAVA">
|
||||
<constraint name="Instance" script="""" nameOfExprType="com.intellij.openapi.wm.ToolWindowManager" exprTypeWithinHierarchy="true" minCount="0" within="" contains="" />
|
||||
<constraint name="MethodCall" target="true" within="" contains="" />
|
||||
<constraint name="Parameter" minCount="0" maxCount="2147483647" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
<replaceConfiguration name="PsiManager.getInstance(psiElement.getProject())" text="com.intellij.psi.PsiManager.getInstance($psiElement$.getProject())" recursive="false" caseInsensitive="true" type="JAVA" reformatAccordingToStyle="true" shortenFQN="true" replacement="$psiElement$.getManager()">
|
||||
<constraint name="psiElement" script="""" nameOfExprType="com\.intellij\.psi\.PsiElement" exprTypeWithinHierarchy="true" within="" contains="" />
|
||||
</replaceConfiguration>
|
||||
<searchConfiguration name="String.getBytes() is current locale-dependant, use String.getBytes(Charset) instead" text="$s$.getBytes()" recursive="false" caseInsensitive="true" type="JAVA">
|
||||
<constraint name="String" within="" contains="" />
|
||||
<constraint name="myTexts" within="" contains="" />
|
||||
<constraint name="s" script="""" nameOfExprType="java.lang.String" exprTypeWithinHierarchy="true" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="SeamAnnotationIncorrectSignatureInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="SeamAnnotationsInconsistencyInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="SeamBijectionIllegalScopeParameterInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="SeamBijectionTypeMismatchInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="SeamBijectionUndefinedContextVariableInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SeamDomModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="SeamDuplicateComponentsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="SeamIllegalComponentScopeInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="SeamJamComponentInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="SessionScopedInjectsRequestScoped" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SetReplaceableByEnumSet" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="SetupCallsSuperSetup" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="SetupIsPublicVoidNoArg" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="ShiftOutOfRangeJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SillyAssignmentJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SimplifiableIfStatement" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="Since15" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="SingletonInjectsScoped" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SocketResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="insideTryAllowed" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="SpringFacetCodeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="SpringFacetInspection" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="checkTestFiles" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="SpringFacetProgrammaticInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="StaticCallOnSubclass" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="StaticFieldReferenceOnSubclass" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="StaticSuite" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="StringConstructor" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="ignoreSubstringArguments" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="StringEquality" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="StringEqualsEmptyString" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="Struts2ModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="StrutsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="StrutsTilesInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="StrutsValidatorFormInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="StrutsValidatorInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="SwitchStatementWithConfusingDeclaration" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="SynchronizeOnThis" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="SystemOutErr" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<scope name="Tests" level="WARNING" enabled="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="TeardownCallsSuperTeardown" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="TeardownIsPublicVoidNoArg" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="TelReferencesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="TestCaseWithConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="TestCaseWithNoTestMethods" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoreSupers" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="TestMethodIsPublicVoidNoArg" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="TestOnlyProblems" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="TextLabelInSwitchStatement" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="ThisExpressionReferencesGlobalObjectJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ThreadDumpStack" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<scope name="Tests" level="WARNING" enabled="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="ThreadRun" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="ThreadStartInConstruction" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="ThrowFromFinallyBlockJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="ThrowablePrintStackTrace" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<scope name="Tests" level="WARNING" enabled="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="TrivialConditionalJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="TrivialIf" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="TrivialIfJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="TrivialStringConcatenation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="UNCHECKED_WARNING" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="IGNORE_UNCHECKED_ASSIGNMENT" value="false" />
|
||||
<option name="IGNORE_UNCHECKED_GENERICS_ARRAY_CREATION" value="true" />
|
||||
<option name="IGNORE_UNCHECKED_CALL" value="false" />
|
||||
<option name="IGNORE_UNCHECKED_CAST" value="false" />
|
||||
<option name="IGNORE_UNCHECKED_OVERRIDING" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="UndeclaredTests" enabled="true" level="WARNING" enabled_by_default="false">
|
||||
<scope name="Tests" level="WARNING" enabled="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="UninstantiableBinding" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UninstantiableImplementedByClass" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UninstantiableProvidedByClass" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnnecessarilyQualifiedStaticUsage" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<scope name="Tests" level="WARNING" enabled="false">
|
||||
<option name="m_ignoreStaticFieldAccesses" value="false" />
|
||||
<option name="m_ignoreStaticMethodCalls" value="false" />
|
||||
<option name="m_ignoreStaticAccessFromStaticContext" value="false" />
|
||||
</scope>
|
||||
<option name="m_ignoreStaticFieldAccesses" value="false" />
|
||||
<option name="m_ignoreStaticMethodCalls" value="false" />
|
||||
<option name="m_ignoreStaticAccessFromStaticContext" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="UnnecessarilyQualifiedStaticallyImportedElement" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="UnnecessaryBoxing" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnnecessaryContinueJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnnecessaryEnumModifier" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="UnnecessaryFullyQualifiedName" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<scope name="Tests" level="WARNING" enabled="false">
|
||||
<option name="m_ignoreJavadoc" value="true" />
|
||||
</scope>
|
||||
<option name="m_ignoreJavadoc" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="UnnecessaryInterfaceModifier" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="UnnecessaryLabelJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnnecessaryLabelOnBreakStatement" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnnecessaryLabelOnBreakStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnnecessaryLabelOnContinueStatement" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnnecessaryLabelOnContinueStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnnecessaryLocalVariable" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="m_ignoreImmediatelyReturnedVariables" value="false" />
|
||||
<option name="m_ignoreAnnotatedVariables" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="UnnecessaryLocalVariableJS" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="m_ignoreImmediatelyReturnedVariables" value="false" />
|
||||
<option name="m_ignoreAnnotatedVariables" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="UnnecessaryQualifierForThis" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="UnnecessaryReturnJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnnecessaryStaticInjection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnnecessaryUnboxing" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnreachableCodeJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnresolvedReference" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="UnterminatedStatementJS" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="ignoreSemicolonAtEndOfBlock" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="UseJBColor" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<scope name="Tests" level="WARNING" enabled="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="UseOfPropertiesAsHashtable" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="UtilityClassWithPublicConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="ValidatorConfigModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="ValidatorModelInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="WaitNotInLoop" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="WaitNotInSynchronizedContext" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="WaitWhileHoldingTwoLocks" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="WeakerAccess" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS" value="false" />
|
||||
<option name="SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES" value="false" />
|
||||
<option name="SUGGEST_PRIVATE_FOR_INNERS" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="Weblogic" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="WhileLoopSpinsOnField" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoreNonEmtpyLoops" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="WithStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="XsltDeclarations" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="XsltTemplateInvocation" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="XsltUnusedDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="XsltVariableShadowing" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="osmorcClassInDefaultPackage" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="osmorcNonOsgiMavenDependency" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="osmorcUnknownManifestPackage" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="osmorcUnregisteredActivator" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="osmorcWrongImportPackage" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
</profile>
|
||||
</component>
|
||||
7
plugins/postfix/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="PROJECT_PROFILE" value="idea.default" />
|
||||
<option name="USE_PROJECT_PROFILE" value="true" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
10
plugins/postfix/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="IDEA sdk" project-jdk-type="IDEA JDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
9
plugins/postfix/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/intellij-postfix.iml" filepath="$PROJECT_DIR$/intellij-postfix.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
27
plugins/postfix/.idea/runConfigurations/All_tests.xml
generated
Normal file
@@ -0,0 +1,27 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="All tests" type="JUnit" factoryName="JUnit">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<module name="intellij-postfix" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<option name="PACKAGE_NAME" value="org.jetbrains.postfixCompletion" />
|
||||
<option name="MAIN_CLASS_NAME" value="" />
|
||||
<option name="METHOD_NAME" value="" />
|
||||
<option name="TEST_OBJECT" value="package" />
|
||||
<option name="VM_PARAMETERS" value="-ea" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="moduleWithDependencies" />
|
||||
</option>
|
||||
<envs />
|
||||
<patterns />
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<RunnerSettings RunnerId="teamcity.remote.debug.runner" />
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="teamcity.remote.debug.runner" />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
15
plugins/postfix/.idea/runConfigurations/Postfix.xml
generated
Normal file
@@ -0,0 +1,15 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Postfix" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin" singleton="true">
|
||||
<module name="intellij-postfix" />
|
||||
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea -Didea.is.internal=true" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<log_file path="$USER_HOME$/.IntelliJIdea13/system/plugins-sandbox/system/log/idea.log" checked="false" skipped="true" show_all="false" alias="IDEA LOG" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="" />
|
||||
<option name="TRANSPORT" value="0" />
|
||||
<option name="LOCAL" value="true" />
|
||||
</RunnerSettings>
|
||||
<ConfigurationWrapper RunnerId="Debug" />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
5
plugins/postfix/.idea/scopes/scope_settings.xml
generated
Normal file
@@ -0,0 +1,5 @@
|
||||
<component name="DependencyValidationManager">
|
||||
<state>
|
||||
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
||||
</state>
|
||||
</component>
|
||||
125
plugins/postfix/.idea/uiDesigner.xml
generated
Normal file
@@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
7
plugins/postfix/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
109
plugins/postfix/META-INF/plugin.xml
Normal file
@@ -0,0 +1,109 @@
|
||||
<idea-plugin version="2">
|
||||
<id>org.jetbrains.postfixCompletion</id>
|
||||
<name>Postfix Completion</name>
|
||||
<version>0.8-beta</version>
|
||||
<vendor email="alexander.shvedov@jetbrains.com" url="https://github.com/controlflow">Alexander Shvedov, Alexander Zolotov, Sergey Ignatov</vendor>
|
||||
<depends>com.intellij.modules.lang</depends>
|
||||
<depends>com.intellij.modules.java</depends>
|
||||
|
||||
<description><![CDATA[
|
||||
The basic idea is to prevent caret jumps backward while typing code,
|
||||
let you start with the some expression, explore some APIs, think about
|
||||
what you are going to do and after finish with statement of some type.<br/><br/>
|
||||
|
||||
<b>Available templates:</b><br/><br/>
|
||||
|
||||
<ul>
|
||||
<li> <b>.if</b> – checks boolean expression to be true – <b>if (expr)</b></li>
|
||||
<li> <b>.else</b> – checks boolean expression to be false – <b>if (!expr)</b></li>
|
||||
<li> <b>.var</b> – initialize new variable with expression – <b>T x = expr;</b></li>
|
||||
<li> <b>.null</b> – checks nullable expression to be null – <b>if (expr == null)</b></li>
|
||||
<li> <b>.notnull</b> – checks expression to be non-null – <b>if (expr != null)</b></li>
|
||||
<li> <b>.not</b> – negates value of inner boolean expression – <b>!expr</b></li>
|
||||
<li> <b>.for</b> – iterates over collection – <b>for (T item : collection)</b></li>
|
||||
<li> <b>.while</b> – uses expression as loop condition – <b>while (expr)</b></li>
|
||||
<li> <b>.arg</b> – helps surround argument with invocation – <b>method(expr)</b></li>
|
||||
<li> <b>.cast</b> – surrounds expression with cast – <b>(SomeType) expr</b></li>
|
||||
<li> <b>.new</b> – produces instantiation expression for type – <b>new T()</b></li>
|
||||
<li> <b>.fori</b> – surrounds with loop – <b>for (int i = 0; i < expr.length; i++)</b></li>
|
||||
<li> <b>.forr</b> – reverse loop – <b>for (int i = expr.length - 1; i >= 0; i--)</b></li>
|
||||
<li> <b>.field</b> – introduces field for expression – <b>_field = expr;</b></li>
|
||||
<li> <b>.par</b> – surrounds outer expression with parentheses – <b>(expr)</b></li>
|
||||
<li> <b>.return</b> – returns value from containing method – <b>return expr;</b></li>
|
||||
<li> <b>.switch</b> – switch over integral/enum/string values – <b>switch (expr)</b></li>
|
||||
<li> <b>.throw</b> – throws exception of 'Throwable' type – <b>throw new Exception();</b></li>
|
||||
<li> <b>.assert</b> – creates assertion from boolean expression – <b>assert expr;</b></li>
|
||||
<li> <b>.synchronized</b> – produces synchronized block – <b>synchronized (expr)</b></li>
|
||||
<li> <b>.instanceof</b> – surrounds expression with instanceof – <b>expr instanceof SomeType ? ((SomeType) expr). : null</b></li>
|
||||
</ul>
|
||||
|
||||
<br/><b>Other features:</b><br/><br/>
|
||||
|
||||
<ul>
|
||||
<li>Template expansion by <b>[Tab]</b> key in editor (like live templates)</li>
|
||||
<li>Settings page to disable/enable particular postfix templates</li>
|
||||
</ul>
|
||||
]]></description>
|
||||
|
||||
<change-notes><![CDATA[
|
||||
<b>Version 0.8-beta</b><br/>
|
||||
API redesigned. Templates work like native live-templates now, that is more consistently.<br/>
|
||||
New <b>instanceof</b> template.<br/>
|
||||
Added abilities to configure expanding key and to disable particular templates directly from completion list (Alt+Enter).<br/><br/>
|
||||
|
||||
<b>Version 0.7.6-beta</b><br/>
|
||||
Braces insertion in <b>.if</b>, <b>.else</b>, <b>.null</b> and <b>.notnull</b>.<br/><br/>
|
||||
|
||||
<b>Version 0.7.5-beta</b><br/>
|
||||
Settings page to disable/enable particular templates. Better <b>.cast</b> template.<br/><br/>
|
||||
|
||||
<b>Version 0.7-beta</b><br/>
|
||||
New templates: <b>.switch</b>, <b>.throw</b>, <b>.assert</b> and <b>.synchronized</b>.<br/><br/>
|
||||
|
||||
<b>Version 0.6-beta</b><br/>
|
||||
Fixes, new templates: <b>.field</b>, <b>.par</b> and <b>.return</b>.<br/><br/>
|
||||
|
||||
<b>Version 0.5-beta</b><br/>
|
||||
Various fixes for completion with over literals.<br/>
|
||||
New <b>.fori</b> and <b>.forr</b> templates iteration with index.<br/><br/>
|
||||
]]></change-notes>
|
||||
|
||||
<idea-version since-build="130.754"/>
|
||||
|
||||
<extensionPoints>
|
||||
<extensionPoint name="postfixTemplate" interface="org.jetbrains.postfixCompletion.templates.PostfixTemplate"/>
|
||||
</extensionPoints>
|
||||
|
||||
<extensions defaultExtensionNs="org.jetbrains.postfixCompletion">
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.ElseStatementPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.IntroduceVariablePostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.NotNullCheckPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.IsNullCheckPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.NotExpressionPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.ForeachPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.WhileStatementPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.CastExpressionPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.NewExpressionPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.IfStatementPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.ForAscendingPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.ForDescendingPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.IntroduceFieldPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.ParenthesizedExpressionPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.ReturnStatementPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.SwitchStatementPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.ThrowExceptionPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.AssertStatementPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.SynchronizedStatementPostfixTemplate"/>
|
||||
<postfixTemplate implementation="org.jetbrains.postfixCompletion.templates.InstanceofExpressionPostfixTemplate"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<applicationService id="postfixCompletionSettings" serviceImplementation="org.jetbrains.postfixCompletion.settings.PostfixCompletionSettings"/>
|
||||
<customLiveTemplate implementation="org.jetbrains.postfixCompletion.templates.PostfixLiveTemplate"/>
|
||||
|
||||
<completion.contributor language="JAVA" implementationClass="org.jetbrains.postfixCompletion.completion.PostfixTemplateCompletionContributor"/>
|
||||
<lookup.actionProvider implementation="org.jetbrains.postfixCompletion.completion.PostfixTemplateLookupActionProvider"/>
|
||||
|
||||
<editorOptionsProvider id="editing.postfixCompletion" instance="org.jetbrains.postfixCompletion.settings.PostfixCompletionConfigurable"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
70
plugins/postfix/README.md
Normal file
@@ -0,0 +1,70 @@
|
||||
IntelliJ IDEA Postfix Completion plugin
|
||||
---------------------------------------
|
||||
|
||||
The basic idea is to prevent caret jumps backward while typing code,
|
||||
let you start with the some expression, explore some APIs, think about
|
||||
what you are going to do and after finish with statement of some type.
|
||||
|
||||
#### Examples
|
||||

|
||||
|
||||
See [more examples](examples.md).
|
||||
|
||||
#### Download
|
||||
|
||||
Plugin currently is under development.
|
||||
Pre-release versions are available for download in [IntelliJ IDEA plugin repository](http://plugins.jetbrains.com/plugin/7342).
|
||||
To install into IDEA simply go *Preferences* – *Plugins* – *Browse repositories...* and search for *"postfix"*.
|
||||
|
||||
#### Version
|
||||
|
||||
Currently plugin tested and works well with IDEA 13 CE (since first preview build v130.754),
|
||||
but you can easily build it against IDEA 12 SDK. When main development phase will be finished,
|
||||
I'll investigate ability to work in IDEA 12 and lower the required version if possible.
|
||||
|
||||
#### Features
|
||||
|
||||
Available templates:
|
||||
|
||||
* `.if` – checks boolean expression to be true `if (expr)`
|
||||
* `.else` – checks boolean expression to be false `if (!expr)`
|
||||
* `.var` – initialize new variable with expression `T name = expr;`
|
||||
* `.null` – checks nullable expression to be null `if (expr == null)`
|
||||
* `.notnull` – checks expression to be non-null `if (expr != null)`
|
||||
* `.instanceof` – checks type `expr instanceof T ? ((T) expr).m : null`
|
||||
* `.not` – negates value of inner boolean expression `!expr`
|
||||
* `.for` – iterates over collection `for (T item : collection)`
|
||||
* `.while` – uses expression as loop condition `while (expr)`
|
||||
* `.arg` – helps surround argument with invocation `method(expr)`
|
||||
* `.cast` – surrounds expression with cast `(SomeType) expr`
|
||||
* `.new` – produces instantiation expression for type `new T()`
|
||||
* `.fori` – surrounds with loop `for (int i = 0; i < expr.length; i++)`
|
||||
* `.forr` – reverse loop `for (int i = expr.length - 1; i >= 0; i--)`
|
||||
* `.field` – introduces field for expression `_field = expr;`
|
||||
* `.par` – surrounds outer expression with parentheses `(expr)`
|
||||
* `.return` – returns value from containing method `return expr;`
|
||||
* `.switch` – switch over integral/enum/string values `switch (expr)`
|
||||
* `.throw` – throws exception of 'Throwable' type `throw new Exception();`
|
||||
* `.assert` - creates assertion from boolean expression `assert expr;`
|
||||
* `.synchronized` – produces synchronized block `synchronized (expr)`
|
||||
|
||||
Other features:
|
||||
|
||||
* Template expansion by `Tab` key in editor (like live templates)
|
||||
* Settings page to disable/enable particular postfix templates
|
||||
|
||||
Future work:
|
||||
* `.try` – surrounds resource expression with `try (T resource = expr)`
|
||||
* Control braces insertion for statements (use code style settings?)
|
||||
* Completion char handling `expr.var.usage()` => `T x = expr; x.usage()`?
|
||||
* `1..10` - for (int i = 1; i < 10; i++) {}
|
||||
* `list.each` - for (E e : list) {}
|
||||
* `.for` should be equals to fori for int expressions and to `.each` for iterable expressions
|
||||
* `.while` should expand iterator expressions to while(iterator.hasNext()) { SomeType next = iterator.next() }
|
||||
* `map`, `filter` and other stuff from `ContainerUtil` or Guava collections
|
||||
* Support non-Java languages
|
||||
|
||||
#### Feedback
|
||||
|
||||
Feel free to post any issues or feature requests here on github or contact me directly:
|
||||
* *alexander.shvedov[at]jetbrains.com*
|
||||
BIN
plugins/postfix/content/example.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
plugins/postfix/content/foreach.gif
Normal file
|
After Width: | Height: | Size: 92 KiB |
BIN
plugins/postfix/content/fori_forr.gif
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
plugins/postfix/content/if_cast.gif
Normal file
|
After Width: | Height: | Size: 257 KiB |
BIN
plugins/postfix/content/instanceof.gif
Normal file
|
After Width: | Height: | Size: 190 KiB |
BIN
plugins/postfix/content/not_null.gif
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
plugins/postfix/content/while.gif
Normal file
|
After Width: | Height: | Size: 219 KiB |
21
plugins/postfix/examples.md
Normal file
@@ -0,0 +1,21 @@
|
||||
Examples
|
||||
---------------------------------------
|
||||
|
||||
### instanceof
|
||||

|
||||
|
||||
### if and cast
|
||||

|
||||
|
||||
### foreach
|
||||

|
||||
|
||||
### for
|
||||

|
||||
|
||||
### notnull
|
||||

|
||||
|
||||
### while
|
||||

|
||||
|
||||
15
plugins/postfix/intellij-postfix.iml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PLUGIN_MODULE" version="4">
|
||||
<component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/META-INF/plugin.xml" />
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/images" type="java-resource" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.jetbrains.postfixCompletion.completion;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionContributor;
|
||||
import com.intellij.codeInsight.completion.CompletionType;
|
||||
import com.intellij.codeInsight.template.CustomLiveTemplate;
|
||||
import com.intellij.patterns.ElementPattern;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.impl.source.tree.ElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.postfixCompletion.templates.PostfixLiveTemplate;
|
||||
|
||||
import static com.intellij.patterns.PsiJavaPatterns.psiElement;
|
||||
import static com.intellij.patterns.StandardPatterns.string;
|
||||
|
||||
public class PostfixTemplateCompletionContributor extends CompletionContributor {
|
||||
private static final TokenSet SUITABLE_ELEMENTS = TokenSet.orSet(ElementType.KEYWORD_BIT_SET,
|
||||
ElementType.LITERAL_BIT_SET,
|
||||
TokenSet.create(JavaTokenType.IDENTIFIER));
|
||||
|
||||
public PostfixTemplateCompletionContributor() {
|
||||
extend(CompletionType.BASIC, identifierAfterDot(), new PostfixTemplatesCompletionProvider());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PostfixLiveTemplate getPostfixLiveTemplate(@NotNull PsiFile file, int offset) {
|
||||
PostfixLiveTemplate postfixLiveTemplate = CustomLiveTemplate.EP_NAME.findExtension(PostfixLiveTemplate.class);
|
||||
return postfixLiveTemplate != null && postfixLiveTemplate.isApplicable(file, offset, false) ? postfixLiveTemplate : null;
|
||||
}
|
||||
|
||||
private static ElementPattern<? extends PsiElement> identifierAfterDot() {
|
||||
return psiElement().withElementType(SUITABLE_ELEMENTS).afterLeaf(psiElement().withText(string().endsWith(".")));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package org.jetbrains.postfixCompletion.completion;
|
||||
|
||||
import com.intellij.codeInsight.lookup.Lookup;
|
||||
import com.intellij.codeInsight.lookup.LookupActionProvider;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementAction;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.options.ShowSettingsUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import org.jetbrains.postfixCompletion.settings.PostfixCompletionConfigurable;
|
||||
import org.jetbrains.postfixCompletion.settings.PostfixCompletionSettings;
|
||||
import org.jetbrains.postfixCompletion.settings.PostfixTemplatesListPanel;
|
||||
import org.jetbrains.postfixCompletion.templates.PostfixTemplate;
|
||||
|
||||
public class PostfixTemplateLookupActionProvider implements LookupActionProvider {
|
||||
@Override
|
||||
public void fillActions(LookupElement element, final Lookup lookup, Consumer<LookupElementAction> consumer) {
|
||||
if (element instanceof PostfixTemplateLookupElement) {
|
||||
final PostfixTemplate template = ((PostfixTemplateLookupElement)element).getPostfixTemplate();
|
||||
|
||||
consumer.consume(new LookupElementAction(PlatformIcons.EDIT, "Edit postfix completion settings") {
|
||||
@Override
|
||||
public Result performLookupAction() {
|
||||
final Project project = lookup.getEditor().getProject();
|
||||
assert project != null;
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (project.isDisposed()) return;
|
||||
|
||||
final PostfixCompletionConfigurable configurable = new PostfixCompletionConfigurable();
|
||||
ShowSettingsUtil.getInstance().editConfigurable(project, configurable, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PostfixTemplatesListPanel templatesListPanel = configurable.getTemplatesListPanel();
|
||||
if (templatesListPanel != null) {
|
||||
templatesListPanel.selectTemplate(template);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return Result.HIDE_LOOKUP;
|
||||
}
|
||||
});
|
||||
|
||||
final PostfixCompletionSettings settings = PostfixCompletionSettings.getInstance();
|
||||
if (settings != null && settings.isTemplateEnabled(template)) {
|
||||
consumer.consume(new LookupElementAction(AllIcons.Actions.Delete, String.format("Disable '%s' template", template.getKey())) {
|
||||
@Override
|
||||
public Result performLookupAction() {
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
settings.disableTemplate(template);
|
||||
}
|
||||
});
|
||||
return Result.HIDE_LOOKUP;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package org.jetbrains.postfixCompletion.completion;
|
||||
|
||||
import com.intellij.codeInsight.completion.InsertionContext;
|
||||
import com.intellij.codeInsight.lookup.LookupElementPresentation;
|
||||
import com.intellij.codeInsight.template.CustomTemplateCallback;
|
||||
import com.intellij.codeInsight.template.impl.LiveTemplateLookupElement;
|
||||
import com.intellij.codeInsight.template.impl.TemplateImpl;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.postfixCompletion.templates.PostfixLiveTemplate;
|
||||
import org.jetbrains.postfixCompletion.templates.PostfixTemplate;
|
||||
|
||||
import static org.jetbrains.postfixCompletion.completion.PostfixTemplateCompletionContributor.getPostfixLiveTemplate;
|
||||
|
||||
class PostfixTemplateLookupElement extends LiveTemplateLookupElement {
|
||||
@NotNull
|
||||
private final PostfixTemplate myTemplate;
|
||||
|
||||
public PostfixTemplateLookupElement(@NotNull PostfixTemplate template, char shortcut) {
|
||||
super(createStubTemplate(template, shortcut), template.getPresentableName(), true, true);
|
||||
myTemplate = template;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PostfixTemplate getPostfixTemplate() {
|
||||
return myTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderElement(LookupElementPresentation presentation) {
|
||||
super.renderElement(presentation);
|
||||
presentation.setTailText(" " + arrow() + " " + myTemplate.getExample());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleInsert(InsertionContext context) {
|
||||
context.setAddCompletionChar(false);
|
||||
int lengthOfTypedKey = context.getTailOffset() - context.getStartOffset();
|
||||
String templateKey = myTemplate.getKey();
|
||||
Editor editor = context.getEditor();
|
||||
if (lengthOfTypedKey < templateKey.length()) {
|
||||
context.getDocument().insertString(context.getTailOffset(), templateKey.substring(lengthOfTypedKey));
|
||||
editor.getCaretModel().moveToOffset(context.getTailOffset() + templateKey.length() - lengthOfTypedKey);
|
||||
}
|
||||
|
||||
PsiFile file = context.getFile();
|
||||
|
||||
PostfixLiveTemplate postfixLiveTemplate = getPostfixLiveTemplate(file, editor.getCaretModel().getOffset());
|
||||
if (postfixLiveTemplate != null) {
|
||||
postfixLiveTemplate.expand(templateKey, new CustomTemplateCallback(editor, file, false));
|
||||
}
|
||||
}
|
||||
|
||||
private static TemplateImpl createStubTemplate(@NotNull PostfixTemplate postfixTemplate, char shortcut) {
|
||||
TemplateImpl template = new TemplateImpl(postfixTemplate.getKey(), "postfixTemplate");
|
||||
template.setShortcutChar(shortcut);
|
||||
return template;
|
||||
}
|
||||
|
||||
private static String arrow() {
|
||||
return SystemInfo.isMac ? "→" :"->";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package org.jetbrains.postfixCompletion.completion;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionParameters;
|
||||
import com.intellij.codeInsight.completion.CompletionProvider;
|
||||
import com.intellij.codeInsight.completion.CompletionResultSet;
|
||||
import com.intellij.codeInsight.template.CustomTemplateCallback;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.patterns.StandardPatterns;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.postfixCompletion.settings.PostfixCompletionSettings;
|
||||
import org.jetbrains.postfixCompletion.templates.PostfixLiveTemplate;
|
||||
import org.jetbrains.postfixCompletion.templates.PostfixTemplate;
|
||||
|
||||
import static org.jetbrains.postfixCompletion.completion.PostfixTemplateCompletionContributor.getPostfixLiveTemplate;
|
||||
|
||||
class PostfixTemplatesCompletionProvider extends CompletionProvider<CompletionParameters> {
|
||||
@Override
|
||||
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) {
|
||||
if (!isCompletionEnabled(parameters)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PostfixLiveTemplate postfixLiveTemplate = getPostfixLiveTemplate(parameters.getOriginalFile(), parameters.getOffset());
|
||||
if (postfixLiveTemplate != null) {
|
||||
PsiFile file = parameters.getPosition().getContainingFile();
|
||||
final CustomTemplateCallback callback = new CustomTemplateCallback(parameters.getEditor(), file, false);
|
||||
String computedKey = postfixLiveTemplate.computeTemplateKey(callback);
|
||||
if (computedKey != null) {
|
||||
PostfixTemplate template = postfixLiveTemplate.getTemplateByKey(computedKey);
|
||||
if (template != null) {
|
||||
result = result.withPrefixMatcher(computedKey);
|
||||
result.addElement(new PostfixTemplateLookupElement(template, postfixLiveTemplate.getShortcut()));
|
||||
}
|
||||
}
|
||||
|
||||
String possibleKey = postfixLiveTemplate.computeTemplateKeyWithoutContextChecking(parameters.getEditor());
|
||||
if (StringUtil.isNotEmpty(possibleKey)) {
|
||||
result = result.withPrefixMatcher(possibleKey);
|
||||
result.restartCompletionOnPrefixChange(StandardPatterns.string().startsWith(possibleKey));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isCompletionEnabled(@NotNull CompletionParameters parameters) {
|
||||
if (!parameters.isAutoPopup()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PostfixCompletionSettings settings = PostfixCompletionSettings.getInstance();
|
||||
if (settings == null || !settings.isPostfixPluginEnabled() || !settings.isTemplatesCompletionEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.postfixCompletion.settings.PostfixCompletionConfigurable">
|
||||
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="500" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="f9f95" class="com.intellij.ui.components.JBCheckBox" binding="myPluginEnabledCheckbox">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="1" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="&Enable Postfix plugin"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="a9fc9" binding="myTemplatesListPanelContainer" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<component id="9f784" class="com.intellij.ui.components.JBCheckBox" binding="myCompletionEnabledCheckbox">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="1" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="&Show postfix templates in completion autopopup"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="2231a" class="com.intellij.ui.components.JBLabel">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="1" anchor="8" fill="0" indent="1" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Expand templates with"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="63d6b" class="com.intellij.openapi.ui.ComboBox" binding="myShortcutComboBox">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<model/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,169 @@
|
||||
package org.jetbrains.postfixCompletion.settings;
|
||||
|
||||
import com.intellij.application.options.editor.EditorOptionsProvider;
|
||||
import com.intellij.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.codeInsight.template.impl.TemplateSettings;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.SearchableConfigurable;
|
||||
import com.intellij.openapi.ui.ComboBox;
|
||||
import com.intellij.ui.components.JBCheckBox;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.postfixCompletion.templates.PostfixTemplate;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
public class PostfixCompletionConfigurable implements SearchableConfigurable, EditorOptionsProvider, Configurable.NoScroll {
|
||||
@Nullable
|
||||
private PostfixTemplatesListPanel myTemplatesListPanel;
|
||||
@NotNull
|
||||
private final PostfixCompletionSettings myTemplatesSettings;
|
||||
|
||||
private JComponent myPanel;
|
||||
private JBCheckBox myCompletionEnabledCheckbox;
|
||||
private JBCheckBox myPluginEnabledCheckbox;
|
||||
private JPanel myTemplatesListPanelContainer;
|
||||
private ComboBox myShortcutComboBox;
|
||||
|
||||
private static final String SPACE = CodeInsightBundle.message("template.shortcut.space");
|
||||
private static final String TAB = CodeInsightBundle.message("template.shortcut.tab");
|
||||
private static final String ENTER = CodeInsightBundle.message("template.shortcut.enter");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public PostfixCompletionConfigurable() {
|
||||
PostfixCompletionSettings settings = PostfixCompletionSettings.getInstance();
|
||||
if (settings == null) {
|
||||
throw new RuntimeException("Can't retrieve postfix template settings");
|
||||
}
|
||||
|
||||
myTemplatesSettings = settings;
|
||||
myTemplatesListPanel = new PostfixTemplatesListPanel(Arrays.asList(PostfixTemplate.EP_NAME.getExtensions()));
|
||||
myTemplatesListPanelContainer.setLayout(new BorderLayout());
|
||||
myTemplatesListPanelContainer.add(myTemplatesListPanel.getComponent(), BorderLayout.CENTER);
|
||||
myPluginEnabledCheckbox.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
updateComponents();
|
||||
}
|
||||
});
|
||||
myShortcutComboBox.addItem(TAB);
|
||||
myShortcutComboBox.addItem(SPACE);
|
||||
myShortcutComboBox.addItem(ENTER);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getId() {
|
||||
return "reference.settingsdialog.IDE.editor.postfix.completion";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getHelpTopic() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nls
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return "Postfix Completion";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PostfixTemplatesListPanel getTemplatesListPanel() {
|
||||
return myTemplatesListPanel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JComponent createComponent() {
|
||||
return myPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() throws ConfigurationException {
|
||||
if (myTemplatesListPanel != null) {
|
||||
Map<String, Boolean> newTemplatesState = ContainerUtil.newHashMap();
|
||||
for (Map.Entry<String, Boolean> entry : myTemplatesListPanel.getState().entrySet()) {
|
||||
Boolean value = entry.getValue();
|
||||
if (value != null && !value) {
|
||||
newTemplatesState.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
myTemplatesSettings.setTemplatesState(newTemplatesState);
|
||||
myTemplatesSettings.setPostfixPluginEnabled(myPluginEnabledCheckbox.isSelected());
|
||||
myTemplatesSettings.setTemplatesCompletionEnabled(myCompletionEnabledCheckbox.isSelected());
|
||||
myTemplatesSettings.setShortcut(stringToShortcut((String)myShortcutComboBox.getSelectedItem()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
if (myTemplatesListPanel != null) {
|
||||
myTemplatesListPanel.setState(myTemplatesSettings.getTemplatesState());
|
||||
myPluginEnabledCheckbox.setSelected(myTemplatesSettings.isPostfixPluginEnabled());
|
||||
myCompletionEnabledCheckbox.setSelected(myTemplatesSettings.isTemplatesCompletionEnabled());
|
||||
myShortcutComboBox.setSelectedItem(shortcutToString((char)myTemplatesSettings.getShortcut()));
|
||||
updateComponents();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
if (myTemplatesListPanel == null) {
|
||||
return false;
|
||||
}
|
||||
return myPluginEnabledCheckbox.isSelected() != myTemplatesSettings.isPostfixPluginEnabled() ||
|
||||
myCompletionEnabledCheckbox.isSelected() != myTemplatesSettings.isTemplatesCompletionEnabled() ||
|
||||
stringToShortcut((String)myShortcutComboBox.getSelectedItem()) != myTemplatesSettings.getShortcut() ||
|
||||
!myTemplatesListPanel.getState().equals(myTemplatesSettings.getTemplatesState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeUIResources() {
|
||||
myTemplatesListPanel = null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Runnable enableSearch(String s) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void updateComponents() {
|
||||
boolean pluginEnabled = myPluginEnabledCheckbox.isSelected();
|
||||
myCompletionEnabledCheckbox.setEnabled(pluginEnabled);
|
||||
myShortcutComboBox.setEnabled(pluginEnabled);
|
||||
if (myTemplatesListPanel != null) {
|
||||
myTemplatesListPanel.setEnabled(pluginEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
private static char stringToShortcut(@NotNull String string) {
|
||||
if (SPACE.equals(string)) {
|
||||
return TemplateSettings.SPACE_CHAR;
|
||||
}
|
||||
else if (ENTER.equals(string)) {
|
||||
return TemplateSettings.ENTER_CHAR;
|
||||
}
|
||||
return TemplateSettings.TAB_CHAR;
|
||||
}
|
||||
|
||||
private static String shortcutToString(char shortcut) {
|
||||
if (shortcut == TemplateSettings.SPACE_CHAR) {
|
||||
return SPACE;
|
||||
}
|
||||
if (shortcut == TemplateSettings.ENTER_CHAR) {
|
||||
return ENTER;
|
||||
}
|
||||
return TAB;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package org.jetbrains.postfixCompletion.settings;
|
||||
|
||||
import com.intellij.codeInsight.template.impl.TemplateSettings;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.xmlb.XmlSerializerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.postfixCompletion.templates.PostfixTemplate;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
@State(
|
||||
name = "PostfixCompletionSettings",
|
||||
storages = {
|
||||
@Storage(file = StoragePathMacros.APP_CONFIG + "/postfixCompletion.xml")
|
||||
}
|
||||
)
|
||||
public class PostfixCompletionSettings implements PersistentStateComponent<PostfixCompletionSettings>, ExportableComponent {
|
||||
@NotNull
|
||||
private Map<String, Boolean> myTemplatesState = ContainerUtil.newHashMap();
|
||||
private boolean postfixPluginEnabled = true;
|
||||
private boolean templatesCompletionEnabled = true;
|
||||
private int myShortcut = TemplateSettings.TAB_CHAR;
|
||||
|
||||
public boolean isTemplateEnabled(@NotNull PostfixTemplate template) {
|
||||
return ContainerUtil.getOrElse(myTemplatesState, template.getKey(), true);
|
||||
}
|
||||
|
||||
public void disableTemplate(@NotNull PostfixTemplate template) {
|
||||
myTemplatesState.put(template.getKey(), Boolean.FALSE);
|
||||
}
|
||||
|
||||
public boolean isPostfixPluginEnabled() {
|
||||
return postfixPluginEnabled;
|
||||
}
|
||||
|
||||
public void setPostfixPluginEnabled(boolean postfixPluginEnabled) {
|
||||
this.postfixPluginEnabled = postfixPluginEnabled;
|
||||
}
|
||||
|
||||
public boolean isTemplatesCompletionEnabled() {
|
||||
return templatesCompletionEnabled;
|
||||
}
|
||||
|
||||
public void setTemplatesCompletionEnabled(boolean templatesCompletionEnabled) {
|
||||
this.templatesCompletionEnabled = templatesCompletionEnabled;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Map<String, Boolean> getTemplatesState() {
|
||||
return myTemplatesState;
|
||||
}
|
||||
|
||||
public void setTemplatesState(@NotNull Map<String, Boolean> templatesState) {
|
||||
myTemplatesState = templatesState;
|
||||
}
|
||||
|
||||
public int getShortcut() {
|
||||
return myShortcut;
|
||||
}
|
||||
|
||||
public void setShortcut(int shortcut) {
|
||||
myShortcut = shortcut;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PostfixCompletionSettings getInstance() {
|
||||
return ServiceManager.getService(PostfixCompletionSettings.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public PostfixCompletionSettings getState() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadState(PostfixCompletionSettings settings) {
|
||||
XmlSerializerUtil.copyBean(settings, this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public File[] getExportFiles() {
|
||||
return new File[]{PathManager.getOptionsFile("postfixCompletion.xml")};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getPresentableName() {
|
||||
return "Postfix Completion";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
package org.jetbrains.postfixCompletion.settings;
|
||||
|
||||
import com.intellij.ui.BooleanTableCellEditor;
|
||||
import com.intellij.ui.BooleanTableCellRenderer;
|
||||
import com.intellij.ui.TableViewSpeedSearch;
|
||||
import com.intellij.ui.ToolbarDecorator;
|
||||
import com.intellij.ui.components.JBCheckBox;
|
||||
import com.intellij.ui.table.TableView;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.NotNullFunction;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.ColumnInfo;
|
||||
import com.intellij.util.ui.ListTableModel;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.postfixCompletion.templates.PostfixTemplate;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class PostfixTemplatesListPanel {
|
||||
private static final NotNullFunction<PostfixTemplate, String> GET_SHORTCUT_FUNCTION =
|
||||
new NotNullFunction<PostfixTemplate, String>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public String fun(@NotNull PostfixTemplate template) {
|
||||
return template.getKey();
|
||||
}
|
||||
};
|
||||
|
||||
private static final NotNullFunction<PostfixTemplate, String> GET_DESCRIPTION_FUNCTION =
|
||||
new NotNullFunction<PostfixTemplate, String>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public String fun(@NotNull PostfixTemplate template) {
|
||||
return template.getDescription();
|
||||
}
|
||||
};
|
||||
|
||||
private static final NotNullFunction<PostfixTemplate, String> GET_EXAMPLE_FUNCTION =
|
||||
new NotNullFunction<PostfixTemplate, String>() {
|
||||
@NotNull
|
||||
@Override
|
||||
public String fun(@NotNull PostfixTemplate template) {
|
||||
return template.getExample();
|
||||
}
|
||||
};
|
||||
|
||||
@NotNull private final Map<String, Boolean> myTemplatesState = ContainerUtil.newHashMap();
|
||||
@NotNull private final JPanel myPanelWithTableView;
|
||||
private final TableView<PostfixTemplate> myTemplatesTableView;
|
||||
|
||||
public PostfixTemplatesListPanel(@NotNull List<PostfixTemplate> templates) {
|
||||
ColumnInfo[] columns = generateColumns(templates);
|
||||
ListTableModel<PostfixTemplate> templatesTableModel = new ListTableModel<PostfixTemplate>(columns, templates, 0);
|
||||
myTemplatesTableView = new TableView<PostfixTemplate>();
|
||||
myTemplatesTableView.setModelAndUpdateColumns(templatesTableModel);
|
||||
myTemplatesTableView.setShowGrid(false);
|
||||
myTemplatesTableView.setStriped(true);
|
||||
myTemplatesTableView.setBorder(null);
|
||||
|
||||
new TableViewSpeedSearch<PostfixTemplate>(myTemplatesTableView) {
|
||||
@Override
|
||||
protected String getItemText(@NotNull PostfixTemplate template) {
|
||||
return template.getPresentableName();
|
||||
}
|
||||
};
|
||||
|
||||
myPanelWithTableView = ToolbarDecorator.createDecorator(myTemplatesTableView)
|
||||
.setAsUsualTopToolbar()
|
||||
.disableAddAction()
|
||||
.disableRemoveAction()
|
||||
.disableUpDownActions().createPanel();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private ColumnInfo[] generateColumns(@NotNull List<PostfixTemplate> templates) {
|
||||
String longestTemplateName = "";
|
||||
String longestDescription = "";
|
||||
String longestExample = "";
|
||||
for (PostfixTemplate template : templates) {
|
||||
longestTemplateName = longestString(longestTemplateName, GET_SHORTCUT_FUNCTION.fun(template));
|
||||
longestDescription = longestString(longestDescription, GET_DESCRIPTION_FUNCTION.fun(template));
|
||||
longestExample = longestString(longestExample, GET_EXAMPLE_FUNCTION.fun(template));
|
||||
}
|
||||
return new ColumnInfo[]{
|
||||
new BooleanColumnInfo(),
|
||||
new StringColumnInfo("Shortcut", GET_SHORTCUT_FUNCTION, longestTemplateName),
|
||||
new StringColumnInfo("Description", GET_DESCRIPTION_FUNCTION, longestDescription),
|
||||
new StringColumnInfo("Example", GET_EXAMPLE_FUNCTION, longestExample),
|
||||
};
|
||||
}
|
||||
|
||||
public void selectTemplate(@NotNull PostfixTemplate template) {
|
||||
myTemplatesTableView.setSelection(Arrays.asList(template));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String longestString(@NotNull String firstString, @NotNull String secondString) {
|
||||
return secondString.length() > firstString.length() ? secondString : firstString;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JPanel getComponent() {
|
||||
return myPanelWithTableView;
|
||||
}
|
||||
|
||||
public void setState(@NotNull Map<String, Boolean> templatesState) {
|
||||
myTemplatesState.clear();
|
||||
for (Map.Entry<String, Boolean> entry : templatesState.entrySet()) {
|
||||
myTemplatesState.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Map<String, Boolean> getState() {
|
||||
return myTemplatesState;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
myTemplatesTableView.setEnabled(enabled);
|
||||
}
|
||||
|
||||
private class BooleanColumnInfo extends ColumnInfo<PostfixTemplate, Boolean> {
|
||||
private final BooleanTableCellRenderer CELL_RENDERER = new BooleanTableCellRenderer();
|
||||
private final BooleanTableCellEditor CELL_EDITOR = new BooleanTableCellEditor();
|
||||
private final int WIDTH = new JBCheckBox().getPreferredSize().width + 4;
|
||||
|
||||
public BooleanColumnInfo() {
|
||||
super("");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TableCellRenderer getRenderer(PostfixTemplate template) {
|
||||
return CELL_RENDERER;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TableCellEditor getEditor(PostfixTemplate template) {
|
||||
return CELL_EDITOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth(JTable table) {
|
||||
return WIDTH;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Class getColumnClass() {
|
||||
return Boolean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(PostfixTemplate template) {
|
||||
return myTemplatesTableView.isEnabled();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Boolean valueOf(@NotNull PostfixTemplate template) {
|
||||
return ContainerUtil.getOrElse(myTemplatesState, template.getKey(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(@NotNull PostfixTemplate template, Boolean value) {
|
||||
myTemplatesState.put(template.getKey(), value);
|
||||
}
|
||||
}
|
||||
|
||||
private static class StringColumnInfo extends ColumnInfo<PostfixTemplate, String> {
|
||||
@NotNull private final Function<PostfixTemplate, String> myValueOfFunction;
|
||||
@Nullable private final String myPreferredStringValue;
|
||||
|
||||
public StringColumnInfo(@NotNull String name,
|
||||
@NotNull Function<PostfixTemplate, String> valueOfFunction,
|
||||
@Nullable String preferredStringValue) {
|
||||
super(name);
|
||||
myValueOfFunction = valueOfFunction;
|
||||
|
||||
boolean hasValue = preferredStringValue != null && !preferredStringValue.isEmpty();
|
||||
myPreferredStringValue = hasValue ? preferredStringValue : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAdditionalWidth() {
|
||||
return UIUtil.DEFAULT_HGAP;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getPreferredStringValue() {
|
||||
return myPreferredStringValue;
|
||||
}
|
||||
|
||||
public String valueOf(final PostfixTemplate template) {
|
||||
return myValueOfFunction.fun(template);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.postfixCompletion.util.CommonUtils;
|
||||
|
||||
public class AssertStatementPostfixTemplate extends BooleanPostfixTemplate {
|
||||
public AssertStatementPostfixTemplate() {
|
||||
super("assert", "Creates assertion from boolean expression", "assert expr;");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(@NotNull PsiElement context, @NotNull Editor editor) {
|
||||
CommonUtils.createSimpleStatement(context, editor, "assert");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import com.intellij.psi.PsiExpressionStatement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.postfixCompletion.util.CommonUtils;
|
||||
|
||||
abstract public class BooleanPostfixTemplate extends PostfixTemplate {
|
||||
protected BooleanPostfixTemplate(@NotNull String name, @NotNull String description, @NotNull String example) {
|
||||
super(name, description, example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset) {
|
||||
PsiExpression topmostExpression = getTopmostExpression(context);
|
||||
return topmostExpression != null &&
|
||||
topmostExpression.getParent() instanceof PsiExpressionStatement &&
|
||||
CommonUtils.isBoolean(topmostExpression.getType());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.postfixCompletion.util.JavaSurroundersProxy;
|
||||
|
||||
public class CastExpressionPostfixTemplate extends ExpressionPostfixTemplateWithChooser {
|
||||
public CastExpressionPostfixTemplate() {
|
||||
super("cast", "Surrounds expression with cast", "((SomeType) expr)");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doIt(@NotNull final Editor editor, @NotNull final PsiExpression expression) {
|
||||
JavaSurroundersProxy.cast(expression.getProject(), editor, expression);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightServicesUtil;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.postfixCompletion.util.JavaSurroundersProxy;
|
||||
|
||||
public class ElseStatementPostfixTemplate extends BooleanPostfixTemplate {
|
||||
public ElseStatementPostfixTemplate() {
|
||||
super("else", "Checks boolean expression to be 'false'", "if (!expr)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(@NotNull PsiElement context, @NotNull Editor editor) {
|
||||
PsiExpression expression = getTopmostExpression(context);
|
||||
assert expression != null;
|
||||
PsiExpression invertedExpression = (PsiExpression)expression.replace(CodeInsightServicesUtil.invertCondition(expression));
|
||||
TextRange range = JavaSurroundersProxy.ifStatement(invertedExpression.getProject(), editor, invertedExpression);
|
||||
if (range != null) {
|
||||
editor.getCaretModel().moveToOffset(range.getStartOffset());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.codeInsight.unwrap.ScopeHighlighter;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Pass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.psi.util.PsiExpressionTrimRenderer;
|
||||
import com.intellij.refactoring.IntroduceTargetChooser;
|
||||
import com.intellij.refactoring.introduceVariable.IntroduceVariableBase;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.postfixCompletion.util.CommonUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ignatov
|
||||
*/
|
||||
public abstract class ExpressionPostfixTemplateWithChooser extends PostfixTemplate {
|
||||
protected ExpressionPostfixTemplateWithChooser(@NotNull String name, @NotNull String description, @NotNull String example) {
|
||||
super(name, description, example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset) {
|
||||
Editor editor = EditorFactory.getInstance().createEditor(copyDocument);
|
||||
boolean result;
|
||||
try {
|
||||
result = !getExpressions(context, editor, newOffset).isEmpty();
|
||||
}
|
||||
finally {
|
||||
EditorFactory.getInstance().releaseEditor(editor);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(@NotNull PsiElement context, @NotNull final Editor editor) {
|
||||
List<PsiExpression> expressions = getExpressions(context, editor, editor.getCaretModel().getOffset());
|
||||
|
||||
if (expressions.isEmpty()) {
|
||||
CommonUtils.showErrorHint(context.getProject(), editor);
|
||||
}
|
||||
else if (expressions.size() == 1) {
|
||||
doIt(editor, expressions.get(0));
|
||||
}
|
||||
else {
|
||||
IntroduceTargetChooser.showChooser(
|
||||
editor, expressions,
|
||||
new Pass<PsiExpression>() {
|
||||
public void pass(@NotNull final PsiExpression e) {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CommandProcessor.getInstance().executeCommand(e.getProject(), new Runnable() {
|
||||
public void run() {
|
||||
doIt(editor, e);
|
||||
}
|
||||
}, "Expand postfix template", PostfixLiveTemplate.POSTFIX_TEMPLATE_ID);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
new PsiExpressionTrimRenderer.RenderFunction(),
|
||||
"Expressions", 0, ScopeHighlighter.NATURAL_RANGER);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected List<PsiExpression> getExpressions(@NotNull PsiElement context, @NotNull Editor editor, int offset) {
|
||||
List<PsiExpression> expressions = IntroduceVariableBase.collectExpressions(context.getContainingFile(), editor, offset);
|
||||
return ContainerUtil.filter(expressions.isEmpty() ? maybeTopmostExpression(context) : expressions, getTypeCondition());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Condition<PsiExpression> getTypeCondition() {
|
||||
return Condition.TRUE;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static List<PsiExpression> maybeTopmostExpression(@NotNull PsiElement context) {
|
||||
PsiExpression expression = getTopmostExpression(context);
|
||||
PsiType type = expression != null ? expression.getType() : null;
|
||||
if (type == null || PsiType.VOID.equals(type)) return ContainerUtil.emptyList();
|
||||
return ContainerUtil.createMaybeSingletonList(expression);
|
||||
}
|
||||
|
||||
protected abstract void doIt(@NotNull Editor editor, @NotNull PsiExpression expression);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ForAscendingPostfixTemplate extends ForIndexedPostfixTemplate {
|
||||
public ForAscendingPostfixTemplate() {
|
||||
super("fori", "Iterates with index over collection", "for (int i = 0; i < expr.length; i++)");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String getOperator() {
|
||||
return "++";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getComparativeSign(@NotNull PsiExpression expr) {
|
||||
return "<";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected Pair<String, String> calculateBounds(@NotNull PsiExpression expression) {
|
||||
String bound = getExpressionBound(expression);
|
||||
return bound != null ? Pair.create("0", bound) : null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.postfixCompletion.util.CommonUtils;
|
||||
|
||||
public class ForDescendingPostfixTemplate extends ForIndexedPostfixTemplate {
|
||||
public ForDescendingPostfixTemplate() {
|
||||
super("forr", "Iterates with index in reverse order", "for (int i = expr.length-1; i >= 0; i--)");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected String getOperator() {
|
||||
return "--";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getComparativeSign(@NotNull PsiExpression expr) {
|
||||
return CommonUtils.isNumber(expr.getType()) ? ">" : ">=";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected Pair<String, String> calculateBounds(@NotNull PsiExpression expression) {
|
||||
String bound = getExpressionBound(expression);
|
||||
if (bound == null) {
|
||||
return null;
|
||||
}
|
||||
return CommonUtils.isNumber(expression.getType())
|
||||
? Pair.create(bound, "0")
|
||||
: Pair.create(bound + " - 1", "0");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.codeInsight.template.Template;
|
||||
import com.intellij.codeInsight.template.TemplateManager;
|
||||
import com.intellij.codeInsight.template.impl.MacroCallNode;
|
||||
import com.intellij.codeInsight.template.macro.SuggestVariableNameMacro;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import com.intellij.psi.PsiExpressionStatement;
|
||||
import com.intellij.psi.PsiType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.postfixCompletion.util.CommonUtils;
|
||||
|
||||
public abstract class ForIndexedPostfixTemplate extends PostfixTemplate {
|
||||
protected ForIndexedPostfixTemplate(@NotNull String key, @NotNull String description, @NotNull String example) {
|
||||
super(key, description, example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset) {
|
||||
PsiExpression expr = getTopmostExpression(context);
|
||||
if (expr == null || !(expr.getParent() instanceof PsiExpressionStatement)) return false;
|
||||
return CommonUtils.isNumber(expr.getType()) || CommonUtils.isArray(expr.getType()) || CommonUtils.isIterable(expr.getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(@NotNull PsiElement context, @NotNull Editor editor) {
|
||||
PsiExpression expr = getTopmostExpression(context);
|
||||
if (expr == null) {
|
||||
CommonUtils.showErrorHint(context.getProject(), editor);
|
||||
return;
|
||||
}
|
||||
|
||||
Pair<String, String> bounds = calculateBounds(expr);
|
||||
if (bounds == null) {
|
||||
CommonUtils.showErrorHint(context.getProject(), editor);
|
||||
return;
|
||||
}
|
||||
Project project = context.getProject();
|
||||
|
||||
Document document = editor.getDocument();
|
||||
document.deleteString(expr.getTextRange().getStartOffset(), expr.getTextRange().getEndOffset());
|
||||
TemplateManager manager = TemplateManager.getInstance(project);
|
||||
|
||||
Template template = manager.createTemplate("", "");
|
||||
template.setToReformat(true);
|
||||
template.addTextSegment("for (" + suggestIndexType(expr) + " ");
|
||||
MacroCallNode index = new MacroCallNode(new SuggestVariableNameMacro());
|
||||
String indexVariable = "index";
|
||||
template.addVariable(indexVariable, index, index, true);
|
||||
template.addTextSegment(" = " + bounds.first + "; ");
|
||||
template.addVariableSegment(indexVariable);
|
||||
template.addTextSegment(getComparativeSign(expr));
|
||||
template.addTextSegment(bounds.second);
|
||||
template.addTextSegment("; ");
|
||||
template.addVariableSegment(indexVariable);
|
||||
template.addTextSegment(getOperator());
|
||||
template.addTextSegment(") {\n");
|
||||
template.addEndVariable();
|
||||
template.addTextSegment("\n}");
|
||||
|
||||
manager.startTemplate(editor, template);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected abstract String getComparativeSign(@NotNull PsiExpression expr);
|
||||
|
||||
@Nullable
|
||||
protected abstract Pair<String, String> calculateBounds(@NotNull PsiExpression expression);
|
||||
|
||||
@NotNull
|
||||
protected abstract String getOperator();
|
||||
|
||||
@Nullable
|
||||
protected static String getExpressionBound(@NotNull PsiExpression expr) {
|
||||
PsiType type = expr.getType();
|
||||
if (CommonUtils.isNumber(type)) {
|
||||
return expr.getText();
|
||||
}
|
||||
else if (CommonUtils.isArray(type)) {
|
||||
return expr.getText() + ".length";
|
||||
}
|
||||
else if (CommonUtils.isIterable(type)) {
|
||||
return expr.getText() + ".size()";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String suggestIndexType(@NotNull PsiExpression expr) {
|
||||
PsiType type = expr.getType();
|
||||
if (CommonUtils.isNumber(type)) {
|
||||
return type.getCanonicalText();
|
||||
}
|
||||
return "int";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.codeInsight.template.Template;
|
||||
import com.intellij.codeInsight.template.TemplateManager;
|
||||
import com.intellij.codeInsight.template.impl.MacroCallNode;
|
||||
import com.intellij.codeInsight.template.impl.TextExpression;
|
||||
import com.intellij.codeInsight.template.impl.VariableNode;
|
||||
import com.intellij.codeInsight.template.macro.IterableComponentTypeMacro;
|
||||
import com.intellij.codeInsight.template.macro.SuggestVariableNameMacro;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import com.intellij.psi.PsiExpressionStatement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.postfixCompletion.util.CommonUtils;
|
||||
|
||||
public class ForeachPostfixTemplate extends PostfixTemplate {
|
||||
public ForeachPostfixTemplate() {
|
||||
super("for", "Iterates over enumerable collection", "for (T item : collection)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset) {
|
||||
PsiExpression expr = getTopmostExpression(context);
|
||||
if (expr == null || !(expr.getParent() instanceof PsiExpressionStatement)) return false;
|
||||
return CommonUtils.isArray(expr.getType()) || CommonUtils.isIterable(expr.getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(@NotNull PsiElement context, @NotNull Editor editor) {
|
||||
PsiExpression expr = getTopmostExpression(context);
|
||||
if (expr == null) return;
|
||||
Project project = context.getProject();
|
||||
|
||||
Document document = editor.getDocument();
|
||||
document.deleteString(expr.getTextRange().getStartOffset(), expr.getTextRange().getEndOffset());
|
||||
TemplateManager manager = TemplateManager.getInstance(project);
|
||||
|
||||
Template template = manager.createTemplate("", "");
|
||||
template.setToReformat(true);
|
||||
template.addTextSegment("for (");
|
||||
MacroCallNode type = new MacroCallNode(new IterableComponentTypeMacro());
|
||||
|
||||
String variable = "variable";
|
||||
type.addParameter(new VariableNode(variable, null));
|
||||
MacroCallNode name = new MacroCallNode(new SuggestVariableNameMacro());
|
||||
|
||||
template.addVariable("type", type, type, false);
|
||||
template.addTextSegment(" ");
|
||||
template.addVariable("name", name, name, true);
|
||||
|
||||
template.addTextSegment(" : ");
|
||||
template.addVariable(variable, new TextExpression(expr.getText()), false);
|
||||
template.addTextSegment(") {\n");
|
||||
template.addEndVariable();
|
||||
template.addTextSegment("\n}");
|
||||
|
||||
manager.startTemplate(editor, template);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.postfixCompletion.util.JavaSurroundersProxy;
|
||||
|
||||
public class IfStatementPostfixTemplate extends BooleanPostfixTemplate {
|
||||
public IfStatementPostfixTemplate() {
|
||||
super("if", "Checks boolean expression to be 'true'", "if (expr)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(@NotNull PsiElement context, @NotNull final Editor editor) {
|
||||
PsiExpression expression = getTopmostExpression(context);
|
||||
assert expression != null;
|
||||
TextRange range = JavaSurroundersProxy.ifStatement(expression.getProject(), editor, expression);
|
||||
if (range != null) {
|
||||
editor.getCaretModel().moveToOffset(range.getStartOffset());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.codeInsight.guess.GuessManager;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.PsiTypeLookupItem;
|
||||
import com.intellij.codeInsight.template.*;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.RangeMarker;
|
||||
import com.intellij.openapi.editor.ScrollType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.refactoring.introduceField.ElementToWorkOn;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.postfixCompletion.util.Aliases;
|
||||
import org.jetbrains.postfixCompletion.util.CommonUtils;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@Aliases("inst")
|
||||
public class InstanceofExpressionPostfixTemplate extends PostfixTemplate {
|
||||
public InstanceofExpressionPostfixTemplate() {
|
||||
super("instanceof", "Surrounds expression with instanceof", "expr instanceof SomeType ? ((SomeType) expr). : null");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset) {
|
||||
return getTopmostExpression(context) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(@NotNull PsiElement context, @NotNull Editor editor) {
|
||||
PsiExpression expression = getTopmostExpression(context);
|
||||
if (expression == null) return;
|
||||
surroundExpression(context.getProject(), editor, expression);
|
||||
}
|
||||
|
||||
private static void surroundExpression(Project project, Editor editor, PsiExpression expr) throws IncorrectOperationException {
|
||||
assert expr.isValid();
|
||||
PsiType[] types = GuessManager.getInstance(project).guessTypeToCast(expr);
|
||||
final boolean parenthesesNeeded = expr instanceof PsiPolyadicExpression ||
|
||||
expr instanceof PsiConditionalExpression ||
|
||||
expr instanceof PsiAssignmentExpression;
|
||||
String exprText = parenthesesNeeded ? "(" + expr.getText() + ")" : expr.getText();
|
||||
Template template = generateTemplate(project, exprText, types);
|
||||
TextRange range;
|
||||
if (expr.isPhysical()) {
|
||||
range = expr.getTextRange();
|
||||
}
|
||||
else {
|
||||
RangeMarker rangeMarker = expr.getUserData(ElementToWorkOn.TEXT_RANGE);
|
||||
if (rangeMarker == null) {
|
||||
CommonUtils.showErrorHint(project, editor);
|
||||
return;
|
||||
}
|
||||
range = new TextRange(rangeMarker.getStartOffset(), rangeMarker.getEndOffset());
|
||||
}
|
||||
editor.getDocument().deleteString(range.getStartOffset(), range.getEndOffset());
|
||||
editor.getCaretModel().moveToOffset(range.getStartOffset());
|
||||
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
|
||||
TemplateManager.getInstance(project).startTemplate(editor, template);
|
||||
}
|
||||
|
||||
private static Template generateTemplate(Project project, String exprText, PsiType[] suggestedTypes) {
|
||||
TemplateManager templateManager = TemplateManager.getInstance(project);
|
||||
Template template = templateManager.createTemplate("", "");
|
||||
template.setToReformat(true);
|
||||
|
||||
Set<LookupElement> itemSet = new LinkedHashSet<LookupElement>();
|
||||
for (PsiType type : suggestedTypes) {
|
||||
itemSet.add(PsiTypeLookupItem.createLookupItem(type, null));
|
||||
}
|
||||
final LookupElement[] lookupItems = itemSet.toArray(new LookupElement[itemSet.size()]);
|
||||
final Result result = suggestedTypes.length > 0 ? new PsiTypeResult(suggestedTypes[0], project) : null;
|
||||
|
||||
Expression expr = new Expression() {
|
||||
@Override
|
||||
public LookupElement[] calculateLookupItems(ExpressionContext context) {
|
||||
return lookupItems.length > 1 ? lookupItems : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result calculateResult(ExpressionContext context) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result calculateQuickResult(ExpressionContext context) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
template.addTextSegment(exprText);
|
||||
template.addTextSegment(" instanceof ");
|
||||
String type = "type";
|
||||
template.addVariable(type, expr, expr, true);
|
||||
template.addTextSegment(" ? ((");
|
||||
template.addVariableSegment(type);
|
||||
template.addTextSegment(")" + exprText + ")");
|
||||
template.addEndVariable();
|
||||
template.addTextSegment(" : null;");
|
||||
|
||||
return template;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.refactoring.introduceField.IntroduceFieldHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class IntroduceFieldPostfixTemplate extends ExpressionPostfixTemplateWithChooser {
|
||||
public IntroduceFieldPostfixTemplate() {
|
||||
super("field", "Introduces field for expression", "myField = expr;");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doIt(@NotNull Editor editor, @NotNull PsiExpression expression) {
|
||||
IntroduceFieldHandler handler = ApplicationManager.getApplication().isUnitTestMode() ? getMockHandler(expression) : new IntroduceFieldHandler();
|
||||
handler.invoke(expression.getProject(), new PsiElement[]{expression}, null);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static IntroduceFieldHandler getMockHandler(@NotNull final PsiExpression expression) {
|
||||
final PsiClass containingClass = PsiTreeUtil.getParentOfType(expression, PsiClass.class);
|
||||
assert containingClass != null;
|
||||
|
||||
return new IntroduceFieldHandler() {
|
||||
// mock default settings
|
||||
@Override
|
||||
protected Settings showRefactoringDialog(Project project, Editor editor, PsiClass parentClass,
|
||||
PsiExpression expr, PsiType type, PsiExpression[] occurrences,
|
||||
PsiElement anchorElement, PsiElement anchorElementIfAll) {
|
||||
return new Settings(
|
||||
"foo", expression, PsiExpression.EMPTY_ARRAY, false, false, false,
|
||||
InitializationPlace.IN_CURRENT_METHOD, PsiModifier.PRIVATE, null,
|
||||
null, false, containingClass, false, false);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.refactoring.introduce.inplace.OccurrencesChooser;
|
||||
import com.intellij.refactoring.introduceVariable.InputValidator;
|
||||
import com.intellij.refactoring.introduceVariable.IntroduceVariableHandler;
|
||||
import com.intellij.refactoring.introduceVariable.IntroduceVariableSettings;
|
||||
import com.intellij.refactoring.ui.TypeSelectorManagerImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
// todo: support for int[].var (parses as .class access!)
|
||||
public class IntroduceVariablePostfixTemplate extends ExpressionPostfixTemplateWithChooser {
|
||||
public IntroduceVariablePostfixTemplate() {
|
||||
super("var", "Introduces variable for expression", "T name = expr;");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doIt(@NotNull Editor editor, @NotNull PsiExpression expression) {
|
||||
// for advanced stuff use ((PsiJavaCodeReferenceElement)expression).advancedResolve(true).getElement();
|
||||
IntroduceVariableHandler handler = ApplicationManager.getApplication().isUnitTestMode() ? getMockHandler() : new IntroduceVariableHandler();
|
||||
handler.invoke(expression.getProject(), editor, expression);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static IntroduceVariableHandler getMockHandler() {
|
||||
return new IntroduceVariableHandler() {
|
||||
// mock default settings
|
||||
@Override
|
||||
public final IntroduceVariableSettings getSettings(Project project, Editor editor, final PsiExpression expr,
|
||||
PsiExpression[] occurrences, TypeSelectorManagerImpl typeSelectorManager,
|
||||
boolean declareFinalIfAll, boolean anyAssignmentLHS, InputValidator validator,
|
||||
PsiElement anchor, OccurrencesChooser.ReplaceChoice replaceChoice) {
|
||||
return new IntroduceVariableSettings() {
|
||||
@Override
|
||||
public String getEnteredName() {
|
||||
return "foo";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceAllOccurrences() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeclareFinal() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceLValues() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiType getSelectedType() {
|
||||
return expr.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOK() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class IsNullCheckPostfixTemplate extends NullCheckPostfixTemplate {
|
||||
public IsNullCheckPostfixTemplate() {
|
||||
super("null", "Checks expression to be null", "if (expr == null)");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTail() {
|
||||
return "== null";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class NewExpressionPostfixTemplate extends PostfixTemplate {
|
||||
public NewExpressionPostfixTemplate() {
|
||||
super("new", "Produces instantiation expression for type", "new SomeType()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset) {
|
||||
// todo: copy paste?
|
||||
PsiElement ref = PsiTreeUtil.getParentOfType(context, PsiJavaCodeReferenceElement.class);
|
||||
if (ref instanceof PsiJavaReference) {
|
||||
PsiElement element = ((PsiJavaReference)ref).advancedResolve(true).getElement();
|
||||
if (element instanceof PsiClass) {
|
||||
PsiClass psiClass = (PsiClass)element;
|
||||
CtorAccessibility accessibility = calcAccessibility(psiClass, context);
|
||||
if (accessibility != CtorAccessibility.NOT_ACCESSIBLE) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(@NotNull PsiElement context, @NotNull Editor editor) {
|
||||
PsiElement ref = PsiTreeUtil.getParentOfType(context, PsiJavaCodeReferenceElement.class);
|
||||
|
||||
if (ref instanceof PsiJavaReference) {
|
||||
PsiElement element = ((PsiJavaReference)ref).advancedResolve(true).getElement();
|
||||
if (element instanceof PsiClass) {
|
||||
PsiClass psiClass = (PsiClass)element;
|
||||
CtorAccessibility accessibility = calcAccessibility(psiClass, context);
|
||||
if (accessibility != CtorAccessibility.NOT_ACCESSIBLE) {
|
||||
boolean typeRequiresRefinement = psiClass.isInterface() || psiClass.hasModifierProperty(PsiModifier.ABSTRACT);
|
||||
|
||||
String template = "new " + ref.getText() + "()";
|
||||
if (typeRequiresRefinement) template += "{}";
|
||||
|
||||
PsiElementFactory factory = JavaPsiFacade.getInstance(context.getProject()).getElementFactory();
|
||||
PsiNewExpression newExpression = (PsiNewExpression)factory.createExpressionFromText(template, context);
|
||||
PsiElement replace = ref.getParent().replace(newExpression);
|
||||
replace.getNode().addLeaf(JavaTokenType.SEMICOLON, ";", null);
|
||||
int offset = calculateOffset((PsiNewExpression)replace, accessibility, typeRequiresRefinement);
|
||||
editor.getCaretModel().moveToOffset(offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int calculateOffset(PsiNewExpression expression, CtorAccessibility accessibility, boolean typeRequiresRefinement) {
|
||||
PsiExpressionList argumentList = expression.getArgumentList();
|
||||
assert argumentList != null;
|
||||
if (accessibility == CtorAccessibility.WITH_PARAMETRIC_CTOR || accessibility == CtorAccessibility.NOT_ACCESSIBLE) { // new T(<caret>)
|
||||
return argumentList.getFirstChild().getTextRange().getEndOffset();
|
||||
}
|
||||
else if (typeRequiresRefinement) {
|
||||
PsiAnonymousClass anonymousClass = expression.getAnonymousClass();
|
||||
PsiElement lBrace = anonymousClass != null ? anonymousClass.getLBrace() : null;
|
||||
if (lBrace != null) return lBrace.getTextRange().getEndOffset();
|
||||
}
|
||||
return expression.getTextRange().getEndOffset();
|
||||
}
|
||||
|
||||
public enum CtorAccessibility {
|
||||
NOT_ACCESSIBLE,
|
||||
WITH_DEFAULT_CTOR,
|
||||
WITH_PARAMETRIC_CTOR
|
||||
}
|
||||
|
||||
private static CtorAccessibility calcAccessibility(@Nullable PsiClass psiClass, @NotNull PsiElement accessContext) {
|
||||
if (psiClass == null) return CtorAccessibility.NOT_ACCESSIBLE;
|
||||
if (psiClass.isEnum()) return CtorAccessibility.NOT_ACCESSIBLE;
|
||||
if (psiClass.isInterface()) return CtorAccessibility.WITH_DEFAULT_CTOR;
|
||||
|
||||
PsiClass containingType = PsiTreeUtil.getParentOfType(accessContext, PsiClass.class);
|
||||
JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(accessContext.getProject());
|
||||
PsiResolveHelper resolveHelper = psiFacade.getResolveHelper();
|
||||
|
||||
PsiMethod[] constructors = psiClass.getConstructors();
|
||||
if (constructors.length == 0) return CtorAccessibility.WITH_DEFAULT_CTOR;
|
||||
|
||||
boolean hasAccessibleCtors = false, hasParametricCtors = false;
|
||||
|
||||
for (PsiMethod constructor : constructors) {
|
||||
if (resolveHelper.isAccessible(constructor, accessContext, containingType)) {
|
||||
hasAccessibleCtors = true;
|
||||
int parametersCount = constructor.getParameterList().getParametersCount();
|
||||
if (parametersCount != 0) hasParametricCtors = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasAccessibleCtors) return CtorAccessibility.NOT_ACCESSIBLE;
|
||||
|
||||
return hasParametricCtors ? CtorAccessibility.WITH_PARAMETRIC_CTOR : CtorAccessibility.WITH_DEFAULT_CTOR;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightServicesUtil;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.postfixCompletion.util.CommonUtils;
|
||||
|
||||
public class NotExpressionPostfixTemplate extends ExpressionPostfixTemplateWithChooser {
|
||||
public NotExpressionPostfixTemplate() {
|
||||
super("not", "Negates boolean expression", "!expr");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doIt(@NotNull Editor editor, @NotNull PsiExpression expression) {
|
||||
expression.replace(CodeInsightServicesUtil.invertCondition(expression));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected Condition<PsiExpression> getTypeCondition() {
|
||||
return new Condition<PsiExpression>() {
|
||||
@Override
|
||||
public boolean value(PsiExpression expression) {
|
||||
return CommonUtils.isBoolean(expression.getType());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.postfixCompletion.util.Aliases;
|
||||
|
||||
@Aliases("nn")
|
||||
public class NotNullCheckPostfixTemplate extends NullCheckPostfixTemplate {
|
||||
public NotNullCheckPostfixTemplate() {
|
||||
super("notnull", "Checks expression to be not-null", "if (expr != null)");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTail() {
|
||||
return "!= null";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.postfixCompletion.util.JavaSurroundersProxy;
|
||||
|
||||
/**
|
||||
* @author ignatov
|
||||
*/
|
||||
public abstract class NullCheckPostfixTemplate extends PostfixTemplate {
|
||||
protected NullCheckPostfixTemplate(@NotNull String name, @NotNull String description, @NotNull String example) {
|
||||
super(name, description, example);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
abstract String getTail();
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset) {
|
||||
PsiExpression expr = getTopmostExpression(context);
|
||||
PsiElement parent = expr != null ? expr.getParent() : null;
|
||||
return parent instanceof PsiExpressionStatement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(@NotNull PsiElement context, @NotNull Editor editor) {
|
||||
PsiExpression expr = getTopmostExpression(context);
|
||||
if (expr == null) return;
|
||||
|
||||
Project project = expr.getProject();
|
||||
PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();
|
||||
PsiBinaryExpression condition = (PsiBinaryExpression)factory.createExpressionFromText(expr.getText() + getTail(), context);
|
||||
|
||||
PsiElement replace = expr.replace(condition);
|
||||
assert replace instanceof PsiExpression;
|
||||
|
||||
TextRange range = JavaSurroundersProxy.ifStatement(project, editor, (PsiExpression)replace);
|
||||
if (range != null) {
|
||||
editor.getCaretModel().moveToOffset(range.getStartOffset());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiElementFactory;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import com.intellij.psi.PsiParenthesizedExpression;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ParenthesizedExpressionPostfixTemplate extends ExpressionPostfixTemplateWithChooser {
|
||||
public ParenthesizedExpressionPostfixTemplate() {
|
||||
super("par", "Parenthesizes expression", "(expression)");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doIt(@NotNull Editor editor, @NotNull PsiExpression expression) {
|
||||
PsiElementFactory factory = JavaPsiFacade.getInstance(expression.getProject()).getElementFactory();
|
||||
PsiParenthesizedExpression parenthesizedExpression = (PsiParenthesizedExpression)factory.createExpressionFromText("(expr)", expression.getParent());
|
||||
PsiExpression operand = parenthesizedExpression.getExpression();
|
||||
assert operand != null;
|
||||
operand.replace(expression);
|
||||
expression.replace(parenthesizedExpression);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionInitializationContext;
|
||||
import com.intellij.codeInsight.completion.CompletionType;
|
||||
import com.intellij.codeInsight.completion.JavaCompletionContributor;
|
||||
import com.intellij.codeInsight.template.CustomLiveTemplateBase;
|
||||
import com.intellij.codeInsight.template.CustomTemplateCallback;
|
||||
import com.intellij.codeInsight.template.impl.TemplateSettings;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.command.undo.UndoConstants;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiFileFactory;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.postfixCompletion.settings.PostfixCompletionSettings;
|
||||
import org.jetbrains.postfixCompletion.util.Aliases;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class PostfixLiveTemplate extends CustomLiveTemplateBase {
|
||||
public static final String POSTFIX_TEMPLATE_ID = "POSTFIX_TEMPLATE_ID";
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(PostfixLiveTemplate.class);
|
||||
private final HashMap<String, PostfixTemplate> myTemplates = ContainerUtil.newHashMap();
|
||||
|
||||
public PostfixLiveTemplate() {
|
||||
for (PostfixTemplate template : PostfixTemplate.EP_NAME.getExtensions()) {
|
||||
register(template.getKey(), template);
|
||||
Aliases aliases = template.getClass().getAnnotation(Aliases.class);
|
||||
if (aliases != null) {
|
||||
for (String key : aliases.value()) {
|
||||
register("." + key, template);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void register(@NotNull String key, @NotNull PostfixTemplate template) {
|
||||
PostfixTemplate registered = myTemplates.put(key, template);
|
||||
if (registered != null) {
|
||||
LOG.error("Can't register postfix template. Duplicated key: " + template.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String computeTemplateKey(@NotNull CustomTemplateCallback callback) {
|
||||
Editor editor = callback.getEditor();
|
||||
String key = computeTemplateKeyWithoutContextChecking(editor);
|
||||
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
return isApplicableTemplate(getTemplateByKey(key), key, callback.getContext().getContainingFile(), editor) ? key : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String computeTemplateKeyWithoutContextChecking(@NotNull Editor editor) {
|
||||
int currentOffset = editor.getCaretModel().getOffset();
|
||||
CharSequence documentContent = editor.getDocument().getCharsSequence();
|
||||
int startOffset = currentOffset;
|
||||
while (startOffset > 0) {
|
||||
char currentChar = documentContent.charAt(startOffset - 1);
|
||||
if (!Character.isJavaIdentifierPart(currentChar)) {
|
||||
if (currentChar != '.') {
|
||||
return null;
|
||||
}
|
||||
startOffset--;
|
||||
break;
|
||||
}
|
||||
startOffset--;
|
||||
}
|
||||
return String.valueOf(documentContent.subSequence(startOffset, currentOffset));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(@NotNull final String key, @NotNull final CustomTemplateCallback callback) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
|
||||
final PostfixTemplate template = getTemplateByKey(key);
|
||||
final Editor editor = callback.getEditor();
|
||||
final PsiFile file = callback.getContext().getContainingFile();
|
||||
if (isApplicableTemplate(template, key, file, editor)) {
|
||||
int currentOffset = editor.getCaretModel().getOffset();
|
||||
PsiElement newContext = deleteTemplateKey(file, editor.getDocument(), currentOffset, key);
|
||||
newContext = addSemicolonIfNeeded(editor, editor.getDocument(), newContext, currentOffset - key.length());
|
||||
expandTemplate(template, editor, newContext);
|
||||
}
|
||||
else {
|
||||
LOG.error("Template not found by key: " + key);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(PsiFile file, int offset, boolean wrapping) {
|
||||
PostfixCompletionSettings settings = PostfixCompletionSettings.getInstance();
|
||||
return !wrapping
|
||||
&& file != null
|
||||
&& settings != null
|
||||
&& settings.isPostfixPluginEnabled()
|
||||
&& PsiUtilCore.getLanguageAtOffset(file, offset) == JavaLanguage.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsWrapping() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wrap(@NotNull String selection, @NotNull CustomTemplateCallback callback) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return "Postfix";
|
||||
}
|
||||
|
||||
@Override
|
||||
public char getShortcut() {
|
||||
PostfixCompletionSettings settings = PostfixCompletionSettings.getInstance();
|
||||
return settings != null ? (char)settings.getShortcut() : TemplateSettings.TAB_CHAR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCompletionItem(@NotNull PsiFile file, int offset) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PostfixTemplate getTemplateByKey(@NotNull String key) {
|
||||
return myTemplates.get(key);
|
||||
}
|
||||
|
||||
private static void expandTemplate(@NotNull final PostfixTemplate template,
|
||||
@NotNull final Editor editor,
|
||||
@NotNull final PsiElement context) {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CommandProcessor.getInstance().executeCommand(context.getProject(), new Runnable() {
|
||||
public void run() {
|
||||
template.expand(context, editor);
|
||||
}
|
||||
}, "Expand postfix template", POSTFIX_TEMPLATE_ID);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Contract("null, _, _, _ -> false")
|
||||
private static boolean isApplicableTemplate(@Nullable PostfixTemplate template, @NotNull String key, @NotNull PsiFile file, @NotNull Editor editor) {
|
||||
if (template == null || !template.isEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int currentOffset = editor.getCaretModel().getOffset();
|
||||
int newOffset = currentOffset - key.length();
|
||||
CharSequence fileContent = editor.getDocument().getCharsSequence();
|
||||
|
||||
StringBuilder fileContentWithoutKey = new StringBuilder();
|
||||
fileContentWithoutKey.append(fileContent.subSequence(0, newOffset));
|
||||
fileContentWithoutKey.append(fileContent.subSequence(currentOffset, fileContent.length()));
|
||||
PsiFile copyFile = copyFile(file, fileContentWithoutKey);
|
||||
Document copyDocument = copyFile.getViewProvider().getDocument();
|
||||
if (copyDocument == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isSemicolonNeeded(copyFile, editor)) {
|
||||
fileContentWithoutKey.insert(newOffset, ';');
|
||||
copyFile = copyFile(file, fileContentWithoutKey);
|
||||
copyDocument = copyFile.getViewProvider().getDocument();
|
||||
if (copyDocument == null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
PsiElement context = CustomTemplateCallback.getContext(copyFile, newOffset > 0 ? newOffset - 1 : newOffset);
|
||||
return template.isApplicable(context, copyDocument, newOffset);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static PsiFile copyFile(@NotNull PsiFile file, @NotNull StringBuilder fileContentWithoutKey) {
|
||||
final PsiFileFactory psiFileFactory = PsiFileFactory.getInstance(file.getProject());
|
||||
PsiFile copy = psiFileFactory.createFileFromText(file.getName(), file.getFileType(), fileContentWithoutKey);
|
||||
VirtualFile vFile = copy.getVirtualFile();
|
||||
if (vFile != null) {
|
||||
vFile.putUserData(UndoConstants.DONT_RECORD_UNDO, Boolean.TRUE);
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static PsiElement deleteTemplateKey(@NotNull final PsiFile file,
|
||||
@NotNull final Document document,
|
||||
final int currentOffset,
|
||||
@NotNull final String key) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
|
||||
final int startOffset = currentOffset - key.length();
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() {
|
||||
public void run() {
|
||||
document.deleteString(startOffset, currentOffset);
|
||||
PsiDocumentManager.getInstance(file.getProject()).commitDocument(document);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return CustomTemplateCallback.getContext(file, startOffset > 0 ? startOffset - 1 : startOffset);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static PsiElement addSemicolonIfNeeded(@NotNull final Editor editor,
|
||||
@NotNull final Document document,
|
||||
@NotNull final PsiElement context,
|
||||
final int offset) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
|
||||
final Ref<PsiElement> newContext = Ref.create(context);
|
||||
final PsiFile file = context.getContainingFile();
|
||||
if (isSemicolonNeeded(file, editor)) {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() {
|
||||
public void run() {
|
||||
document.insertString(offset, ";");
|
||||
PsiDocumentManager.getInstance(context.getProject()).commitDocument(document);
|
||||
newContext.set(CustomTemplateCallback.getContext(file, offset - 1));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
return newContext.get();
|
||||
}
|
||||
|
||||
private static boolean isSemicolonNeeded(@NotNull PsiFile file, @NotNull Editor editor) {
|
||||
CompletionInitializationContext initializationContext = new CompletionInitializationContext(editor, file, CompletionType.BASIC);
|
||||
new JavaCompletionContributor().beforeCompletion(initializationContext);
|
||||
return StringUtil.endsWithChar(initializationContext.getDummyIdentifier(), ';');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.postfixCompletion.settings.PostfixCompletionSettings;
|
||||
|
||||
public abstract class PostfixTemplate {
|
||||
@NotNull private final String myPresentableName;
|
||||
@NotNull private final String myKey;
|
||||
@NotNull private final String myDescription;
|
||||
@NotNull private final String myExample;
|
||||
|
||||
@NotNull
|
||||
public static final ExtensionPointName<PostfixTemplate> EP_NAME = ExtensionPointName.create("org.jetbrains.postfixCompletion.postfixTemplate");
|
||||
|
||||
protected PostfixTemplate(@NotNull String name, @NotNull String description, @NotNull String example) {
|
||||
this(name, "." + name, description, example);
|
||||
}
|
||||
|
||||
protected PostfixTemplate(@NotNull String name, @NotNull String key, @NotNull String description, @NotNull String example) {
|
||||
myPresentableName = name;
|
||||
myKey = key;
|
||||
myDescription = description;
|
||||
myExample = example;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public final String getKey() {
|
||||
return myKey;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getPresentableName() {
|
||||
return myPresentableName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getDescription() {
|
||||
return myDescription;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getExample() {
|
||||
return myExample;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
final PostfixCompletionSettings settings = PostfixCompletionSettings.getInstance();
|
||||
return settings != null && settings.isPostfixPluginEnabled() && settings.isTemplateEnabled(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiExpression getTopmostExpression(PsiElement context) {
|
||||
return PsiTreeUtil.getTopmostParentOfType(context, PsiExpression.class);
|
||||
}
|
||||
|
||||
public abstract boolean isApplicable(@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset);
|
||||
|
||||
public abstract void expand(@NotNull PsiElement context, @NotNull Editor editor);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ReturnStatementPostfixTemplate extends PostfixTemplate {
|
||||
public ReturnStatementPostfixTemplate() {
|
||||
super("return", "Returns value from containing method", "return expr;");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset) {
|
||||
PsiExpression expr = getTopmostExpression(context);
|
||||
if (expr == null || !(expr.getParent() instanceof PsiExpressionStatement)) return false;
|
||||
PsiType type = expr.getType();
|
||||
return type != null && !PsiType.VOID.equals(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(@NotNull PsiElement context, @NotNull Editor editor) {
|
||||
PsiExpression expr = getTopmostExpression(context);
|
||||
PsiElement parent = expr != null ? expr.getParent() : null;
|
||||
if (!(parent instanceof PsiExpressionStatement)) return;
|
||||
PsiElementFactory factory = JavaPsiFacade.getInstance(expr.getProject()).getElementFactory();
|
||||
PsiReturnStatement returnStatement = (PsiReturnStatement)factory.createStatementFromText("return " + expr.getText() + ";", parent);
|
||||
parent.replace(returnStatement);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightUtilCore;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
|
||||
/**
|
||||
* @author ignatov
|
||||
*/
|
||||
public abstract class StatementPostfixTemplateBase extends PostfixTemplate {
|
||||
protected StatementPostfixTemplateBase(String name, String description, String example) {
|
||||
super(name, description, example);
|
||||
}
|
||||
|
||||
protected void surroundWith(PsiElement context, Editor editor, String text) {
|
||||
PsiExpression expr = getTopmostExpression(context);
|
||||
PsiElement parent = expr != null ? expr.getParent() : null;
|
||||
if (!(parent instanceof PsiExpressionStatement)) return;
|
||||
|
||||
Project project = context.getProject();
|
||||
PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();
|
||||
CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(project);
|
||||
PsiElement statement = codeStyleManager.reformat(factory.createStatementFromText(text + " (" + expr.getText() + ") {\nst;\n}", context));
|
||||
statement = parent.replace(statement);
|
||||
|
||||
//noinspection ConstantConditions
|
||||
PsiCodeBlock block = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(PsiTreeUtil.getChildOfType(statement, PsiCodeBlock.class));
|
||||
TextRange range = block.getStatements()[0].getTextRange();
|
||||
editor.getDocument().deleteString(range.getStartOffset(), range.getEndOffset());
|
||||
|
||||
editor.getCaretModel().moveToOffset(range.getStartOffset());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class SwitchStatementPostfixTemplate extends StatementPostfixTemplateBase {
|
||||
public SwitchStatementPostfixTemplate() {
|
||||
super("switch", "Produces switch over integral/enum/string values", "switch (expr)");
|
||||
}
|
||||
|
||||
private static boolean isSwitchCompatibleType(@Nullable PsiType type, @NotNull PsiElement context) {
|
||||
if (type == null) return false;
|
||||
if (PsiType.INT.isAssignableFrom(type)) return true;
|
||||
|
||||
if (type instanceof PsiClassType) {
|
||||
PsiClass psiClass = ((PsiClassType)type).resolve();
|
||||
if (psiClass != null && psiClass.isEnum()) return true;
|
||||
}
|
||||
|
||||
if (type.equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) return true; // todo: mock jdk 6 and 7
|
||||
PsiFile containingFile = context.getContainingFile();
|
||||
if (containingFile instanceof PsiJavaFile) {
|
||||
LanguageLevel level = ((PsiJavaFile)containingFile).getLanguageLevel();
|
||||
if (level.isAtLeast(LanguageLevel.JDK_1_7)) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset) {
|
||||
PsiExpression expr = getTopmostExpression(context);
|
||||
return expr != null && expr.getParent() instanceof PsiExpressionStatement && isSwitchCompatibleType(expr.getType(), context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(@NotNull PsiElement context, @NotNull Editor editor) {
|
||||
surroundWith(context, editor, "switch");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class SynchronizedStatementPostfixTemplate extends StatementPostfixTemplateBase {
|
||||
public SynchronizedStatementPostfixTemplate() {
|
||||
super("synchronized", "Produces synchronization statement", "synchronized (expr)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset) {
|
||||
PsiExpression expression = getTopmostExpression(context);
|
||||
PsiElement parent = expression != null ? expression.getParent() : null;
|
||||
PsiType type = expression != null ? expression.getType() : null;
|
||||
return parent instanceof PsiExpressionStatement && type != null && !(type instanceof PsiPrimitiveType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(@NotNull PsiElement context, @NotNull Editor editor) {
|
||||
surroundWith(context, editor, "synchronized");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import com.intellij.psi.PsiExpressionStatement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.postfixCompletion.util.CommonUtils;
|
||||
|
||||
public class ThrowExceptionPostfixTemplate extends PostfixTemplate {
|
||||
public ThrowExceptionPostfixTemplate() {
|
||||
super("throw", "Throws expression of 'Throwable' type", "throw expr;");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset) {
|
||||
PsiExpression expr = getTopmostExpression(context);
|
||||
PsiElement parent = expr != null ? expr.getParent() : null;
|
||||
return parent instanceof PsiExpressionStatement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(@NotNull PsiElement context, @NotNull Editor editor) {
|
||||
CommonUtils.createSimpleStatement(context, editor, "throw");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.jetbrains.postfixCompletion.templates;
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class WhileStatementPostfixTemplate extends BooleanPostfixTemplate {
|
||||
public WhileStatementPostfixTemplate() {
|
||||
super("while", "Iterating while boolean statement is 'true'", "while (expr)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand(@NotNull PsiElement context, @NotNull Editor editor) {
|
||||
PsiExpression expression = getTopmostExpression(context);
|
||||
assert expression != null;
|
||||
|
||||
PsiElementFactory factory = JavaPsiFacade.getElementFactory(context.getProject());
|
||||
PsiWhileStatement whileStatement = (PsiWhileStatement)factory.createStatementFromText("while(expr)", context);
|
||||
PsiExpression condition = whileStatement.getCondition();
|
||||
assert condition != null;
|
||||
condition.replace(expression);
|
||||
PsiElement replacedWhileStatement = expression.replace(whileStatement);
|
||||
if (replacedWhileStatement instanceof PsiWhileStatement) {
|
||||
PsiJavaToken parenth = ((PsiWhileStatement)replacedWhileStatement).getRParenth();
|
||||
if (parenth != null) {
|
||||
editor.getCaretModel().moveToOffset(parenth.getTextRange().getEndOffset());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.jetbrains.postfixCompletion.util;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* @author ignatov
|
||||
*/
|
||||
@Target(value = ElementType.TYPE)
|
||||
@Retention(value = RetentionPolicy.RUNTIME)
|
||||
public @interface Aliases {
|
||||
String[] value();
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package org.jetbrains.postfixCompletion.util;
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.refactoring.util.CommonRefactoringUtil;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.postfixCompletion.templates.PostfixTemplate;
|
||||
|
||||
public abstract class CommonUtils {
|
||||
private CommonUtils() {
|
||||
}
|
||||
|
||||
public static void showErrorHint(Project project, Editor editor) {
|
||||
CommonRefactoringUtil.showErrorHint(project, editor, "Can't perform postfix completion", "Can't perform postfix completion", "");
|
||||
}
|
||||
|
||||
public static void createSimpleStatement(@NotNull PsiElement context, @NotNull Editor editor, @NotNull String text) {
|
||||
PsiExpression expr = PostfixTemplate.getTopmostExpression(context);
|
||||
PsiElement parent = expr != null ? expr.getParent() : null;
|
||||
assert parent instanceof PsiStatement;
|
||||
PsiElementFactory factory = JavaPsiFacade.getInstance(context.getProject()).getElementFactory();
|
||||
PsiStatement assertStatement = factory.createStatementFromText(text + " " + expr.getText() + ";", parent);
|
||||
PsiElement replace = parent.replace(assertStatement);
|
||||
editor.getCaretModel().moveToOffset(replace.getTextRange().getEndOffset());
|
||||
}
|
||||
|
||||
@Contract("null -> false")
|
||||
public static boolean isIterable(@Nullable PsiType type) {
|
||||
return type != null && InheritanceUtil.isInheritor(type, CommonClassNames.JAVA_LANG_ITERABLE);
|
||||
}
|
||||
|
||||
@Contract("null -> false")
|
||||
public static boolean isArray(@Nullable PsiType type) {
|
||||
return type != null && type instanceof PsiArrayType;
|
||||
}
|
||||
|
||||
@Contract("null -> false")
|
||||
public static boolean isBoolean(@Nullable PsiType type) {
|
||||
return type != null && (PsiType.BOOLEAN.equals(type) || PsiType.BOOLEAN.equals(PsiPrimitiveType.getUnboxedType(type)));
|
||||
}
|
||||
|
||||
@Contract("null -> false")
|
||||
public static boolean isNumber(@Nullable PsiType type) {
|
||||
if (type == null) {
|
||||
return false;
|
||||
}
|
||||
if (PsiType.INT.equals(type) || PsiType.BYTE.equals(type) || PsiType.LONG.equals(type)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
PsiPrimitiveType unboxedType = PsiPrimitiveType.getUnboxedType(type);
|
||||
return PsiType.INT.equals(unboxedType) || PsiType.BYTE.equals(unboxedType) || PsiType.LONG.equals(unboxedType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package org.jetbrains.postfixCompletion.util;
|
||||
|
||||
import com.intellij.codeInsight.generation.surroundWith.JavaExpressionSurroundDescriptor;
|
||||
import com.intellij.lang.surroundWith.Surrounder;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author ignatov
|
||||
*/
|
||||
public class JavaSurroundersProxy {
|
||||
private static final Surrounder[] SURROUNDERS = new JavaExpressionSurroundDescriptor().getSurrounders();
|
||||
|
||||
public static void cast(@NotNull Project project, @NotNull Editor editor, @NotNull PsiExpression expr)
|
||||
throws IncorrectOperationException {
|
||||
findAndApply("JavaWithCastSurrounder", project, editor, expr);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static TextRange ifStatement(@NotNull Project project, @NotNull Editor editor, @NotNull PsiExpression expr)
|
||||
throws IncorrectOperationException {
|
||||
return findAndApply("JavaWithIfExpressionSurrounder", project, editor, expr);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static TextRange findAndApply(@NotNull final String name,
|
||||
@NotNull Project project,
|
||||
@NotNull Editor editor,
|
||||
@NotNull PsiExpression expr) {
|
||||
Surrounder surrounder = ContainerUtil.find(SURROUNDERS, new Condition<Surrounder>() {
|
||||
@Override
|
||||
public boolean value(Surrounder surrounder) {
|
||||
return surrounder.getClass().getName().contains(name);
|
||||
}
|
||||
});
|
||||
|
||||
PsiElement[] elements = {expr};
|
||||
if (surrounder != null) {
|
||||
if (surrounder.isApplicable(elements)) {
|
||||
return surrounder.surroundElements(project, editor, elements);
|
||||
}
|
||||
else {
|
||||
CommonUtils.showErrorHint(project, editor);
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new IncorrectOperationException("Can't find any applicable surrounder with elements: " + Arrays.toString(elements));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
6
plugins/postfix/testData/backlog/var/var03-out.java
Normal file
@@ -0,0 +1,6 @@
|
||||
public class Foo {
|
||||
void m(Object o) {
|
||||
Foo foo = new Foo() {
|
||||
};<caret>
|
||||
}
|
||||
}
|
||||
5
plugins/postfix/testData/backlog/var/var03.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m(Object o) {
|
||||
new Foo() { }.<caret>
|
||||
}
|
||||
}
|
||||
5
plugins/postfix/testData/backlog/var/var04-out.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
int foo = 2 + 2;<caret>
|
||||
}
|
||||
}
|
||||
5
plugins/postfix/testData/backlog/var/var04.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
2 + 2.<caret>
|
||||
}
|
||||
}
|
||||
5
plugins/postfix/testData/backlog/var/var05-out.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
Foo foo = new Foo();<caret>
|
||||
}
|
||||
}
|
||||
5
plugins/postfix/testData/backlog/var/var05.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
Foo.<caret>
|
||||
}
|
||||
}
|
||||
6
plugins/postfix/testData/backlog/var/var06-out.java
Normal file
@@ -0,0 +1,6 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
unresolved.var
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
5
plugins/postfix/testData/backlog/var/var06.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
unresolved.<caret>
|
||||
}
|
||||
}
|
||||
7
plugins/postfix/testData/backlog/var/var07-out.java
Normal file
@@ -0,0 +1,7 @@
|
||||
public class Foo {
|
||||
Foo m() {
|
||||
Foo foo = m().m();
|
||||
foo<caret>.m();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
6
plugins/postfix/testData/backlog/var/var07.java
Normal file
@@ -0,0 +1,6 @@
|
||||
public class Foo {
|
||||
Foo m() {
|
||||
m().m().<caret>.m();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
5
plugins/postfix/testData/backlog/var/var08-out.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
boolean foo = true && false;<caret>
|
||||
}
|
||||
}
|
||||
5
plugins/postfix/testData/backlog/var/var08.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
true && false.<caret>
|
||||
}
|
||||
}
|
||||
6
plugins/postfix/testData/backlog/var/var09-out.java
Normal file
@@ -0,0 +1,6 @@
|
||||
public class Foo {
|
||||
void m(boolean b) {
|
||||
boolean foo = b && false;
|
||||
m(foo<caret>);
|
||||
}
|
||||
}
|
||||
5
plugins/postfix/testData/backlog/var/var09.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m(boolean b) {
|
||||
m(b && false.<caret>);
|
||||
}
|
||||
}
|
||||
5
plugins/postfix/testData/backlog/var/var10-out.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Foo<T> {
|
||||
void m() {
|
||||
Foo<Foo> foo = new Foo<Foo>();<caret>
|
||||
}
|
||||
}
|
||||
5
plugins/postfix/testData/backlog/var/var10.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Foo<T> {
|
||||
void m() {
|
||||
Foo<Foo>.<caret>;
|
||||
}
|
||||
}
|
||||
8
plugins/postfix/testData/backlog/var/var11-out.java
Normal file
@@ -0,0 +1,8 @@
|
||||
public class Foo {
|
||||
Foo f;
|
||||
Foo m() {
|
||||
Foo foo = m().m().f;<caret>
|
||||
m();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
7
plugins/postfix/testData/backlog/var/var11.java
Normal file
@@ -0,0 +1,7 @@
|
||||
public class Foo {
|
||||
Foo f;
|
||||
Foo m() {
|
||||
m().m().f.<caret>m();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
6
plugins/postfix/testData/backlog/var/var12-out.java
Normal file
@@ -0,0 +1,6 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
int foo = 1;
|
||||
foo<caret> + 2 /* comment */; // comment2
|
||||
}
|
||||
}
|
||||
5
plugins/postfix/testData/backlog/var/var12.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
1.<caret> + 2 /* comment */; // comment2
|
||||
}
|
||||
}
|
||||
8
plugins/postfix/testData/backlog/var/var13-out.java
Normal file
@@ -0,0 +1,8 @@
|
||||
public class Foo {
|
||||
Foo f;
|
||||
Foo m() {
|
||||
Foo foo = m().m().f;<caret>
|
||||
blah();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
7
plugins/postfix/testData/backlog/var/var13.java
Normal file
@@ -0,0 +1,7 @@
|
||||
public class Foo {
|
||||
Foo f;
|
||||
Foo m() {
|
||||
m().m().f.v<caret>blah();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
5
plugins/postfix/testData/backlog/var/var14-out.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
int foo = 1;<caret>
|
||||
}
|
||||
}
|
||||
5
plugins/postfix/testData/backlog/var/var14.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
1.<caret>
|
||||
}
|
||||
}
|
||||
6
plugins/postfix/testData/backlog/var/var15-out.java
Normal file
@@ -0,0 +1,6 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
int foo = 2 * 2;
|
||||
foo<caret> + 2 * 2; /* boo */
|
||||
}
|
||||
}
|
||||
5
plugins/postfix/testData/backlog/var/var15.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
2 * 2.<caret> + 2 * 2; /* boo */
|
||||
}
|
||||
}
|
||||
6
plugins/postfix/testData/backlog/var/var16-out.java
Normal file
@@ -0,0 +1,6 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
int foo = 2;
|
||||
int i = foo<caret> + 2 /**/ ;
|
||||
}
|
||||
}
|
||||
5
plugins/postfix/testData/backlog/var/var16.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
int i = 2.<caret> + 2 /**/ ;
|
||||
}
|
||||
}
|
||||
6
plugins/postfix/testData/backlog/var/var17-out.java
Normal file
@@ -0,0 +1,6 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
int foo = 2 + 3;
|
||||
int i = foo<caret> * 4; // blah
|
||||
}
|
||||
}
|
||||
5
plugins/postfix/testData/backlog/var/var17.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Foo {
|
||||
void m() {
|
||||
int i = 2 + 3.<caret> * 4; // blah
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import java.lang.Object;
|
||||
|
||||
public class Foo {
|
||||
void m() {
|
||||
new Object().<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import java.lang.Object;
|
||||
|
||||
public class Foo {
|
||||
void m() {
|
||||
new Object().<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import java.lang.Object;
|
||||
|
||||
public class Foo {
|
||||
void m() {
|
||||
new Object().<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
package com.<caret>
|
||||
@@ -0,0 +1,7 @@
|
||||
import java.lang.Object;
|
||||
|
||||
public class Foo {
|
||||
void m() {
|
||||
new Object().<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import java.lang.Object;
|
||||
|
||||
public class Foo {
|
||||
void m() {
|
||||
new Object().<caret>
|
||||
}
|
||||
}
|
||||