diff options
author | Tor Norbye <tnorbye@google.com> | 2013-09-05 16:07:26 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2013-09-05 16:07:52 -0700 |
commit | c7f983b5dcd0499fc68aacaba043874648932b6b (patch) | |
tree | c3a4323111a1af487dadb054a7f8974d76427b6a /xml | |
parent | 932259520ebaedeb2ccf4b7594bad50c700963d7 (diff) | |
download | idea-c7f983b5dcd0499fc68aacaba043874648932b6b.tar.gz |
Snapshot 2cb2395a861df68b665447030b8eba2323968de0 from idea/132.106 of git://git.jetbrains.org/idea/community.git
2cb2395: 2013-09-04 Sergey Evdokimov - IDEA generate maven libraries with incorrect classes URL. Url points to pom.xml instead of jar.
52aca33: 2013-09-04 Vladimir Krivosheev - cleanup: remove NodeJSProcessHandler
2e683c3: 2013-09-04 peter - @VisibleForTesting: when no real visibility is specified, consider it is one less the one specified in the source (IDEA-107730)
d3d2c37: 2013-09-04 Vladimir Krivosheev - CR-IC-2185 remove deprecated getStreamProviders()
6abec2b: 2013-09-04 Sergey Evdokimov - IDEA-90438 tooltip for constructor/method call should display package
7d20ed1: 2013-09-04 Vladislav.Soroka - IDEA-112870 Changing a library's scope from compile to testCompile in build.gradle does not change IDEA module settings
d40c1f8: 2013-09-04 Konstantin Bulenkov - IDEA-113175 Expanding nodes in Variables(Debug tools window) while debug application throws exception
9733cb8: 2013-09-04 peter - dfa: use correct code block for closure dfa calculation
1bcdb8e: 2013-09-04 Vassiliy - http://ea.jetbrains.com/browser/ea_reports/533457 NPE after dispose (as I see)
03698e8: 2013-09-04 peter - uppercase prefix should middle-match lowercase string
b2dce0d: 2013-09-04 Vladislav.Soroka - IDEA-78536 Gradle: New Project wizard: notifications on "Gradle home" field disappear too quickly
310cdb9: 2013-09-04 nik - simplified
bdfbce8: 2013-09-04 nik - cleanup
e2856e1: 2013-09-04 Anna Kozlova - EA-49556 - CCE: ExpectedTypesProvider$MyParentVisitor.visitAnnotationArrayInitializer
a56c7b1: 2013-09-04 Alexey Kudravtsev - editor api modules refactoring: - editor-ui-api module containing public API editor interfaces - editor-ui-impl module containing editor implementation interfaces - analysis* modules made dependant on editor-ui* modules - highlighting classes moved to *analysis* modules - majority of highlighting quickfixes moved to QuickFixFactory - injections in GeneralHighlightingPass splitted away to InjectedGeneralHighlightingPass
06c2cde: 2013-09-04 Alexey Kudravtsev - removing of smart pointers fixed
2a8f1fb: 2013-09-04 Anna Kozlova - Merge remote-tracking branch 'origin/master'
9494207: 2013-09-04 Anna Kozlova - Revert: Fix all known "Field may be final" problems (IDEA-80439, IDEA-84561, IDEA-84614, IDEA-87373,IDEA-89711, IDEA-91969, IDEA-111396) (a3afcb0)
2c72731: 2013-09-04 Mikhail Golubev - Merge remote-tracking branch 'origin/master'
321e11e: 2013-09-04 Anna Kozlova - testdata updated
0622404: 2013-09-03 Anna Kozlova - method refs: ambiguity (IDEA-113078)
a3afcb0: 2013-09-04 Bas Leijdekkers - Fix all known "Field may be final" problems (IDEA-80439, IDEA-84561, IDEA-84614, IDEA-87373,IDEA-89711, IDEA-91969, IDEA-111396)
d1f8908: 2013-09-04 Vladislav.Soroka - IDEA-50450 Gradle code insight
071903a: 2013-09-04 nik - compilation fixed
cc76e57: 2013-09-04 nik - xdebugger api: method intended for internal use only removed from interface
dc939ea: 2013-09-04 nik - xdebugger api: constant moved to proper class
3b928f9: 2013-09-04 nik - deprecated XNamedValue class from inappropriate package, usages migrated to use proper class
e34bd1c: 2013-09-03 Max Medvedev - Groovy: inplace introduce parameter. initial
a8f70f8: 2013-08-29 Max Medvedev - Groovy: initial in-place introduce constant
0ad9f02: 2013-09-04 nik - xdebugger api streamlined: unnecessary intermediate classes removed, XNamedValue moved to proper package
adf5a40: 2013-09-04 Vladimir Krivosheev - deprecated getStreamProviders
d273f7d: 2013-09-03 Bas Leijdekkers - "Move assignment to field declaration" intention CCE fix
5ce8e21: 2013-09-03 Konstantin Bulenkov - NPE fix
318ea89: 2013-09-03 Konstantin Bulenkov - add retina to statistics
6274f22: 2013-09-03 Mikhail Golubev - Remove annoying warning about unparsable date from RedmineRepository
d1ccda6: 2013-09-03 Andrey Vlasovskikh - Merge remote-tracking branch 'origin/master'
e410ff2: 2013-09-03 Mikhail Golubev - Add attempt to move issue to "Reopened" state if some error occur
d062130: 2013-09-03 Vladislav.Soroka - IDEA-50450 Gradle code insight
73cf33f: 2013-09-03 peter - dfa: analyze inner class field initializers
b87a393: 2013-09-03 peter - don't pass null dependencies to fold region cached values
f770424: 2013-09-03 Mikhail Golubev - Add TaskBuilder helper class. Update repository integration tests accordingly
48ef9f7: 2013-09-03 Andrey Vlasovskikh - Merge branch 'python-fixes'
bed7303: 2013-09-03 peter - don't pass null dependencies to fold region cached values
b85f89b: 2013-09-03 peter - clear meta data at least when its target element changes
3bb5907: 2013-09-03 peter - dfa: analyze only top-level methods together with their nested classes
1d180f0: 2013-09-03 peter - copy constructor for MultiMap
e1cdae4: 2013-09-03 peter - render lookup elements in a read action (EA-49032, some accessibility stuff may access it from non-EDT)
48ba699: 2013-09-03 Vladislav.Soroka - IDEA-50450 Gradle code insight
45008fd: 2013-09-03 nik - added assertions to check that module root type id can be properly stored
5aa3fe4: 2013-09-03 nik - support for resource directories: enable java-specific actions only for directories under source roots
21b9422: 2013-09-03 Konstantin Bulenkov - IDEA-113150 Balloon shadow looks bad under Retina
35755e9: 2013-09-03 Alexey Kudravtsev - cleanup
2c3ff99: 2013-09-03 Alexey Kudravtsev - tighten expectations
8cde32f: 2013-09-03 Alexey Kudravtsev - cleanup
5e53dd4: 2013-08-30 Alexey Kudravtsev - assertions
cadf902: 2013-08-30 Alexey Kudravtsev - notnull, cleanup
50638b6: 2013-08-30 Alexey Kudravtsev - notnull
d58ae6e: 2013-08-30 Alexey Kudravtsev - cleanup
60a92d1: 2013-08-30 Alexey Kudravtsev - annotations
52eefc3: 2013-08-30 Alexey Kudravtsev - cleanup
67791f7: 2013-08-29 Alexey Kudravtsev - notnull
76d2c5e: 2013-08-29 Alexey Kudravtsev - removed @Nullable from getVirtualFile() since it is almost never null
0b9b6e5: 2013-08-29 Alexey Kudravtsev - removed @Nullable from getVirtualFile() since it is almost never null
a2e1b80: 2013-09-03 Mikhail Golubev - IDEA-112857 Cannot open task for JIRA server. Testing connection works. JiraRepository's GSON instance uses TaskUtil#parseDate to deserialize dates
8583a9b: 2013-09-03 Konstantin Kolosovsky - Merge branch 'svn1_8_new'
e976ec1: 2013-09-03 Mikhail Golubev - Merge remote-tracking branch 'origin/master'
3077f6c: 2013-09-03 Konstantin Kolosovsky - IDEA-94942 Fixed info command for nonexistent file
8861d44: 2013-09-03 Mikhail Golubev - IDEA-112857 Cannot open task for JIRA server. Testing connection works. Update date parsing to accept single date as well
132a601: 2013-09-03 Anna Kozlova - Merge remote-tracking branch 'origin/master'
a419785: 2013-09-03 Anna Kozlova - NPE
4b9b570: 2013-09-03 Andrey Vlasovskikh - Added ignore shadowed built-in quick-fix (PY-8672)
7a47af4: 2013-09-02 nik - simplification
c0ffb7c: 2013-09-02 nik - base class extracted
c17c545: 2013-09-02 nik - refined types of FileIndex to make easier searching for ModuleFileIndex specific methods
52a0af9: 2013-09-02 nik - custom source root types supported in DirectoryIndex
f6ed90c: 2013-09-03 Dmitry Avdeev - getting rid of PsiSoftReferenceDecorator
0fe9c4d: 2013-09-03 Anna Kozlova - optimization: do not obtain text
391e125: 2013-09-03 peter - avoid passing null dependencies to cached value
372bdda: 2013-09-03 Dmitry Avdeev - TextRange going to be fair: javadocs
d091163: 2013-09-03 Dmitry Avdeev - TextRange going to be fair: javadocs
897f497: 2013-09-03 peter - PsiPackageImpl.findClassByShortName should check containsClassNamed before linearly traversing all the package files
f045a48: 2013-09-03 Anna Kozlova - optimization: avoid searching for all classes when non-strict mode is on
6423cde: 2013-09-03 Anna Kozlova - cleanup
662b874: 2013-09-03 Dmitry Avdeev - TextRange going to be fair
7bd0a96: 2013-09-03 Konstantin Bulenkov - IDEA-113130 Project View on Mac: text is invisible under selection
89c8508: 2013-09-03 Sergey Evdokimov - Reference inside <relativePath>../pom.xml</relativePath> refers to <xs:element name="relativePath" minOccurs="0" type="xs:string" default="../pom.xml"> instead of pom.xml Fix tests.
445d3c1: 2013-09-03 Konstantin Kolosovsky - IDEA-112803
90c4159: 2013-09-03 peter - avoid passing null dependencies to cached value
d0a3be5: 2013-09-03 peter - IDEA-112526 com.intellij.openapi.util.text.StringUtil.join() variants have inconsistent behavior
4b4209b: 2013-09-03 Sascha Weinreuter - Merge remote-tracking branch 'origin/master'
670eb2e: 2013-09-03 Sergey Evdokimov - Reference inside <relativePath>../pom.xml</relativePath> refers to <xs:element name="relativePath" minOccurs="0" type="xs:string" default="../pom.xml"> instead of pom.xml +review CR-IC @Dmitriy.Avdeev
c300c0d: 2013-09-03 Sascha Weinreuter - IDEA-113046: XSL autocompletion insert unnecessary elements
725c90b: 2013-09-03 Dmitry Avdeev - TextRange going to be fair
0e01c80: 2013-09-03 Konstantin Kolosovsky - IDEA-94942 Revert of missing directories fixed
1328456: 2013-09-03 Roman Shevchenko - EA-40505 (don't fail on malformed .zip files)
208d804: 2013-09-03 Dmitry Avdeev - TextRange going to be fair
8a528da: 2013-09-02 Vladimir Krivosheev - mark StreamProvider.saveContent content param as NotNull
920594a: 2013-09-02 Konstantin Kolosovsky - IDEA-112805 "Merge from" -> "Manual select", "Select with pre-filter" base implementation
de6b1c3: 2013-09-02 peter - IDEA-112779 ISE at com.intellij.ide.util.gotoByName.ChooseByNameBase.getNames
510ccb2: 2013-09-02 Vladimir Krivosheev - extract guessProjectForContentFile
41a0645: 2013-09-02 Konstantin Bulenkov - IDEA-113071 File Colors feature doesn't work in ProjectView under Darcula
8dbc50c: 2013-09-02 peter - use not-null CachedValue dependencies
b4c2616: 2013-09-02 Aleksey Pivovarov - Github: run in EDT
83ebb64: 2013-09-02 Aleksey Pivovarov - IDEA-112867 Github: show diff for remote branch
b716a1e: 2013-09-02 Aleksey Pivovarov - Github: add util function
0064502: 2013-09-02 Aleksey Pivovarov - Github: add computeValueInModal without exceptions
8f54a42: 2013-09-01 Aleksey Pivovarov - Remove code duplication
1d75872: 2013-09-01 Aleksey Pivovarov - Revert GitHub WebBrowserUrlProvider extension
40fa73f: 2013-09-02 Anna Kozlova - Merge remote-tracking branch 'origin/master'
9d1857b: 2013-09-02 Anna Kozlova - cache scope in ref
c6e41b5: 2013-09-02 Anna Kozlova - parameter info generics: check resulted html
83ec3ed: 2013-09-02 Bas Leijdekkers - Fix "Loop variable not updated inside loop" inspection the the presence of polyadic expressions and add test
7d52e17: 2013-09-02 Konstantin Bulenkov - fix Ctrl+Click
6414f18: 2013-09-02 Konstantin Bulenkov - get back (JTree)e.getSource
33c79a3: 2013-09-02 Konstantin Bulenkov - multi selection dnd
f135b4e: 2013-09-02 peter - provide missing dependencies for various CachedValue-s
9564cda: 2013-09-02 peter - [^kb] collect os type and os version stats in separate groups
01d5b0e: 2013-09-02 Yann Cébron - do not return invalid DOM element
b14a923: 2013-09-02 Roman Shevchenko - IDEA-112412 ("Internal Error" dialog usability)
721701a: 2013-09-02 Roman Shevchenko - Bootstrap dependencies lessened
0282729: 2013-09-02 Konstantin Bulenkov - UI info statistics
015c3dd: 2013-09-02 Konstantin Kolosovsky - IDEA-94942 Subversion change lists implementation
bfb3a8b: 2013-09-02 Anna Kozlova - remove testdata copyright
32fa8b7: 2013-09-02 Anna Kozlova - support downloadUrl for custom plugin repositories (IDEA-112778)
e06741a: 2013-09-02 Roman Shevchenko - IDEA-112276 (turn startup exceptions in AS to Google)
dd37027: 2013-09-02 Anna Kozlova - EA-49390 - assert: WriteCommandAction.execute
d29cb10: 2013-09-02 Anna Kozlova - EA-49373 - assert: PsiFileImpl.loadTreeElement
f2dace3: 2013-09-02 Anna Kozlova - optimization (CR-IC-2032)
38c6a24: 2013-09-02 Anna Kozlova - method refs: mismatched collection query (IDEA-112981)
465edc7: 2013-09-02 Anna Kozlova - cleanup after review (++IDEA-112553)
751525b: 2013-09-02 Vladislav.Soroka - Merge remote-tracking branch 'origin/master'
c28ebf2: 2013-09-02 Dmitry Avdeev - IDEA-112914 Insert closing tag after typing </ : fixing tests
601f184: 2013-09-02 Roman Shevchenko - Test fixed
4358f3f: 2013-08-30 Alex Ruiz - Updated to Gradle version that supports single-pass project import.
c056544: 2013-09-02 Konstantin Kolosovsky - IDEA-112805 "Merge from" -> "Merge all" implementation for reintegrate merge
1d626b5: 2013-09-02 Konstantin Kolosovsky - IDEA-94942 Ability to handle subversion properties recursively
127bc3f: 2013-09-02 peter - don't warn when calling @VisibleForTesting method with no original visibility specified (IDEA-107730)
44011ff: 2013-09-02 peter - first letter case sensitivity should match pattern start with name start even in middle matches
ec36ca8: 2013-09-01 Konstantin Bulenkov - TreePath bound shouldn't be changed. Roll back last two changes
abe39e9: 2013-08-31 peter - use the new stub index key processing API for class name completion
8b100aa: 2013-08-31 Konstantin Bulenkov - avoid extra gradient on Mac (NavBar + Run Bar)
c4ba846: 2013-08-31 Konstantin Bulenkov - support fully transparent combo (no border and bg)
15809e5: 2013-08-31 peter - suggest better-matching non-imported classes by default
3d0bb87: 2013-08-31 peter - don't duplicate expected type argument variant when showing non-imported classes
4135d12: 2013-08-31 peter - make tests more independent from all/imported classes behavior
0b3f5d3: 2013-08-31 peter - editors should only handle bulk changes of their own documents (otherwise main editor constantly scrolls during test run)
445acfb: 2013-08-31 peter - make tests more independent from all/imported classes behavior
fa68185: 2013-08-30 peter - IDEA-112173 Smart completion after 'new' should honor upper bound of generic parameters
aff844a: 2013-08-30 Eugene Kudelevsky - IDEA-112979 spellchecker inspection should be suppressed for symbols user cannot edit
584c732: 2013-08-30 Anna Kozlova - Merge branch 'master' of git.labs.intellij.net:idea/community
f1df9e8: 2013-08-30 Dmitry Jemerov - packaging UI moved to lang-impl
48205f5: 2013-08-30 Anna Kozlova - IDEA-112562 Pull up should allow to pull method body into interface as default method
ca6489e: 2013-08-30 Yann Cébron - + "tuple"
b5ea526: 2013-08-30 Roman Shevchenko - NPE fixed
d562eba: 2013-08-30 Roman Shevchenko - vfs: async refresh for .jar files (IDEA-112873)
68e340a: 2013-08-30 Roman Shevchenko - vfs: .jar refresh test
76fa4e7: 2013-08-30 Dmitry Trofimov - Merge remote-tracking branch 'origin/master'
fd1a3b6: 2013-08-30 Dmitry Trofimov - Fixed short-cup processing (VIM-552).
5426bcf: 2013-08-30 Anna Kozlova - NPE
0510fad: 2013-08-30 Bas Leijdekkers - java.util.Calendar methods magically annotated (IDEA-112317)
b59b96d: 2013-08-30 Anna Kozlova - hide ignored tests: do not treat test case with ignored and non-ignored tests as ignored (IDEA-112757)
4eeaa0a: 2013-08-30 Anna Kozlova - EA-49189 - assert: GotoDeclarationAction.chooseAmbiguousTarget
41a598b: 2013-08-30 Anna Kozlova - accept @docRoot in parameter documentation
46fb5e8: 2013-08-30 Denis Fokin - IDEA-35480 Per project/frame modality
f146f92: 2013-08-30 Vladimir Krivosheev - overrides
344c895: 2013-08-30 Kirill Likhodedov - IDEA-112868 "Compare middle and left panel contents" swaps the files
b7e8a2a: 2013-08-30 Konstantin Kolosovsky - IDEA-94942 Info client refactored Create branch/tag action implemented
ef8db2c: 2013-08-30 Vladimir Krivosheev - don't allow set root as root
1bb97bb: 2013-08-30 Vladimir Krivosheev - show NaN or Infinity as KEYWORD instead of NUMBER
ae52dd2: 2013-08-30 Bas Leijdekkers - fix testdata
403a77b: 2013-08-30 Vassiliy Kudryashov - IDEA-112669 Project View: "Wide selection" broken
97c8241: 2013-08-30 Vladimir Krivosheev - AddToWatches action should be available in the Inspect pop-up too
a8fdca8: 2013-08-30 Vladimir Krivosheev - XInspectDialog — use XValueHintTreeComponent, now UI of this component closer to inspect functionality from the editor
61ad075: 2013-08-30 Vladimir Krivosheev - cleanup
67d92f5: 2013-08-30 Roman Shevchenko - vfs: null-tolerant property change event (OC-7947)
ffe6785: 2013-08-30 Roman Shevchenko - Test cleanup
dedb189: 2013-08-30 Sergey Simonchik - refresh if not valid
f287c7c: 2013-08-30 Anna Kozlova - inspection settings: do not override stored settings when try to init from source profile (IDEA-112668)
1e303c6: 2013-08-30 Anna Kozlova - IDEA-112684
0ea95a6: 2013-08-30 Mikhail Golubev - Remove old version of Assembla connector
7959ff2: 2013-08-30 Mikhail Golubev - Update repositories integration tests
efa295e: 2013-08-30 Mikhail Golubev - Merge remote-tracking branch 'origin/master'
4466d42: 2013-08-30 Dmitry Avdeev - TypeOrElementOrAttributeReference extracted
e310a22: 2013-08-30 nik - more usages of getSourceContentRoots corrected to fetch only java roots where needed
0d7f837: 2013-08-30 Alexander Zolotov - RUBY-14163 "p" Ruby live template expands to "params" in ERB files
5f62d94: 2013-08-30 Dmitry Avdeev - cleanup
c9d4712: 2013-08-30 Dmitry Avdeev - cleanup
368636d: 2013-08-30 Vladislav.Soroka - IDEA-50450 Gradle code insight. 'configurations' resolving added
6ec1856: 2013-08-30 Vladimir Krivosheev - add "Collecting" message only if computation is not yet done
cafb4a9: 2013-08-30 Vladimir Krivosheev - remove deprecated method
c7c8f30: 2013-08-30 Vladimir Krivosheev - cleanup
ca42bab: 2013-08-30 Dmitry Avdeev - @NotNull
b100cb3: 2013-08-30 Dmitry Avdeev - IDEA-112914 Insert closing tag after typing </
6dc07e7: 2013-08-30 Dmitry Avdeev - diagnostics for EA-48275 - SIOOBE: TextRange.substring
8091683: 2013-08-30 Dmitry Avdeev - cleanup
c7ddea2: 2013-08-30 Bas Leijdekkers - enable "Ignore named constants in determining pointless expressions" option by default (IDEA-112864)
84f8dd7: 2013-08-30 Vladimir Krivosheev - correct XGroupingValue package
256e07b: 2013-08-30 Vladimir Krivosheev - move ObsolescentAsyncResults to xdebugger
7c56a37: 2013-08-30 Anna Kozlova - create var from instanceOf check: do not insert before previous line end-line comment
7d71ded: 2013-08-30 Bas Leijdekkers - EA-49286 (CCE: SimplifiableIfStatementInspection.buildNegatedExpressionText)
7bbb306: 2013-08-30 Sergey Evdokimov - Exclude target/work/* expect target/work/plugins
47a0044: 2013-08-30 Mikhail Golubev - Update JIRA integration tests: add new one to test status changing capability
bdf2e58: 2013-08-30 Sergey Evdokimov - IDEA-112910 Grails advanced mode
48df8f8: 2013-08-30 nik - unused class deleted
b56c3aa: 2013-08-30 nik - unused code removed
4f49ed7: 2013-08-30 nik - more usages of getSourceRoots corrected to fetch only java or only resource roots where needed
0b234d4: 2013-08-30 Anna Kozlova - method refs: perform highlighting checks on valid refs only
7584749: 2013-08-30 Anna Kozlova - method refs: accept 2 phase acceptance (static and receiver based), raise 'staticAccess' errors at highlighting level
8cb40bf: 2013-08-30 nik - notnullified
713a474: 2013-08-30 nik - added methods to get module source roots of different types; exclude resource roots from processing where needed
ec7ee74: 2013-08-29 nik - don't treat deep inner classes names in run configurations as path variables
673a512: 2013-08-29 nik - module source roots: show correct icon for custom root types
19d4ebf: 2013-08-29 nik - NPE fixed
72c4726: 2013-08-28 nik - 'equals' for source folders fixed
4da8e26: 2013-08-28 nik - added 'Mark Directory as Root' actions for resource roots
d0d47a5: 2013-08-28 nik - cleanup
345eb19: 2013-08-28 nik - mark as root action: obtain action presentation from root type
fff4ee8: 2013-08-28 nik - resource roots supported for java modules (IDEA-71324)
14fa2eb: 2013-08-30 Dmitry Avdeev - IDEA-112885 Task management: Open Task makes no effect
f2e34ac: 2013-08-30 Bas Leijdekkers - IDEA-112813 (Chain of instanceof checks: Support if/if/if/... chains)
52a714a: 2013-08-30 Aleksey Pivovarov - IDEA-112823 Github: use inherited URL TextField
6efccd8: 2013-08-30 Aleksey Pivovarov - Github: fix initialization order in copy constructor
91f93c0: 2013-08-29 Aleksey Pivovarov - Github: split function
9116ba2: 2013-08-29 Aleksey Pivovarov - Github: Simplify
ecc4302: 2013-08-29 Aleksey Pivovarov - Github: strict isConfigured()
270c7b2: 2013-08-29 Bas Leijdekkers - IDEA-112755 ("JUnit test method contains no assertions" for hamcrest-based assertions)
44de4db: 2013-08-29 Bas Leijdekkers - IDEA-112753 ("JUnit test method contains no assertions" detailed description mentions missing table)
e0480b7: 2013-08-29 Bas Leijdekkers - try to fix hard to reproduce NoSuchFieldException (IDEA-112678)
d4f214a: 2013-08-29 Yann Cébron - IDEA-112700 Devkit: highlight usage of deprecated EPs
484fb86: 2013-08-29 Yann Cébron - DevKit: move test data to proper place
e936fb2: 2013-08-29 Konstantin Kolosovsky - IDEA-94942 Updated SvnKit vs CommandLine resolution strategy
c735071: 2013-08-29 Nadya Zabrodina - parsing tests added for log command and moved to separate test class
493eb87: 2013-08-29 Nadya Zabrodina - Template for old hg version added (without join function)
8cbe8e7: 2013-08-29 Nadya Zabrodina - HgVersion changed: use only 1 digit as minor version component
de9bccd: 2013-08-29 Konstantin Kolosovsky - IDEA-112869
9f41ec2: 2013-08-29 Sergey Evdokimov - Add registry key 'grails_griffon.view'
6606b34: 2013-08-29 Alexey Kudravtsev - Merge remote-tracking branch 'origin/master'
3438be5: 2013-08-29 peter - IDEA-112329 IDE Fatal Errors dialog: Details tab can't be scrolled
e130d1d: 2013-08-29 peter - IDE errors dialog: use better-looking JTextArea (IDEA-109834)
4b0b915: 2013-08-29 Alexey Kudravtsev - compilation
dcb5208: 2013-08-29 Alexey Kudravtsev - notnull
48d2b9c: 2013-08-29 Alexey Kudravtsev - notnull
808f5ae: 2013-08-29 Alexey Kudravtsev - notnull
b096e0c: 2013-08-29 Alexey Kudravtsev - notnull
f988efe: 2013-08-29 Alexey Kudravtsev - notnull
029295f: 2013-08-29 Alexey Kudravtsev - moved to java-psi
fed5eeb: 2013-08-29 Alexey Kudravtsev - notnull
6eff0fb: 2013-08-29 Alexey Kudravtsev - notnull
a2a52b6: 2013-08-29 Konstantin Kolosovsky - IDEA-94942 Viewing subversion properties for item IDEA-112719
ecb474d: 2013-08-29 Mikhail Golubev - IDEA-112828 NPE when trying to close JIRA issue
0c8b65d: 2013-08-29 Roman Shevchenko - vfs: symlink target update w/o file recreation (OC-7947)
34c43fe: 2013-08-29 Roman Shevchenko - Cleanup
46e06f7: 2013-08-29 Vladimir Krivosheev - prefer doWhenDone(@NotNull final Consumer<T> consumer)
e409a49: 2013-08-29 Vladimir Krivosheev - deprecate doWhenRejected(@NotNull final Handler<T> handler)
6e84f22: 2013-08-29 Vladislav.Soroka - IDEA-112865 Gradle: completion and quick-docs for standard gradle plugins
6a10552: 2013-08-29 Vladimir Krivosheev - WEB-8064 Debugger: Pause Program button is not working actionCallback — pass error message to child
b8c9cdd: 2013-08-29 peter - test paste single tabbed string into block selection
2411065: 2013-08-29 Yann Cébron - Dom EPs: revert <with> for "dom.converter" (breaks for CustomReferenceConverter)
c376d34: 2013-08-29 Dmitry Avdeev - EA-48655 - IAE: XmlMover.checkAvailable
7cb078e: 2013-08-29 Dmitry Avdeev - EA-48877 - NPE: GenerateByPatternDialog.update
3046258: 2013-08-29 Fedor Korotkov - Reverted a8992f523de8898: Fixed performance issue.
28a10e0: 2013-08-29 Vladimir Krivosheev - EditorTabPopupMenuEx — add separator between RunContextPopupGroup and VersionControlsGroup (the same as in the EditorPopupMenu) add OpenInBrowser to editor tab popup menu, move it to RunContextPopupGroup disable GithubWebBrowserUrlProvider until purpose of this implementation is not clear
b7bc081: 2013-08-29 Max Medvedev - introduce constant to a script
2a3ccbb: 2013-08-29 Max Medvedev - choose target class for introduce constant
5750c71: 2013-08-29 Sergey Evdokimov - EA-49076 - assert: ComponentManagerImpl.getPicoContainer
5f56145: 2013-08-28 Mikhail Golubev - Slightly update JQL lexer rules
ef0f8ed: 2013-08-28 Konstantin Kolosovsky - IDEA-94942 Parsing "svn status" output with remote changes IDEA-112729
Change-Id: Icbc9b8c16a0c7766bd64993999b5905e8cd24257
Diffstat (limited to 'xml')
20 files changed, 492 insertions, 417 deletions
diff --git a/xml/dom-impl/src/META-INF/DomPlugin.xml b/xml/dom-impl/src/META-INF/DomPlugin.xml index 89dee6b3f6ad..9fdaaedc89d8 100644 --- a/xml/dom-impl/src/META-INF/DomPlugin.xml +++ b/xml/dom-impl/src/META-INF/DomPlugin.xml @@ -10,10 +10,7 @@ </extensionPoint> <extensionPoint name="dom.converter" - beanClass="com.intellij.util.xml.impl.DomImplementationClassEP"> - <with attribute="interfaceName" implements="com.intellij.util.xml.Converter"/> - <with attribute="implementationName" implements="com.intellij.util.xml.Converter"/> - </extensionPoint> + beanClass="com.intellij.util.xml.impl.DomImplementationClassEP"/> <extensionPoint name="dom.extender" beanClass="com.intellij.util.xml.reflect.DomExtenderEP"> diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptorImpl.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptorImpl.java index 6f1f9a2cbbcc..cf61ef35a186 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptorImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptorImpl.java @@ -21,6 +21,7 @@ import com.intellij.codeInspection.ProblemsHolder; import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.TextRange; +import com.intellij.openapi.util.UnfairTextRange; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiReference; import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReference; @@ -57,9 +58,10 @@ class DomElementResolveProblemDescriptorImpl extends DomElementProblemDescriptor final TextRange referenceRange = reference.getRangeInElement(); if (referenceRange.isEmpty()) { + int startOffset = referenceRange.getStartOffset(); return element instanceof XmlAttributeValue - ? Pair.create(TextRange.from(referenceRange.getStartOffset() - 1, 2), element) - : Pair.create(TextRange.from(referenceRange.getStartOffset(), 1), element); + ? Pair.create((TextRange)new UnfairTextRange(startOffset - 1, startOffset + 1), element) + : Pair.create(TextRange.from(startOffset, 1), element); } return Pair.create(referenceRange, element); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ElementPresentationManager.java b/xml/dom-openapi/src/com/intellij/util/xml/ElementPresentationManager.java index 049ce0db2778..e802a98a7832 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ElementPresentationManager.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ElementPresentationManager.java @@ -132,7 +132,7 @@ public abstract class ElementPresentationManager { } @Nullable - public static String getElementName(Object element) { + public static String getElementName(@NotNull Object element) { for (final Function<Object, String> function : ourNameProviders) { final String s = function.fun(element); if (s != null) { @@ -167,7 +167,7 @@ public abstract class ElementPresentationManager { } @Nullable - public static Object invokeNameValueMethod(final Object element) { + public static Object invokeNameValueMethod(@NotNull final Object element) { final Method nameValueMethod = findNameValueMethod(element.getClass()); if (nameValueMethod == null) { return null; diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/AddSchemaPrefixIntention.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/AddSchemaPrefixIntention.java index 723ba6e14fa6..c9d4059c5cf6 100644 --- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/AddSchemaPrefixIntention.java +++ b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/AddSchemaPrefixIntention.java @@ -25,7 +25,7 @@ import com.intellij.openapi.ui.Messages; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiReference; import com.intellij.psi.XmlRecursiveElementVisitor; -import com.intellij.psi.impl.source.resolve.reference.impl.providers.SchemaReferencesProvider; +import com.intellij.psi.impl.source.resolve.reference.impl.providers.TypeOrElementOrAttributeReference; import com.intellij.psi.impl.source.xml.SchemaPrefixReference; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.xml.XmlAttribute; @@ -97,7 +97,7 @@ public class AddSchemaPrefixIntention extends PsiElementBaseIntentionAction { PsiReference ref = null; boolean skip = false; for (PsiReference reference : value.getReferences()) { - if (reference instanceof SchemaReferencesProvider.TypeOrElementOrAttributeReference) { + if (reference instanceof TypeOrElementOrAttributeReference) { ref = reference; } else if (reference instanceof SchemaPrefixReference) { skip = true; diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlUnboundNsPrefixInspection.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlUnboundNsPrefixInspection.java index 777c3acefef9..ffe32b39e9e7 100644 --- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlUnboundNsPrefixInspection.java +++ b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlUnboundNsPrefixInspection.java @@ -128,7 +128,7 @@ public class XmlUnboundNsPrefixInspection extends XmlSuppressableInspectionTool PsiFile psiFile = context.getContainingFile(); if (!(psiFile instanceof XmlFile)) return; final XmlFile containingFile = (XmlFile)psiFile; - if (!HighlightLevelUtil.shouldInspect(containingFile)) return; + if (!HighlightingLevelManager.getInstance(containingFile.getProject()).shouldInspect(containingFile)) return; final XmlExtension extension = XmlExtension.getExtension(containingFile); if (extension.getPrefixDeclaration(context, namespacePrefix) != null) { diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlSelectioner.java b/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlSelectioner.java index 0bd36fbc1564..8cc670ecc513 100644 --- a/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlSelectioner.java +++ b/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlSelectioner.java @@ -33,6 +33,7 @@ import com.intellij.openapi.editor.highlighter.EditorHighlighter; import com.intellij.openapi.editor.highlighter.HighlighterIterator; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.util.TextRange; +import com.intellij.openapi.util.UnfairTextRange; import com.intellij.psi.FileViewProvider; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; @@ -121,7 +122,7 @@ public class HtmlSelectioner extends AbstractWordSelectioner { while (!i.atEnd() && i.getTokenType() != XmlTokenType.XML_END_TAG_START) i.retreat(); if (!i.atEnd() && !j.atEnd()) { - result.add(new TextRange(j.getEnd(), i.getStart())); + result.add(new UnfairTextRange(j.getEnd(), i.getStart())); } if (!j.atEnd()) { result.add(new TextRange(start, j.getEnd())); diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlGtTypedHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlGtTypedHandler.java index 71cba6f09053..e76b5a3447e2 100644 --- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlGtTypedHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlGtTypedHandler.java @@ -30,7 +30,6 @@ import com.intellij.openapi.util.TextRange; import com.intellij.psi.*; import com.intellij.psi.codeStyle.CodeStyleManager; import com.intellij.psi.html.HtmlTag; -import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; import com.intellij.psi.impl.source.xml.XmlTokenImpl; import com.intellij.psi.templateLanguages.OuterLanguageElement; import com.intellij.psi.templateLanguages.TemplateLanguageFileViewProvider; @@ -48,11 +47,6 @@ public class XmlGtTypedHandler extends TypedHandlerDelegate { private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.editorActions.TypedHandler"); public Result beforeCharTyped(final char c, final Project project, Editor editor, PsiFile editedFile, final FileType fileType) { - final Editor injectedEditor = InjectedLanguageUtil.getEditorForInjectedLanguageNoCommit(editor, editedFile); - if (editor != injectedEditor) { - editor = injectedEditor; - editedFile = PsiDocumentManager.getInstance(project).getPsiFile(injectedEditor.getDocument()); - } final WebEditorOptions webEditorOptions = WebEditorOptions.getInstance(); if (c == '>' && webEditorOptions != null && webEditorOptions.isAutomaticallyInsertClosingTag() && fileContainsXmlLanguage(editedFile)) { PsiDocumentManager.getInstance(project).commitAllDocuments(); diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlSlashTypedHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlSlashTypedHandler.java index 3a7ab2a3e0e2..821694de0170 100644 --- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlSlashTypedHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlSlashTypedHandler.java @@ -22,6 +22,7 @@ import com.intellij.openapi.editor.EditorModificationUtil; import com.intellij.openapi.editor.ScrollType; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.FileViewProvider; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiElement; @@ -34,7 +35,7 @@ import com.intellij.psi.xml.*; import com.intellij.xml.util.XmlUtil; import org.jetbrains.annotations.NotNull; -public class XmlSlashTypedHandler extends TypedHandlerDelegate { +public class XmlSlashTypedHandler extends TypedHandlerDelegate implements XmlTokenType { public Result beforeCharTyped(final char c, final Project project, final Editor editor, final PsiFile editedFile, final FileType fileType) { if ((editedFile.getLanguage() instanceof XMLLanguage || editedFile.getViewProvider().getBaseLanguage() instanceof XMLLanguage) && c == '/') { PsiDocumentManager.getInstance(project).commitAllDocuments(); @@ -80,10 +81,17 @@ public class XmlSlashTypedHandler extends TypedHandlerDelegate { if (!(element.getLanguage() instanceof XMLLanguage)) return Result.CONTINUE; ASTNode prevLeaf = element.getNode(); - final String prevLeafText = prevLeaf != null ? prevLeaf.getText():null; - if (prevLeaf != null && !"/".equals(prevLeafText)) { - if (!"/".equals(prevLeafText.trim())) return Result.CONTINUE; + if (prevLeaf == null) return Result.CONTINUE; + final String prevLeafText = prevLeaf.getText(); + if ("</".equals(prevLeafText) && prevLeaf.getElementType() == XML_END_TAG_START) { + XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class); + if (tag != null && StringUtil.isNotEmpty(tag.getName()) && TreeUtil.findSibling(prevLeaf, XmlTokenType.XML_NAME) == null) { + EditorModificationUtil.insertStringAtCaret(editor, tag.getName() + ">"); + return Result.STOP; + } } + if (!"/".equals(prevLeafText.trim())) return Result.CONTINUE; + while((prevLeaf = TreeUtil.prevLeaf(prevLeaf)) != null && prevLeaf.getElementType() == XmlTokenType.XML_WHITE_SPACE); if(prevLeaf instanceof OuterLanguageElement) { element = file.getViewProvider().findElementAt(offset - 1, file.getLanguage()); diff --git a/xml/impl/src/com/intellij/codeInsight/template/HtmlContextType.java b/xml/impl/src/com/intellij/codeInsight/template/HtmlContextType.java index 5fe1dbf0b4b0..566309103d25 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/HtmlContextType.java +++ b/xml/impl/src/com/intellij/codeInsight/template/HtmlContextType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import com.intellij.lang.html.HTMLLanguage; import com.intellij.lang.xhtml.XHTMLLanguage; import com.intellij.openapi.fileTypes.StdFileTypes; import com.intellij.psi.PsiFile; +import com.intellij.psi.util.PsiUtilBase; import org.jetbrains.annotations.NotNull; /** @@ -33,7 +34,7 @@ public class HtmlContextType extends FileTypeBasedContextType { @Override public boolean isInContext(@NotNull PsiFile file, int offset) { - return isMyLanguage(file.getLanguage()) && !XmlContextType.isEmbeddedContent(file, offset); + return isMyLanguage(PsiUtilBase.getLanguageAtOffset(file, offset)) && !XmlContextType.isEmbeddedContent(file, offset); } static boolean isMyLanguage(Language language) { diff --git a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/CreateXmlElementIntentionAction.java b/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/CreateXmlElementIntentionAction.java index a467aa4a841e..b7bbaab2fd75 100644 --- a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/CreateXmlElementIntentionAction.java +++ b/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/CreateXmlElementIntentionAction.java @@ -37,7 +37,7 @@ import org.jetbrains.annotations.PropertyKey; class CreateXmlElementIntentionAction implements IntentionAction { private final String myMessageKey; - protected final SchemaReferencesProvider.TypeOrElementOrAttributeReference myRef; + protected final TypeOrElementOrAttributeReference myRef; private boolean myIsAvailableEvaluated; private XmlFile myTargetFile; private final String myDeclarationTagName; @@ -45,7 +45,7 @@ class CreateXmlElementIntentionAction implements IntentionAction { CreateXmlElementIntentionAction( @PropertyKey(resourceBundle = XmlBundle.PATH_TO_BUNDLE) String messageKey, @NonNls @NotNull String declarationTagName, - SchemaReferencesProvider.TypeOrElementOrAttributeReference ref) { + TypeOrElementOrAttributeReference ref) { myMessageKey = messageKey; myRef = ref; diff --git a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/IdRefReference.java b/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/IdRefReference.java index 8bf214792947..ce0d199425cf 100644 --- a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/IdRefReference.java +++ b/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/IdRefReference.java @@ -120,7 +120,7 @@ public class IdRefReference extends BasicAttributeValueReference { return subTag.getAttributeValue(IdReferenceProvider.ID_ATTR_NAME) != null || subTag.getAttributeValue(IdReferenceProvider.FOR_ATTR_NAME) != null || getImplicitIdRefValue(subTag) != null || (subTag.getAttributeValue(IdReferenceProvider.NAME_ATTR_NAME) != null && - subTag.getName().indexOf(".directive") == -1); + !subTag.getName().contains(".directive")); } private static final FileBasedUserDataCache<List<PsiElement>> ourCachedIdsCache = new FileBasedUserDataCache<List<PsiElement>>() { diff --git a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferenceQuickFixProvider.java b/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferenceQuickFixProvider.java index eb3d558b6e18..b7b53b97284f 100644 --- a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferenceQuickFixProvider.java +++ b/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferenceQuickFixProvider.java @@ -25,10 +25,10 @@ import org.jetbrains.annotations.PropertyKey; /** * @author yole */ -public class SchemaReferenceQuickFixProvider extends UnresolvedReferenceQuickFixProvider<SchemaReferencesProvider.TypeOrElementOrAttributeReference> { +public class SchemaReferenceQuickFixProvider extends UnresolvedReferenceQuickFixProvider<TypeOrElementOrAttributeReference> { @Override - public void registerFixes(@NotNull SchemaReferencesProvider.TypeOrElementOrAttributeReference ref, @NotNull QuickFixActionRegistrar registrar) { - if (ref.getType() == SchemaReferencesProvider.TypeOrElementOrAttributeReference.ReferenceType.TypeReference) { + public void registerFixes(@NotNull TypeOrElementOrAttributeReference ref, @NotNull QuickFixActionRegistrar registrar) { + if (ref.getType() == TypeOrElementOrAttributeReference.ReferenceType.TypeReference) { registrar.register( new CreateXmlElementIntentionAction("xml.schema.create.complex.type.intention.name", SchemaReferencesProvider.COMPLEX_TYPE_TAG_NAME, ref) ); @@ -40,16 +40,16 @@ public class SchemaReferenceQuickFixProvider extends UnresolvedReferenceQuickFix @PropertyKey(resourceBundle = XmlBundle.PATH_TO_BUNDLE) String key = null; @NonNls String declarationTagName = null; - if (ref.getType() == SchemaReferencesProvider.TypeOrElementOrAttributeReference.ReferenceType.ElementReference) { + if (ref.getType() == TypeOrElementOrAttributeReference.ReferenceType.ElementReference) { declarationTagName = SchemaReferencesProvider.ELEMENT_TAG_NAME; key = "xml.schema.create.element.intention.name"; - } else if (ref.getType() == SchemaReferencesProvider.TypeOrElementOrAttributeReference.ReferenceType.AttributeReference) { + } else if (ref.getType() == TypeOrElementOrAttributeReference.ReferenceType.AttributeReference) { declarationTagName = SchemaReferencesProvider.ATTRIBUTE_TAG_NAME; key = "xml.schema.create.attribute.intention.name"; - } else if (ref.getType() == SchemaReferencesProvider.TypeOrElementOrAttributeReference.ReferenceType.AttributeGroupReference) { + } else if (ref.getType() == TypeOrElementOrAttributeReference.ReferenceType.AttributeGroupReference) { declarationTagName = SchemaReferencesProvider.ATTRIBUTE_GROUP_TAG_NAME; key = "xml.schema.create.attribute.group.intention.name"; - } else if (ref.getType() == SchemaReferencesProvider.TypeOrElementOrAttributeReference.ReferenceType.GroupReference) { + } else if (ref.getType() == TypeOrElementOrAttributeReference.ReferenceType.GroupReference) { declarationTagName = SchemaReferencesProvider.GROUP_TAG_NAME; key = "xml.schema.create.group.intention.name"; } @@ -61,7 +61,7 @@ public class SchemaReferenceQuickFixProvider extends UnresolvedReferenceQuickFix @NotNull @Override - public Class<SchemaReferencesProvider.TypeOrElementOrAttributeReference> getReferenceClass() { - return SchemaReferencesProvider.TypeOrElementOrAttributeReference.class; + public Class<TypeOrElementOrAttributeReference> getReferenceClass() { + return TypeOrElementOrAttributeReference.class; } } diff --git a/xml/impl/src/com/intellij/xml/util/XmlEnumeratedValueReferenceProvider.java b/xml/impl/src/com/intellij/xml/util/XmlEnumeratedValueReferenceProvider.java index c1309a54f1d2..32887f477032 100644 --- a/xml/impl/src/com/intellij/xml/util/XmlEnumeratedValueReferenceProvider.java +++ b/xml/impl/src/com/intellij/xml/util/XmlEnumeratedValueReferenceProvider.java @@ -18,10 +18,16 @@ package com.intellij.xml.util; import com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor; import com.intellij.openapi.util.Key; import com.intellij.psi.*; +import com.intellij.psi.impl.source.resolve.reference.impl.PsiDelegateReference; import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; -import com.intellij.psi.xml.*; +import com.intellij.psi.xml.XmlAttribute; +import com.intellij.psi.xml.XmlElement; +import com.intellij.psi.xml.XmlTag; +import com.intellij.psi.xml.XmlText; import com.intellij.util.ArrayUtil; +import com.intellij.util.Function; import com.intellij.util.ProcessingContext; +import com.intellij.util.containers.ContainerUtil; import com.intellij.xml.impl.XmlEnumerationDescriptor; import com.intellij.xml.impl.schema.XmlSchemaTagsProcessor; import org.jetbrains.annotations.NotNull; @@ -52,12 +58,20 @@ public class XmlEnumeratedValueReferenceProvider<T extends PsiElement> extends P @SuppressWarnings("unchecked") final Object descriptor = getDescriptor((T)element); if (descriptor instanceof XmlEnumerationDescriptor) { XmlEnumerationDescriptor enumerationDescriptor = (XmlEnumerationDescriptor)descriptor; - if (enumerationDescriptor.isFixed() || - enumerationDescriptor.isEnumerated((XmlElement)element) || - unquotedValue.equals(enumerationDescriptor.getDefaultValue())) { // todo case insensitive + + if (enumerationDescriptor.isFixed() || enumerationDescriptor.isEnumerated((XmlElement)element)) { //noinspection unchecked return enumerationDescriptor.getValueReferences((XmlElement)element, unquotedValue); } + else if (unquotedValue.equals(enumerationDescriptor.getDefaultValue())) { // todo case insensitive + return ContainerUtil.map2Array(enumerationDescriptor.getValueReferences((XmlElement)element, unquotedValue), PsiReference.class, + new Function<PsiReference, PsiReference>() { + @Override + public PsiReference fun(PsiReference reference) { + return PsiDelegateReference.createSoft(reference, true); + } + }); + } } return PsiReference.EMPTY_ARRAY; } diff --git a/xml/tests/src/com/intellij/codeInsight/completion/XmlTypedHandlersTest.java b/xml/tests/src/com/intellij/codeInsight/completion/XmlTypedHandlersTest.java new file mode 100644 index 000000000000..bcc1afbe797d --- /dev/null +++ b/xml/tests/src/com/intellij/codeInsight/completion/XmlTypedHandlersTest.java @@ -0,0 +1,38 @@ +/* + * Copyright 2000-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.codeInsight.completion; + +import com.intellij.ide.highlighter.XmlFileType; +import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase; + +/** + * @author Dmitry Avdeev + * Date: 30.08.13 + */ +public class XmlTypedHandlersTest extends LightPlatformCodeInsightFixtureTestCase { + + public void testClosingTag() throws Exception { + myFixture.configureByText(XmlFileType.INSTANCE, "<foo><<caret>"); + myFixture.type('/'); + myFixture.checkResult("<foo></foo>"); + } + + public void testGreedyClosing() { + myFixture.configureByText(XmlFileType.INSTANCE, "<foo><<caret>foo>"); + myFixture.type('/'); + myFixture.checkResult("<foo></foo>"); + } +} diff --git a/xml/xml-psi-impl/src/com/intellij/lang/XmlCodeFoldingBuilder.java b/xml/xml-psi-impl/src/com/intellij/lang/XmlCodeFoldingBuilder.java index 7e51f482056d..de49862af9f4 100644 --- a/xml/xml-psi-impl/src/com/intellij/lang/XmlCodeFoldingBuilder.java +++ b/xml/xml-psi-impl/src/com/intellij/lang/XmlCodeFoldingBuilder.java @@ -25,6 +25,7 @@ import com.intellij.openapi.editor.Document; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.util.TextRange; +import com.intellij.openapi.util.UnfairTextRange; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiWhiteSpace; import com.intellij.psi.impl.source.html.HtmlFileImpl; @@ -143,11 +144,11 @@ public abstract class XmlCodeFoldingBuilder implements FoldingBuilder, DumbAware if (lastAttributeBeforeCR != null) { int attributeEnd = lastAttributeBeforeCR.getTextRange().getEndOffset(); - return new TextRange(attributeEnd, end); + return new UnfairTextRange(attributeEnd, end); } } - return new TextRange(nameEnd, end); + return new UnfairTextRange(nameEnd, end); } else if (element instanceof XmlComment) { final XmlComment xmlComment = (XmlComment)element; final TextRange textRange = element.getTextRange(); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/BasicAttributeValueReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/BasicAttributeValueReference.java index b3c0fbc31800..6cd7479593a2 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/BasicAttributeValueReference.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/BasicAttributeValueReference.java @@ -15,10 +15,10 @@ */ package com.intellij.psi.impl.source.resolve.reference.impl.providers; -import com.intellij.psi.PsiReference; -import com.intellij.psi.PsiElement; -import com.intellij.psi.ElementManipulators; import com.intellij.openapi.util.TextRange; +import com.intellij.psi.ElementManipulators; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiReference; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferencesProvider.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferencesProvider.java index cd1f672d8819..c71da31cce97 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferencesProvider.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferencesProvider.java @@ -18,21 +18,11 @@ package com.intellij.psi.impl.source.resolve.reference.impl.providers; import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider; import com.intellij.openapi.util.TextRange; import com.intellij.psi.*; -import com.intellij.psi.impl.source.resolve.ResolveCache; import com.intellij.psi.impl.source.xml.SchemaPrefixReference; -import com.intellij.psi.search.PsiElementProcessor; -import com.intellij.psi.util.PsiTreeUtil; -import com.intellij.psi.util.PsiUtilCore; import com.intellij.psi.xml.*; import com.intellij.util.ArrayUtil; import com.intellij.util.IncorrectOperationException; import com.intellij.util.ProcessingContext; -import com.intellij.util.Processor; -import com.intellij.xml.XmlAttributeDescriptor; -import com.intellij.xml.XmlElementDescriptor; -import com.intellij.xml.XmlNSDescriptor; -import com.intellij.xml.impl.schema.ComplexTypeDescriptor; -import com.intellij.xml.impl.schema.TypeDescriptor; import com.intellij.xml.impl.schema.XmlNSDescriptorImpl; import com.intellij.xml.util.XmlUtil; import org.jetbrains.annotations.NonNls; @@ -40,7 +30,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; import java.util.regex.Pattern; @@ -51,11 +40,11 @@ import java.util.regex.Pattern; public class SchemaReferencesProvider extends PsiReferenceProvider { @NonNls private static final String VALUE_ATTR_NAME = "value"; @NonNls private static final String PATTERN_TAG_NAME = "pattern"; - @NonNls private static final String NAME_ATTR_NAME = "name"; + @NonNls static final String NAME_ATTR_NAME = "name"; - @NonNls private static final String MEMBER_TYPES_ATTR_NAME = "memberTypes"; - @NonNls private static final String ITEM_TYPE_ATTR_NAME = "itemType"; - @NonNls private static final String BASE_ATTR_NAME = "base"; + @NonNls static final String MEMBER_TYPES_ATTR_NAME = "memberTypes"; + @NonNls static final String ITEM_TYPE_ATTR_NAME = "itemType"; + @NonNls static final String BASE_ATTR_NAME = "base"; @NonNls static final String GROUP_TAG_NAME = "group"; @NonNls static final String ATTRIBUTE_GROUP_TAG_NAME = "attributeGroup"; @@ -64,10 +53,9 @@ public class SchemaReferencesProvider extends PsiReferenceProvider { @NonNls static final String SIMPLE_TYPE_TAG_NAME = "simpleType"; @NonNls static final String COMPLEX_TYPE_TAG_NAME = "complexType"; - @NonNls private static final String REF_ATTR_NAME = "ref"; - @NonNls private static final String TARGET_NAMESPACE = "targetNamespace"; - @NonNls private static final String TYPE_ATTR_NAME = "type"; - @NonNls private static final String SUBSTITUTION_GROUP_ATTR_NAME = "substitutionGroup"; + @NonNls static final String REF_ATTR_NAME = "ref"; + @NonNls static final String TYPE_ATTR_NAME = "type"; + @NonNls static final String SUBSTITUTION_GROUP_ATTR_NAME = "substitutionGroup"; public String[] getCandidateAttributeNamesForSchemaReferences() { return new String[] {REF_ATTR_NAME,TYPE_ATTR_NAME, BASE_ATTR_NAME,NAME_ATTR_NAME, SUBSTITUTION_GROUP_ATTR_NAME,MEMBER_TYPES_ATTR_NAME, @@ -169,352 +157,6 @@ public class SchemaReferencesProvider extends PsiReferenceProvider { } } - public static class TypeOrElementOrAttributeReference implements PsiReference { - private final PsiElement myElement; - private TextRange myRange; - private String nsPrefix; - - @Nullable - public ReferenceType getType() { - return myType; - } - - public void setNamespacePrefix(String prefix) { - this.nsPrefix = prefix; - } - - protected enum ReferenceType { - ElementReference, AttributeReference, GroupReference, AttributeGroupReference, TypeReference - } - - private final @Nullable ReferenceType myType; - - protected TypeOrElementOrAttributeReference(PsiElement element, TextRange range, @Nullable ReferenceType type) { - myElement = element; - myRange = range; - - assert myRange.getLength() >= 0; - - myType = type; - } - - TypeOrElementOrAttributeReference(PsiElement element, TextRange range) { - this(element, range, determineReferenceType(element)); - } - - @Nullable - private static ReferenceType determineReferenceType(PsiElement element) { - final XmlAttribute attribute = PsiTreeUtil.getParentOfType(element, XmlAttribute.class); - if (attribute == null) { - return null; - } - final XmlTag tag = attribute.getParent(); - final String localName = tag.getLocalName(); - final String attributeLocalName = attribute.getLocalName(); - - if (REF_ATTR_NAME.equals(attributeLocalName) || SUBSTITUTION_GROUP_ATTR_NAME.equals(attributeLocalName)) { - if (localName.equals(GROUP_TAG_NAME)) { - return ReferenceType.GroupReference; - } else if (localName.equals(ATTRIBUTE_GROUP_TAG_NAME)) { - return ReferenceType.AttributeGroupReference; - } else if (ELEMENT_TAG_NAME.equals(localName)) { - return ReferenceType.ElementReference; - } else if (ATTRIBUTE_TAG_NAME.equals(localName)) { - return ReferenceType.AttributeReference; - } - } else if (TYPE_ATTR_NAME.equals(attributeLocalName) || - BASE_ATTR_NAME.equals(attributeLocalName) || - MEMBER_TYPES_ATTR_NAME.equals(attributeLocalName) || - ITEM_TYPE_ATTR_NAME.equals(attributeLocalName) - ) { - return ReferenceType.TypeReference; - } - return null; - } - - public PsiElement getElement() { - return myElement; - } - - public TextRange getRangeInElement() { - return myRange; - } - - @Nullable - public PsiElement resolve() { - final PsiElement psiElement = ResolveCache.getInstance(getElement().getProject()).resolveWithCaching(this, MyResolver.INSTANCE, false, false); - - return psiElement != PsiUtilCore.NULL_PSI_ELEMENT ? psiElement:null; - } - - private PsiElement resolveInner() { - final XmlTag tag = PsiTreeUtil.getContextOfType(myElement, XmlTag.class, false); - if (tag == null) return PsiUtilCore.NULL_PSI_ELEMENT; - - String canonicalText = getCanonicalText(); - XmlNSDescriptorImpl nsDescriptor = getDescriptor(tag,canonicalText); - - if (myType != null && nsDescriptor != null && nsDescriptor.getTag() != null) { - - switch(myType) { - case GroupReference: return nsDescriptor.findGroup(canonicalText); - case AttributeGroupReference: return nsDescriptor.findAttributeGroup(canonicalText); - case ElementReference: { - XmlElementDescriptor descriptor = nsDescriptor.getElementDescriptor( - XmlUtil.findLocalNameByQualifiedName(canonicalText), getNamespace(tag, canonicalText), - new HashSet<XmlNSDescriptorImpl>(), - true - ); - - return descriptor != null ? descriptor.getDeclaration(): PsiUtilCore.NULL_PSI_ELEMENT; - } - case AttributeReference: { - //final String prefixByQualifiedName = XmlUtil.findPrefixByQualifiedName(canonicalText); - final String localNameByQualifiedName = XmlUtil.findLocalNameByQualifiedName(canonicalText); - XmlAttributeDescriptor descriptor = nsDescriptor.getAttribute( - localNameByQualifiedName, - getNamespace(tag, canonicalText), - tag - ); - - if (descriptor != null) return descriptor.getDeclaration(); - - return PsiUtilCore.NULL_PSI_ELEMENT; - } - case TypeReference: { - TypeDescriptor typeDescriptor = nsDescriptor.getTypeDescriptor(canonicalText,tag); - if (typeDescriptor instanceof ComplexTypeDescriptor) { - return ((ComplexTypeDescriptor)typeDescriptor).getDeclaration(); - } else if (typeDescriptor instanceof TypeDescriptor) { - return myElement; - } - } - } - } - - return PsiUtilCore.NULL_PSI_ELEMENT; - } - - XmlNSDescriptorImpl getDescriptor(final XmlTag tag, String text) { - if (myType != ReferenceType.ElementReference && - myType != ReferenceType.AttributeReference) { - final PsiElement parentElement = myElement.getContext(); - final PsiElement grandParentElement = parentElement != null ? parentElement.getParent() : null; - boolean doRedefineCheck = false; - - if (parentElement instanceof XmlAttribute && - grandParentElement instanceof XmlTag - ) { - final String attrName = ((XmlAttribute)parentElement).getName(); - final String tagLocalName = ((XmlTag)grandParentElement).getLocalName(); - - doRedefineCheck = (REF_ATTR_NAME.equals(attrName) && - ( GROUP_TAG_NAME.equals(tagLocalName) || - ATTRIBUTE_GROUP_TAG_NAME.equals(tagLocalName) - ) - ) || - ( BASE_ATTR_NAME.equals(attrName) || - MEMBER_TYPES_ATTR_NAME.equals(attrName) - ); - } - - if (doRedefineCheck) { - XmlNSDescriptorImpl redefinedDescriptor = findRedefinedDescriptor(tag, text); - if (redefinedDescriptor != null) return redefinedDescriptor; - } - } - - final String namespace = getNamespace(tag, text); - XmlNSDescriptor nsDescriptor = tag.getNSDescriptor(namespace,true); - - final XmlDocument document = ((XmlFile)tag.getContainingFile()).getDocument(); - - if (nsDescriptor == null) { // import - nsDescriptor = (XmlNSDescriptor)document.getMetaData(); - } - - if (nsDescriptor == null) { - final XmlNSDescriptor[] descrs = new XmlNSDescriptor[1]; - - URLReference.processWsdlSchemas( - document.getRootTag(), - new Processor<XmlTag>() { - public boolean process(final XmlTag xmlTag) { - if (namespace.equals(xmlTag.getAttributeValue(TARGET_NAMESPACE))) { - descrs[0] = (XmlNSDescriptor)xmlTag.getMetaData(); - return false; - } - return true; - } - } - ); - - if (descrs[0] instanceof XmlNSDescriptorImpl) return (XmlNSDescriptorImpl)descrs[0]; - } - - return nsDescriptor instanceof XmlNSDescriptorImpl ? (XmlNSDescriptorImpl)nsDescriptor:null; - } - - private static String getNamespace(final XmlTag tag, final String text) { - final String namespacePrefix = XmlUtil.findPrefixByQualifiedName(text); - final String namespaceByPrefix = tag.getNamespaceByPrefix(namespacePrefix); - if (namespaceByPrefix.length() > 0) return namespaceByPrefix; - final XmlTag rootTag = ((XmlFile)tag.getContainingFile()).getDocument().getRootTag(); - - if (rootTag != null && - "schema".equals(rootTag.getLocalName()) && - XmlUtil.ourSchemaUrisList.indexOf(rootTag.getNamespace()) != -1 ) { - final String targetNS = rootTag.getAttributeValue(TARGET_NAMESPACE); - - if (targetNS != null) { - final String targetNsPrefix = rootTag.getPrefixByNamespace(targetNS); - - if (namespacePrefix.equals(targetNsPrefix) || - (namespaceByPrefix.length() == 0 && targetNsPrefix == null)) { - return targetNS; - } - } - } - return namespaceByPrefix; - } - - @NotNull - public String getCanonicalText() { - final String text = myElement.getText(); - String name = myRange.getEndOffset() <= text.length() ? myRange.substring(text) : ""; - if (name.length() > 0 && nsPrefix != null && nsPrefix.length() > 0) { - name = nsPrefix + ":" + name; - } - return name; - } - - public PsiElement handleElementRename(String _newElementName) throws IncorrectOperationException { - final String canonicalText = getCanonicalText(); - //final String newElementName = canonicalText.substring(0,canonicalText.indexOf(':') + 1) + _newElementName; - final String newElementName = _newElementName; - - final PsiElement element = ElementManipulators.getManipulator(myElement) - .handleContentChange(myElement, getRangeInElement(), newElementName); - myRange = new TextRange(myRange.getStartOffset(),myRange.getEndOffset() - (canonicalText.length() - newElementName.length())); - return element; - } - - public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException { - throw new IncorrectOperationException(); - } - - public boolean isReferenceTo(PsiElement element) { - return myElement.getManager().areElementsEquivalent(resolve(), element); - } - - class CompletionProcessor implements PsiElementProcessor<XmlTag> { - List<String> myElements = new ArrayList<String>(1); - String namespace; - final XmlTag tag; - - CompletionProcessor(XmlTag tag) { - this.tag = tag; - } - - public boolean execute(@NotNull final XmlTag element) { - String name = element.getAttributeValue(NAME_ATTR_NAME); - final String prefixByNamespace = tag.getPrefixByNamespace(namespace); - if (prefixByNamespace != null && prefixByNamespace.length() > 0 && nsPrefix == null) { - name = prefixByNamespace + ":" + name; - } - myElements.add( name ); - return true; - } - } - - @NotNull - public Object[] getVariants() { - final XmlTag tag = PsiTreeUtil.getContextOfType(myElement, XmlTag.class, true); - if (tag == null || myType == null) return ArrayUtil.EMPTY_OBJECT_ARRAY; - - String[] tagNames = null; - - switch (myType) { - case GroupReference: - tagNames = new String[] {GROUP_TAG_NAME}; - break; - case AttributeGroupReference: - tagNames = new String[] {ATTRIBUTE_GROUP_TAG_NAME}; - break; - case AttributeReference: - tagNames = new String[] {ATTRIBUTE_TAG_NAME}; - break; - case ElementReference: - tagNames = new String[] {ELEMENT_TAG_NAME}; - break; - case TypeReference: - tagNames = new String[] {SIMPLE_TYPE_TAG_NAME,COMPLEX_TYPE_TAG_NAME}; - break; - } - - CompletionProcessor processor = new CompletionProcessor(tag); - - final XmlElement context = PsiTreeUtil.getContextOfType(myElement, XmlElement.class, false); - if (context == null) { - return ArrayUtil.EMPTY_OBJECT_ARRAY; - } - final XmlDocument document = ((XmlFile)context.getContainingFile()).getDocument(); - if (document == null) { - return ArrayUtil.EMPTY_OBJECT_ARRAY; - } - final XmlTag rootTag = document.getRootTag(); - String ourNamespace = rootTag != null ? rootTag.getAttributeValue(TARGET_NAMESPACE) : ""; - if (ourNamespace == null) ourNamespace = ""; - - for(String namespace:tag.knownNamespaces()) { - if (ourNamespace.equals(namespace)) continue; - final XmlNSDescriptor nsDescriptor = tag.getNSDescriptor(namespace, true); - - if (nsDescriptor instanceof XmlNSDescriptorImpl) { - processNamespace(namespace, processor, nsDescriptor, tagNames); - } - } - - - XmlNSDescriptor nsDescriptor = (XmlNSDescriptor)document.getMetaData(); - if (nsDescriptor != null) { - processNamespace( - ourNamespace, - processor, - nsDescriptor, - tagNames - ); - } - - return ArrayUtil.toStringArray(processor.myElements); - } - - private static void processNamespace(final String namespace, - final CompletionProcessor processor, - final XmlNSDescriptor nsDescriptor, - final String[] tagNames) { - processor.namespace = namespace; - - final XmlNSDescriptorImpl xmlNSDescriptor = ((XmlNSDescriptorImpl)nsDescriptor); - XmlNSDescriptorImpl.processTagsInNamespace( - xmlNSDescriptor.getTag(), - tagNames, - processor - ); - } - - public boolean isSoft() { - return false; - } - - private static class MyResolver implements ResolveCache.Resolver { - static MyResolver INSTANCE = new MyResolver(); - public PsiElement resolve(@NotNull PsiReference ref, boolean incompleteCode) { - return ((TypeOrElementOrAttributeReference)ref).resolveInner(); - } - } - } - @NotNull public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull final ProcessingContext context) { final PsiElement parent = element.getParent(); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/TypeOrElementOrAttributeReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/TypeOrElementOrAttributeReference.java new file mode 100644 index 000000000000..3ecff0d97045 --- /dev/null +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/TypeOrElementOrAttributeReference.java @@ -0,0 +1,376 @@ +package com.intellij.psi.impl.source.resolve.reference.impl.providers; + +import com.intellij.openapi.util.TextRange; +import com.intellij.psi.ElementManipulators; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiReference; +import com.intellij.psi.impl.source.resolve.ResolveCache; +import com.intellij.psi.search.PsiElementProcessor; +import com.intellij.psi.util.PsiTreeUtil; +import com.intellij.psi.util.PsiUtilCore; +import com.intellij.psi.xml.*; +import com.intellij.util.ArrayUtil; +import com.intellij.util.IncorrectOperationException; +import com.intellij.util.Processor; +import com.intellij.xml.XmlAttributeDescriptor; +import com.intellij.xml.XmlElementDescriptor; +import com.intellij.xml.XmlNSDescriptor; +import com.intellij.xml.impl.schema.ComplexTypeDescriptor; +import com.intellij.xml.impl.schema.TypeDescriptor; +import com.intellij.xml.impl.schema.XmlNSDescriptorImpl; +import com.intellij.xml.util.XmlUtil; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; + +public class TypeOrElementOrAttributeReference implements PsiReference { + + public enum ReferenceType { + ElementReference, AttributeReference, GroupReference, AttributeGroupReference, TypeReference + } + + @NonNls private static final String TARGET_NAMESPACE = "targetNamespace"; + + private final PsiElement myElement; + private TextRange myRange; + private String nsPrefix; + + @Nullable + public ReferenceType getType() { + return myType; + } + + public void setNamespacePrefix(String prefix) { + this.nsPrefix = prefix; + } + + private final @Nullable ReferenceType myType; + + protected TypeOrElementOrAttributeReference(PsiElement element, TextRange range, @Nullable ReferenceType type) { + myElement = element; + myRange = range; + + assert myRange.getLength() >= 0; + + myType = type; + } + + TypeOrElementOrAttributeReference(PsiElement element, TextRange range) { + this(element, range, determineReferenceType(element)); + } + + @Nullable + private static ReferenceType determineReferenceType(PsiElement element) { + final XmlAttribute attribute = PsiTreeUtil.getParentOfType(element, XmlAttribute.class); + if (attribute == null) { + return null; + } + final XmlTag tag = attribute.getParent(); + final String localName = tag.getLocalName(); + final String attributeLocalName = attribute.getLocalName(); + + if (SchemaReferencesProvider.REF_ATTR_NAME.equals(attributeLocalName) || SchemaReferencesProvider.SUBSTITUTION_GROUP_ATTR_NAME.equals(attributeLocalName)) { + if (localName.equals(SchemaReferencesProvider.GROUP_TAG_NAME)) { + return ReferenceType.GroupReference; + } else if (localName.equals(SchemaReferencesProvider.ATTRIBUTE_GROUP_TAG_NAME)) { + return ReferenceType.AttributeGroupReference; + } else if (SchemaReferencesProvider.ELEMENT_TAG_NAME.equals(localName)) { + return ReferenceType.ElementReference; + } else if (SchemaReferencesProvider.ATTRIBUTE_TAG_NAME.equals(localName)) { + return ReferenceType.AttributeReference; + } + } else if (SchemaReferencesProvider.TYPE_ATTR_NAME.equals(attributeLocalName) || + SchemaReferencesProvider.BASE_ATTR_NAME.equals(attributeLocalName) || + SchemaReferencesProvider.MEMBER_TYPES_ATTR_NAME.equals(attributeLocalName) || + SchemaReferencesProvider.ITEM_TYPE_ATTR_NAME.equals(attributeLocalName) + ) { + return ReferenceType.TypeReference; + } + return null; + } + + public PsiElement getElement() { + return myElement; + } + + public TextRange getRangeInElement() { + return myRange; + } + + @Nullable + public PsiElement resolve() { + final PsiElement psiElement = ResolveCache + .getInstance(getElement().getProject()).resolveWithCaching(this, MyResolver.INSTANCE, false, false); + + return psiElement != PsiUtilCore.NULL_PSI_ELEMENT ? psiElement:null; + } + + private PsiElement resolveInner() { + final XmlTag tag = PsiTreeUtil.getContextOfType(myElement, XmlTag.class, false); + if (tag == null) return PsiUtilCore.NULL_PSI_ELEMENT; + + String canonicalText = getCanonicalText(); + XmlNSDescriptorImpl nsDescriptor = getDescriptor(tag,canonicalText); + + if (myType != null && nsDescriptor != null && nsDescriptor.getTag() != null) { + + switch(myType) { + case GroupReference: return nsDescriptor.findGroup(canonicalText); + case AttributeGroupReference: return nsDescriptor.findAttributeGroup(canonicalText); + case ElementReference: { + XmlElementDescriptor descriptor = nsDescriptor.getElementDescriptor( + XmlUtil.findLocalNameByQualifiedName(canonicalText), getNamespace(tag, canonicalText), + new HashSet<XmlNSDescriptorImpl>(), + true + ); + + return descriptor != null ? descriptor.getDeclaration(): PsiUtilCore.NULL_PSI_ELEMENT; + } + case AttributeReference: { + //final String prefixByQualifiedName = XmlUtil.findPrefixByQualifiedName(canonicalText); + final String localNameByQualifiedName = XmlUtil.findLocalNameByQualifiedName(canonicalText); + XmlAttributeDescriptor descriptor = nsDescriptor.getAttribute( + localNameByQualifiedName, + getNamespace(tag, canonicalText), + tag + ); + + if (descriptor != null) return descriptor.getDeclaration(); + + return PsiUtilCore.NULL_PSI_ELEMENT; + } + case TypeReference: { + TypeDescriptor typeDescriptor = nsDescriptor.getTypeDescriptor(canonicalText,tag); + if (typeDescriptor instanceof ComplexTypeDescriptor) { + return ((ComplexTypeDescriptor)typeDescriptor).getDeclaration(); + } else if (typeDescriptor != null) { + return myElement; + } + } + } + } + + return PsiUtilCore.NULL_PSI_ELEMENT; + } + + XmlNSDescriptorImpl getDescriptor(final XmlTag tag, String text) { + if (myType != ReferenceType.ElementReference && + myType != ReferenceType.AttributeReference) { + final PsiElement parentElement = myElement.getContext(); + final PsiElement grandParentElement = parentElement != null ? parentElement.getParent() : null; + boolean doRedefineCheck = false; + + if (parentElement instanceof XmlAttribute && + grandParentElement instanceof XmlTag + ) { + final String attrName = ((XmlAttribute)parentElement).getName(); + final String tagLocalName = ((XmlTag)grandParentElement).getLocalName(); + + doRedefineCheck = (SchemaReferencesProvider.REF_ATTR_NAME.equals(attrName) && + ( SchemaReferencesProvider.GROUP_TAG_NAME.equals(tagLocalName) || + SchemaReferencesProvider.ATTRIBUTE_GROUP_TAG_NAME.equals(tagLocalName) + ) + ) || + ( SchemaReferencesProvider.BASE_ATTR_NAME.equals(attrName) || + SchemaReferencesProvider.MEMBER_TYPES_ATTR_NAME.equals(attrName) + ); + } + + if (doRedefineCheck) { + XmlNSDescriptorImpl redefinedDescriptor = SchemaReferencesProvider.findRedefinedDescriptor(tag, text); + if (redefinedDescriptor != null) return redefinedDescriptor; + } + } + + final String namespace = getNamespace(tag, text); + XmlNSDescriptor nsDescriptor = tag.getNSDescriptor(namespace,true); + + final XmlDocument document = ((XmlFile)tag.getContainingFile()).getDocument(); + + if (nsDescriptor == null) { // import + nsDescriptor = (XmlNSDescriptor)document.getMetaData(); + } + + if (nsDescriptor == null) { + final XmlNSDescriptor[] descrs = new XmlNSDescriptor[1]; + + URLReference.processWsdlSchemas( + document.getRootTag(), + new Processor<XmlTag>() { + public boolean process(final XmlTag xmlTag) { + if (namespace.equals(xmlTag.getAttributeValue(TARGET_NAMESPACE))) { + descrs[0] = (XmlNSDescriptor)xmlTag.getMetaData(); + return false; + } + return true; + } + } + ); + + if (descrs[0] instanceof XmlNSDescriptorImpl) return (XmlNSDescriptorImpl)descrs[0]; + } + + return nsDescriptor instanceof XmlNSDescriptorImpl ? (XmlNSDescriptorImpl)nsDescriptor:null; + } + + private static String getNamespace(final XmlTag tag, final String text) { + final String namespacePrefix = XmlUtil.findPrefixByQualifiedName(text); + final String namespaceByPrefix = tag.getNamespaceByPrefix(namespacePrefix); + if (namespaceByPrefix.length() > 0) return namespaceByPrefix; + final XmlTag rootTag = ((XmlFile)tag.getContainingFile()).getRootTag(); + + if (rootTag != null && + "schema".equals(rootTag.getLocalName()) && + XmlUtil.ourSchemaUrisList.indexOf(rootTag.getNamespace()) != -1 ) { + final String targetNS = rootTag.getAttributeValue(TARGET_NAMESPACE); + + if (targetNS != null) { + final String targetNsPrefix = rootTag.getPrefixByNamespace(targetNS); + + if (namespacePrefix.equals(targetNsPrefix) || + (namespaceByPrefix.length() == 0 && targetNsPrefix == null)) { + return targetNS; + } + } + } + return namespaceByPrefix; + } + + @NotNull + public String getCanonicalText() { + final String text = myElement.getText(); + String name = myRange.getEndOffset() <= text.length() ? myRange.substring(text) : ""; + if (name.length() > 0 && nsPrefix != null && nsPrefix.length() > 0) { + name = nsPrefix + ":" + name; + } + return name; + } + + public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException { + final String canonicalText = getCanonicalText(); + + final PsiElement element = ElementManipulators.getManipulator(myElement) + .handleContentChange(myElement, getRangeInElement(), newElementName); + myRange = new TextRange(myRange.getStartOffset(),myRange.getEndOffset() - (canonicalText.length() - newElementName.length())); + return element; + } + + public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException { + throw new IncorrectOperationException(); + } + + public boolean isReferenceTo(PsiElement element) { + return myElement.getManager().areElementsEquivalent(resolve(), element); + } + + @NotNull + public Object[] getVariants() { + final XmlTag tag = PsiTreeUtil.getContextOfType(myElement, XmlTag.class, true); + if (tag == null || myType == null) return ArrayUtil.EMPTY_OBJECT_ARRAY; + + return getVariants(tag, myType, nsPrefix); + } + + public static Object[] getVariants(XmlTag tag, ReferenceType type, String prefix) { + String[] tagNames = null; + + switch (type) { + case GroupReference: + tagNames = new String[] {SchemaReferencesProvider.GROUP_TAG_NAME}; + break; + case AttributeGroupReference: + tagNames = new String[] {SchemaReferencesProvider.ATTRIBUTE_GROUP_TAG_NAME}; + break; + case AttributeReference: + tagNames = new String[] {SchemaReferencesProvider.ATTRIBUTE_TAG_NAME}; + break; + case ElementReference: + tagNames = new String[] {SchemaReferencesProvider.ELEMENT_TAG_NAME}; + break; + case TypeReference: + tagNames = new String[] {SchemaReferencesProvider.SIMPLE_TYPE_TAG_NAME, SchemaReferencesProvider.COMPLEX_TYPE_TAG_NAME}; + break; + } + + final XmlDocument document = ((XmlFile)tag.getContainingFile()).getDocument(); + if (document == null) { + return ArrayUtil.EMPTY_OBJECT_ARRAY; + } + final XmlTag rootTag = document.getRootTag(); + String ourNamespace = rootTag != null ? rootTag.getAttributeValue(TARGET_NAMESPACE) : ""; + if (ourNamespace == null) ourNamespace = ""; + + CompletionProcessor processor = new CompletionProcessor(tag, prefix); + for(String namespace: tag.knownNamespaces()) { + if (ourNamespace.equals(namespace)) continue; + final XmlNSDescriptor nsDescriptor = tag.getNSDescriptor(namespace, true); + + if (nsDescriptor instanceof XmlNSDescriptorImpl) { + processNamespace(namespace, processor, nsDescriptor, tagNames); + } + } + + XmlNSDescriptor nsDescriptor = (XmlNSDescriptor)document.getMetaData(); + if (nsDescriptor != null) { + processNamespace( + ourNamespace, + processor, + nsDescriptor, + tagNames + ); + } + + return ArrayUtil.toStringArray(processor.myElements); + } + + private static void processNamespace(final String namespace, + final CompletionProcessor processor, + final XmlNSDescriptor nsDescriptor, + final String[] tagNames) { + processor.namespace = namespace; + + final XmlNSDescriptorImpl xmlNSDescriptor = ((XmlNSDescriptorImpl)nsDescriptor); + XmlNSDescriptorImpl.processTagsInNamespace( + xmlNSDescriptor.getTag(), + tagNames, + processor + ); + } + + public boolean isSoft() { + return false; + } + + private static class MyResolver implements ResolveCache.Resolver { + static MyResolver INSTANCE = new MyResolver(); + public PsiElement resolve(@NotNull PsiReference ref, boolean incompleteCode) { + return ((TypeOrElementOrAttributeReference)ref).resolveInner(); + } + } + + private static class CompletionProcessor implements PsiElementProcessor<XmlTag> { + List<String> myElements = new ArrayList<String>(1); + String namespace; + final XmlTag tag; + private final String prefix; + + CompletionProcessor(XmlTag tag, String prefix) { + this.tag = tag; + this.prefix = prefix; + } + + public boolean execute(@NotNull final XmlTag element) { + String name = element.getAttributeValue(SchemaReferencesProvider.NAME_ATTR_NAME); + final String prefixByNamespace = tag.getPrefixByNamespace(namespace); + if (prefixByNamespace != null && prefixByNamespace.length() > 0 && prefix == null) { + name = prefixByNamespace + ":" + name; + } + myElements.add( name ); + return true; + } + } +} diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java index 81645bd453f3..c986bb1ebb25 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java @@ -384,7 +384,7 @@ public class XmlTagImpl extends XmlElementImpl implements XmlTag { ExternalResourceManager.getInstance()); } } - return new Result<XmlNSDescriptor>(null, XmlTagImpl.this, currentFile, ExternalResourceManager.getInstance()); + return new Result<XmlNSDescriptor>(null, XmlTagImpl.this, currentFile == null ? XmlTagImpl.this : currentFile, ExternalResourceManager.getInstance()); } }, false)); diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlNSDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlNSDescriptorImpl.java index 4e5e37eaf0d4..748d597d16a3 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlNSDescriptorImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlNSDescriptorImpl.java @@ -29,6 +29,7 @@ import com.intellij.psi.search.PsiElementProcessor; import com.intellij.psi.util.CachedValue; import com.intellij.psi.util.CachedValueProvider; import com.intellij.psi.util.CachedValuesManager; +import com.intellij.psi.util.PsiModificationTracker; import com.intellij.psi.xml.XmlAttribute; import com.intellij.psi.xml.XmlDocument; import com.intellij.psi.xml.XmlFile; @@ -80,7 +81,7 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator<XmlDocum public XmlNSDescriptorImpl() { } - private Object[] dependencies; + private volatile Object[] dependencies; private static final ThreadLocal<Set<PsiFile>> myRedefinedDescriptorsInProcessing = new ThreadLocal<Set<PsiFile>>(); @@ -189,7 +190,7 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator<XmlDocum if (name != null && !name.equals(pair.second)) { myDescriptorsMap.remove(pair); - return new Result<XmlElementDescriptor>(null); + return new Result<XmlElementDescriptor>(null, PsiModificationTracker.MODIFICATION_COUNT); } final XmlElementDescriptor xmlElementDescriptor = createElementDescriptor(tag); return new Result<XmlElementDescriptor>(xmlElementDescriptor, xmlElementDescriptor.getDependences()); @@ -530,7 +531,7 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator<XmlDocum xmlFile.getDocument() == null ) { myTypesMap.remove(pair); - return new Result<TypeDescriptor>(null); + return new Result<TypeDescriptor>(null, PsiModificationTracker.MODIFICATION_COUNT); } final XmlDocument document = xmlFile.getDocument(); @@ -538,7 +539,7 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator<XmlDocum if (nsDescriptor == null) { myTypesMap.remove(pair); - return new Result<TypeDescriptor>(null); + return new Result<TypeDescriptor>(null, PsiModificationTracker.MODIFICATION_COUNT); } final XmlTag rTag = document.getRootTag(); @@ -615,7 +616,7 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator<XmlDocum !name.equals(XmlUtil.findLocalNameByQualifiedName(pair.first.first)) ) { myTypesMap.remove(pair); - return new Result<TypeDescriptor>(null); + return new Result<TypeDescriptor>(null, PsiModificationTracker.MODIFICATION_COUNT); } final ComplexTypeDescriptor complexTypeDescriptor = new ComplexTypeDescriptor(XmlNSDescriptorImpl.this, tag); return new Result<TypeDescriptor>(complexTypeDescriptor, tag); @@ -927,7 +928,7 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator<XmlDocum } public Object[] getDependences() { - if (dependencies == null) dependencies = new Object[] {myFile}; // init was not called + if (dependencies == null) dependencies = myFile == null ? ArrayUtil.EMPTY_OBJECT_ARRAY : new Object[] {myFile}; // init was not called return dependencies; } |