summaryrefslogtreecommitdiff
path: root/plugins/properties/src/com/intellij
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2014-06-10 18:12:50 -0700
committerTor Norbye <tnorbye@google.com>2014-06-10 18:12:57 -0700
commit9ea67227e8fdcf8ed37e65bb96e32767291d0f4f (patch)
treeb9d56f49fde137a6098f7cec1aebeda51af705ef /plugins/properties/src/com/intellij
parentc667c1f74abd96a2098520effdd5afdff7f0d34b (diff)
downloadidea-9ea67227e8fdcf8ed37e65bb96e32767291d0f4f.tar.gz
Snapshot idea/138.538 from git://git.jetbrains.org/idea/community.git
a18cb3f: fix CCE d7d596e: Groovy: Remove extra spaces after deleted statements. So no extra line feed in Introduce Variable appears 25032fc: Groovy traits : abstract trait methods are not clashing acf850e: IDEA-126013 fix SOE : maps and lists declared recursively should not fail type inference into recursion 75e06bf: clashing trait methods inspection 7ae9c94: TypesUtil.getQualifiedName(type) should return qname even if type is not resolved beaa518: GrClassReferenceType.rawType() should return raw type even if type is not resolved 2e95615: Groovy: don't use type.getCanonicalText() to infer type qualified name since it can lead to inferring of type parameters and wasting time 08c6e63: Skipping Ant "After Compilation" task if compilation completed with errors (IDEA-125901) 1856d07: SoftWrapModelImpl refactoring. Mocking SoftWrapPainter to make tests platform-independent. 6246ee2: unlock under finally 9ab9a99: corrected 'contains' for library scopes for files from library sources 2e7fcc7: Merge remote-tracking branch 'origin/master' 5928bf7: Merge remote-tracking branch 'origin/master' 718a6a5: removed explicit virtual file inequality 08cab53: Fixed shebang formatting (PY-12775). 24be689: http://ea.jetbrains.com/browser/ea_problems/57321 bf4c84d: http://ea.jetbrains.com/browser/ea_problems/57321 65944db: Merge remote-tracking branch 'origin/master' 5106fdd: better name: reuseActivation -> reuseToolWindowActivation e1c9f77: Merge pull request 191 from suman-ganta for IDEA-123890 b66574a: Karma auto-rerun tests shouldn't activate Run toolwindow 56409a9: Karma auto-rerun tests shouldn't activate Run toolwindow every time 880a4db: added test for SurroundWithQuotesAnnotationParameterValueFix that checks that char '\n' replaces by "\n" correctly f6a393d: lambda: fix parameter types comparing order (IDEA-126056) ccdc69a: method references: avoid double substitution (IDEA-126062) e05cddc: JavaFx SceneBuilder b-14 fix c4e8b2c: Merge remote-tracking branch 'origin/master' 879c23d: PY-13210 Unused star import in Django settings.py a4351eb: platform: profiling actions overhauled 5ec97cf: IDEA-81568 (ignore FS events from /private unless asked explicitly) 236752e: unused library: use existing graph instead of custom dependency analysis 2a1a7c8: IDEA-126047 - Git Clouds: show commit dialog on deploy d05243d: prefer junit/testng pattern configuration: detect multiple selection directly by context component (IDEA-126045) 27f10a6: check to prevent contradicted intersection type (IDEA-67600) 046b90c: IDEA-114252 WebStorm clipboard history conflicts with external clipboard manager (ClipMenu) Fix native hangup (steps: periodical "Paste action" update() for toolbar button during Drag&Drop in AppCode UI Designer) 885a24d: don't even schedule excluded files for update upon before contents changed events 122cd32: check for invaild file de3bf99: optimisation: reduce instances of DirectoryScope created e2efe2e: cleanup 000bd7a: cleanup 68a5b6e: performance 732238f: performance 2f08301: check for type param numbers in java 1.6 should not rise error if super methods have type params (IDEA-57338) 598f921: testdata for IDEA-61415 6deb5bb: testdata for IDEA-65473 9853fb6: suspicious removeAll: compare type arguments, not qualifiers 1dc83a9: Added ability to pass command-line args to Gradle on project sync/refresh. e61c327: fix binary compatibility ef92f2f: fix binary compatibility 40875a7: fix binary compatibility 79d53fd: IDEA-118400 Update Project dialog redesigned, IDEA-106435 ability to perform only update, IDEA-75768 checks saved for Update dialog d218629: Remove 'zen coding' from emmet support configurable 150b674: HTML: ignore unknown filters 2fac634: @NotNull 99d5348: Emmet CSS completion 2989429: EA-57291 (severity reduced as the real reason is logged earlier) 491dc5f: contract inference initial bc12a14: extract contract checking to a separatate inspection 75c4257: MethodContract.createConstraintArray 109906e: WEB-12316 PhpStorm performing awful when typing in HTML zones in PHP files 91b7c69: check file on updateExecutionPoint 1591844: WEB-11678 JavaScript debug: step into and step over do not change the line ec43ad0: Merge remote-tracking branch 'origin/master' e58ce76: try unnecessary module dependencies to support exported dependencies a9c8a08: IDEA-125568 (possible NPE in some test setup paths fixed) 2fdb004: Merge remote-tracking branch 'origin/master' 39cc27d: suggest to restart IDEA if user accepted to enable/disable plugins from startup notification (IDEA-121369) 693bbf6: encapsulate fields: preserve comments inside (IDEA-124747) fcaa3e2: add java specific debugger settings into common settings node 1a3c6c6: code cleanup optimization: run inspections over exactly one element 4c3bda0: Get rid of direct "dispose" call 539f90a: WI-23626 Breakpoint muting does not disable after run. Regression from 7.1.3 to EAP 8. ffcf607: junit: accept custom matcher descriptions (IDEA-125942) de7387f: provide remove assignment fix for silly assignment inspection (IDEA-125993) 54e38ee: IDEA-121664 Search Everywhere: results from different categories appear mixed 99adcfd: EA-55292 (NPE fixed) a87bf9b: Unneeded exception dropped 128b05b: Merge remote-tracking branch 'origin/master' abc4ba7: GWT builder: test added f76fea5: test added 30fe2c4: invoke 'save' after 'mark root' action to update iml files immediately 9f6fa54: registering output-to-buildTarget mapping instead of output-to-source mapping to address cases when multiple sources compile into the same output (e.g. Kotlin) f06f5a6: Handle '@' symbol in ssh username c142a3c: OC-9609 [Refactoring: common approach for Non-DumbAware mode in folding] +review CR-OC-1561 e4dbc27: fix problem with extending sorted set by one and attempting to increase random access capacity in case of value removal aa0e217: use more detailed path to file only when opened file name is not unique (IDEA-125958) fe72975: Marking DuplicateIndex as PsiDependentIndex to attempt to avoid problems with unsaved document indexing being asynchronously committed (EA-36001) 22db3a8: get rid of RowSorters to fix a few exceptions. New Plugin UI has its own table header without swing's row sorters e5541c8: deprecation inspection uses default serialization 24077b1: push 'change method return type' fix down when variable is checked 65ec59f: icon decoration for external annotations (IDEA-39633) 8f10d71: option to warn about members in deprecated classes (IDEA-112084) 27ec65a: optimize imports under progress (IDEA-125761) 14d3780: Cleanup (formatting) e5fcad3: revert (java: minor optimization) f8e2be2: do not recreate breakpoint highlighter if not requested implicitly, this fixes jumping breakpoints on several quick line insertions 44fc624: sql: better varchar and varchar2 completion b5d09fe: getEqualityObject() fixed for JS debugger dc3bd73: call applyInformation for all EditorBoundPass for each editor 47336a6: cleanup 67c4e4b: calculate default inspection name by trimming Inspection or InspectionBase 4a0d396: notnull a3f3988: cleanup c8337a2: cleanup 8ad9eb1: moved long-running tests into performance suite 395ae29: expand javadoc on PSI validity 48c2fc4: special PIEAE handling for NULL_PSI_ELEMENT (its getUserData throws exceptions) f3fe82e: IDEA-114252 WebStorm clipboard history conflicts with external clipboard manager (ClipMenu) 3d7f7d2: IDEA-125820 DOM Generator: problem with XML element names matching default/generated imports CR-IC-5549 eadc889: build initial foldings in background (improvements as per CR-IC-5531) 350760c: rename: detect "field would hide local" conflict (IDEA-125934) 0de6aa9: move: do not convert classes to files before move 35005bc: IDEA-125947 not initialized final field should not be raised on any refs from inner classes 62f7acd: plugins: take into account already installed plugins during dependencies check (IDEA-123767) a673a47: softReference to cache known plugin extensions 3995088: update info: link to the product home page (IDEA-124023) aa9a7b1: move: filter out nested dirs/files on actionPerformed, update should be fast (IDEA-111413) e887cc3: Merge remote-tracking branch 'origin/master' 24c1fab: fix thread crash in debug console after syntax error (PY-12600) 49b602b: java: minor optimization f5f8124: java: helper method for Kotlin e674dd1: fixed PY-13177 PyCharm hangs on adding incorrect interpreter (python3-pyinotify) 5c41c76: Maven: manifest generation fixes - use ApplicationNamesInfo#getFullProductName for "Created-By" attribute value, redundant code removed d2752f1: invalidNames is a bit confusing, let's use existingNames; also small cleanup 7b282c4: lots of EA-57109 - PIEAE: LeafPsiElement.invalid. attempt 2. cf78c48: External System + Gradle: support for running a task before launch of another configuration added. Related issue for Gradle: IDEA-113437 'Before Launch' should support running a Gradle task 6396cd8: IDEA-125900 (resolve of synthetic enum methods in class files fixed) bb35b26: Cleanup (cached value manager instead of boilerplate) 6f417af: reuse LocalQuickFix because several instances can be handled badly c44d318: IDEA-104484 Console ExceptionFilters are added twice for debugging java app e67157d: IDEA-125470 While in editor, wild re-displaying occurs when soft wraps are enabled 2de7658: folding model implementation cleanup c7a1fbb: fixed NPE in debuggers that do not use value markers 159a46b: JavaRearranger: fixed field caching in case of multiple classes in java file (IDEA-123733) b3f67525: Added scope and file mask filter to reformat directory/project/module dialogs (IDEA-59850) [CR-IC-5534] c3a1eb8: Merge remote-tracking branch 'origin/master' 9d5429e: remove variable: do not leave tailing loops/ifs (IDEA-124489) d6c14fb: Delete LightLexerTestCase 83abbd0: fixing OOME in tests fd0acc2: temp disable 6520348e0292c4bb47389cb12926dc83826796e7 22c687d: Merge remote-tracking branch 'origin/master' 9102909: use goto.nonProjectScopeDisabler EP to show/hide 'include non-project files' checkbox 0dca1c3: use goto.nonProjectScopeDisabler EP to show/hide non-project items checkbox def9b6f: EP to disable using Non-project scope for IDEs where this doesn't make sence 6520348: lots of EA-57109 - PIEAE: LeafPsiElement.invalid 1ecc94f: don't set Darcula UI in search text field if it's already set 2357251: rollback NPE fix (found the real problem) f52fccd: Cleanup (optimization; formatting) 5d85b2b: spped search by value in debugger trees 7e5f8a2: fixed VM leak in debugger tree listener 8771d61: fixed VM leak in object marks b9abbfb: template ConstructorInsertHandler test (IDEA-101429) 6713978: start type template if at least object was inferred 8540bac: RefCountHolder: allow referenced files' ast to be gc-ed during highlighting 716aa5a: generate name for save scheme dialog c86e3af: external annotation change should drop all psi cachedValues ae0bd0f: cleanup 26af3f5: implement equals and hashCode to make two LocalQuickFix instances equal if they refer to one and the same IntentionAction 0ade045: IDEA-125645 On breakpoint hit, opens file in new tab in "active" split -- even if file is already open in tab in "inactive" split 1881ceb: test — auto expressions: filter out expression contained unresolved local variable 3677585: IDEA-103523 MethodMayBeStaticInspection replace qualified usages by class name (reused MakeMethodStaticProcessor) 89905f6: don't hold reference to PsiFile 83bc4af: move AddSpaceInsertHandler.java to lang-impl 769a599: WEB-12348 Quick fixes not always working in Inspection window 18b220c: IDEA-90008 (editor files are refreshed elsewhere, no need to watch) 894818e: Cleanup (deprecated code dropped) aba3f2f: CreateSwitchIntention removed all operations with Document to exclude possible problems 4c6818a: removed from IdeaPlugin SurroundWithQoutesIntention 044671d: Merge remote-tracking branch 'origin/master' a109c22: IDEA-121370 Failed Gradle task doesn't block the dependent run configurations fbf4eb5: Merge remote-tracking branch 'origin/master' 89f5018: imports optimized baa6389: SurroundWithQuotesAnnotationParameter: intention replaced by quick fix to the corresponding error 5f7a426: no later runnable for anonymous class creation template 05d13a3: Get rid of needless filtering a8660f4: use "OS user" term cb71334: fix NPE on linux 930235e: notnull and remove unused field c7cd901: notnull 83d5484: Color & Fonts panel: generate new name when copy 6cc553f: cleanup fa4e0deb: remove unused class e291480: correct checking read-only status for CreateSwitchIntention cdd07a4: CreateSwitchIntention checks language level and that file is witable 11adc57: Cleanup (warning; unneeded reflection) b6b5bbd: start template when anonymous class is completed with Object params (need better heuristic) f9a561c: enable change type signature for anonymous classes d645cf9: optimize icon b393a47: IDEA-125825 Surround with quotes annotation parameter value intention f5f2f31: IDEA-99541 New run configuration type to run Ant Return back ProcessHandler.waitFor() for standard task execution (not Run Configuration) 4112da6: IDEA-125872 (avoid resetting mod. stamp) 4b93641: fix html parsing (big thanks to cdr) 0b6b37c: notnull 4ffddd7: IDEA-125829 ClassInheritorSearch should find traits 2fe5331: fix compilation 9ddfbc8: IDEA-125730 Declare explicit type: broken template should revert all its changes and move the caret back to the original position. 8f5e205: IDEA-125759 correct assert check 59aef31: IDEA-125781 ReadAction in GroovyTraitFieldSearcher d946471: IDEA-125730 correct item order in ChooseTypeExpression 9c99488: JS debugger in Chrome: support breakpoint conditions, better support for 'log evaluated expression', non-strict column number comparison 6b9f4a4: goto related localizations for properties files 3c06c05: fixed truncated object id ee5bba7: ResourceBundleEditor: subeditors without virtual spaces (part of IDEA-85572) 9e358f4: CR-IC-5505 (cleanup) 69b649e: Offer to launch vagrant on skeletons generation in popup balloon. 82b7f75: Merge remote-tracking branch 'origin/master' 86ada28: Don't show modal dialog about vagrant start from packages list (PY-12838). af40fe8: DataPointHolderConversionIntention not supports fields without initializer for conflicts escapings 0455ae8: NPE 02ca2bd: PsiBundle: fix typo in bundle name, cleanup cc8d259: don't cache language level in JavaDirectoryService 60cbfb0: allow to create java classes named pkg.Class (IDEA-125442, CR-IC-5537) b673277: ensure canonical module order in CE modules.xml 1388cfb: BaseElementAtCaretIntentionAction extends BaseElementAtCaretIntentionAction a777074: IDEA-125558 new debugger: double result in evaluate expression - updated fix add5377: reverted fix for IDEA-125558 5ad334b: AddJavadocIntention moved to "Declaration" category b4f899b: notnull dd53334: allow com.intellij.openapi.roots.impl.ModuleRootManagerImpl#getFileIndex to work in upsource a28c2f4: register ExternalResourceManagerExImpl 9aa5346: EA-53941 - assert: FileManagerImpl.getCachedPsiFile 3b946e3: Merge remote-tracking branch 'origin/master' 62eeced: show notification if power save mode is on on startup (IDEA-125847) d13982b: most specific: do not start java 8 algorithm for provided type args (IDEA-125855) 12a99d8: virtual array by selection rule (IDEA-125862) 610b0ba: IDEA-125820 DOM Generator: problem with XML element names matching default/generated imports 80199b4: DBE-19 0xDBE: edit description at Settings / Passwords 85c5cf1: Merge remote-tracking branch 'origin/master' 3efe19e: added help id for evaluate dialog 8456e04: IDEA-123787 "No live templates selected" label in multiple selection 9ce90b8: IDEA-124362 No scrollbar in Settings | Code Style | General c04939b: auto expressions: don't compute for nested values 56917b3: make it by default and look at the performance f30498b: Merge remote-tracking branch 'origin/master' adae926: Don't ask to start Vagrant in a modal dialog on skeleton generation (PY-12838). 1315295: watches in tasks 57f4bbf: IDEA-125462 Unable to execute simple platform test with IDEA Ultimate Plugin SDK 9a56986: do not evaluate values twice b7b995b: IDEA-54137 All alarms in RBE deleted. Save to file on focus change c3b697a: IDEA-39879 Background color and gutter stripe color for bookmarks should be configurable b893466: close editors only 08d3b73: NPE fixed 37cb86b6: fixed Color object icon renderer a1ecb55: fixed switching multiple suspended threads in java 0c7e893: correctly load old enabled state of debugger expressions 6847fc3: IDEA-119364 (not introduces case statements for enum) 673d730: wrong shortcut suggested in goto test popup (IDEA-125857) 6a73a71: IDEA-108141 reused code of FixDocCommentAction d03289c: IDEA-85274 Tasks: the detached editors are not affected by context change a375d1e: java: correct stub for enums compiled by Groovy c4edd41: aware of debugger communication error on break event fd6ccfc: IDEA-125678 ConvertInterfaceToClassIntention.moveExtendsToImplements improved 0b0873d: IDEA-58422 implemented in IPP ef6b09a: more possible reasons for non-physical file invalidation 745c9b0: IDEA-68916 "Zoom" for Mac OS 5372371: cleanup c1810c1: cleanup 24cc395: Merge remote-tracking branch 'origin/master' fd72f3e: javac 6 workaround (from IDEA-16723) 19af1ec: refactoring (following CR-IC-5531) 784512b: enum constants access inside enum constant initializers fixed (IDEA-125816) b1b3b1d: accept intersection types in foreach stmts (IDEA-125800) f1d927b: Mac: add app-title if project-title is empty 08f4caf: fix sorting 4559c7f: IDEA-123189 Project wizard: tree entries text cutoff 90bd11d: javadoc 6a6fa53: cleanup b8be4e2: IDEA-125805 (language level increase quickfix for switch on enum/string) 75a492a: Cleanup (less repeated checks; less parameter pinballing) b159632: testdata for IDEA-57388 656ce72: testdata for IDEA-67578 88a9ace: old inference: take only EQUALS bounds from sibling param (IDEA-119757) dc3b3a9: try 'generate missed tests' without names check (IDEA-125818) 1dfcabe: javadoc fix 9b09325: moved to psi, register more services f3cc359: register find usage providers a0f8840: moved to psi 25fe38e: javadoc fix 6f7574c: dfa: invalid type diagnostics (IDEA-125179) c9dff24: don't advertise Quick Definition when completion doesn't contain psi items (IDEA-87208) 43c06cfc: always use forward slashes in copy reference (IDEA-125292) 3dd0451: IDEA-125442 Strip .java from classname when creating new class 571196f: IDEA-125749 Create New Class Dialog - Pressing 'e' in Kind selects 'Interface' instead of 'Enum' 7a71a4d: External system: code cleanup a635296: fix popup width jumping 9ea2438: IDEA-125609 - Built-in Git SSH executable ignores IDEA http proxy settings f894389: IDEA-122962 - Clouds: perform connection test in background - auto-reload in CloudFoundry run configuration 494fbfe: renamed and more factories 309e1b1: provide empty quick fix factories for upsource b78b8d0: initialize and register stub serializers da59ab8: IDEA-125498 Search Everywhere: sometimes after navigation the list of search results reappears in the left corner of the screen 6549903: External System: IDEA-123031 Import sources and docs for module level libraries b8d02c9: isValid c59fbba: Reimplement parameter info test 50e11e6: fixed PY-13150 Pyramid run configuration fails when specifing '--reload' in additional option 320ecac: IDEA-39879 Background color and gutter stripe color for bookmarks should be configurable ab780e0: WEB-12346 Watches pane: Adding/removing variable not possible when dragged out 4cdca43: Merge remote-tracking branch 'origin/master' 347094c: Merge remote-tracking branch 'origin/master' b75e6ed: fixed tests ae2b6c6: testdata fixed 37b352f: changelist preselection for file fixed and refactored 982e039: fix rendering issues 4dbfccf: registry ui improvements 16ce85a: notnull 4568663: IDEA-114011 Github: work with HTTP, not only with HTTPS 8cb550e: ExternalResourceManagerImpl inlined, moved to psi ecff152: moved to core 2ff189c: removed "new in" which are not that new anymore 8787917: toString 6afd4f4: build initial foldings in background 9a121b2: EA-57104 - assert: PsiFileImpl.navigate 1080da4: IDEA-77640 Warn if the current subscription license will not work with the new version in the Update Info dialog 478fc87: test fixes and code unification fda1430: update inspection and quickfix 287c944: OC-9609 [Java doc only] +review CR-OC-1561 71594cc: OC-9609 broken based on AST-tree folding at project opening +review CR-OC-1561 80ea2b9: better name for static method newOne -> of b97e528: suppress contract validation for wrong Logger.assertTrue 5d8ee45: IDEA-112222 Validate @Contract annotation is related to the code b09762d: cache properties files by bundle name and module f25f58e: fix invalid PsiTreeUtil contract 97e0bde: remove unused VfsUtil.virtualToIFile 1f4d0df: notify BuildManager only if file events affect opened and watched projects (second part of IDEA-122685) c503439: quickfix for IDEA-125710 (Wrong selection behavior in file history window) 5318e0e: fix assertion / comments / better transformation policy of array of changes / sorted ints into bit set edeb5d2: testdata for IDEA-57290 b1b3964: testdata for IDEA-58692 af3e413: testdata for IDEA-24496 ae57176: provide 'place' language level for convertible check to allow types from old libraries to be casted to primitives (IDEA-117684) 2f6d5c9: testdata for IDEA-118362 f55b7ff: equality asymmetry fixed (IDEA-118533) fdcb20b: type distinct prover asymmetry fixed (IDEA-118533) 6b5c924: suspicious collections call: process removeAll (IDEA-108755) e9e9523: IDEA-125414 DB keys/indices to columns navigation 756b77b: accumulate index changes into array and convert it into bitset as needed 29f2788: track index info when encountering duplicated inputId 5803a5f: to Peter: addAll for emptySet doesn't work 61dbfe9: Merge remote-tracking branch 'origin/master' 95bc1fb: some more @MagicConstant c3c31bd: EA-57052 - assert: MasterKeyPasswordSafe.decryptPassword e761dd8: @NotNull'ed for EA-56831 - NPE: RemoteProcessSupport.release 9463bb3: Merge remote-tracking branch 'origin/master' ff49bd1: use VirtualFile.nameSequence for isProjectOrWorkspaceFile check 248d752: restore classes merge with fix of foreach processing fedbba7: Merge remote-tracking branch 'origin/master' a494959: WeakReference objects used for vfile->document mapping should not stay in memory forever 8110e0b: less allocations in FileBasedIndexImpl.getUnsavedDocuments 180df2c: completion: don't suggest true/false literals where boolean is not expected 76939c8: restore query mismatch inspection fffde12: new inference: mark erased for type params/raw types compatibility (IDEA-122932) a2615d0: new inference: accept raw equality 67daae0: leave capture during bound composition of unbounded wildcards (IDEA-125423) 01c9bba: old inference: ignore java 1.6 bug in new versions (IDEA-125744) b7ab465: old inference: choose child type between types in subtypes constraint (IDEA-118536) d311a4e: perform target.findUsages() if no psi found 98302cc: IDEA-125186 Shorten reference with an import even if there is a conflicting class from Groovy default packages d47756d: show initial value only for strings and primitive types 13986db: IDEA-125693 Creating a project in dir '~/Desktop/test' creates the project in the dir '/Applications/IntelliJ IDEA 13 CE.app/bin/test' ae7d190: NPE when using from UML 530189b: a little bit smarter methods matching 8150b8b: IDEA-125566 Start From Scratch: can't close Customize IDEA dialog ab7b2a0: IDEA-122962 - Clouds: perform connection test in background - auto-reload in frameworks 1a7ab39: restore (wrong) Logger.assertTrue contracts c12b68d: dumb-aware error dropping actions ac9d1e8: get java language level from the root model when pushers haven't finished yet bd93483: IDEA-125565 Start from Scratch: Customize IDEA dialog: UI Themes page looks bad on Linux 6ea44e9: Gradle: use module library level for local dependencies, update library name to contain groupId 7d4dae9: IDEA-125565 Start from Scratch: Customize IDEA dialog: UI Themes page looks bad on Linux fb173cc: IDEA-124461 New Module (Maven, Gradle) created in Empty project don't get the specified jdk be064c3: cleanup 89dc105: show mark for a stack frame executing a method from marked object f48b9fa: Merge remote-tracking branch 'origin/master' c4dc543: IDEA-125745 Controls on breakpoints dialog resize differently a105b5b: IDEA-125736 new debugger: disabled all exceptions breakpoint stops at every exception even in mute mode 5fd6a23: IDEA-124082 default changelist for Commit dialog fixed when 'commit directory' called 3a9e539: IDEA-124347 Master Password prompt strategy changed for mercurial authentication 74d52dd: introduce CvsFilePath to prevent public api changes a489967: fix typo f2c14b5: Start plugins wizard #30 for Mac OS X should be "native" keymap by default a16bfe6: External-system: IDEA-124927 Don't refresh projects on opening when auto-import is disabled 78ee0a2: IDEA-125551 Start From Scratch: Customize IDEA dialog: JBoss plugin should not appear in JavaFrameworks group e276bfa: unregistering obsolete service components fbb0f39: jasper validation tests: fixes and cleanup 0d5f295: clean up: - replaced 2 usages isAssociated method from ValueContainer with getValueAssociationPredicate() delegation - rewrote serialization of input ids to be independent from concrete input id set implementation via usage of int iterator - inlined saveInvalidateCommand in ValueContainermpl and added comments 7321069: ad text in 'go to' actions b57a8ca: get python language level from the root model when pushers haven't finished yet a30a74e8: fix dfa contract believing that nullable is always null 9c29b95: fix dfa contract IOOBE with varargs 31be027: relax time in MessageBusTest.testPostingPerformanceWithLowListenerDensityInHierarchy 4955009: remove mostly non-useful Integer.valueOf completion suggestions 41b974e: anonym -> lambda: disable if target SAM type is raw and methods are called on params with Object erasure (IDEA-125613) 032faad: EIAE 2f4d4fb: register container provider ba6e884: initialize file types 2f3db6a: UOE 73bfc96: NPE 3a8647f: reverted changes blocking inner classes in libraries to work b66623a: do not fail position manager if assert happened in one of the providers 6dc93a1: skip binary files earlier, no need to get psi for that 91f7c25: do not scan all files when trigram index is available 7d81587: register extension points 4489140: -contributor 5fe5352: rw detector 707e584: IDEA-125649 6a28780: notnull a7d14fe: IDEA-107588 (Mismatched query and update of collection - include Collections.addAll()) 39d4dfb: fix 'as Trait' result type b1e9f66: EA-57003 - NPE: WatchInplaceEditor.doOKAction 2d0aa2a: BlockMarkerCommentsInspection changes after review 98954e2: EA-57004 - NPE: XBreakpointManagerImpl.createBreakpointDefaults 3b09eea: fix compilation 40f7150: low priority 'create getters/setters' quickfixes a34a01d: duplicated code c6d539f: disable assert for Groovy clients 7459b0b: cleanup f008f98: IDEA-125584 Groovy: NPE at org.jetbrains.plugins.groovy.annotator.intentions.CreateMethodFromUsageFix.invokeImpl 93d7ac9: IDEA-125576 Groovy: 'Create trait' could be added to 'Create From Usage' 6975411: get rid of 'public' keyword in templates 53fbe15: IDEA-125556 New Groovy class dialog contains trait option IDEA-125577 new icons for Groovy traits 90ec82d: more diagnostics for gdsl scripts 60c7d6f: EA-57072 - IOOBE: EditorImpl.offsetToLogicalLine 5801886: External-system: IDEA-124927 Don't refresh projects on opening when auto-import is disabled 2b0a1b9: One more condition for go to actions history 3ab65e6: (EA-55107) case with empty parents in history fixed d67e9b4: IDEA-118279 create constructor params: apply cleanup 11d1e29: one test rewritten in Kotlin 9b3b90d: EA-56987 - NPE: DebuggerTreeNodeImpl.updateCaches 91005a8: added a separator above annotate action 32874b1: renamed to PropertiesPlugin.xml to avoid conflict inside upsource jar 05191a3: renamed to GroovyPlugin.xml to avoid conflict inside upsource jar 08caf4f: add to watches action should work from evaluate and inspect d85d443: more moves to groovy-psi fadd451: moved properties to properties-psi b9fa2ab: register folding builder in env ab8b582: moved to psi c1da4f3: moved away from openapi 4bf725a: moved away from java-impl 41f2d2c: moved to core 5366e96: moved to psi cf298fc: ensure editor is released in EDT 5b09e28: EA-57008 (pair was good enough) 1144d7b: extend java-class instead of groovy-class (to migrate to Kotlin) 3b85f7c: removing obsolete extension point 7ac28ba: remove outdated action id 53ddc21: Simplify condition in go to actions history 2807e38: rerun failed: include concrete class if containing is abstract (IDEA-125425) 9758f97: return inside finally: stop at lambda (IDEA-125605) b90111f: more reliable keeping of reference on stack (following CR-IC-5487) 203d7fb: remove unused code 75c7630: cleanup dc11403: cleanup 9d2b9ae: maven compiler tests to use external compiler only ff05505: standalone jps updated: load path variables specified in gant scripts 05c2f31: history for go to actions, initial 0918150: combine two classes into one to reduce duplication 806c8d2: more accurate collection query detection for method references 19bf6b9: add "stream" and "parallelStream" query names c0a470f: EA-57015 - SOE: AbstractTreeUi.access$ 48a01b0: add common actions to all variable views 0529ff5: NPE if a previous focus owner is null. d27fd1e: plugin updater: accept older plugin versions for broken plugins (IDEA-125646) eeca5a8: search for package everywhere again (IDEA-125688) 04a7434: EA-56966 - IAE: XRegularValuePresentation.<init> f1b4acc: Enabling dialog based implementation because of always on top regression. 5ef4a59: fixing java compilers configuration UI 7322427: EA-56894 - AIOOBE: AppCodeDesignerEditor.findModule - for AppCode designer module don't needed 05e2292: IDEA-125684 appearance of JTextField component in disabled state 4660916: IDEA-125500 Terminal is not locale aware e3c14f5: following review CR-IC-5487 80a7f69: IDEA-25183 80eba2a: IDEA-42954 Watches are not saved on restart of debug sessions d174c22: refactoring - following review #525 535844a: IDEA-104441 Wrong auto-completion of closed XML tags: handling unbalanced xml psi 220964b: BlockMarkerCommentInspection moved to java-analysis-impl 6c6a682: Shortcut Promoter initial dff9280: IDEA-93040 622c1df: NPE 8f1d011: reverted 31d0a47: moved to analysis a518606: moved to psi e0d0ffd: moved to core 282862d: moved to core 1ccdeb0: more moved to psi 5d21da5: added equals to LocalsControlFlowPolicy, notnull 15ecfbd: deleting old make implementation fa243c5: IdePlugin fixed 0427d8e: change default action 487d93d: remove useless source roots b5fb0b6: IDEA-100200 - Clouds: deployment to clouds ignores the http proxy settings - CloudBees cef9a6c: IDEA-71997 05b1763: deleting old make implementation 29b98db: deleting old make implementation f723b07: Tips added (PY-12484). de95451: Merge remote-tracking branch 'origin/master' 2d108ef: Tips updated (PY-12982). cc4b248: java: parsing of complex bounds in stub signatures fixed 66d70ab: Cleanup (unneeded concatenation) 259d59a: added dependency from devkit module to its jps-plugin cff9f70: JPS: added method to process modules and libraries in order 36e275f: Gradle: handling of project build classpath resolving errors related issues: http://youtrack.jetbrains.com/issue/IDEA-125592 http://youtrack.jetbrains.com/issue/IDEA-124839 6e512d0: [ review #701 ] introduce field where required to avoid multiple objects creation 98edcf4: Ruby highlighting lexer refactored for upsource core environment bbb4d67: removed jsf-iml c8b081a: DevKit: Goto EP declaration in plugin.xml (IDEA-86100) CR-IC-5473 c96948d: show initial value in "set value" editor 758adbb: make sure document reference is cached reliably 19cd6d5: show progress for editors opening 311406c: select only required editor in window 68aadaf: init foldings for all opened editors (otherwise saved folding state will not be restored for them) c0511af: remove dead code e5708cd: open editors in EDT ffcd49d: IDEA-41226 Reference debugger-marked objects in expressions 0034f61: Merge remote-tracking branch 'origin/master' a7e0137: externalization: suppress unused to .xml compatibility 0f8912f: enforce string copying (trim substring() result for java 6) 152503a: new exception creation without args: completely ignore exceptions with only no param constructor (IDEA-125660) d64d714: customizations: check group is included in correct root group; allow to invoke moved action group, e.g. Create Run Configurations group (IDEA-125484) aaa01e4: fix module leaks via CompilerTester 1551266: Added output folders to ModuleExtendedModel. 9874668: IDEA-104441 Wrong auto-completion of closed XML tags b71fe91: simplification & cleanup postfix templates 9835800: Maven: plexus-archiver lib added to licenses a7aa0df: lambda: extract parameters incompatibility check 0fac1ec: Merge remote-tracking branch 'origin/master' 5eeea43: PY-13084 Variables passed to url kwargs are not suggested to template 8a3ad93: hide lang-api refactoring actions if no handlers present 86d0ff8: Merge branch 'fix4' of https://github.com/krasa/intellij-community into fix4 6b46fcf: dfa: contracts validation should not exclude notnull validation 0212832: Better comments 463a90c: force check for update on exception from non-bundled plugin 4e95814: nullify: to run on pooled thread without progress 90b27a4: IDEA-122929 Hg: remove unrelated urls paths from pull/push dialog. e2e243b: CompositeFilter#forceUseAllFilters=false by default to restore previous behaviour Deprecated public fields in Filter#Result and getters to give warning about possible danger aa83182: Merge branch 'python-fixes' a9aaf0c: Maven: fix artifact layouts tests for added generated manifest.mf a1d93e0: Use union of types of members as iteration type for tuples 06a130f: Interpret tuple default parameter value as a weak type (PY-10967) 24b18f8: IDEA-119804 second click on item in watches panel should toggle edit mode a479d46: IDEA-81789 Expression Evaluation goes crazy when multiline expression is inserted 3f1d913: Merge remote-tracking branch 'origin/master' 1b010d0: PY-12981 django apps don't resolve when INSTALLED_APPS is set with '+=' 846b42a: Nullity annotations and explicit TypeEvalContext for PyUnionType.excludeNull() 5352177: IDEA-97915 Mercurial incoming/outgoing widgets updated e618345: EA-51820 check that root from mappings is a valid vcs root 2f5f8f9: IDEA-122562 - Warning from SettingsEditor#applyEditorTo prevents runconfig editor from closing 12272ec: cosmetic: "Remember on disk" -> "Save on disk" in all places ef5ae1c: ensure rename is performed inside project only, do not search for a package inside libraries! 0dd4ead: generate missed tests intention (IDEA-90247; IDEA-122790) 8ee7f6d: ignore setup/teardown generation when methods already exist and additional methods are not expected dc043ce: IDEA-121972 - Map help button of the Clouds page 71f507b: Cleanup 2322568: Don't suggest Python live templates inside parameter list (PY-12395) 9b96bc0: common style for expressions f9685fd: Don't suggest Python live templates in string literals (PY-12349) a554bba: Don't suggest Python live templates in comments (PY-13076) 511b7db: IDEA-125624 Run tool window does not have deployments list in debug mode 73dce39: Use 'Python' context for 'super' live template (PY-13080) 8e0bbd5: cover with tests ce036b5: IDEA-125129 I would like to reopen IDEA-117698: regression fixed 2475299: IDEA-61480 DocBook5: complains about xlink:href in <link> 2fd7151: IDEA-125557 Start From Scratch: on Darcula selecting as UI Theme in the Customize IDEA wisard it is applied incorrectly fa9f7fe: Fixed messy usage of colons in the Breakpoints window 6b7841e: format f3c2fa2: IDEA-117949 Xml editor doesn't treat xml namespace correctly 08c14cb: Cleanup (optimization) 298bf22: Cleanup (formatting) c026ff3: java: missing deprecated attribute on inner classes fixed 301b5e7: java: injected methods excluded from enum stub 06f261c: Maven: artifact's manifest generation support related issues: http://youtrack.jetbrains.com/issue/IDEA-82725 http://youtrack.jetbrains.com/issue/IDEA-91497 http://youtrack.jetbrains.com/issue/IDEA-47990 1913bdc: IDEA-119640 Problem with goto declaration of XML attribute defined in XSD: re-fixed, completion fixed ee89d4f: cleanup 560924a: Merge remote-tracking branch 'origin/master' 80dbfb5: byte code viewer in same colors as editor 7fea4ff: fix failing tests: OverrideImplementTest.testEnumConstant ImplementMethodsTest.runSingle(EnumConstantWithoutClassInitializer.java) 590e025: add example to postfix templates tree 9457946: cleanup 9307a77: better colors for ctrl + shift + a Change-Id: I63f543234051b4bfd5588e9307dad56cdff7aa1b
Diffstat (limited to 'plugins/properties/src/com/intellij')
-rw-r--r--plugins/properties/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.form86
-rw-r--r--plugins/properties/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.java451
-rw-r--r--plugins/properties/src/com/intellij/codeInspection/unused/ImplicitPropertyUsageProvider.java36
-rw-r--r--plugins/properties/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java111
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/LastSelectedPropertiesFileStore.java6
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/PropertiesAnnotator.java133
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/PropertiesCommenter.java43
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/PropertiesCompletionContributor.java44
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/PropertiesFilesManager.java6
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/PropertiesQuickFixFactoryImpl.java42
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/PropertiesUtilBase.java38
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/PropertySuppressableInspectionBase.java164
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/PropertyValueManipulator.java36
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/RemovePropertyFix.java63
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/RemovePropertyLocalFix.java56
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/TrailingSpacesInPropertyInspection.java110
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/editor/GotoResourceBundleLocalizationsProvider.java61
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewModel.java27
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/editor/PropertiesValueHighlighter.java31
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/editor/PropertiesValueHighlightingLexer.java35
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleAsVirtualFile.java165
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java290
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditorUtil.java52
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java99
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileType.java9
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java119
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewModel.java122
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleUtil.java97
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/findUsages/PropertiesFindUsagesProvider.java58
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/findUsages/PropertySearcher.java29
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/parsing/PropertiesWordsScanner.java29
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/psi/impl/PropertiesElementImpl.java36
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/refactoring/PropertiesRefactoringSettings.java44
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/refactoring/ResourceBundleKeyRenameHandler.java7
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/refactoring/ResourceBundleRenameHandler.java6
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/references/CreatePropertyFix.java2
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/references/PropertiesCompletionContributor.java154
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/references/PropertyReference.java61
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/references/PropertyReferenceBase.java289
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java186
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java71
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewModel.java119
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java133
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesSeparatorManager.java207
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java82
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/xml/XmlPropertiesIconProvider.java25
-rw-r--r--plugins/properties/src/com/intellij/lang/properties/xml/XmlPropertiesReferenceContributor.java47
-rw-r--r--plugins/properties/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesFilterLexer.java49
-rw-r--r--plugins/properties/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesIdIndexer.java34
-rw-r--r--plugins/properties/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesTodoIndexer.java30
50 files changed, 424 insertions, 3806 deletions
diff --git a/plugins/properties/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.form b/plugins/properties/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.form
deleted file mode 100644
index 7924729785d3..000000000000
--- a/plugins/properties/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.form
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.codeInspection.duplicatePropertyInspection.DuplicatePropertyInspection.OptionsPanel">
- <grid id="ac1a1" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="3" 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>
- <xy x="41" y="45" width="266" height="215"/>
- </constraints>
- <properties/>
- <border type="none"/>
- <children>
- <grid id="8f33e" layout-manager="GridLayoutManager" row-count="3" 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="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
- </constraints>
- <properties/>
- <border type="none"/>
- <children>
- <component id="7b8ec" class="javax.swing.JRadioButton" binding="myProjectScope">
- <constraints>
- <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
- </constraints>
- <properties>
- <text resource-bundle="messages/InspectionsBundle" key="duplicate.property.project.scope.option"/>
- </properties>
- </component>
- <component id="425f9" class="javax.swing.JRadioButton" binding="myFileScope">
- <constraints>
- <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
- </constraints>
- <properties>
- <text resource-bundle="messages/InspectionsBundle" key="duplicate.property.file.scope.option"/>
- </properties>
- </component>
- <component id="f42e9" class="javax.swing.JRadioButton" binding="myModuleScope">
- <constraints>
- <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
- </constraints>
- <properties>
- <text resource-bundle="messages/InspectionsBundle" key="duplicate.property.module.scope.option"/>
- </properties>
- </component>
- </children>
- </grid>
- <grid id="d6280" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
- <margin top="20" left="0" bottom="0" right="0"/>
- <constraints>
- <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
- </constraints>
- <properties/>
- <border type="none"/>
- <children>
- <component id="7c01a" class="javax.swing.JCheckBox" binding="myDuplicateKeys">
- <constraints>
- <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
- </constraints>
- <properties>
- <text resource-bundle="messages/InspectionsBundle" key="duplicate.property.key.option"/>
- </properties>
- </component>
- <component id="c80d5" class="javax.swing.JCheckBox" binding="myDuplicateValues">
- <constraints>
- <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
- </constraints>
- <properties>
- <text resource-bundle="messages/InspectionsBundle" key="duplicate.property.value.option"/>
- </properties>
- </component>
- <component id="e73a3" class="javax.swing.JCheckBox" binding="myDuplicateBoth">
- <constraints>
- <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
- </constraints>
- <properties>
- <text resource-bundle="messages/InspectionsBundle" key="duplicate.property.diff.key.option"/>
- </properties>
- </component>
- </children>
- </grid>
- <vspacer id="1c453">
- <constraints>
- <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
- </constraints>
- </vspacer>
- </children>
- </grid>
-</form>
diff --git a/plugins/properties/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.java b/plugins/properties/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.java
deleted file mode 100644
index 192f455ba615..000000000000
--- a/plugins/properties/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.java
+++ /dev/null
@@ -1,451 +0,0 @@
-/*
- * Copyright 2000-2012 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.codeInspection.duplicatePropertyInspection;
-
-import com.intellij.codeInspection.*;
-import com.intellij.codeInspection.ex.GlobalInspectionContextImpl;
-import com.intellij.codeInspection.reference.RefManager;
-import com.intellij.concurrency.JobLauncher;
-import com.intellij.lang.properties.IProperty;
-import com.intellij.lang.properties.PropertiesBundle;
-import com.intellij.lang.properties.psi.PropertiesFile;
-import com.intellij.lang.properties.psi.Property;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleUtil;
-import com.intellij.openapi.progress.ProcessCanceledException;
-import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.progress.ProgressManager;
-import com.intellij.openapi.progress.util.ProgressWrapper;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.impl.search.LowLevelSearchUtil;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.PsiSearchHelper;
-import com.intellij.util.CommonProcessors;
-import com.intellij.util.Processor;
-import com.intellij.util.text.CharArrayUtil;
-import com.intellij.util.text.StringSearcher;
-import gnu.trove.THashSet;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.*;
-
-public class DuplicatePropertyInspection extends GlobalSimpleInspectionTool {
- private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.DuplicatePropertyInspection");
-
- public boolean CURRENT_FILE = true;
- public boolean MODULE_WITH_DEPENDENCIES = false;
-
- public boolean CHECK_DUPLICATE_VALUES = true;
- public boolean CHECK_DUPLICATE_KEYS = true;
- public boolean CHECK_DUPLICATE_KEYS_WITH_DIFFERENT_VALUES = true;
-
- @Override
- public void checkFile(@NotNull PsiFile file,
- @NotNull InspectionManager manager,
- @NotNull ProblemsHolder problemsHolder,
- @NotNull GlobalInspectionContext globalContext,
- @NotNull ProblemDescriptionsProcessor problemDescriptionsProcessor) {
- checkFile(file, manager, (GlobalInspectionContextImpl)globalContext, globalContext.getRefManager(), problemDescriptionsProcessor);
- }
-
- @SuppressWarnings({"HardCodedStringLiteral"})
- private static void surroundWithHref(StringBuffer anchor, PsiElement element, final boolean isValue) {
- if (element != null) {
- final PsiElement parent = element.getParent();
- PsiElement elementToLink = isValue ? parent.getFirstChild() : parent.getLastChild();
- if (elementToLink != null) {
- HTMLComposer.appendAfterHeaderIndention(anchor);
- HTMLComposer.appendAfterHeaderIndention(anchor);
- anchor.append("<a HREF=\"");
- try {
- final PsiFile file = element.getContainingFile();
- if (file != null) {
- final VirtualFile virtualFile = file.getVirtualFile();
- if (virtualFile != null) {
- anchor.append(new URL(virtualFile.getUrl() + "#" + elementToLink.getTextRange().getStartOffset()));
- }
- }
- }
- catch (MalformedURLException e) {
- LOG.error(e);
- }
- anchor.append("\">");
- anchor.append(elementToLink.getText().replaceAll("\\$", "\\\\\\$"));
- anchor.append("</a>");
- compoundLineLink(anchor, element);
- anchor.append("<br>");
- }
- }
- else {
- anchor.append("<font style=\"font-family:verdana; font-weight:bold; color:#FF0000\";>");
- anchor.append(InspectionsBundle.message("inspection.export.results.invalidated.item"));
- anchor.append("</font>");
- }
- }
-
- @SuppressWarnings({"HardCodedStringLiteral"})
- private static void compoundLineLink(StringBuffer lineAnchor, PsiElement psiElement) {
- final PsiFile file = psiElement.getContainingFile();
- if (file != null) {
- final VirtualFile vFile = file.getVirtualFile();
- if (vFile != null) {
- Document doc = FileDocumentManager.getInstance().getDocument(vFile);
- final int lineNumber = doc.getLineNumber(psiElement.getTextOffset()) + 1;
- lineAnchor.append(" ").append(InspectionsBundle.message("inspection.export.results.at.line")).append(" ");
- lineAnchor.append("<a HREF=\"");
- try {
- int offset = doc.getLineStartOffset(lineNumber - 1);
- offset = CharArrayUtil.shiftForward(doc.getCharsSequence(), offset, " \t");
- lineAnchor.append(new URL(vFile.getUrl() + "#" + offset));
- }
- catch (MalformedURLException e) {
- LOG.error(e);
- }
- lineAnchor.append("\">");
- lineAnchor.append(Integer.toString(lineNumber));
- lineAnchor.append("</a>");
- }
- }
- }
-
- private void checkFile(final PsiFile file,
- final InspectionManager manager,
- GlobalInspectionContextImpl context,
- final RefManager refManager,
- final ProblemDescriptionsProcessor processor) {
- if (!(file instanceof PropertiesFile)) return;
- if (!context.isToCheckFile(file, this)) return;
- final PsiSearchHelper searchHelper = PsiSearchHelper.SERVICE.getInstance(file.getProject());
- final PropertiesFile propertiesFile = (PropertiesFile)file;
- final List<IProperty> properties = propertiesFile.getProperties();
- Module module = ModuleUtil.findModuleForPsiElement(file);
- if (module == null) return;
- final GlobalSearchScope scope = CURRENT_FILE
- ? GlobalSearchScope.fileScope(file)
- : MODULE_WITH_DEPENDENCIES
- ? GlobalSearchScope.moduleWithDependenciesScope(module)
- : GlobalSearchScope.projectScope(file.getProject());
- final Map<String, Set<PsiFile>> processedValueToFiles = Collections.synchronizedMap(new HashMap<String, Set<PsiFile>>());
- final Map<String, Set<PsiFile>> processedKeyToFiles = Collections.synchronizedMap(new HashMap<String, Set<PsiFile>>());
- final ProgressIndicator original = ProgressManager.getInstance().getProgressIndicator();
- final ProgressIndicator progress = ProgressWrapper.wrap(original);
- ProgressManager.getInstance().runProcess(new Runnable() {
- @Override
- public void run() {
- if (!JobLauncher.getInstance().invokeConcurrentlyUnderProgress(properties, progress, false, new Processor<IProperty>() {
- @Override
- public boolean process(final IProperty property) {
- if (original != null) {
- if (original.isCanceled()) return false;
- original.setText2(PropertiesBundle.message("searching.for.property.key.progress.text", property.getUnescapedKey()));
- }
- processTextUsages(processedValueToFiles, property.getValue(), processedKeyToFiles, searchHelper, scope);
- processTextUsages(processedKeyToFiles, property.getUnescapedKey(), processedValueToFiles, searchHelper, scope);
- return true;
- }
- })) throw new ProcessCanceledException();
-
- List<ProblemDescriptor> problemDescriptors = new ArrayList<ProblemDescriptor>();
- Map<String, Set<String>> keyToDifferentValues = new HashMap<String, Set<String>>();
- if (CHECK_DUPLICATE_KEYS || CHECK_DUPLICATE_KEYS_WITH_DIFFERENT_VALUES) {
- prepareDuplicateKeysByFile(processedKeyToFiles, manager, keyToDifferentValues, problemDescriptors, file, original);
- }
- if (CHECK_DUPLICATE_VALUES) prepareDuplicateValuesByFile(processedValueToFiles, manager, problemDescriptors, file, original);
- if (CHECK_DUPLICATE_KEYS_WITH_DIFFERENT_VALUES) {
- processDuplicateKeysWithDifferentValues(keyToDifferentValues, processedKeyToFiles, problemDescriptors, manager, file, original);
- }
- if (!problemDescriptors.isEmpty()) {
- processor.addProblemElement(refManager.getReference(file),
- problemDescriptors.toArray(new ProblemDescriptor[problemDescriptors.size()]));
- }
- }
- }, progress);
- }
-
- private static void processTextUsages(final Map<String, Set<PsiFile>> processedTextToFiles,
- final String text,
- final Map<String, Set<PsiFile>> processedFoundTextToFiles,
- final PsiSearchHelper searchHelper,
- final GlobalSearchScope scope) {
- if (!processedTextToFiles.containsKey(text)) {
- if (processedFoundTextToFiles.containsKey(text)) {
- final Set<PsiFile> filesWithValue = processedFoundTextToFiles.get(text);
- processedTextToFiles.put(text, filesWithValue);
- }
- else {
- final Set<PsiFile> resultFiles = new HashSet<PsiFile>();
- findFilesWithText(text, searchHelper, scope, resultFiles);
- if (resultFiles.isEmpty()) return;
- processedTextToFiles.put(text, resultFiles);
- }
- }
- }
-
-
- private static void prepareDuplicateValuesByFile(final Map<String, Set<PsiFile>> valueToFiles,
- final InspectionManager manager,
- final List<ProblemDescriptor> problemDescriptors,
- final PsiFile psiFile,
- final ProgressIndicator progress) {
- for (String value : valueToFiles.keySet()) {
- if (progress != null){
- progress.setText2(InspectionsBundle.message("duplicate.property.value.progress.indicator.text", value));
- progress.checkCanceled();
- }
- if (value.length() == 0) continue;
- StringSearcher searcher = new StringSearcher(value, true, true);
- StringBuffer message = new StringBuffer();
- int duplicatesCount = 0;
- Set<PsiFile> psiFilesWithDuplicates = valueToFiles.get(value);
- for (PsiFile file : psiFilesWithDuplicates) {
- CharSequence text = file.getViewProvider().getContents();
- final char[] textArray = CharArrayUtil.fromSequenceWithoutCopying(text);
-
- for (int offset = LowLevelSearchUtil.searchWord(text, textArray, 0, text.length(), searcher, progress);
- offset >= 0;
- offset = LowLevelSearchUtil.searchWord(text, textArray, offset + searcher.getPattern().length(), text.length(), searcher, progress)
- ) {
- PsiElement element = file.findElementAt(offset);
- if (element != null && element.getParent() instanceof Property) {
- final Property property = (Property)element.getParent();
- if (Comparing.equal(property.getValue(), value) && element.getStartOffsetInParent() != 0) {
- if (duplicatesCount == 0){
- message.append(InspectionsBundle.message("duplicate.property.value.problem.descriptor", property.getValue()));
- }
- surroundWithHref(message, element, true);
- duplicatesCount ++;
- }
- }
- }
- }
- if (duplicatesCount > 1) {
- problemDescriptors.add(manager.createProblemDescriptor(psiFile, message.toString(), false, null, ProblemHighlightType.GENERIC_ERROR_OR_WARNING));
- }
- }
-
-
- }
-
- private void prepareDuplicateKeysByFile(final Map<String, Set<PsiFile>> keyToFiles,
- final InspectionManager manager,
- final Map<String, Set<String>> keyToValues,
- final List<ProblemDescriptor> problemDescriptors,
- final PsiFile psiFile,
- final ProgressIndicator progress) {
- for (String key : keyToFiles.keySet()) {
- if (progress!= null){
- progress.setText2(InspectionsBundle.message("duplicate.property.key.progress.indicator.text", key));
- if (progress.isCanceled()) throw new ProcessCanceledException();
- }
- final StringBuffer message = new StringBuffer();
- int duplicatesCount = 0;
- Set<PsiFile> psiFilesWithDuplicates = keyToFiles.get(key);
- for (PsiFile file : psiFilesWithDuplicates) {
- if (!(file instanceof PropertiesFile)) continue;
- PropertiesFile propertiesFile = (PropertiesFile)file;
- final List<IProperty> propertiesByKey = propertiesFile.findPropertiesByKey(key);
- for (IProperty property : propertiesByKey) {
- if (duplicatesCount == 0){
- message.append(InspectionsBundle.message("duplicate.property.key.problem.descriptor", key));
- }
- surroundWithHref(message, property.getPsiElement().getFirstChild(), false);
- duplicatesCount ++;
- //prepare for filter same keys different values
- Set<String> values = keyToValues.get(key);
- if (values == null){
- values = new HashSet<String>();
- keyToValues.put(key, values);
- }
- values.add(property.getValue());
- }
- }
- if (duplicatesCount > 1 && CHECK_DUPLICATE_KEYS) {
- problemDescriptors.add(manager.createProblemDescriptor(psiFile, message.toString(), false, null, ProblemHighlightType.GENERIC_ERROR_OR_WARNING));
- }
- }
-
- }
-
-
- private static void processDuplicateKeysWithDifferentValues(final Map<String, Set<String>> keyToDifferentValues,
- final Map<String, Set<PsiFile>> keyToFiles,
- final List<ProblemDescriptor> problemDescriptors,
- final InspectionManager manager,
- final PsiFile psiFile,
- final ProgressIndicator progress) {
- for (String key : keyToDifferentValues.keySet()) {
- if (progress != null) {
- progress.setText2(InspectionsBundle.message("duplicate.property.diff.key.progress.indicator.text", key));
- if (progress.isCanceled()) throw new ProcessCanceledException();
- }
- final Set<String> values = keyToDifferentValues.get(key);
- if (values == null || values.size() < 2){
- keyToFiles.remove(key);
- } else {
- StringBuffer message = new StringBuffer();
- final Set<PsiFile> psiFiles = keyToFiles.get(key);
- boolean firstUsage = true;
- for (PsiFile file : psiFiles) {
- if (!(file instanceof PropertiesFile)) continue;
- PropertiesFile propertiesFile = (PropertiesFile)file;
- final List<IProperty> propertiesByKey = propertiesFile.findPropertiesByKey(key);
- for (IProperty property : propertiesByKey) {
- if (firstUsage){
- message.append(InspectionsBundle.message("duplicate.property.diff.key.problem.descriptor", key));
- firstUsage = false;
- }
- surroundWithHref(message, property.getPsiElement().getFirstChild(), false);
- }
- }
- problemDescriptors.add(manager.createProblemDescriptor(psiFile, message.toString(), false, null, ProblemHighlightType.GENERIC_ERROR_OR_WARNING));
- }
- }
- }
-
- private static void findFilesWithText(String stringToFind,
- PsiSearchHelper searchHelper,
- GlobalSearchScope scope,
- final Set<PsiFile> resultFiles) {
- final List<String> words = StringUtil.getWordsIn(stringToFind);
- if (words.isEmpty()) return;
- Collections.sort(words, new Comparator<String>() {
- @Override
- public int compare(final String o1, final String o2) {
- return o2.length() - o1.length();
- }
- });
- for (String word : words) {
- final Set<PsiFile> files = new THashSet<PsiFile>();
- searchHelper.processAllFilesWithWord(word, scope, new CommonProcessors.CollectProcessor<PsiFile>(files), true);
- if (resultFiles.isEmpty()) {
- resultFiles.addAll(files);
- }
- else {
- resultFiles.retainAll(files);
- }
- if (resultFiles.isEmpty()) return;
- }
- }
-
- @Override
- @NotNull
- public String getDisplayName() {
- return InspectionsBundle.message("duplicate.property.display.name");
- }
-
- @Override
- @NotNull
- public String getGroupDisplayName() {
- return InspectionsBundle.message("group.names.properties.files");
- }
-
- @Override
- @NotNull
- public String getShortName() {
- return "DuplicatePropertyInspection";
- }
-
- @Override
- public boolean isEnabledByDefault() {
- return false;
- }
-
- @Override
- public JComponent createOptionsPanel() {
- return new OptionsPanel().myWholePanel;
- }
-
- public class OptionsPanel {
- private JRadioButton myFileScope;
- private JRadioButton myModuleScope;
- private JRadioButton myProjectScope;
- private JCheckBox myDuplicateValues;
- private JCheckBox myDuplicateKeys;
- private JCheckBox myDuplicateBoth;
- private JPanel myWholePanel;
-
- OptionsPanel() {
- ButtonGroup buttonGroup = new ButtonGroup();
- buttonGroup.add(myFileScope);
- buttonGroup.add(myModuleScope);
- buttonGroup.add(myProjectScope);
-
- myFileScope.setSelected(CURRENT_FILE);
- myModuleScope.setSelected(MODULE_WITH_DEPENDENCIES);
- myProjectScope.setSelected(!(CURRENT_FILE || MODULE_WITH_DEPENDENCIES));
-
- myFileScope.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- CURRENT_FILE = myFileScope.isSelected();
- }
- });
- myModuleScope.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- MODULE_WITH_DEPENDENCIES = myModuleScope.isSelected();
- if (MODULE_WITH_DEPENDENCIES) {
- CURRENT_FILE = false;
- }
- }
- });
- myProjectScope.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- if (myProjectScope.isSelected()) {
- CURRENT_FILE = false;
- MODULE_WITH_DEPENDENCIES = false;
- }
- }
- });
-
- myDuplicateKeys.setSelected(CHECK_DUPLICATE_KEYS);
- myDuplicateValues.setSelected(CHECK_DUPLICATE_VALUES);
- myDuplicateBoth.setSelected(CHECK_DUPLICATE_KEYS_WITH_DIFFERENT_VALUES);
-
- myDuplicateKeys.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- CHECK_DUPLICATE_KEYS = myDuplicateKeys.isSelected();
- }
- });
- myDuplicateValues.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- CHECK_DUPLICATE_VALUES = myDuplicateValues.isSelected();
- }
- });
- myDuplicateBoth.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- CHECK_DUPLICATE_KEYS_WITH_DIFFERENT_VALUES = myDuplicateBoth.isSelected();
- }
- });
- }
- }
-}
diff --git a/plugins/properties/src/com/intellij/codeInspection/unused/ImplicitPropertyUsageProvider.java b/plugins/properties/src/com/intellij/codeInspection/unused/ImplicitPropertyUsageProvider.java
deleted file mode 100644
index ee0b9f593638..000000000000
--- a/plugins/properties/src/com/intellij/codeInspection/unused/ImplicitPropertyUsageProvider.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2000-2012 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.codeInspection.unused;
-
-import com.intellij.lang.properties.psi.Property;
-import com.intellij.openapi.extensions.ExtensionPointName;
-
-/**
- * @author Max Medvedev
- */
-public abstract class ImplicitPropertyUsageProvider {
- private static final ExtensionPointName<ImplicitPropertyUsageProvider> EP_NAME =
- ExtensionPointName.create("com.intellij.properties.implicitPropertyUsageProvider");
-
- public static boolean isImplicitlyUsed(Property property) {
- for (ImplicitPropertyUsageProvider provider : EP_NAME.getExtensions()) {
- if (provider.isUsed(property)) return true;
- }
- return false;
- }
-
- protected abstract boolean isUsed(Property property);
-}
diff --git a/plugins/properties/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java b/plugins/properties/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java
deleted file mode 100644
index 2f8370defdba..000000000000
--- a/plugins/properties/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright 2000-2009 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.codeInspection.unused;
-
-import com.intellij.codeInspection.LocalInspectionToolSession;
-import com.intellij.codeInspection.ProblemHighlightType;
-import com.intellij.codeInspection.ProblemsHolder;
-import com.intellij.lang.ASTNode;
-import com.intellij.lang.properties.PropertiesBundle;
-import com.intellij.lang.properties.PropertySuppressableInspectionBase;
-import com.intellij.lang.properties.RemovePropertyLocalFix;
-import com.intellij.lang.properties.findUsages.PropertySearcher;
-import com.intellij.lang.properties.psi.Property;
-import com.intellij.openapi.extensions.Extensions;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleUtil;
-import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.progress.ProgressManager;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiElementVisitor;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.PsiSearchHelper;
-import com.intellij.psi.search.searches.ReferencesSearch;
-import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.containers.FilteringIterator;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author cdr
- */
-public class UnusedPropertyInspection extends PropertySuppressableInspectionBase {
- @Override
- @NotNull
- public String getDisplayName() {
- return PropertiesBundle.message("unused.property.inspection.display.name");
- }
-
- @Override
- @NotNull
- public String getShortName() {
- return "UnusedProperty";
- }
-
- @NotNull
- @Override
- public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder,
- final boolean isOnTheFly,
- @NotNull final LocalInspectionToolSession session) {
- final PsiFile file = session.getFile();
- Module module = ModuleUtil.findModuleForPsiElement(file);
- if (module == null) return super.buildVisitor(holder, isOnTheFly, session);
- Object[] extensions = Extensions.getExtensions("com.intellij.referencesSearch");
- final PropertySearcher searcher =
- (PropertySearcher)ContainerUtil.find(extensions, new FilteringIterator.InstanceOf<PropertySearcher>(PropertySearcher.class));
- final GlobalSearchScope searchScope = GlobalSearchScope.moduleWithDependentsScope(module);
- final PsiSearchHelper searchHelper = PsiSearchHelper.SERVICE.getInstance(file.getProject());
- return new PsiElementVisitor() {
- @Override
- public void visitElement(PsiElement element) {
- if (!(element instanceof Property)) return;
- Property property = (Property)element;
-
- final ProgressIndicator original = ProgressManager.getInstance().getProgressIndicator();
- if (original != null) {
- if (original.isCanceled()) return;
- original.setText(PropertiesBundle.message("searching.for.property.key.progress.text", property.getUnescapedKey()));
- }
-
- if (ImplicitPropertyUsageProvider.isImplicitlyUsed(property)) return;
-
- String name = property.getName();
- if (name == null) return;
- if (searcher != null) {
- name = searcher.getKeyToSearch(name, element.getProject());
- if (name == null) return;
- }
-
- PsiSearchHelper.SearchCostResult cheapEnough = searchHelper.isCheapEnoughToSearch(name, searchScope, file, original);
- if (cheapEnough == PsiSearchHelper.SearchCostResult.TOO_MANY_OCCURRENCES) return;
-
- if (cheapEnough != PsiSearchHelper.SearchCostResult.ZERO_OCCURRENCES &&
- ReferencesSearch.search(property, searchScope, false).findFirst() != null) {
- return;
- }
-
- final ASTNode propertyNode = property.getNode();
- assert propertyNode != null;
-
- ASTNode[] nodes = propertyNode.getChildren(null);
- PsiElement key = nodes.length == 0 ? property : nodes[0].getPsi();
- String description = PropertiesBundle.message("unused.property.problem.descriptor.name");
-
- holder.registerProblem(key, description, ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemovePropertyLocalFix.INSTANCE);
- }
- };
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/LastSelectedPropertiesFileStore.java b/plugins/properties/src/com/intellij/lang/properties/LastSelectedPropertiesFileStore.java
index 37eb79ed07f3..6fd19b2d9c89 100644
--- a/plugins/properties/src/com/intellij/lang/properties/LastSelectedPropertiesFileStore.java
+++ b/plugins/properties/src/com/intellij/lang/properties/LastSelectedPropertiesFileStore.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -18,7 +18,7 @@ package com.intellij.lang.properties;
import com.intellij.injected.editor.VirtualFileWindow;
import com.intellij.lang.properties.psi.PropertiesFile;
import com.intellij.openapi.components.*;
-import com.intellij.openapi.module.ModuleUtil;
+import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.io.FileUtil;
@@ -71,7 +71,7 @@ public class LastSelectedPropertiesFileStore implements PersistentStateComponent
if (lastSelectedFileUrl != null) {
VirtualFile lastFile = VirtualFileManager.getInstance().findFileByUrl(lastSelectedFileUrl);
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(context.getProject()).getFileIndex();
- if (lastFile != null && ModuleUtil.findModuleForPsiElement(context) == fileIndex.getModuleForFile(lastFile)) {
+ if (lastFile != null && ModuleUtilCore.findModuleForPsiElement(context) == fileIndex.getModuleForFile(lastFile)) {
return lastSelectedFileUrl;
}
}
diff --git a/plugins/properties/src/com/intellij/lang/properties/PropertiesAnnotator.java b/plugins/properties/src/com/intellij/lang/properties/PropertiesAnnotator.java
deleted file mode 100644
index 316a0f8c09b7..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/PropertiesAnnotator.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright 2000-2009 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.lang.properties;
-
-import com.intellij.codeInsight.FileModificationService;
-import com.intellij.codeInsight.intention.IntentionAction;
-import com.intellij.lang.ASTNode;
-import com.intellij.lang.annotation.Annotation;
-import com.intellij.lang.annotation.AnnotationHolder;
-import com.intellij.lang.annotation.Annotator;
-import com.intellij.lang.annotation.HighlightSeverity;
-import com.intellij.lang.properties.editor.PropertiesValueHighlighter;
-import com.intellij.lang.properties.psi.PropertiesFile;
-import com.intellij.lang.properties.psi.Property;
-import com.intellij.lang.properties.psi.impl.PropertyImpl;
-import com.intellij.lexer.Lexer;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.editor.colors.EditorColorsManager;
-import com.intellij.openapi.editor.colors.TextAttributesKey;
-import com.intellij.openapi.editor.markup.TextAttributes;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.tree.IElementType;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Collection;
-
-/**
- * @author cdr
- */
-public class PropertiesAnnotator implements Annotator {
-
- public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
- if (!(element instanceof IProperty)) return;
- final Property property = (Property)element;
- PropertiesFile propertiesFile = property.getPropertiesFile();
- Collection<IProperty> others = propertiesFile.findPropertiesByKey(property.getUnescapedKey());
- ASTNode keyNode = ((PropertyImpl)property).getKeyNode();
- if (others.size() != 1) {
- Annotation annotation = holder.createErrorAnnotation(keyNode, PropertiesBundle.message("duplicate.property.key.error.message"));
- annotation.registerFix(new RemovePropertyFix(property));
- }
-
- highlightTokens(property, keyNode, holder, new PropertiesHighlighter());
- ASTNode valueNode = ((PropertyImpl)property).getValueNode();
- if (valueNode != null) {
- highlightTokens(property, valueNode, holder, new PropertiesValueHighlighter());
- }
- }
-
- private static void highlightTokens(final Property property, final ASTNode node, final AnnotationHolder holder, PropertiesHighlighter highlighter) {
- Lexer lexer = highlighter.getHighlightingLexer();
- final String s = node.getText();
- lexer.start(s);
-
- while (lexer.getTokenType() != null) {
- IElementType elementType = lexer.getTokenType();
- TextAttributesKey[] keys = highlighter.getTokenHighlights(elementType);
- for (TextAttributesKey key : keys) {
- Pair<String,HighlightSeverity> pair = PropertiesHighlighter.DISPLAY_NAMES.get(key);
- String displayName = pair.getFirst();
- HighlightSeverity severity = pair.getSecond();
- if (severity != null) {
- int start = lexer.getTokenStart() + node.getTextRange().getStartOffset();
- int end = lexer.getTokenEnd() + node.getTextRange().getStartOffset();
- TextRange textRange = new TextRange(start, end);
- final Annotation annotation;
- if (severity == HighlightSeverity.WARNING) {
- annotation = holder.createWarningAnnotation(textRange, displayName);
- }
- else if (severity == HighlightSeverity.ERROR) {
- annotation = holder.createErrorAnnotation(textRange, displayName);
- }
- else {
- annotation = holder.createInfoAnnotation(textRange, displayName);
- }
- TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(key);
- annotation.setEnforcedTextAttributes(attributes);
- if (key == PropertiesHighlighter.PROPERTIES_INVALID_STRING_ESCAPE) {
- annotation.registerFix(new IntentionAction() {
- @NotNull
- public String getText() {
- return PropertiesBundle.message("unescape");
- }
-
- @NotNull
- public String getFamilyName() {
- return getText();
- }
-
- public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
- if (!property.isValid() || !property.getManager().isInProject(property)) return false;
-
- String text = property.getPropertiesFile().getContainingFile().getText();
- int startOffset = annotation.getStartOffset();
- return text.length() > startOffset && text.charAt(startOffset) == '\\';
- }
-
- public void invoke(@NotNull Project project, Editor editor, PsiFile file) {
- if (!FileModificationService.getInstance().prepareFileForWrite(file)) return;
- int offset = annotation.getStartOffset();
- if (property.getPropertiesFile().getContainingFile().getText().charAt(offset) == '\\') {
- editor.getDocument().deleteString(offset, offset+1);
- }
- }
-
- public boolean startInWriteAction() {
- return true;
- }
- });
- }
- }
- }
- lexer.advance();
- }
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/PropertiesCommenter.java b/plugins/properties/src/com/intellij/lang/properties/PropertiesCommenter.java
deleted file mode 100644
index a80c90f8ed02..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/PropertiesCommenter.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2000-2009 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.lang.properties;
-
-import com.intellij.lang.Commenter;
-
-/**
- * @author max
- */
-public class PropertiesCommenter implements Commenter {
- public String getLineCommentPrefix() {
- return "#";
- }
-
- public String getBlockCommentPrefix() {
- return null;
- }
-
- public String getBlockCommentSuffix() {
- return "";
- }
-
- public String getCommentedBlockCommentPrefix() {
- return null;
- }
-
- public String getCommentedBlockCommentSuffix() {
- return null;
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/PropertiesCompletionContributor.java b/plugins/properties/src/com/intellij/lang/properties/PropertiesCompletionContributor.java
deleted file mode 100644
index 370b6b6856c0..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/PropertiesCompletionContributor.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2000-2012 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.lang.properties;
-
-import com.intellij.codeInsight.completion.*;
-import com.intellij.lang.properties.psi.PropertiesFile;
-import com.intellij.util.Consumer;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author peter
- */
-public class PropertiesCompletionContributor extends CompletionContributor {
- @Override
- public void fillCompletionVariants(CompletionParameters parameters, final CompletionResultSet result) {
- if (parameters.isExtendedCompletion()) {
- CompletionService.getCompletionService().getVariantsFromContributors(parameters.delegateToClassName(), null, new Consumer<CompletionResult>() {
- public void consume(final CompletionResult completionResult) {
- result.passResult(completionResult);
- }
- });
- }
- }
-
- @Override
- public void beforeCompletion(@NotNull CompletionInitializationContext context) {
- if (context.getFile() instanceof PropertiesFile) {
- context.setDummyIdentifier(CompletionUtil.DUMMY_IDENTIFIER_TRIMMED);
- }
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/PropertiesFilesManager.java b/plugins/properties/src/com/intellij/lang/properties/PropertiesFilesManager.java
index 789cfc6934c4..60d337681a31 100644
--- a/plugins/properties/src/com/intellij/lang/properties/PropertiesFilesManager.java
+++ b/plugins/properties/src/com/intellij/lang/properties/PropertiesFilesManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -79,8 +79,4 @@ public class PropertiesFilesManager extends AbstractProjectComponent {
public String getComponentName() {
return "PropertiesFileManager";
}
-
- public boolean processAllPropertiesFiles(final PropertiesFileProcessor processor) {
- return PropertiesReferenceManager.getInstance(myProject).processAllPropertiesFiles(processor);
- }
}
diff --git a/plugins/properties/src/com/intellij/lang/properties/PropertiesQuickFixFactoryImpl.java b/plugins/properties/src/com/intellij/lang/properties/PropertiesQuickFixFactoryImpl.java
new file mode 100644
index 000000000000..8b2d3e3c6cd1
--- /dev/null
+++ b/plugins/properties/src/com/intellij/lang/properties/PropertiesQuickFixFactoryImpl.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2000-2014 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.lang.properties;
+
+import com.intellij.codeInsight.intention.IntentionAction;
+import com.intellij.codeInspection.LocalQuickFix;
+import com.intellij.lang.properties.psi.PropertiesFile;
+import com.intellij.lang.properties.psi.Property;
+import com.intellij.lang.properties.references.CreatePropertyFix;
+import com.intellij.psi.PsiElement;
+
+import java.util.List;
+
+public class PropertiesQuickFixFactoryImpl extends PropertiesQuickFixFactory {
+ @Override
+ public LocalQuickFix createCreatePropertyFix(PsiElement element, String key, List<PropertiesFile> files) {
+ return new CreatePropertyFix(element, key, files);
+ }
+
+ @Override
+ public IntentionAction createRemovePropertyFix(Property property) {
+ return new RemovePropertyFix(property);
+ }
+
+ @Override
+ public LocalQuickFix createRemovePropertyLocalFix() {
+ return new RemovePropertyLocalFix();
+ }
+}
diff --git a/plugins/properties/src/com/intellij/lang/properties/PropertiesUtilBase.java b/plugins/properties/src/com/intellij/lang/properties/PropertiesUtilBase.java
deleted file mode 100644
index 60d6a01037fe..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/PropertiesUtilBase.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2000-2014 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.lang.properties;
-
-import com.intellij.lang.properties.psi.PropertiesFile;
-import com.intellij.openapi.module.Module;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Locale;
-
-/**
- * @author Anna Bulenkova
- */
-public class PropertiesUtilBase {
- private PropertiesUtilBase() {}
-
- @Nullable
- public static PropertiesFile getPropertiesFile(@NotNull String bundleName,
- @NotNull Module searchFromModule,
- @Nullable Locale locale) {
- PropertiesReferenceManager manager = PropertiesReferenceManager.getInstance(searchFromModule.getProject());
- return manager.findPropertiesFile(searchFromModule, bundleName, locale);
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/PropertySuppressableInspectionBase.java b/plugins/properties/src/com/intellij/lang/properties/PropertySuppressableInspectionBase.java
deleted file mode 100644
index 7aff26844901..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/PropertySuppressableInspectionBase.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright 2000-2010 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.lang.properties;
-
-import com.intellij.codeInsight.FileModificationService;
-import com.intellij.codeInspection.CustomSuppressableInspectionTool;
-import com.intellij.codeInspection.LocalInspectionTool;
-import com.intellij.codeInspection.SuppressIntentionAction;
-import com.intellij.lang.properties.psi.PropertiesFile;
-import com.intellij.lang.properties.psi.PropertiesList;
-import com.intellij.lang.properties.psi.Property;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.editor.Document;
-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.util.IncorrectOperationException;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * User: cdr
- */
-public abstract class PropertySuppressableInspectionBase extends LocalInspectionTool implements CustomSuppressableInspectionTool {
- private static final Logger LOG = Logger.getInstance("#com.intellij.lang.properties.PropertySuppressableInspectionBase");
- @NotNull
- public String getGroupDisplayName() {
- return PropertiesBundle.message("properties.files.inspection.group.display.name");
- }
-
- public SuppressIntentionAction[] getSuppressActions(final PsiElement element) {
- return new SuppressIntentionAction[] {new SuppressSinglePropertyFix(getShortName()), new SuppressForFile(getShortName())};
- }
-
- public boolean isSuppressedFor(@NotNull PsiElement element) {
- Property property = PsiTreeUtil.getParentOfType(element, Property.class, false);
- PropertiesFile file;
- if (property == null) {
- PsiFile containingFile = element.getContainingFile();
- if (containingFile instanceof PropertiesFile) {
- file = (PropertiesFile)containingFile;
- }
- else {
- return false;
- }
- }
- else {
- PsiElement prev = property.getPrevSibling();
- while (prev instanceof PsiWhiteSpace || prev instanceof PsiComment) {
- if (prev instanceof PsiComment) {
- @NonNls String text = prev.getText();
- if (text.contains("suppress") && text.contains("\"" + getShortName() + "\"")) return true;
- }
- prev = prev.getPrevSibling();
- }
- file = property.getPropertiesFile();
- }
- PsiElement leaf = file.getContainingFile().findElementAt(0);
- while (leaf instanceof PsiWhiteSpace) leaf = leaf.getNextSibling();
-
- while (leaf instanceof PsiComment) {
- @NonNls String text = leaf.getText();
- if (text.contains("suppress") && text.contains("\"" + getShortName() + "\"") && text.contains("file")) {
- return true;
- }
- leaf = leaf.getNextSibling();
- if (leaf instanceof PsiWhiteSpace) leaf = leaf.getNextSibling();
- // comment before first property get bound to the file, not property
- if (leaf instanceof PropertiesList && leaf.getFirstChild() == property && text.contains("suppress") && text.contains("\"" + getShortName() + "\"")) {
- return true;
- }
- }
-
- return false;
- }
-
- private static class SuppressSinglePropertyFix extends SuppressIntentionAction {
- private final String shortName;
-
- public SuppressSinglePropertyFix(String shortName) {
- this.shortName = shortName;
- }
-
- @NotNull
- public String getText() {
- return PropertiesBundle.message("unused.property.suppress.for.property");
- }
-
- @NotNull
- public String getFamilyName() {
- return PropertiesBundle.message("unused.property.suppress.for.property");
- }
-
- public boolean isAvailable(@NotNull final Project project, final Editor editor, @NotNull final PsiElement element) {
- final Property property = PsiTreeUtil.getParentOfType(element, Property.class);
- return property != null && property.isValid();
- }
-
- public void invoke(@NotNull final Project project, final Editor editor, @NotNull final PsiElement element) throws IncorrectOperationException {
- final PsiFile file = element.getContainingFile();
- if (!FileModificationService.getInstance().prepareFileForWrite(file)) return;
-
- final Property property = PsiTreeUtil.getParentOfType(element, Property.class);
- LOG.assertTrue(property != null);
- final int start = property.getTextRange().getStartOffset();
-
- @NonNls final Document doc = PsiDocumentManager.getInstance(project).getDocument(file);
- LOG.assertTrue(doc != null);
- final int line = doc.getLineNumber(start);
- final int lineStart = doc.getLineStartOffset(line);
-
- doc.insertString(lineStart, "# suppress inspection \"" + shortName +
- "\"\n");
- }
- }
-
- private static class SuppressForFile extends SuppressIntentionAction {
- private final String shortName;
-
- public SuppressForFile(String shortName) {
- this.shortName = shortName;
- }
-
- @NotNull
- public String getText() {
- return PropertiesBundle.message("unused.property.suppress.for.file");
- }
-
- @NotNull
- public String getFamilyName() {
- return PropertiesBundle.message("unused.property.suppress.for.file");
- }
-
- public boolean isAvailable(@NotNull final Project project, final Editor editor, @NotNull final PsiElement element) {
- return element.isValid() && element.getContainingFile() instanceof PropertiesFile;
- }
-
- public void invoke(@NotNull final Project project, final Editor editor, @NotNull final PsiElement element) throws IncorrectOperationException {
- final PsiFile file = element.getContainingFile();
- if (!FileModificationService.getInstance().prepareFileForWrite(file)) return;
-
- @NonNls final Document doc = PsiDocumentManager.getInstance(project).getDocument(file);
- LOG.assertTrue(doc != null, file);
-
- doc.insertString(0, "# suppress inspection \"" +
- shortName +
- "\" for whole file\n");
- }
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/PropertyValueManipulator.java b/plugins/properties/src/com/intellij/lang/properties/PropertyValueManipulator.java
deleted file mode 100644
index 1ad2eaf6e34d..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/PropertyValueManipulator.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2000-2014 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.lang.properties;
-
-import com.intellij.lang.properties.psi.impl.PropertyValueImpl;
-import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.AbstractElementManipulator;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * User: anna
- * Date: Aug 27, 2010
- */
-public class PropertyValueManipulator extends AbstractElementManipulator<PropertyValueImpl>{
- @Override
- public PropertyValueImpl handleContentChange(@NotNull PropertyValueImpl element, @NotNull TextRange range, String newContent)
- throws IncorrectOperationException {
- final String oldText = element.getText();
- String newText = oldText.substring(0, range.getStartOffset()) + newContent + oldText.substring(range.getEndOffset());
- return (PropertyValueImpl)element.replaceWithText(newText);
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/RemovePropertyFix.java b/plugins/properties/src/com/intellij/lang/properties/RemovePropertyFix.java
deleted file mode 100644
index a5fd365f58c5..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/RemovePropertyFix.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2000-2009 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.lang.properties;
-
-import com.intellij.codeInsight.FileModificationService;
-import com.intellij.codeInsight.intention.IntentionAction;
-import com.intellij.lang.properties.psi.Property;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.PsiFile;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author cdr
- */
-class RemovePropertyFix implements IntentionAction {
- private final Property myProperty;
-
- public RemovePropertyFix(@NotNull final Property origProperty) {
- myProperty = origProperty;
- }
-
- @NotNull
- public String getText() {
- return PropertiesBundle.message("remove.property.intention.text");
- }
-
- @NotNull
- public String getFamilyName() {
- return getText();
- }
-
- public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
- return file.isValid()
- && myProperty != null
- && myProperty.isValid()
- && myProperty.getManager().isInProject(myProperty)
- ;
- }
-
- public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
- if (!FileModificationService.getInstance().prepareFileForWrite(file)) return;
- myProperty.delete();
- }
-
- public boolean startInWriteAction() {
- return true;
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/RemovePropertyLocalFix.java b/plugins/properties/src/com/intellij/lang/properties/RemovePropertyLocalFix.java
deleted file mode 100644
index 5c8c581f44cb..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/RemovePropertyLocalFix.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2000-2009 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.lang.properties;
-
-import com.intellij.codeInspection.LocalQuickFix;
-import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.lang.properties.psi.Property;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author cdr
-*/
-public class RemovePropertyLocalFix implements LocalQuickFix {
- private static final Logger LOG = Logger.getInstance("#com.intellij.lang.properties.RemovePropertyLocalFix");
- public static final RemovePropertyLocalFix INSTANCE = new RemovePropertyLocalFix();
-
- @NotNull
- public String getName() {
- return PropertiesBundle.message("remove.property.quick.fix.name");
- }
-
- public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
- PsiElement element = descriptor.getPsiElement();
- Property property = PsiTreeUtil.getParentOfType(element, Property.class, false);
- if (property == null) return;
- try {
- new RemovePropertyFix(property).invoke(project, null, property.getPropertiesFile().getContainingFile());
- }
- catch (IncorrectOperationException e) {
- LOG.error(e);
- }
- }
-
- @NotNull
- public String getFamilyName() {
- return getName();
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/TrailingSpacesInPropertyInspection.java b/plugins/properties/src/com/intellij/lang/properties/TrailingSpacesInPropertyInspection.java
deleted file mode 100644
index 9ff99a9e0576..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/TrailingSpacesInPropertyInspection.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright 2000-2010 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.lang.properties;
-
-import com.intellij.codeInspection.InspectionManager;
-import com.intellij.codeInspection.LocalQuickFix;
-import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.codeInspection.ProblemHighlightType;
-import com.intellij.lang.ASTNode;
-import com.intellij.lang.properties.psi.PropertiesFile;
-import com.intellij.lang.properties.psi.Property;
-import com.intellij.lang.properties.psi.impl.PropertyImpl;
-import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.progress.ProgressManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.PsiDocumentManager;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.util.SmartList;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-/**
- * @author cdr
- */
-public class TrailingSpacesInPropertyInspection extends PropertySuppressableInspectionBase {
- @NotNull
- public String getDisplayName() {
- return PropertiesBundle.message("trail.spaces.property.inspection.display.name");
- }
-
- @NotNull
- public String getShortName() {
- return "TrailingSpacesInProperty";
- }
-
- public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull final InspectionManager manager, final boolean isOnTheFly) {
- if (!(file instanceof PropertiesFile)) return null;
- final List<IProperty> properties = ((PropertiesFile)file).getProperties();
- final List<ProblemDescriptor> descriptors = new SmartList<ProblemDescriptor>();
-
- for (IProperty property : properties) {
- ProgressManager.checkCanceled();
-
- ASTNode keyNode = ((PropertyImpl)property).getKeyNode();
- if (keyNode != null) {
- PsiElement key = keyNode.getPsi();
- TextRange textRange = getTrailingSpaces(key);
- if (textRange != null) {
- descriptors.add(manager.createProblemDescriptor(key, textRange, "Trailing Spaces", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, true, RemoveTrailingSpacesFix.INSTANCE));
- }
- }
- ASTNode valueNode = ((PropertyImpl)property).getValueNode();
- if (valueNode != null) {
- PsiElement value = valueNode.getPsi();
- TextRange textRange = getTrailingSpaces(value);
- if (textRange != null) {
- descriptors.add(manager.createProblemDescriptor(value, textRange, "Trailing Spaces", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, true, RemoveTrailingSpacesFix.INSTANCE));
- }
- }
- }
- return descriptors.toArray(new ProblemDescriptor[descriptors.size()]);
- }
-
- private static TextRange getTrailingSpaces(PsiElement element) {
- String key = element.getText();
-
- return PropertyImpl.trailingSpaces(key);
- }
-
- private static class RemoveTrailingSpacesFix implements LocalQuickFix {
- private static final RemoveTrailingSpacesFix INSTANCE = new RemoveTrailingSpacesFix();
- @NotNull
- public String getName() {
- return "Remove Trailing Spaces";
- }
-
- @NotNull
- public String getFamilyName() {
- return getName();
- }
-
- public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
- PsiElement element = descriptor.getPsiElement();
- PsiElement parent = element == null ? null : element.getParent();
- if (!(parent instanceof PropertyImpl)) return;
- TextRange textRange = getTrailingSpaces(element);
- if (textRange != null) {
- Document document = PsiDocumentManager.getInstance(project).getDocument(element.getContainingFile());
- TextRange docRange = textRange.shiftRight(element.getTextRange().getStartOffset());
- document.deleteString(docRange.getStartOffset(), docRange.getEndOffset());
- }
- }
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/GotoResourceBundleLocalizationsProvider.java b/plugins/properties/src/com/intellij/lang/properties/editor/GotoResourceBundleLocalizationsProvider.java
new file mode 100644
index 000000000000..a092ad1f912b
--- /dev/null
+++ b/plugins/properties/src/com/intellij/lang/properties/editor/GotoResourceBundleLocalizationsProvider.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2000-2014 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.lang.properties.editor;
+
+import com.intellij.lang.properties.ResourceBundle;
+import com.intellij.lang.properties.psi.PropertiesFile;
+import com.intellij.navigation.GotoRelatedItem;
+import com.intellij.navigation.GotoRelatedProvider;
+import com.intellij.openapi.actionSystem.*;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.util.Function;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class GotoResourceBundleLocalizationsProvider extends GotoRelatedProvider {
+
+ @NotNull
+ @Override
+ public List<? extends GotoRelatedItem> getItems(@NotNull final DataContext context) {
+ final PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(context);
+ if (psiFile == null || !(psiFile instanceof PropertiesFile)) {
+ return Collections.emptyList();
+ }
+ final ResourceBundle resourceBundle = ((PropertiesFile)psiFile).getResourceBundle();
+ final List<PropertiesFile> bundlePropertiesFiles = resourceBundle.getPropertiesFiles(((PropertiesFile)psiFile).getProject());
+ assert bundlePropertiesFiles.size() != 0;
+ if (bundlePropertiesFiles.size() != 1) {
+ final ArrayList<PropertiesFile> propertiesFilesWithoutCurrent = ContainerUtil.newArrayList(bundlePropertiesFiles);
+ propertiesFilesWithoutCurrent.remove(psiFile);
+ return ContainerUtil.map(propertiesFilesWithoutCurrent, new Function<PropertiesFile, GotoRelatedItem>() {
+ @Override
+ public GotoRelatedItem fun(final PropertiesFile propertiesFile) {
+ return new GotoRelatedItem((PsiElement) propertiesFile, "Other Localizations");
+ }
+ });
+ } else {
+ return Collections.emptyList();
+ }
+ }
+}
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewModel.java b/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewModel.java
deleted file mode 100644
index f9dcf034c015..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewModel.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2000-2009 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.lang.properties.editor;
-
-import com.intellij.ide.structureView.StructureViewModel;
-
-/**
- * @author max
- */
-public interface PropertiesGroupingStructureViewModel extends StructureViewModel.ElementInfoProvider {
- void setSeparator(String separator);
-
- String getSeparator();
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesValueHighlighter.java b/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesValueHighlighter.java
deleted file mode 100644
index 0a937f07e62a..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesValueHighlighter.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2000-2009 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.lang.properties.editor;
-
-import com.intellij.lang.properties.PropertiesHighlighter;
-import com.intellij.lexer.Lexer;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author max
- */
-public class PropertiesValueHighlighter extends PropertiesHighlighter {
-
- @NotNull
- public Lexer getHighlightingLexer() {
- return new PropertiesValueHighlightingLexer();
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesValueHighlightingLexer.java b/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesValueHighlightingLexer.java
deleted file mode 100644
index a4e105adbc6c..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesValueHighlightingLexer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2000-2009 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.
- */
-
-/**
- * @author Alexey
- */
-package com.intellij.lang.properties.editor;
-
-import com.intellij.lang.properties.parsing.PropertiesTokenTypes;
-import com.intellij.lexer.DummyLexer;
-import com.intellij.lexer.LayeredLexer;
-import com.intellij.lexer.StringLiteralLexer;
-import com.intellij.psi.tree.IElementType;
-
-public class PropertiesValueHighlightingLexer extends LayeredLexer {
- public PropertiesValueHighlightingLexer() {
- super(new DummyLexer(PropertiesTokenTypes.VALUE_CHARACTERS));
-
- registerSelfStoppingLayer(new StringLiteralLexer(StringLiteralLexer.NO_QUOTE_CHAR, PropertiesTokenTypes.VALUE_CHARACTERS, true, "#!=:"),
- new IElementType[]{PropertiesTokenTypes.VALUE_CHARACTERS}, IElementType.EMPTY_ARRAY);
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleAsVirtualFile.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleAsVirtualFile.java
deleted file mode 100644
index 2f799368084c..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleAsVirtualFile.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright 2000-2014 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.
- */
-
-/**
- * @author Alexey
- */
-package com.intellij.lang.properties.editor;
-
-import com.intellij.ide.presentation.Presentation;
-import com.intellij.lang.properties.ResourceBundle;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.VirtualFileSystem;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-@Presentation(icon = "AllIcons.Nodes.ResourceBundle")
-public class ResourceBundleAsVirtualFile extends VirtualFile {
- private final ResourceBundle myResourceBundle;
-
- public ResourceBundleAsVirtualFile(ResourceBundle resourceBundle) {
- myResourceBundle = resourceBundle;
- }
-
- public ResourceBundle getResourceBundle() {
- return myResourceBundle;
- }
-
- @Override
- @NotNull
- public VirtualFileSystem getFileSystem() {
- return LocalFileSystem.getInstance();
- }
-
- @Override
- @NotNull
- public String getPath() {
- return getName();
- }
-
- @Override
- @NotNull
- public String getName() {
- return myResourceBundle.getBaseName();
- }
-
- public boolean equals(final Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- final ResourceBundleAsVirtualFile resourceBundleAsVirtualFile = (ResourceBundleAsVirtualFile)o;
-
- if (!myResourceBundle.equals(resourceBundleAsVirtualFile.myResourceBundle)) return false;
-
- return true;
- }
-
- public int hashCode() {
- return myResourceBundle.hashCode();
- }
-
- @Override
- public void rename(Object requestor, @NotNull String newName) throws IOException {
- }
-
- @Override
- public boolean isWritable() {
- return true;
- }
-
- @Override
- public boolean isDirectory() {
- return false;
- }
-
- @Override
- public boolean isValid() {
- return true;
- }
-
- @Override
- public VirtualFile getParent() {
- return myResourceBundle.getBaseDirectory();
- }
-
- @Override
- public VirtualFile[] getChildren() {
- return EMPTY_ARRAY;
- }
-
- @NotNull
- @Override
- public VirtualFile createChildDirectory(Object requestor, @NotNull String name) throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @NotNull
- @Override
- public VirtualFile createChildData(Object requestor, @NotNull String name) throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void delete(Object requestor) throws IOException {
- //todo
- }
-
- @Override
- public void move(Object requestor, @NotNull VirtualFile newParent) throws IOException {
- //todo
- }
-
- @Override
- public InputStream getInputStream() throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- @NotNull
- public OutputStream getOutputStream(Object requestor, long newModificationStamp, long newTimeStamp) throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- @NotNull
- public byte[] contentsToByteArray() throws IOException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public long getModificationStamp() {
- return 0;
- }
-
- @Override
- public long getTimeStamp() {
- return 0;
- }
-
- @Override
- public long getLength() {
- return 0;
- }
-
- @Override
- public void refresh(boolean asynchronous, boolean recursive, Runnable postRunnable) {
-
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java
index 89e6baf76283..5abeb70cf985 100644
--- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java
+++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java
@@ -29,23 +29,19 @@ import com.intellij.ide.util.treeView.AbstractTreeUi;
import com.intellij.ide.util.treeView.smartTree.TreeElement;
import com.intellij.lang.properties.IProperty;
import com.intellij.lang.properties.PropertiesImplUtil;
-import com.intellij.lang.properties.PropertiesUtil;
import com.intellij.lang.properties.ResourceBundle;
import com.intellij.lang.properties.psi.PropertiesFile;
import com.intellij.lang.properties.psi.PropertiesResourceBundleUtil;
import com.intellij.openapi.actionSystem.DataProvider;
import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.application.ModalityState;
-import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.command.CommandProcessor;
+import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
-import com.intellij.openapi.editor.event.DocumentAdapter;
-import com.intellij.openapi.editor.event.DocumentEvent;
-import com.intellij.openapi.editor.event.DocumentListener;
import com.intellij.openapi.editor.ex.EditorEx;
+import com.intellij.openapi.editor.ex.FocusChangeListener;
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter;
import com.intellij.openapi.fileEditor.*;
import com.intellij.openapi.project.Project;
@@ -60,7 +56,6 @@ import com.intellij.ui.JBColor;
import com.intellij.ui.JBSplitter;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.util.Alarm;
-import com.intellij.util.DocumentUtil;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ContainerUtilRt;
import com.intellij.util.containers.Stack;
@@ -73,13 +68,10 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.border.TitledBorder;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
+import javax.swing.event.*;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreePath;
import java.awt.*;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
import java.beans.PropertyChangeListener;
import java.util.*;
import java.util.List;
@@ -95,13 +87,11 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
private final ResourceBundle myResourceBundle;
private final Map<PropertiesFile, JPanel> myTitledPanels;
private final JComponent myNoPropertySelectedPanel = new NoPropertySelectedPanel().getComponent();
- private final Map<Editor, DocumentListener> myDocumentListeners = new THashMap<Editor, DocumentListener>();
private final Project myProject;
private final DataProviderPanel myDataProviderPanel;
// user pressed backslash in the corresponding editor.
// we cannot store it back to properties file right now, so just append the backslash to the editor and wait for the subsequent chars
private final Set<PropertiesFile> myBackSlashPressed = new THashSet<PropertiesFile>();
- private final Alarm myUpdateEditorAlarm = new Alarm();
private final Alarm mySelectionChangeAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
private JPanel myValuesPanel;
@@ -279,9 +269,37 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
: null;
}
- private void recreateEditorsPanel() {
- myUpdateEditorAlarm.cancelAllRequests();
+ private void writeEditorPropertyValue(final Editor editor, final PropertiesFile propertiesFile) {
+ final String currentValue = editor.getDocument().getText();
+ final String selectedProperty = getSelectedPropertyName();
+ assert selectedProperty != null;
+ ApplicationManager.getApplication().runWriteAction(new Runnable() {
+ @Override
+ public void run() {
+ WriteCommandAction.runWriteCommandAction(myProject, new Runnable() {
+ @Override
+ public void run() {
+ final IProperty property = propertiesFile.findPropertyByKey(selectedProperty);
+ try {
+ if (property == null) {
+ propertiesFile.addProperty(selectedProperty, currentValue);
+ }
+ else {
+ property.setValue(currentValue);
+ }
+ }
+ catch (final IncorrectOperationException e) {
+ LOG.error(e);
+ }
+ }
+ });
+
+ }
+ });
+ }
+
+ private void recreateEditorsPanel() {
myValuesPanel.removeAll();
myValuesPanel.setLayout(new CardLayout());
@@ -309,12 +327,16 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
if (oldEditor != null) {
EditorFactory.getInstance().releaseEditor(oldEditor);
}
-
- editor.getContentComponent().addFocusListener(new FocusAdapter() {
+ ((EditorEx) editor).addFocusListener(new FocusChangeListener() {
@Override
- public void focusGained(FocusEvent e) {
+ public void focusGained(final Editor editor) {
mySelectedEditor = editor;
}
+
+ @Override
+ public void focusLost(final Editor eventEditor) {
+ writeEditorPropertyValue(editor, propertiesFile);
+ }
});
gc.gridx = 0;
gc.gridy = y++;
@@ -364,6 +386,51 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
valuesPanelComponent.add(new JPanel(), gc);
selectionChanged();
myValuesPanel.repaint();
+ UIUtil.invokeAndWaitIfNeeded(new Runnable() {
+ @Override
+ public void run() {
+ updateEditorsFromProperties();
+ }
+ });
+ }
+
+ @NotNull
+ public static String getPropertyEditorValue(@Nullable final IProperty property) {
+ if (property == null) {
+ return "";
+ }
+ else {
+ String rawValue = property.getValue();
+ return rawValue == null ? "" : PropertiesResourceBundleUtil.fromPropertyValueToValueEditor(rawValue);
+ }
+ }
+
+ private void updateEditorsFromProperties() {
+ String propertyName = getSelectedPropertyName();
+ ((CardLayout)myValuesPanel.getLayout()).show(myValuesPanel, propertyName == null ? NO_PROPERTY_SELECTED : VALUES);
+ if (propertyName == null) return;
+
+ for (final PropertiesFile propertiesFile : myResourceBundle.getPropertiesFiles(myProject)) {
+ final EditorEx editor = (EditorEx)myEditors.get(propertiesFile);
+ if (editor == null) continue;
+ final IProperty property = propertiesFile.findPropertyByKey(propertyName);
+ final Document document = editor.getDocument();
+ CommandProcessor.getInstance().executeCommand(null, new Runnable() {
+ @Override
+ public void run() {
+ ApplicationManager.getApplication().runWriteAction(new Runnable() {
+ @Override
+ public void run() {
+ updateDocumentFromPropertyValue(getPropertyEditorValue(property), document, propertiesFile);
+ }
+ });
+ }
+ }, "", this);
+
+ JPanel titledPanel = myTitledPanels.get(propertiesFile);
+ ((TitledBorder)titledPanel.getBorder()).setTitleColor(property == null ? JBColor.RED : UIUtil.getLabelTextForeground());
+ titledPanel.repaint();
+ }
}
private void installPropertiesChangeListeners() {
@@ -446,63 +513,6 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
});
}
- private void updateEditorsFromProperties() {
- myUpdateEditorAlarm.cancelAllRequests();
- myUpdateEditorAlarm.addRequest(new Runnable() {
- @Override
- public void run() {
- if (!isValid()) return;
- // there is pending update which is going to change prop file anyway
- if (!myUpdatePsiAlarm.isEmpty()) {
- myUpdateEditorAlarm.cancelAllRequests();
- myUpdateEditorAlarm.addRequest(this, 200);
- return;
- }
- uninstallDocumentListeners();
- try {
- String propertyName = getSelectedPropertyName();
- ((CardLayout)myValuesPanel.getLayout()).show(myValuesPanel, propertyName == null ? NO_PROPERTY_SELECTED : VALUES);
- if (propertyName == null) return;
-
- List<PropertiesFile> propertiesFiles = myResourceBundle.getPropertiesFiles(myProject);
- for (final PropertiesFile propertiesFile : propertiesFiles) {
- EditorEx editor = (EditorEx)myEditors.get(propertiesFile);
- if (editor == null) continue;
- reinitSettings(editor);
- IProperty property = propertiesFile.findPropertyByKey(propertyName);
- final String value;
- if (property == null) {
- value = "";
- }
- else {
- String rawValue = property.getValue();
- value = rawValue == null ? "" : PropertiesResourceBundleUtil.fromPropertyValueToValueEditor(rawValue);
- }
- final Document document = editor.getDocument();
- CommandProcessor.getInstance().executeCommand(null, new Runnable() {
- @Override
- public void run() {
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
- @Override
- public void run() {
- updateDocumentFromPropertyValue(value, document, propertiesFile);
- }
- });
- }
- }, "", this);
-
- JPanel titledPanel = myTitledPanels.get(propertiesFile);
- ((TitledBorder)titledPanel.getBorder()).setTitleColor(property == null ? JBColor.RED : UIUtil.getLabelTextForeground());
- titledPanel.repaint();
- }
- }
- finally {
- installDocumentListeners();
- }
- }
- }, 200);
- }
-
private void updateDocumentFromPropertyValue(final String value,
final Document document,
final PropertiesFile propertiesFile) {
@@ -513,107 +523,6 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
document.replaceString(0, document.getTextLength(), text);
}
- private void updatePropertyValueFromDocument(final String propertyName,
- final PropertiesFile propertiesFile,
- final String text) {
- if (PropertiesUtil.isUnescapedBackSlashAtTheEnd(text)) {
- myBackSlashPressed.add(propertiesFile);
- }
- else {
- myBackSlashPressed.remove(propertiesFile);
- }
- IProperty property = propertiesFile.findPropertyByKey(propertyName);
- try {
- if (property == null) {
- propertiesFile.addProperty(propertyName, text);
- }
- else {
- property.setValue(text);
- }
- }
- catch (IncorrectOperationException e) {
- LOG.error(e);
- }
- }
-
- private void installDocumentListeners() {
- List<PropertiesFile> propertiesFiles = myResourceBundle.getPropertiesFiles(myProject);
- for (final PropertiesFile propertiesFile : propertiesFiles) {
- final EditorEx editor = (EditorEx)myEditors.get(propertiesFile);
- if (editor == null) continue;
- DocumentAdapter listener = new DocumentAdapter() {
- private String oldText;
-
- @Override
- public void beforeDocumentChange(DocumentEvent e) {
- oldText = e.getDocument().getText();
- }
-
- @Override
- public void documentChanged(DocumentEvent e) {
- Document document = e.getDocument();
- String text = document.getText();
- updatePropertyValueFor(document, propertiesFile, text, oldText);
- }
- };
- myDocumentListeners.put(editor, listener);
- editor.getDocument().addDocumentListener(listener);
- }
- }
-
- private void uninstallDocumentListeners() {
- List<PropertiesFile> propertiesFiles = myResourceBundle.getPropertiesFiles(myProject);
- for (final PropertiesFile propertiesFile : propertiesFiles) {
- Editor editor = myEditors.get(propertiesFile);
- uninstallDocumentListener(editor);
- }
- }
-
- private void uninstallDocumentListener(Editor editor) {
- DocumentListener listener = myDocumentListeners.remove(editor);
- if (listener != null) {
- editor.getDocument().removeDocumentListener(listener);
- }
- }
-
- private final Alarm myUpdatePsiAlarm = new Alarm();
- private void updatePropertyValueFor(final Document document, final PropertiesFile propertiesFile, final String text, final String oldText) {
- myUpdatePsiAlarm.cancelAllRequests();
- myUpdatePsiAlarm.addRequest(new Runnable() {
- @Override
- public void run() {
- if (!isValid()) return;
- DocumentUtil.writeInRunUndoTransparentAction(new Runnable() {
- @Override
- public void run() {
- Project project = propertiesFile.getProject();
- PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project);
- documentManager.commitDocument(document);
- Document propertiesFileDocument = documentManager.getDocument(propertiesFile.getContainingFile());
- if (propertiesFileDocument == null) {
- return;
- }
- documentManager.commitDocument(propertiesFileDocument);
-
- if (!FileDocumentManager.getInstance().requestWriting(document, project)) {
- uninstallDocumentListeners();
- try {
- document.replaceString(0, document.getTextLength(), oldText);
- }
- finally {
- installDocumentListeners();
- }
- return;
- }
- String propertyName = getSelectedPropertyName();
- if (propertyName == null) return;
- updatePropertyValueFromDocument(propertyName, propertiesFile, text);
- }
- });
- }
- }, 300, ModalityState.stateForComponent(getComponent()));
- }
-
@Nullable
private String getSelectedPropertyName() {
JTree tree = myStructureViewComponent.getTree();
@@ -677,10 +586,10 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
private PropertiesFile getSelectedPropertiesFile() {
if (mySelectedEditor == null) return null;
PropertiesFile selectedFile = null;
- for (PropertiesFile file : myEditors.keySet()) {
- Editor editor = myEditors.get(file);
+ for (Map.Entry<PropertiesFile, Editor> entry : myEditors.entrySet()) {
+ Editor editor = entry.getValue();
if (editor == mySelectedEditor) {
- selectedFile = file;
+ selectedFile = entry.getKey();
break;
}
}
@@ -761,27 +670,29 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
@Override
public void dispose() {
- VirtualFileManager.getInstance().removeVirtualFileListener(myVfsListener);
+ if (mySelectedEditor != null) {
+ for (final Map.Entry<PropertiesFile, Editor> entry : myEditors.entrySet()) {
+ if (mySelectedEditor.equals(entry.getValue())) {
+ writeEditorPropertyValue(mySelectedEditor, entry.getKey());
+ }
+ }
+ }
+ VirtualFileManager.getInstance().removeVirtualFileListener(myVfsListener);
myDisposed = true;
Disposer.dispose(myStructureViewComponent);
releaseAllEditors();
}
private void releaseAllEditors() {
- for (Editor editor : myEditors.values()) {
- releaseEditor(editor);
+ for (final Editor editor : myEditors.values()) {
+ if (!editor.isDisposed()) {
+ EditorFactory.getInstance().releaseEditor(editor);
+ }
}
myEditors.clear();
}
- private void releaseEditor(Editor editor) {
- if (!editor.isDisposed()) {
- uninstallDocumentListener(editor);
- EditorFactory.getInstance().releaseEditor(editor);
- }
- }
-
/**
* Renames target property if the one is available.
* <p/>
@@ -837,6 +748,7 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
settings.setAdditionalLinesCount(0);
settings.setRightMarginShown(true);
settings.setRightMargin(60);
+ settings.setVirtualSpace(false);
editor.setHighlighter(new LexerEditorHighlighter(new PropertiesValueHighlighter(), scheme));
editor.setVerticalScrollbarVisible(true);
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditorUtil.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditorUtil.java
new file mode 100644
index 000000000000..9c0298375f8a
--- /dev/null
+++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditorUtil.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2000-2014 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.lang.properties.editor;
+
+import com.intellij.openapi.actionSystem.CommonDataKeys;
+import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.fileEditor.FileEditor;
+import com.intellij.openapi.fileEditor.FileEditorManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vfs.VirtualFile;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public class ResourceBundleEditorUtil {
+ /**
+ * Tries to derive {@link com.intellij.lang.properties.editor.ResourceBundleEditor resource bundle editor} identified by the given context.
+ *
+ * @param dataContext target data context
+ * @return resource bundle editor identified by the given context; <code>null</code> otherwise
+ */
+ @Nullable
+ public static ResourceBundleEditor getEditor(@NotNull DataContext dataContext) {
+ Project project = CommonDataKeys.PROJECT.getData(dataContext);
+ if (project == null) {
+ return null;
+ }
+
+ VirtualFile virtualFile = CommonDataKeys.VIRTUAL_FILE.getData(dataContext);
+ if (virtualFile == null) {
+ return null;
+ }
+ FileEditor[] editors = FileEditorManager.getInstance(project).getEditors(virtualFile);
+ if (editors.length != 1 || (!(editors[0] instanceof ResourceBundleEditor))) {
+ return null;
+ }
+
+ return (ResourceBundleEditor)editors[0];
+ }
+}
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java
deleted file mode 100644
index 2a1f94af4c95..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2000-2014 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.
- */
-
-/**
- * @author Alexey
- */
-package com.intellij.lang.properties.editor;
-
-import com.intellij.icons.AllIcons;
-import com.intellij.ide.structureView.StructureViewTreeElement;
-import com.intellij.lang.properties.IProperty;
-import com.intellij.lang.properties.ResourceBundle;
-import com.intellij.lang.properties.psi.PropertiesFile;
-import com.intellij.navigation.ItemPresentation;
-import com.intellij.openapi.project.Project;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-public class ResourceBundleFileStructureViewElement implements StructureViewTreeElement {
- private final Project myProject;
- private final ResourceBundle myResourceBundle;
-
- public ResourceBundleFileStructureViewElement(final Project project, final ResourceBundle resourceBundle) {
- myProject = project;
- myResourceBundle = resourceBundle;
- }
-
- public ResourceBundle getValue() {
- return myResourceBundle;
- }
-
- @NotNull
- public StructureViewTreeElement[] getChildren() {
- List<PropertiesFile> propertiesFiles = myResourceBundle.getPropertiesFiles(myProject);
- Map<String, IProperty> propertyNames = new LinkedHashMap<String, IProperty>();
- for (PropertiesFile propertiesFile : propertiesFiles) {
- List<IProperty> properties = propertiesFile.getProperties();
- for (IProperty property : properties) {
- String name = property.getUnescapedKey();
- if (!propertyNames.containsKey(name)) {
- propertyNames.put(name, property);
- }
- }
- }
- List<StructureViewTreeElement> result = new ArrayList<StructureViewTreeElement>(propertyNames.size());
- for (String property : propertyNames.keySet()) {
- //result.add(new PropertiesStructureViewElement(property));
- result.add(new ResourceBundlePropertyStructureViewElement(myProject, myResourceBundle, property));
- }
- return result.toArray(new StructureViewTreeElement[result.size()]);
- }
-
- @NotNull
- public ItemPresentation getPresentation() {
- return new ItemPresentation() {
- public String getPresentableText() {
- return myResourceBundle.getBaseName();
- }
-
- public String getLocationString() {
- return null;
- }
-
- public Icon getIcon(boolean open) {
- return AllIcons.FileTypes.Properties;
- }
- };
- }
-
- public void navigate(boolean requestFocus) {
-
- }
-
- public boolean canNavigate() {
- return false;
- }
-
- public boolean canNavigateToSource() {
- return false;
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileType.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileType.java
index 9defcbcdd09e..17a80f527b9b 100644
--- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileType.java
+++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileType.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,11 +15,9 @@
*/
package com.intellij.lang.properties.editor;
-import com.intellij.openapi.fileTypes.SyntaxHighlighter;
+import com.intellij.lang.properties.PropertiesBundle;
import com.intellij.openapi.fileTypes.ex.FakeFileType;
-import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.lang.properties.PropertiesBundle;
import org.jetbrains.annotations.NotNull;
/**
@@ -40,7 +38,4 @@ class ResourceBundleFileType extends FakeFileType {
return file instanceof ResourceBundleAsVirtualFile;
}
- public SyntaxHighlighter getHighlighter(Project project, final VirtualFile virtualFile) {
- return null;
- }
}
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java
deleted file mode 100644
index e521047cb9ba..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright 2000-2014 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.
- */
-
-/**
- * @author Alexey
- */
-package com.intellij.lang.properties.editor;
-
-import com.intellij.ide.structureView.StructureViewTreeElement;
-import com.intellij.lang.properties.PropertiesHighlighter;
-import com.intellij.lang.properties.PropertiesUtil;
-import com.intellij.lang.properties.ResourceBundle;
-import com.intellij.navigation.ColoredItemPresentation;
-import com.intellij.navigation.ItemPresentation;
-import com.intellij.openapi.editor.colors.EditorColorsManager;
-import com.intellij.openapi.editor.colors.TextAttributesKey;
-import com.intellij.openapi.editor.markup.TextAttributes;
-import com.intellij.openapi.project.Project;
-import com.intellij.util.PlatformIcons;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-import java.awt.*;
-
-public class ResourceBundlePropertyStructureViewElement implements StructureViewTreeElement {
- private final String myPropertyName;
- private final Project myProject;
- private final ResourceBundle myResourceBundle;
- private String myPresentableName;
-
- private static final TextAttributesKey INCOMPLETE_PROPERTY_KEY;
-
- static {
- TextAttributes textAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(PropertiesHighlighter.PROPERTY_KEY).clone();
- textAttributes.setForegroundColor(Color.red);
- INCOMPLETE_PROPERTY_KEY = TextAttributesKey.createTextAttributesKey("INCOMPLETE_PROPERTY_KEY", textAttributes);
-
- }
- public ResourceBundlePropertyStructureViewElement(final Project project, final ResourceBundle resourceBundle, String propertyName) {
- myProject = project;
- myResourceBundle = resourceBundle;
- myPropertyName = propertyName;
- }
-
- public void setPresentableName(final String presentableName) {
- myPresentableName = presentableName;
- }
-
- @Override
- public String getValue() {
- return myPropertyName;
- }
-
- @Override
- @NotNull
- public StructureViewTreeElement[] getChildren() {
- return EMPTY_ARRAY;
- }
-
- @Override
- @NotNull
- public ItemPresentation getPresentation() {
- return new ColoredItemPresentation() {
- @Override
- public String getPresentableText() {
- return myPresentableName == null ? myPropertyName : myPresentableName;
- }
-
- @Override
- public String getLocationString() {
- return null;
- }
-
- @Override
- public Icon getIcon(boolean open) {
- return PlatformIcons.PROPERTY_ICON;
- }
-
- @Override
- public TextAttributesKey getTextAttributesKey() {
- boolean isComplete = PropertiesUtil.isPropertyComplete(myProject, myResourceBundle, myPropertyName);
-
- if (isComplete) {
- return PropertiesHighlighter.PROPERTY_KEY;
- }
- return INCOMPLETE_PROPERTY_KEY;
- }
- };
- }
-
- @Override
- public void navigate(boolean requestFocus) {
- //todo
- }
-
- @Override
- public boolean canNavigate() {
- return false;
- }
-
- @Override
- public boolean canNavigateToSource() {
- return false;
- }
-
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewModel.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewModel.java
deleted file mode 100644
index 24ba3c513c38..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewModel.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright 2000-2014 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.lang.properties.editor;
-
-import com.intellij.ide.structureView.FileEditorPositionListener;
-import com.intellij.ide.structureView.ModelListener;
-import com.intellij.ide.structureView.StructureViewModel;
-import com.intellij.ide.structureView.StructureViewTreeElement;
-import com.intellij.ide.util.treeView.smartTree.Filter;
-import com.intellij.ide.util.treeView.smartTree.Grouper;
-import com.intellij.ide.util.treeView.smartTree.Sorter;
-import com.intellij.lang.properties.ResourceBundle;
-import com.intellij.lang.properties.structureView.GroupByWordPrefixes;
-import com.intellij.lang.properties.structureView.PropertiesSeparatorManager;
-import com.intellij.openapi.project.Project;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author max
- */
-public class ResourceBundleStructureViewModel implements PropertiesGroupingStructureViewModel, StructureViewModel.ExpandInfoProvider {
- private final ResourceBundle myResourceBundle;
- private final GroupByWordPrefixes myGroupByWordPrefixes;
- private final StructureViewTreeElement myRoot;
-
- public ResourceBundleStructureViewModel(final Project project, ResourceBundle root) {
- myResourceBundle = root;
- String separator = PropertiesSeparatorManager.getInstance().getSeparator(project, new ResourceBundleAsVirtualFile(myResourceBundle));
- myGroupByWordPrefixes = new GroupByWordPrefixes(separator);
- myRoot = new ResourceBundleFileStructureViewElement(project, myResourceBundle);
- }
-
- public void setSeparator(String separator) {
- myGroupByWordPrefixes.setSeparator(separator);
- PropertiesSeparatorManager.getInstance().setSeparator(new ResourceBundleAsVirtualFile(myResourceBundle), separator);
- }
-
- public String getSeparator() {
- return myGroupByWordPrefixes.getSeparator();
- }
-
- @NotNull
- public StructureViewTreeElement getRoot() {
- return myRoot;
- }
-
- @NotNull
- public Grouper[] getGroupers() {
- return new Grouper[]{myGroupByWordPrefixes};
- }
-
- @NotNull
- public Sorter[] getSorters() {
- return new Sorter[] {Sorter.ALPHA_SORTER};
- }
-
- @NotNull
- public Filter[] getFilters() {
- return Filter.EMPTY_ARRAY;
- }
-
- public Object getCurrentEditorElement() {
- return null;
- }
-
- public void addEditorPositionListener(@NotNull FileEditorPositionListener listener) {
-
- }
-
- public void removeEditorPositionListener(@NotNull FileEditorPositionListener listener) {
-
- }
-
- public void addModelListener(@NotNull ModelListener modelListener) {
-
- }
-
- public void removeModelListener(@NotNull ModelListener modelListener) {
-
- }
-
- public void dispose() {
-
- }
-
- public boolean shouldEnterElement(final Object element) {
- return false;
- }
-
- @Override
- public boolean isAlwaysShowsPlus(final StructureViewTreeElement element) {
- return false;
- }
-
- @Override
- public boolean isAlwaysLeaf(final StructureViewTreeElement element) {
- return element instanceof ResourceBundlePropertyStructureViewElement;
- }
-
- @Override
- public boolean isAutoExpand(@NotNull StructureViewTreeElement element) {
- return getRoot() == element;
- }
-
- @Override
- public boolean isSmartExpand() {
- return false;
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleUtil.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleUtil.java
deleted file mode 100644
index ab2035c70b2f..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleUtil.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.lang.properties.editor;
-
-import com.intellij.lang.properties.IProperty;
-import com.intellij.lang.properties.ResourceBundle;
-import com.intellij.lang.properties.psi.PropertiesFile;
-import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.fileEditor.FileEditor;
-import com.intellij.openapi.fileEditor.FileEditorManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiManager;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author Denis Zhdanov
- * @since 10/5/11 2:35 PM
- */
-public class ResourceBundleUtil {
-
- private ResourceBundleUtil() {
- }
-
- /**
- * Tries to derive {@link com.intellij.lang.properties.ResourceBundle resource bundle} related to the given context.
- *
- * @param dataContext target context
- * @return {@link com.intellij.lang.properties.ResourceBundle resource bundle} related to the given context if any;
- * <code>null</code> otherwise
- */
- @Nullable
- public static ResourceBundle getResourceBundleFromDataContext(@NotNull DataContext dataContext) {
- PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
- if (element instanceof IProperty) return null; //rename property
- final ResourceBundle[] bundles = ResourceBundle.ARRAY_DATA_KEY.getData(dataContext);
- if (bundles != null && bundles.length == 1) return bundles[0];
- VirtualFile virtualFile = CommonDataKeys.VIRTUAL_FILE.getData(dataContext);
- if (virtualFile == null) {
- return null;
- }
- if (virtualFile instanceof ResourceBundleAsVirtualFile) {
- return ((ResourceBundleAsVirtualFile)virtualFile).getResourceBundle();
- }
- Project project = CommonDataKeys.PROJECT.getData(dataContext);
- if (project != null) {
- final PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
- if (psiFile instanceof PropertiesFile) {
- return ((PropertiesFile)psiFile).getResourceBundle();
- }
- }
- return null;
- }
-
- /**
- * Tries to derive {@link ResourceBundleEditor resource bundle editor} identified by the given context.
- *
- * @param dataContext target data context
- * @return resource bundle editor identified by the given context; <code>null</code> otherwise
- */
- @Nullable
- public static ResourceBundleEditor getEditor(@NotNull DataContext dataContext) {
- Project project = CommonDataKeys.PROJECT.getData(dataContext);
- if (project == null) {
- return null;
- }
-
- VirtualFile virtualFile = CommonDataKeys.VIRTUAL_FILE.getData(dataContext);
- if (virtualFile == null) {
- return null;
- }
- FileEditor[] editors = FileEditorManager.getInstance(project).getEditors(virtualFile);
- if (editors.length != 1 || (!(editors[0] instanceof ResourceBundleEditor))) {
- return null;
- }
-
- return (ResourceBundleEditor)editors[0];
- }
-
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/findUsages/PropertiesFindUsagesProvider.java b/plugins/properties/src/com/intellij/lang/properties/findUsages/PropertiesFindUsagesProvider.java
deleted file mode 100644
index 99e73384850c..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/findUsages/PropertiesFindUsagesProvider.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.lang.properties.findUsages;
-
-import com.intellij.lang.findUsages.FindUsagesProvider;
-import com.intellij.lang.properties.IProperty;
-import com.intellij.lang.properties.parsing.PropertiesWordsScanner;
-import com.intellij.lang.cacheBuilder.WordsScanner;
-import com.intellij.lang.LangBundle;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiNamedElement;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author cdr
- */
-public class PropertiesFindUsagesProvider implements FindUsagesProvider {
- public boolean canFindUsagesFor(@NotNull PsiElement psiElement) {
- return psiElement instanceof PsiNamedElement;
- }
-
- public String getHelpId(@NotNull PsiElement psiElement) {
- return com.intellij.lang.HelpID.FIND_OTHER_USAGES;
- }
-
- @NotNull
- public String getType(@NotNull PsiElement element) {
- if (element instanceof IProperty) return LangBundle.message("terms.property");
- return "";
- }
-
- @NotNull
- public String getDescriptiveName(@NotNull PsiElement element) {
- return ((PsiNamedElement)element).getName();
- }
-
- @NotNull
- public String getNodeText(@NotNull PsiElement element, boolean useFullName) {
- return getDescriptiveName(element);
- }
-
- public WordsScanner getWordsScanner() {
- return new PropertiesWordsScanner();
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/findUsages/PropertySearcher.java b/plugins/properties/src/com/intellij/lang/properties/findUsages/PropertySearcher.java
deleted file mode 100644
index 0239356a7a17..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/findUsages/PropertySearcher.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2000-2012 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.lang.properties.findUsages;
-
-import com.intellij.openapi.project.Project;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author Dmitry Avdeev
- * Date: 1/31/12
- */
-public interface PropertySearcher {
-
- @Nullable
- String getKeyToSearch(String propertyName, Project project);
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/parsing/PropertiesWordsScanner.java b/plugins/properties/src/com/intellij/lang/properties/parsing/PropertiesWordsScanner.java
deleted file mode 100644
index c4d54d61e10e..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/parsing/PropertiesWordsScanner.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2000-2009 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.lang.properties.parsing;
-
-import com.intellij.lang.cacheBuilder.DefaultWordsScanner;
-import com.intellij.psi.tree.TokenSet;
-
-/**
- * @author max
- */
-public class PropertiesWordsScanner extends DefaultWordsScanner {
- public PropertiesWordsScanner() {
- super(new PropertiesLexer(), TokenSet.create(PropertiesTokenTypes.KEY_CHARACTERS),
- PropertiesTokenTypes.COMMENTS, TokenSet.create(PropertiesTokenTypes.VALUE_CHARACTERS));
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/psi/impl/PropertiesElementImpl.java b/plugins/properties/src/com/intellij/lang/properties/psi/impl/PropertiesElementImpl.java
deleted file mode 100644
index eb328115b0d9..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/psi/impl/PropertiesElementImpl.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2000-2009 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.lang.properties.psi.impl;
-
-import com.intellij.extapi.psi.ASTWrapperPsiElement;
-import com.intellij.lang.ASTNode;
-import com.intellij.lang.Language;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author max
- */
-public class PropertiesElementImpl extends ASTWrapperPsiElement {
- public PropertiesElementImpl(final ASTNode node) {
- super(node);
- }
-
- @NotNull
- public Language getLanguage() {
- return StdFileTypes.PROPERTIES.getLanguage();
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/refactoring/PropertiesRefactoringSettings.java b/plugins/properties/src/com/intellij/lang/properties/refactoring/PropertiesRefactoringSettings.java
deleted file mode 100644
index 650f2ac0555c..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/refactoring/PropertiesRefactoringSettings.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2000-2012 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.lang.properties.refactoring;
-
-import com.intellij.openapi.components.*;
-import com.intellij.util.xmlb.XmlSerializerUtil;
-
-@State(
- name = "PropertiesRefactoringSettings",
- storages = {
- @Storage(
- file = StoragePathMacros.APP_CONFIG + "/other.xml"
- )}
-)
-public class PropertiesRefactoringSettings implements PersistentStateComponent<PropertiesRefactoringSettings> {
-
-
- public boolean RENAME_SEARCH_IN_COMMENTS = false;
-
- public static PropertiesRefactoringSettings getInstance() {
- return ServiceManager.getService(PropertiesRefactoringSettings.class);
- }
-
- public PropertiesRefactoringSettings getState() {
- return this;
- }
-
- public void loadState(PropertiesRefactoringSettings state) {
- XmlSerializerUtil.copyBean(state, this);
- }
-} \ No newline at end of file
diff --git a/plugins/properties/src/com/intellij/lang/properties/refactoring/ResourceBundleKeyRenameHandler.java b/plugins/properties/src/com/intellij/lang/properties/refactoring/ResourceBundleKeyRenameHandler.java
index 303ed3cfc3b3..7d7dbc14aead 100644
--- a/plugins/properties/src/com/intellij/lang/properties/refactoring/ResourceBundleKeyRenameHandler.java
+++ b/plugins/properties/src/com/intellij/lang/properties/refactoring/ResourceBundleKeyRenameHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -19,6 +19,7 @@ import com.intellij.lang.properties.IProperty;
import com.intellij.lang.properties.PropertiesBundle;
import com.intellij.lang.properties.ResourceBundle;
import com.intellij.lang.properties.editor.ResourceBundleEditor;
+import com.intellij.lang.properties.editor.ResourceBundleEditorUtil;
import com.intellij.lang.properties.editor.ResourceBundleUtil;
import com.intellij.lang.properties.psi.PropertiesFile;
import com.intellij.openapi.actionSystem.DataContext;
@@ -46,7 +47,7 @@ public class ResourceBundleKeyRenameHandler implements RenameHandler {
@Override
public boolean isAvailableOnDataContext(DataContext dataContext) {
- ResourceBundleEditor editor = ResourceBundleUtil.getEditor(dataContext);
+ ResourceBundleEditor editor = ResourceBundleEditorUtil.getEditor(dataContext);
if (editor == null) {
return false;
}
@@ -60,7 +61,7 @@ public class ResourceBundleKeyRenameHandler implements RenameHandler {
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) {
- ResourceBundleEditor bundleEditor = ResourceBundleUtil.getEditor(dataContext);
+ ResourceBundleEditor bundleEditor = ResourceBundleEditorUtil.getEditor(dataContext);
if (bundleEditor == null) {
return;
}
diff --git a/plugins/properties/src/com/intellij/lang/properties/refactoring/ResourceBundleRenameHandler.java b/plugins/properties/src/com/intellij/lang/properties/refactoring/ResourceBundleRenameHandler.java
index 31c821c15959..fe555a7a2ca7 100644
--- a/plugins/properties/src/com/intellij/lang/properties/refactoring/ResourceBundleRenameHandler.java
+++ b/plugins/properties/src/com/intellij/lang/properties/refactoring/ResourceBundleRenameHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -24,11 +24,11 @@ import com.intellij.lang.properties.PropertiesBundle;
import com.intellij.lang.properties.ResourceBundle;
import com.intellij.lang.properties.editor.ResourceBundleAsVirtualFile;
import com.intellij.lang.properties.editor.ResourceBundleEditor;
+import com.intellij.lang.properties.editor.ResourceBundleEditorUtil;
import com.intellij.lang.properties.editor.ResourceBundleUtil;
import com.intellij.lang.properties.psi.PropertiesFile;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.FileEditorStateLevel;
@@ -60,7 +60,7 @@ public class ResourceBundleRenameHandler implements RenameHandler {
final VirtualFile virtualFile = CommonDataKeys.VIRTUAL_FILE.getData(dataContext);
- ResourceBundleEditor editor = ResourceBundleUtil.getEditor(dataContext);
+ ResourceBundleEditor editor = ResourceBundleEditorUtil.getEditor(dataContext);
return (editor == null || editor.getState(FileEditorStateLevel.NAVIGATION).getPropertyName() == null /* user selected non-bundle key element */)
&& bundle.getPropertiesFiles(project).size() > 1 && (virtualFile instanceof ResourceBundleAsVirtualFile || virtualFile == null);
}
diff --git a/plugins/properties/src/com/intellij/lang/properties/references/CreatePropertyFix.java b/plugins/properties/src/com/intellij/lang/properties/references/CreatePropertyFix.java
index edcb2e942217..335cacbfea1f 100644
--- a/plugins/properties/src/com/intellij/lang/properties/references/CreatePropertyFix.java
+++ b/plugins/properties/src/com/intellij/lang/properties/references/CreatePropertyFix.java
@@ -138,7 +138,7 @@ public class CreatePropertyFix implements IntentionAction, LocalQuickFix {
final Collection<PropertiesFile> selectedPropertiesFiles = model.getAllPropertiesFiles();
createProperty(project, psiElement, selectedPropertiesFiles, key, value);
- return Couple.newOne(key, value);
+ return Couple.of(key, value);
}
public static void createProperty(@NotNull final Project project,
diff --git a/plugins/properties/src/com/intellij/lang/properties/references/PropertiesCompletionContributor.java b/plugins/properties/src/com/intellij/lang/properties/references/PropertiesCompletionContributor.java
new file mode 100644
index 000000000000..e356771d5812
--- /dev/null
+++ b/plugins/properties/src/com/intellij/lang/properties/references/PropertiesCompletionContributor.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2000-2014 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.lang.properties.references;
+
+import com.intellij.codeInsight.completion.*;
+import com.intellij.codeInsight.lookup.*;
+import com.intellij.icons.AllIcons;
+import com.intellij.lang.properties.EmptyResourceBundle;
+import com.intellij.lang.properties.IProperty;
+import com.intellij.lang.properties.PropertiesHighlighter;
+import com.intellij.lang.properties.ResourceBundle;
+import com.intellij.lang.properties.psi.PropertiesFile;
+import com.intellij.openapi.editor.colors.EditorColorsManager;
+import com.intellij.openapi.editor.markup.TextAttributes;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiReference;
+import com.intellij.util.*;
+import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.FilteringIterator;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Arrays;
+import java.util.Set;
+
+import static com.intellij.patterns.PlatformPatterns.psiElement;
+
+/**
+ * @author peter
+ */
+public class PropertiesCompletionContributor extends CompletionContributor {
+ public PropertiesCompletionContributor() {
+ extend(null, psiElement(), new CompletionProvider<CompletionParameters>() {
+ @Override
+ protected void addCompletions(@NotNull CompletionParameters parameters,
+ ProcessingContext context,
+ @NotNull CompletionResultSet result) {
+ doAdd(parameters, result);
+ }
+ });
+ }
+
+ private static final Condition<PsiReference> PROPERTY_REFERENCE = FilteringIterator.instanceOf(PropertyReference.class);
+ private void doAdd(CompletionParameters parameters, final CompletionResultSet result) {
+ PsiElement position = parameters.getPosition();
+ PsiReference[] references = ArrayUtil.mergeArrays(position.getReferences(), position.getParent().getReferences());
+ PropertyReference propertyReference = (PropertyReference)ContainerUtil.find(references, PROPERTY_REFERENCE);
+ if (propertyReference != null) {
+ final int startOffset = parameters.getOffset();
+ PsiElement element = propertyReference.getElement();
+ final int offsetInElement = startOffset - element.getTextRange().getStartOffset();
+ TextRange range = propertyReference.getRangeInElement();
+ final String prefix = element.getText().substring(range.getStartOffset(), offsetInElement);
+
+ LookupElement[] variants = getVariants(propertyReference);
+ result.withPrefixMatcher(prefix).addAllElements(Arrays.asList(variants));
+ if (variants.length != 0) {
+ result.stopHere();
+ }
+ }
+ //if (parameters.isExtendedCompletion()) {
+ // CompletionService.getCompletionService().getVariantsFromContributors(parameters.delegateToClassName(), null, new Consumer<CompletionResult>() {
+ // public void consume(final CompletionResult completionResult) {
+ // result.passResult(completionResult);
+ // }
+ // });
+ //}
+ }
+
+ public static final LookupElementRenderer<LookupElement> LOOKUP_ELEMENT_RENDERER = new LookupElementRenderer<LookupElement>() {
+ @Override
+ public void renderElement(LookupElement element, LookupElementPresentation presentation) {
+ IProperty property = (IProperty)element.getObject();
+ presentation.setIcon(PlatformIcons.PROPERTY_ICON);
+ String key = StringUtil.notNullize(property.getUnescapedKey());
+ presentation.setItemText(key);
+
+ PropertiesFile propertiesFile = property.getPropertiesFile();
+ ResourceBundle resourceBundle = propertiesFile.getResourceBundle();
+ String value = property.getValue();
+ boolean hasBundle = resourceBundle != EmptyResourceBundle.getInstance();
+ if (hasBundle) {
+ PropertiesFile defaultPropertiesFile = resourceBundle.getDefaultPropertiesFile(propertiesFile.getProject());
+ IProperty defaultProperty = defaultPropertiesFile.findPropertyByKey(key);
+ if (defaultProperty != null) {
+ value = defaultProperty.getValue();
+ }
+ }
+
+ if (hasBundle) {
+ presentation.setTypeText(resourceBundle.getBaseName(), AllIcons.FileTypes.Properties);
+ }
+
+ if (presentation instanceof RealLookupElementPresentation && value != null) {
+ value = "=" + value;
+ int limit = 1000;
+ if (value.length() > limit || !((RealLookupElementPresentation)presentation).hasEnoughSpaceFor(value, false)) {
+ if (value.length() > limit) {
+ value = value.substring(0, limit);
+ }
+ while (value.length() > 0 && !((RealLookupElementPresentation)presentation).hasEnoughSpaceFor(value + "...", false)) {
+ value = value.substring(0, value.length() - 1);
+ }
+ value += "...";
+ }
+ }
+
+ TextAttributes attrs = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(PropertiesHighlighter.PROPERTY_VALUE);
+ presentation.setTailText(value, attrs.getForegroundColor());
+ }
+ };
+
+ @NotNull
+ public static LookupElement[] getVariants(final PropertyReferenceBase propertyReference) {
+ final Set<Object> variants = PropertiesPsiCompletionUtil.getPropertiesKeys(propertyReference);
+ return getVariants(variants);
+ }
+
+ public static LookupElement[] getVariants(Set<Object> variants) {
+ return ContainerUtil.map2Array(variants, LookupElement.class, new NullableFunction < Object, LookupElement > () {
+ @Override
+ public LookupElement fun(Object o) {
+ if (o instanceof String) return LookupElementBuilder.create((String)o).withIcon(PlatformIcons.PROPERTY_ICON);
+ IProperty property = (IProperty)o;
+ String key = property.getKey();
+ if (key == null) return null;
+
+ return LookupElementBuilder.create(property, key).withRenderer(LOOKUP_ELEMENT_RENDERER);
+ }
+ });
+ }
+
+ @Override
+ public void beforeCompletion(@NotNull CompletionInitializationContext context) {
+ if (context.getFile() instanceof PropertiesFile) {
+ context.setDummyIdentifier(CompletionUtil.DUMMY_IDENTIFIER_TRIMMED);
+ }
+ }
+}
diff --git a/plugins/properties/src/com/intellij/lang/properties/references/PropertyReference.java b/plugins/properties/src/com/intellij/lang/properties/references/PropertyReference.java
deleted file mode 100644
index ff5fcfdd698d..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/references/PropertyReference.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2000-2009 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.lang.properties.references;
-
-import com.intellij.codeInspection.LocalQuickFix;
-import com.intellij.codeInspection.LocalQuickFixProvider;
-import com.intellij.lang.properties.psi.PropertiesFile;
-import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.PsiElement;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.List;
-
-/**
- * @author cdr
- */
-public class PropertyReference extends PropertyReferenceBase implements LocalQuickFixProvider {
- @Nullable private final String myBundleName;
-
- public PropertyReference(@NotNull final String key, @NotNull final PsiElement element, @Nullable final String bundleName, final boolean soft, final TextRange range) {
- super(key, soft, element, range);
- myBundleName = bundleName;
- }
-
- public PropertyReference(@NotNull String key, @NotNull PsiElement element, @Nullable final String bundleName, final boolean soft) {
- super(key, soft, element);
- myBundleName = bundleName;
- }
-
- @Nullable
- protected List<PropertiesFile> getPropertiesFiles() {
- if (myBundleName == null) {
- return null;
- }
- return retrievePropertyFilesByBundleName(myBundleName, myElement);
- }
-
- protected List<PropertiesFile> retrievePropertyFilesByBundleName(String bundleName, PsiElement element) {
- return I18nUtil.propertiesFilesByBundleName(bundleName, element);
- }
-
- public LocalQuickFix[] getQuickFixes() {
- List<PropertiesFile> propertiesFiles = retrievePropertyFilesByBundleName(myBundleName, getElement());
- CreatePropertyFix fix = new CreatePropertyFix(myElement, myKey, propertiesFiles);
- return new LocalQuickFix[] {fix};
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/references/PropertyReferenceBase.java b/plugins/properties/src/com/intellij/lang/properties/references/PropertyReferenceBase.java
deleted file mode 100644
index bcc1e84a049a..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/references/PropertyReferenceBase.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Copyright 2000-2009 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.lang.properties.references;
-
-import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider;
-import com.intellij.codeInsight.lookup.*;
-import com.intellij.icons.AllIcons;
-import com.intellij.lang.properties.*;
-import com.intellij.lang.properties.psi.PropertiesFile;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.editor.colors.EditorColorsManager;
-import com.intellij.openapi.editor.markup.TextAttributes;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.TextRange;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.pom.references.PomService;
-import com.intellij.psi.*;
-import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.NullableFunction;
-import com.intellij.util.PlatformIcons;
-import com.intellij.util.containers.ContainerUtil;
-import gnu.trove.THashSet;
-import gnu.trove.TObjectHashingStrategy;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author nik
- */
-public abstract class PropertyReferenceBase implements PsiPolyVariantReference, EmptyResolveMessageProvider {
- private static final Logger LOG = Logger.getInstance("#com.intellij.lang.properties.references.PropertyReferenceBase");
- private static final LookupElementRenderer<LookupElement> LOOKUP_ELEMENT_RENDERER = new LookupElementRenderer<LookupElement>() {
- @Override
- public void renderElement(LookupElement element, LookupElementPresentation presentation) {
- IProperty property = (IProperty)element.getObject();
- presentation.setIcon(PlatformIcons.PROPERTY_ICON);
- String key = StringUtil.notNullize(property.getUnescapedKey());
- presentation.setItemText(key);
-
- PropertiesFile propertiesFile = property.getPropertiesFile();
- ResourceBundle resourceBundle = propertiesFile.getResourceBundle();
- String value = property.getValue();
- boolean hasBundle = resourceBundle != EmptyResourceBundle.getInstance();
- if (hasBundle) {
- PropertiesFile defaultPropertiesFile = resourceBundle.getDefaultPropertiesFile(propertiesFile.getProject());
- IProperty defaultProperty = defaultPropertiesFile.findPropertyByKey(key);
- if (defaultProperty != null) {
- value = defaultProperty.getValue();
- }
- }
-
- if (hasBundle) {
- presentation.setTypeText(resourceBundle.getBaseName(), AllIcons.FileTypes.Properties);
- }
-
- if (presentation instanceof RealLookupElementPresentation && value != null) {
- value = "=" + value;
- int limit = 1000;
- if (value.length() > limit || !((RealLookupElementPresentation)presentation).hasEnoughSpaceFor(value, false)) {
- if (value.length() > limit) {
- value = value.substring(0, limit);
- }
- while (value.length() > 0 && !((RealLookupElementPresentation)presentation).hasEnoughSpaceFor(value + "...", false)) {
- value = value.substring(0, value.length() - 1);
- }
- value += "...";
- }
- }
-
- TextAttributes attrs = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(PropertiesHighlighter.PROPERTY_VALUE);
- presentation.setTailText(value, attrs.getForegroundColor());
- }
- };
- protected final String myKey;
- protected final PsiElement myElement;
- protected boolean mySoft;
- private final TextRange myTextRange;
-
- public PropertyReferenceBase(@NotNull String key, final boolean soft, @NotNull PsiElement element) {
- this(key, soft, element, ElementManipulators.getValueTextRange(element));
- }
-
- public PropertyReferenceBase(@NotNull String key, final boolean soft, @NotNull PsiElement element, TextRange range) {
- myKey = key;
- mySoft = soft;
- myElement = element;
- myTextRange = range;
- }
-
- public PsiElement resolve() {
- ResolveResult[] resolveResults = multiResolve(false);
- return resolveResults.length == 1 ? resolveResults[0].getElement() : null;
- }
-
- @NotNull
- protected String getKeyText() {
- return myKey;
- }
-
- public boolean equals(final Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- PropertyReferenceBase other = (PropertyReferenceBase)o;
-
- return getElement() == other.getElement() && getKeyText().equals(other.getKeyText());
- }
-
- public int hashCode() {
- return getKeyText().hashCode();
- }
-
- @NotNull
- public PsiElement getElement() {
- return myElement;
- }
-
- public TextRange getRangeInElement() {
- return myTextRange;
- }
-
- @NotNull
- public String getCanonicalText() {
- return myKey;
- }
-
- public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
- /*PsiElementFactory factory = JavaPsiFacade.getInstance(myElement.getProject()).getElementFactory();
-
- if (myElement instanceof PsiLiteralExpression) {
- PsiExpression newExpression = factory.createExpressionFromText("\"" + newElementName + "\"", myElement);
- return myElement.replace(newExpression);
- }
- else {*/
- ElementManipulator<PsiElement> manipulator = ElementManipulators.getManipulator(myElement);
- if (manipulator == null) {
- LOG.error("Cannot find manipulator for " + myElement + " of class " + myElement.getClass());
- }
- return manipulator.handleContentChange(myElement, getRangeInElement(), newElementName);
- /*}*/
- }
-
- public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
- throw new IncorrectOperationException("not implemented");
- }
-
- public boolean isReferenceTo(PsiElement element) {
- for (ResolveResult result : multiResolve(false)) {
- final PsiElement el = result.getElement();
- if (el != null && el.isEquivalentTo(element)) return true;
- }
- return false;
- }
-
- protected void addKey(Object property, Set<Object> variants) {
- variants.add(property);
- }
-
- protected void addVariantsFromFile(final PropertiesFile propertiesFile, final Set<Object> variants) {
- if (propertiesFile == null) return;
- if (!ProjectRootManager.getInstance(myElement.getProject()).getFileIndex().isInContent(propertiesFile.getVirtualFile())) return;
- List<? extends IProperty> properties = propertiesFile.getProperties();
- for (IProperty property : properties) {
- addKey(property, variants);
- }
- }
-
- protected void setSoft(final boolean soft) {
- mySoft = soft;
- }
-
- public boolean isSoft() {
- return mySoft;
- }
-
- @NotNull
- public String getUnresolvedMessagePattern() {
- return PropertiesBundle.message("unresolved.property.key");
- }
-
- @NotNull
- public ResolveResult[] multiResolve(final boolean incompleteCode) {
- final String key = getKeyText();
-
- List<IProperty> properties;
- final List<PropertiesFile> propertiesFiles = getPropertiesFiles();
- if (propertiesFiles == null) {
- properties = PropertiesImplUtil.findPropertiesByKey(getElement().getProject(), key);
- }
- else {
- properties = new ArrayList<IProperty>();
- for (PropertiesFile propertiesFile : propertiesFiles) {
- properties.addAll(propertiesFile.findPropertiesByKey(key));
- }
- }
- // put default properties file first
- ContainerUtil.quickSort(properties, new Comparator<IProperty>() {
- public int compare(final IProperty o1, final IProperty o2) {
- String name1 = o1.getPropertiesFile().getName();
- String name2 = o2.getPropertiesFile().getName();
- return Comparing.compare(name1, name2);
- }
- });
- return getResolveResults(properties);
- }
-
- protected static ResolveResult[] getResolveResults(List<IProperty> properties) {
- if (properties.isEmpty()) return ResolveResult.EMPTY_ARRAY;
-
- final ResolveResult[] results = new ResolveResult[properties.size()];
- for (int i = 0; i < properties.size(); i++) {
- IProperty property = properties.get(i);
- results[i] = new PsiElementResolveResult(property instanceof PsiElement ? (PsiElement)property : PomService.convertToPsi(
- (PsiTarget)property));
- }
- return results;
- }
-
- @Nullable
- protected abstract List<PropertiesFile> getPropertiesFiles();
-
- @NotNull
- public Object[] getVariants() {
- final Set<Object> variants = new THashSet<Object>(new TObjectHashingStrategy<Object>() {
- public int computeHashCode(final Object object) {
- if (object instanceof IProperty) {
- final String key = ((IProperty)object).getKey();
- return key == null ? 0 : key.hashCode();
- }
- else {
- return 0;
- }
- }
-
- public boolean equals(final Object o1, final Object o2) {
- return o1 instanceof IProperty && o2 instanceof IProperty &&
- Comparing.equal(((IProperty)o1).getKey(), ((IProperty)o2).getKey(), true);
- }
- });
- List<PropertiesFile> propertiesFileList = getPropertiesFiles();
- if (propertiesFileList == null) {
- PropertiesReferenceManager.getInstance(myElement.getProject()).processAllPropertiesFiles(new PropertiesFileProcessor() {
- @Override
- public boolean process(String baseName, PropertiesFile propertiesFile) {
- addVariantsFromFile(propertiesFile, variants);
- return true;
- }
- });
- }
- else {
- for (PropertiesFile propFile : propertiesFileList) {
- addVariantsFromFile(propFile, variants);
- }
- }
- return getVariants(variants);
- }
-
- protected static Object[] getVariants(Set<Object> variants) {
- return ContainerUtil.mapNotNull(variants, new NullableFunction<Object, LookupElement>() {
- @Override
- public LookupElement fun(Object o) {
- if (o instanceof String) return LookupElementBuilder.create((String)o).withIcon(PlatformIcons.PROPERTY_ICON);
- IProperty property = (IProperty)o;
- String key = property.getKey();
- if (key == null) return null;
-
- return LookupElementBuilder.create(property, key).withRenderer(LOOKUP_ELEMENT_RENDERER);
- }
- }).toArray();
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java b/plugins/properties/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java
deleted file mode 100644
index b67f6bfbea3f..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright 2000-2014 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.lang.properties.structureView;
-
-import com.intellij.icons.AllIcons;
-import com.intellij.ide.util.treeView.AbstractTreeNode;
-import com.intellij.ide.util.treeView.smartTree.*;
-import com.intellij.lang.properties.IProperty;
-import com.intellij.lang.properties.PropertiesBundle;
-import com.intellij.lang.properties.editor.ResourceBundlePropertyStructureViewElement;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.text.StringUtil;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.*;
-
-/**
- * @author cdr
- */
-public class GroupByWordPrefixes implements Grouper, Sorter {
- private static final Logger LOG = Logger.getInstance("#com.intellij.lang.properties.structureView.GroupByWordPrefixes");
- @NonNls public static final String ID = "GROUP_BY_PREFIXES";
- private String mySeparator;
-
- public GroupByWordPrefixes(String separator) {
- mySeparator = separator;
- }
-
- public void setSeparator(final String separator) {
- mySeparator = separator;
- }
-
- public String getSeparator() {
- return mySeparator;
- }
-
- @Override
- @NotNull
- public Collection<Group> group(@NotNull final AbstractTreeNode parent, @NotNull Collection<TreeElement> children) {
- List<Key> keys = new ArrayList<Key>();
-
- String parentPrefix;
- int parentPrefixLength;
- if (parent.getValue() instanceof PropertiesPrefixGroup) {
- parentPrefix = ((PropertiesPrefixGroup)parent.getValue()).getPrefix();
- parentPrefixLength = StringUtil.split(parentPrefix, mySeparator).size();
- }
- else {
- parentPrefix = "";
- parentPrefixLength = 0;
- }
- for (TreeElement element : children) {
- String text = null;
- if (element instanceof PropertiesStructureViewElement) {
- IProperty property = ((PropertiesStructureViewElement)element).getValue();
- text = property.getUnescapedKey();
- }
- else if (element instanceof ResourceBundlePropertyStructureViewElement) {
- text = ((ResourceBundlePropertyStructureViewElement)element).getValue();
- }
- if (text == null) continue;
- LOG.assertTrue(text.startsWith(parentPrefix) || text.startsWith(mySeparator));
- List<String> words = StringUtil.split(text, mySeparator);
- keys.add(new Key(words, element));
- }
- Collections.sort(keys, new Comparator<Key>() {
- @Override
- public int compare(final Key k1, final Key k2) {
- List<String> o1 = k1.words;
- List<String> o2 = k2.words;
- for (int i = 0; i < Math.max(o1.size(), o2.size()); i++) {
- if (i == o1.size()) return 1;
- if (i == o2.size()) return -1;
- String s1 = o1.get(i);
- String s2 = o2.get(i);
- int res = s1.compareTo(s2);
- if (res != 0) return res;
- }
- return 0;
- }
- });
- List<Group> groups = new ArrayList<Group>();
- int groupStart = 0;
- for (int i = 0; i <= keys.size(); i++) {
- if (!isEndOfGroup(i, keys, parentPrefixLength)) {
- continue;
- }
- // find longest group prefix
- List<String> firstKey = groupStart == keys.size() ? Collections.<String>emptyList() : keys.get(groupStart).words;
- int prefixLen = firstKey.size();
- for (int j = groupStart+1; j < i; j++) {
- List<String> prevKey = keys.get(j-1).words;
- List<String> nextKey = keys.get(j).words;
- for (int k = parentPrefixLength; k < prefixLen; k++) {
- String word = k < nextKey.size() ? nextKey.get(k) : null;
- String wordInPrevKey = k < prevKey.size() ? prevKey.get(k) : null;
- if (!Comparing.strEqual(word, wordInPrevKey)) {
- prefixLen = k;
- break;
- }
- }
- }
- String[] strings = firstKey.subList(0,prefixLen).toArray(new String[prefixLen]);
- String prefix = StringUtil.join(strings, mySeparator);
- String presentableName = prefix.substring(parentPrefix.length());
- presentableName = StringUtil.trimStart(presentableName, mySeparator);
- if (i - groupStart > 1) {
- groups.add(new PropertiesPrefixGroup(children, prefix, presentableName, mySeparator));
- }
- else if (groupStart != keys.size()) {
- TreeElement node = keys.get(groupStart).node;
- if (node instanceof PropertiesStructureViewElement) {
- ((PropertiesStructureViewElement)node).setPresentableName(presentableName);
- }
- else {
- ((ResourceBundlePropertyStructureViewElement)node).setPresentableName(presentableName);
- }
- }
- groupStart = i;
- }
- return groups;
- }
-
- private static boolean isEndOfGroup(final int i,
- final List<Key> keys,
- final int parentPrefixLength) {
- if (i == keys.size()) return true;
- if (i == 0) return false;
- List<String> words = keys.get(i).words;
- List<String> prevWords = keys.get(i - 1).words;
- if (prevWords.size() == parentPrefixLength) return true;
- if (words.size() == parentPrefixLength) return true;
- return !Comparing.strEqual(words.get(parentPrefixLength), prevWords.get(parentPrefixLength));
- }
-
- @Override
- @NotNull
- public ActionPresentation getPresentation() {
- return new ActionPresentationData(PropertiesBundle.message("structure.view.group.by.prefixes.action.name"),
- PropertiesBundle.message("structure.view.group.by.prefixes.action.description"),
- AllIcons.Actions.GroupByPrefix);
- }
-
- @Override
- @NotNull
- public String getName() {
- return ID;
- }
-
- @NotNull
- @Override
- public Comparator getComparator() {
- return Sorter.ALPHA_SORTER.getComparator();
- }
-
- @Override
- public boolean isVisible() {
- return true;
- }
-
- private static class Key {
- final List<String> words;
- final TreeElement node;
-
- public Key(final List<String> words, final TreeElement node) {
- this.words = words;
- this.node = node;
- }
- }
-
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java
deleted file mode 100644
index d0a203a7644f..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2000-2014 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.lang.properties.structureView;
-
-import com.intellij.ide.structureView.StructureViewTreeElement;
-import com.intellij.ide.structureView.impl.common.PsiTreeElementBase;
-import com.intellij.lang.properties.IProperty;
-import com.intellij.lang.properties.psi.Property;
-import com.intellij.lang.properties.psi.impl.PropertiesFileImpl;
-import com.intellij.navigation.ItemPresentation;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * @author max
- */
-public class PropertiesFileStructureViewElement extends PsiTreeElementBase<PropertiesFileImpl> {
-
- protected PropertiesFileStructureViewElement(PropertiesFileImpl propertiesFile) {
- super(propertiesFile);
- }
-
- @NotNull
- public Collection<StructureViewTreeElement> getChildrenBase() {
- List<? extends IProperty> properties = getElement().getProperties();
-
- Collection<StructureViewTreeElement> elements = new ArrayList<StructureViewTreeElement>(properties.size());
- for (IProperty property : properties) {
- elements.add(new PropertiesStructureViewElement((Property)property));
- }
- return elements;
- }
-
- public String getPresentableText() {
- return getElement().getName();
- }
-
- @NotNull
- public ItemPresentation getPresentation() {
- return new ItemPresentation() {
- public String getPresentableText() {
- return PropertiesFileStructureViewElement.this.getPresentableText();
- }
-
- public String getLocationString() {
- return null;
- }
-
- public Icon getIcon(boolean open) {
- return getElement().getIcon(0);
- }
- };
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewModel.java b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewModel.java
deleted file mode 100644
index 0b36e14bd802..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewModel.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright 2000-2014 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.lang.properties.structureView;
-
-import com.intellij.icons.AllIcons;
-import com.intellij.ide.IdeBundle;
-import com.intellij.ide.structureView.StructureViewTreeElement;
-import com.intellij.ide.structureView.TextEditorBasedStructureViewModel;
-import com.intellij.ide.util.treeView.smartTree.ActionPresentation;
-import com.intellij.ide.util.treeView.smartTree.ActionPresentationData;
-import com.intellij.ide.util.treeView.smartTree.Grouper;
-import com.intellij.ide.util.treeView.smartTree.Sorter;
-import com.intellij.lang.properties.editor.PropertiesGroupingStructureViewModel;
-import com.intellij.lang.properties.psi.Property;
-import com.intellij.lang.properties.psi.impl.PropertiesFileImpl;
-import com.intellij.psi.PsiFile;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Comparator;
-
-/**
- * @author max
- */
-public class PropertiesFileStructureViewModel extends TextEditorBasedStructureViewModel implements PropertiesGroupingStructureViewModel {
- private final PropertiesFileImpl myPropertiesFile;
- private final GroupByWordPrefixes myGroupByWordPrefixes;
- @NonNls public static final String KIND_SORTER_ID = "KIND_SORTER";
- private static final Sorter KIND_SORTER = new Sorter() {
- @NotNull
- public Comparator getComparator() {
- return new Comparator() {
- public int compare(final Object o1, final Object o2) {
- int weight1 = o1 instanceof PropertiesPrefixGroup ? 1 : 0;
- int weight2 = o2 instanceof PropertiesPrefixGroup ? 1 : 0;
- return weight1 - weight2;
- }
- };
- }
-
- public boolean isVisible() {
- return true;
- }
-
- @NotNull
- public ActionPresentation getPresentation() {
- String name = IdeBundle.message("action.sort.by.type");
- return new ActionPresentationData(name, name, AllIcons.ObjectBrowser.SortByType);
- }
-
- @NotNull
- public String getName() {
- return KIND_SORTER_ID;
- }
- };
-
- public PropertiesFileStructureViewModel(final PropertiesFileImpl root) {
- super(root);
- myPropertiesFile = root;
- String separator = PropertiesSeparatorManager.getInstance().getSeparator(root.getProject(), root.getVirtualFile());
- myGroupByWordPrefixes = new GroupByWordPrefixes(separator);
- }
-
- public void setSeparator(String separator) {
- myGroupByWordPrefixes.setSeparator(separator);
- PropertiesSeparatorManager.getInstance().setSeparator(myPropertiesFile.getVirtualFile(), separator);
- }
-
- public String getSeparator() {
- return myGroupByWordPrefixes.getSeparator();
- }
-
- @NotNull
- public StructureViewTreeElement getRoot() {
- return new PropertiesFileStructureViewElement(myPropertiesFile);
- }
-
- @NotNull
- public Grouper[] getGroupers() {
- return new Grouper[]{myGroupByWordPrefixes};
- }
-
- @NotNull
- public Sorter[] getSorters() {
- return new Sorter[] {Sorter.ALPHA_SORTER, KIND_SORTER};
- }
-
- protected PsiFile getPsiFile() {
- return myPropertiesFile;
- }
-
- @NotNull
- protected Class[] getSuitableClasses() {
- return new Class[] {Property.class};
- }
-
- @Override
- public boolean isAlwaysShowsPlus(StructureViewTreeElement element) {
- return false;
- }
-
- @Override
- public boolean isAlwaysLeaf(StructureViewTreeElement element) {
- return false;
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java
deleted file mode 100644
index ac94b1a1e4ac..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright 2000-2014 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.lang.properties.structureView;
-
-import com.intellij.icons.AllIcons;
-import com.intellij.ide.util.treeView.smartTree.Group;
-import com.intellij.ide.util.treeView.smartTree.TreeElement;
-import com.intellij.lang.properties.IProperty;
-import com.intellij.lang.properties.editor.ResourceBundlePropertyStructureViewElement;
-import com.intellij.navigation.ItemPresentation;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.text.StringUtil;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * @author cdr
- */
-public class PropertiesPrefixGroup implements Group {
- private final Collection<TreeElement> myProperties;
- private final @NotNull String myPrefix;
- private final String myPresentableName;
- private final @NotNull String mySeparator;
-
- public PropertiesPrefixGroup(final Collection<TreeElement> properties, String prefix, String presentableName, final String separator) {
- myProperties = properties;
- myPrefix = prefix;
- myPresentableName = presentableName;
- mySeparator = separator;
- }
-
- @NotNull
- public ItemPresentation getPresentation() {
- return new ItemPresentation() {
- public String getPresentableText() {
- return myPresentableName;
- }
-
- public String getLocationString() {
- return null;
- }
-
- public Icon getIcon(boolean open) {
- return AllIcons.Nodes.Advice;
- }
- };
- }
-
- @NotNull
- public Collection<TreeElement> getChildren() {
- Collection<TreeElement> result = new ArrayList<TreeElement>();
- List<String> prefixWords = StringUtil.split(myPrefix, mySeparator);
- for (TreeElement treeElement : myProperties) {
- String key;
- if (treeElement instanceof PropertiesStructureViewElement) {
- PropertiesStructureViewElement propertiesElement = (PropertiesStructureViewElement)treeElement;
- IProperty property = propertiesElement.getValue();
-
- key = property.getUnescapedKey();
- }
- else if (treeElement instanceof ResourceBundlePropertyStructureViewElement) {
- key = ((ResourceBundlePropertyStructureViewElement)treeElement).getValue();
- }
- else {
- continue;
- }
-
- if (key == null || key.equals(myPrefix)) {
- continue;
- }
- List<String> keyWords = StringUtil.split(key, mySeparator);
- boolean startsWith = prefixWords.size() < keyWords.size();
- if (startsWith) {
- for (int i = 0; i < prefixWords.size(); i++) {
- String prefixWord = prefixWords.get(i);
- String keyWord = keyWords.get(i);
- if (!Comparing.strEqual(keyWord, prefixWord)) {
- startsWith = false;
- break;
- }
- }
- }
- if (startsWith) {
- result.add(treeElement);
- String presentableName = key.substring(myPrefix.length());
- presentableName = StringUtil.trimStart(presentableName, mySeparator);
- if (treeElement instanceof PropertiesStructureViewElement) {
- ((PropertiesStructureViewElement)treeElement).setPresentableName(presentableName);
- }
- if (treeElement instanceof ResourceBundlePropertyStructureViewElement) {
- ((ResourceBundlePropertyStructureViewElement)treeElement).setPresentableName(presentableName);
- }
- }
- }
- return result;
- }
-
- public String getPrefix() {
- return myPrefix;
- }
-
- public boolean equals(final Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- final PropertiesPrefixGroup group = (PropertiesPrefixGroup)o;
-
- if (!myPrefix.equals(group.myPrefix)) return false;
-
- return true;
- }
-
- public int hashCode() {
- return myPrefix.hashCode();
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesSeparatorManager.java b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesSeparatorManager.java
deleted file mode 100644
index 91c7d883d1f0..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesSeparatorManager.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright 2000-2012 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.
- */
-
-/**
- * @author cdr
- */
-package com.intellij.lang.properties.structureView;
-
-import com.intellij.lang.properties.IProperty;
-import com.intellij.lang.properties.PropertiesLanguage;
-import com.intellij.lang.properties.ResourceBundle;
-import com.intellij.lang.properties.ResourceBundleImpl;
-import com.intellij.lang.properties.editor.ResourceBundleAsVirtualFile;
-import com.intellij.lang.properties.psi.PropertiesFile;
-import com.intellij.openapi.components.*;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.VirtualFileManager;
-import com.intellij.psi.FileViewProvider;
-import com.intellij.psi.PsiManager;
-import com.intellij.util.SmartList;
-import com.intellij.util.containers.ContainerUtil;
-import gnu.trove.THashMap;
-import gnu.trove.TIntLongHashMap;
-import gnu.trove.TIntProcedure;
-import org.jdom.Element;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-@State(
- name="PropertiesSeparatorManager",
- storages= {
- @Storage(
- file = StoragePathMacros.APP_CONFIG + "/other.xml"
- )}
-)
-public class PropertiesSeparatorManager implements PersistentStateComponent<Element> {
- @NonNls private static final String FILE_ELEMENT = "file";
- @NonNls private static final String URL_ELEMENT = "url";
- @NonNls private static final String SEPARATOR_ATTR = "separator";
-
- public static PropertiesSeparatorManager getInstance() {
- return ServiceManager.getService(PropertiesSeparatorManager.class);
- }
-
- private final Map<VirtualFile, String> mySeparators = new THashMap<VirtualFile, String>();
-
- public String getSeparator(Project project, VirtualFile file) {
- String separator = mySeparators.get(file);
- if (separator == null) {
- separator = guessSeparator(project, file);
- setSeparator(file, separator);
- }
- return separator;
- }
-
- //returns most probable separator in properties files
- private static String guessSeparator(final Project project, final VirtualFile file) {
- Collection<PropertiesFile> files;
- if (file instanceof ResourceBundleAsVirtualFile) {
- files = ((ResourceBundleAsVirtualFile)file).getResourceBundle().getPropertiesFiles(project);
- }
- else {
- PsiManager psiManager = PsiManager.getInstance(project);
- final FileViewProvider provider = psiManager.findViewProvider(file);
- files = new SmartList<PropertiesFile>();
- if (provider != null) {
- ContainerUtil.addIfNotNull((PropertiesFile)provider.getPsi(PropertiesLanguage.INSTANCE), files);
- }
- }
- final TIntLongHashMap charCounts = new TIntLongHashMap();
- for (PropertiesFile propertiesFile : files) {
- if (propertiesFile == null) continue;
- List<IProperty> properties = propertiesFile.getProperties();
- for (IProperty property : properties) {
- String key = property.getUnescapedKey();
- if (key == null) continue;
- for (int i =0; i<key.length(); i++) {
- char c = key.charAt(i);
- if (!Character.isLetterOrDigit(c)) {
- charCounts.put(c, charCounts.get(c) + 1);
- }
- }
- }
- }
-
- final char[] mostProbableChar = new char[]{'.'};
- charCounts.forEachKey(new TIntProcedure() {
- long count = -1;
- public boolean execute(int ch) {
- long charCount = charCounts.get(ch);
- if (charCount > count) {
- count = charCount;
- mostProbableChar[0] = (char)ch;
- }
- return true;
- }
- });
- if (mostProbableChar[0] == 0) {
- mostProbableChar[0] = '.';
- }
- return Character.toString(mostProbableChar[0]);
- }
-
- public void setSeparator(VirtualFile file, String separator) {
- mySeparators.put(file, separator);
- }
-
- public void loadState(final Element element) {
- List<Element> files = element.getChildren(FILE_ELEMENT);
- for (Element fileElement : files) {
- String url = fileElement.getAttributeValue(URL_ELEMENT, "");
- String separator = fileElement.getAttributeValue(SEPARATOR_ATTR,"");
- separator = decodeSeparator(separator);
- if (separator == null) {
- continue;
- }
- VirtualFile file;
- ResourceBundle resourceBundle = ResourceBundleImpl.createByUrl(url);
- if (resourceBundle != null) {
- file = new ResourceBundleAsVirtualFile(resourceBundle);
- }
- else {
- file = VirtualFileManager.getInstance().findFileByUrl(url);
- }
- if (file != null) {
- mySeparators.put(file, separator);
- }
- }
- }
-
- @Nullable
- private static String decodeSeparator(String separator) {
- if (separator.length() % 6 != 0) {
- return null;
- }
- StringBuilder result = new StringBuilder();
- int pos = 0;
- while (pos < separator.length()) {
- String encodedCharacter = separator.substring(pos, pos+6);
- if (!encodedCharacter.startsWith("\\u")) {
- return null;
- }
- int d1 = Character.digit(encodedCharacter.charAt(2), 16);
- int d2 = Character.digit(encodedCharacter.charAt(3), 16);
- int d3 = Character.digit(encodedCharacter.charAt(4), 16);
- int d4 = Character.digit(encodedCharacter.charAt(5), 16);
- if (d1 == -1 || d2 == -1 || d3 == -1 || d4 == -1) {
- return null;
- }
- int b1 = (d1 << 12) & 0xF000;
- int b2 = (d2 << 8) & 0x0F00;
- int b3 = (d3 << 4) & 0x00F0;
- int b4 = (d4 << 0) & 0x000F;
- char code = (char) (b1 | b2 | b3 | b4);
- result.append(code);
- pos += 6;
- }
- return result.toString();
- }
-
- public Element getState() {
- Element element = new Element("PropertiesSeparatorManager");
- for (VirtualFile file : mySeparators.keySet()) {
- String url;
- if (file instanceof ResourceBundleAsVirtualFile) {
- ResourceBundle resourceBundle = ((ResourceBundleAsVirtualFile)file).getResourceBundle();
- url = ((ResourceBundleImpl)resourceBundle).getUrl();
- }
- else {
- url = file.getUrl();
- }
- String separator = mySeparators.get(file);
- StringBuilder encoded = new StringBuilder(separator.length());
- for (int i=0;i<separator.length();i++) {
- char c = separator.charAt(i);
- encoded.append("\\u");
- encoded.append(Character.forDigit(c >> 12, 16));
- encoded.append(Character.forDigit((c >> 8) & 0xf, 16));
- encoded.append(Character.forDigit((c >> 4) & 0xf, 16));
- encoded.append(Character.forDigit(c & 0xf, 16));
- }
- Element fileElement = new Element(FILE_ELEMENT);
- fileElement.setAttribute(URL_ELEMENT, url);
- fileElement.setAttribute(SEPARATOR_ATTR, encoded.toString());
- element.addContent(fileElement);
- }
- return element;
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java
deleted file mode 100644
index 77946f442518..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2000-2014 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.lang.properties.structureView;
-
-import com.intellij.ide.structureView.StructureViewTreeElement;
-import com.intellij.lang.properties.psi.Property;
-import com.intellij.navigation.ItemPresentation;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-
-/**
- * @author max
- */
-public class PropertiesStructureViewElement implements StructureViewTreeElement {
- private final Property myProperty;
- private String myPresentableName;
-
- public PropertiesStructureViewElement(final Property element) {
- myProperty = element;
- }
-
- public Property getValue() {
- return myProperty;
- }
-
- public void navigate(boolean requestFocus) {
- myProperty.navigate(requestFocus);
- }
-
- public boolean canNavigate() {
- return myProperty.canNavigate();
- }
-
- public boolean canNavigateToSource() {
- return myProperty.canNavigateToSource();
- }
-
- @NotNull
- public StructureViewTreeElement[] getChildren() {
- return EMPTY_ARRAY;
- }
-
- @NotNull
- public ItemPresentation getPresentation() {
- return new ItemPresentation() {
- public String getPresentableText() {
- if (myPresentableName == null) {
- return myProperty.getUnescapedKey();
- }
- else {
- return myPresentableName;
- }
- }
-
- public String getLocationString() {
- return null;
- }
-
- public Icon getIcon(boolean open) {
- return myProperty.getIcon(0);
- }
- };
- }
-
- public void setPresentableName(final String presentableName) {
- myPresentableName = presentableName;
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/xml/XmlPropertiesIconProvider.java b/plugins/properties/src/com/intellij/lang/properties/xml/XmlPropertiesIconProvider.java
deleted file mode 100644
index a6757d050995..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/xml/XmlPropertiesIconProvider.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.intellij.lang.properties.xml;
-
-import com.intellij.ide.IconProvider;
-import com.intellij.ide.highlighter.XmlFileType;
-import com.intellij.lang.properties.PropertiesImplUtil;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.xml.XmlFile;
-import icons.PropertiesIcons;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-
-/**
- * @author Dmitry Avdeev
- * Date: 7/29/11
- */
-public class XmlPropertiesIconProvider extends IconProvider {
-
- @Override
- public Icon getIcon(@NotNull PsiElement element, int flags) {
- return element instanceof XmlFile &&
- ((XmlFile)element).getFileType() == XmlFileType.INSTANCE &&
- PropertiesImplUtil.getPropertiesFile((XmlFile)element) != null ? PropertiesIcons.XmlProperties : null;
- }
-}
diff --git a/plugins/properties/src/com/intellij/lang/properties/xml/XmlPropertiesReferenceContributor.java b/plugins/properties/src/com/intellij/lang/properties/xml/XmlPropertiesReferenceContributor.java
deleted file mode 100644
index bb66ee580205..000000000000
--- a/plugins/properties/src/com/intellij/lang/properties/xml/XmlPropertiesReferenceContributor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2000-2011 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.lang.properties.xml;
-
-import com.intellij.lang.properties.PropertiesImplUtil;
-import com.intellij.lang.properties.psi.PropertiesFile;
-import com.intellij.patterns.XmlPatterns;
-import com.intellij.pom.references.PomService;
-import com.intellij.psi.*;
-import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.psi.xml.XmlTag;
-import com.intellij.util.ProcessingContext;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Dmitry Avdeev
- * Date: 9/15/11
- */
-public class XmlPropertiesReferenceContributor extends PsiReferenceContributor {
- @Override
- public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
- registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withLocalName("key"),
- new PsiReferenceProvider() {
- @NotNull
- @Override
- public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
- PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(element.getContainingFile());
- if (propertiesFile == null) return PsiReference.EMPTY_ARRAY;
- XmlProperty property = new XmlProperty(PsiTreeUtil.getParentOfType(element, XmlTag.class), (XmlPropertiesFileImpl)propertiesFile);
- return new PsiReference[] { new PsiReferenceBase.Immediate<PsiElement>(element, PomService.convertToPsi(property))};
- }
- });
- }
-}
diff --git a/plugins/properties/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesFilterLexer.java b/plugins/properties/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesFilterLexer.java
deleted file mode 100644
index 10e2134e72da..000000000000
--- a/plugins/properties/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesFilterLexer.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2000-2009 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.psi.impl.cache.impl.idCache;
-
-import com.intellij.lang.properties.parsing.PropertiesTokenTypes;
-import com.intellij.lexer.Lexer;
-import com.intellij.psi.impl.cache.impl.BaseFilterLexer;
-import com.intellij.psi.impl.cache.impl.OccurrenceConsumer;
-import com.intellij.psi.search.UsageSearchContext;
-import com.intellij.psi.tree.IElementType;
-
-/**
- * @author ven
- */
-public class PropertiesFilterLexer extends BaseFilterLexer {
- public PropertiesFilterLexer(final Lexer originalLexer, final OccurrenceConsumer table) {
- super(originalLexer, table);
- }
-
- public void advance() {
- final IElementType tokenType = getDelegate().getTokenType();
-
- if (tokenType == PropertiesTokenTypes.KEY_CHARACTERS) {
- scanWordsInToken(UsageSearchContext.IN_CODE | UsageSearchContext.IN_FOREIGN_LANGUAGES | UsageSearchContext.IN_PLAIN_TEXT, false, false);
- }
- else if (PropertiesTokenTypes.COMMENTS.contains(tokenType)) {
- scanWordsInToken(UsageSearchContext.IN_COMMENTS | UsageSearchContext.IN_PLAIN_TEXT, false, false);
- advanceTodoItemCountsInToken();
- }
- else {
- scanWordsInToken(UsageSearchContext.IN_CODE | UsageSearchContext.IN_FOREIGN_LANGUAGES | UsageSearchContext.IN_PLAIN_TEXT, false, false);
- }
-
- getDelegate().advance();
- }
-}
diff --git a/plugins/properties/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesIdIndexer.java b/plugins/properties/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesIdIndexer.java
deleted file mode 100644
index 4224983fc769..000000000000
--- a/plugins/properties/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesIdIndexer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2000-2009 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.psi.impl.cache.impl.idCache;
-
-import com.intellij.lang.properties.parsing.PropertiesLexer;
-import com.intellij.lexer.Lexer;
-import com.intellij.psi.impl.cache.impl.OccurrenceConsumer;
-import com.intellij.psi.impl.cache.impl.id.LexerBasedIdIndexer;
-
-/**
- * @author Maxim.Mossienko
- */
-public class PropertiesIdIndexer extends LexerBasedIdIndexer {
- public Lexer createLexer(final OccurrenceConsumer consumer) {
- return createIndexingLexer(consumer);
- }
-
- static Lexer createIndexingLexer(OccurrenceConsumer consumer) {
- return new PropertiesFilterLexer(new PropertiesLexer(), consumer);
- }
-}
diff --git a/plugins/properties/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesTodoIndexer.java b/plugins/properties/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesTodoIndexer.java
deleted file mode 100644
index b810a435f22f..000000000000
--- a/plugins/properties/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesTodoIndexer.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2000-2009 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.psi.impl.cache.impl.idCache;
-
-import com.intellij.lexer.Lexer;
-import com.intellij.psi.impl.cache.impl.OccurrenceConsumer;
-import com.intellij.psi.impl.cache.impl.todo.LexerBasedTodoIndexer;
-
-/**
- * @author Maxim.Mossienko
- */
-public class PropertiesTodoIndexer extends LexerBasedTodoIndexer {
- @Override
- public Lexer createLexer(OccurrenceConsumer consumer) {
- return PropertiesIdIndexer.createIndexingLexer(consumer);
- }
-}