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
diff --git a/.idea/libraries/KotlinJavaRuntime.xml b/.idea/libraries/KotlinJavaRuntime.xml
new file mode 100644
index 0000000..1529a7e
--- /dev/null
+++ b/.idea/libraries/KotlinJavaRuntime.xml
@@ -0,0 +1,11 @@
+<component name="libraryTable">
+  <library name="KotlinJavaRuntime">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/build/kotlinc/lib/kotlin-runtime.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES>
+      <root url="jar://$PROJECT_DIR$/build/kotlinc/lib/kotlin-runtime-sources.jar!/" />
+    </SOURCES>
+  </library>
+</component>
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 971465f..3c17dff 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -10,6 +10,7 @@
       <module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-tests/IntelliLang-tests.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-tests/IntelliLang-tests.iml" group="plugins/IntelliLang" />
       <module fileurl="file://$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-xml.iml" filepath="$PROJECT_DIR$/plugins/IntelliLang/IntelliLang-xml.iml" group="plugins/IntelliLang" />
       <module fileurl="file://$PROJECT_DIR$/RegExpSupport/RegExpSupport.iml" filepath="$PROJECT_DIR$/RegExpSupport/RegExpSupport.iml" group="platform" />
+      <module fileurl="file://$PROJECT_DIR$/plugins/ShortcutPromoter/ShortcutPromoter.iml" filepath="$PROJECT_DIR$/plugins/ShortcutPromoter/ShortcutPromoter.iml" group="plugins" />
       <module fileurl="file://$PROJECT_DIR$/platform/analysis-api/analysis-api.iml" filepath="$PROJECT_DIR$/platform/analysis-api/analysis-api.iml" group="platform" />
       <module fileurl="file://$PROJECT_DIR$/platform/analysis-impl/analysis-impl.iml" filepath="$PROJECT_DIR$/platform/analysis-impl/analysis-impl.iml" group="platform" />
       <module fileurl="file://$PROJECT_DIR$/platform/annotations/annotations.iml" filepath="$PROJECT_DIR$/platform/annotations/annotations.iml" group="platform" />
@@ -64,6 +65,7 @@
       <module fileurl="file://$PROJECT_DIR$/plugins/gradle/tooling-extension-api/gradle-tooling-extension-api.iml" filepath="$PROJECT_DIR$/plugins/gradle/tooling-extension-api/gradle-tooling-extension-api.iml" group="community/plugins/gradle" />
       <module fileurl="file://$PROJECT_DIR$/plugins/gradle/tooling-extension-impl/gradle-tooling-extension-impl.iml" filepath="$PROJECT_DIR$/plugins/gradle/tooling-extension-impl/gradle-tooling-extension-impl.iml" group="community/plugins/gradle" />
       <module fileurl="file://$PROJECT_DIR$/plugins/groovy/jps-plugin/groovy-jps-plugin.iml" filepath="$PROJECT_DIR$/plugins/groovy/jps-plugin/groovy-jps-plugin.iml" group="plugins/Groovy" />
+      <module fileurl="file://$PROJECT_DIR$/plugins/groovy/groovy-psi/groovy-psi.iml" filepath="$PROJECT_DIR$/plugins/groovy/groovy-psi/groovy-psi.iml" group="plugins/Groovy" />
       <module fileurl="file://$PROJECT_DIR$/plugins/groovy/rt-constants/groovy-rt-constants.iml" filepath="$PROJECT_DIR$/plugins/groovy/rt-constants/groovy-rt-constants.iml" group="plugins/Groovy" />
       <module fileurl="file://$PROJECT_DIR$/plugins/groovy/rt/groovy_rt.iml" filepath="$PROJECT_DIR$/plugins/groovy/rt/groovy_rt.iml" group="plugins/Groovy" />
       <module fileurl="file://$PROJECT_DIR$/plugins/hg4idea/hg4idea.iml" filepath="$PROJECT_DIR$/plugins/hg4idea/hg4idea.iml" group="plugins/VCS" />
@@ -90,7 +92,6 @@
       <module fileurl="file://$PROJECT_DIR$/plugins/javaFX/javaFX-jps-plugin/javaFX-jps-plugin.iml" filepath="$PROJECT_DIR$/plugins/javaFX/javaFX-jps-plugin/javaFX-jps-plugin.iml" group="plugins/JavaFX" />
       <module fileurl="file://$PROJECT_DIR$/java/compiler/javac2/javac2.iml" filepath="$PROJECT_DIR$/java/compiler/javac2/javac2.iml" group="java/compiler" />
       <module fileurl="file://$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml" filepath="$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml" group="plugins/VCS/cvs" />
-      <module fileurl="file://$PROJECT_DIR$/plugins/groovy/groovy-psi/groovy-psi.iml" filepath="$PROJECT_DIR$/plugins/groovy/groovy-psi/groovy-psi.iml" group="plugins/Groovy" />
       <module fileurl="file://$PROJECT_DIR$/plugins/groovy/jetgroovy.iml" filepath="$PROJECT_DIR$/plugins/groovy/jetgroovy.iml" group="plugins/Groovy" />
       <module fileurl="file://$PROJECT_DIR$/plugins/tasks/tasks-core/jira/jira.iml" filepath="$PROJECT_DIR$/plugins/tasks/tasks-core/jira/jira.iml" group="plugins/tasks" />
       <module fileurl="file://$PROJECT_DIR$/jps/jps-builders/jps-builders.iml" filepath="$PROJECT_DIR$/jps/jps-builders/jps-builders.iml" group="jps" />
diff --git a/bin/mac/fsnotifier b/bin/mac/fsnotifier
index e2524e7..d69157a 100755
--- a/bin/mac/fsnotifier
+++ b/bin/mac/fsnotifier
Binary files differ
diff --git a/build/.gitignore b/build/.gitignore
new file mode 100644
index 0000000..960e92a
--- /dev/null
+++ b/build/.gitignore
@@ -0,0 +1 @@
+/kotlinc/
diff --git a/build/gant.xml b/build/gant.xml
index f332c9a..ad3f08f 100644
--- a/build/gant.xml
+++ b/build/gant.xml
@@ -12,6 +12,9 @@
     <fileset dir="${project.home}/build/lib/jps">
       <include name="*.jar"/>
     </fileset>
+    <fileset dir="${project.home}/build/kotlinc/jps" erroronmissingdir="false">
+      <include name="*.jar"/>
+    </fileset>
     <fileset dir="${idea.lib}">
        <include name="jdom.jar"/>
        <include name="log4j.jar"/>
@@ -29,6 +32,7 @@
        <include name="oromatcher.jar"/>
        <include name="cli-parser-*.jar"/>
        <include name="nanoxml-*.jar"/>
+       <include name="jsr166e.jar"/>
     </fileset>
   </path>
 
diff --git a/build/lib/jps/antlayout.jar b/build/lib/jps/antlayout.jar
index 84f9d06..8f6554d 100644
--- a/build/lib/jps/antlayout.jar
+++ b/build/lib/jps/antlayout.jar
Binary files differ
diff --git a/build/lib/jps/groovy-jps-plugin.jar b/build/lib/jps/groovy-jps-plugin.jar
index bb83b0f..5166341 100644
--- a/build/lib/jps/groovy-jps-plugin.jar
+++ b/build/lib/jps/groovy-jps-plugin.jar
Binary files differ
diff --git a/build/lib/jps/groovy_rt.jar b/build/lib/jps/groovy_rt.jar
index f28c213..43d418b 100644
--- a/build/lib/jps/groovy_rt.jar
+++ b/build/lib/jps/groovy_rt.jar
Binary files differ
diff --git a/build/lib/jps/jps-builders.jar b/build/lib/jps/jps-builders.jar
index b0b9c7c..b02ac27 100644
--- a/build/lib/jps/jps-builders.jar
+++ b/build/lib/jps/jps-builders.jar
Binary files differ
diff --git a/build/lib/jps/jps-model.jar b/build/lib/jps/jps-model.jar
index b9ce2a7..e56a781 100644
--- a/build/lib/jps/jps-model.jar
+++ b/build/lib/jps/jps-model.jar
Binary files differ
diff --git a/build/lib/jps/ui-designer-jps-plugin.jar b/build/lib/jps/ui-designer-jps-plugin.jar
index 37c2855..69d7e02 100644
--- a/build/lib/jps/ui-designer-jps-plugin.jar
+++ b/build/lib/jps/ui-designer-jps-plugin.jar
Binary files differ
diff --git a/build/lib/jps/util.jar b/build/lib/jps/util.jar
index ff6a7b8..adef8f0 100644
--- a/build/lib/jps/util.jar
+++ b/build/lib/jps/util.jar
Binary files differ
diff --git a/build/scripts/layouts.gant b/build/scripts/layouts.gant
index 317ea36..0d945a8 100644
--- a/build/scripts/layouts.gant
+++ b/build/scripts/layouts.gant
@@ -489,10 +489,8 @@
     }
 
     layoutPlugin("devkit") {
-      dir("jps") {
-        jar("devkit-jps-plugin.jar") {
-          module("devkit-jps-plugin")
-        }
+      jar("devkit-jps-plugin.jar") {
+        module("devkit-jps-plugin")
       }
       fileset(dir: "${home}/plugins/devkit/lib") {
         include(name: "**/*.jar")
diff --git a/build/scripts/libLicenses.gant b/build/scripts/libLicenses.gant
index 33946d9..2e9691e 100644
--- a/build/scripts/libLicenses.gant
+++ b/build/scripts/libLicenses.gant
@@ -206,6 +206,7 @@
 libraryLicense(name: "markdownj", libraryName: "markdownj", version: "0.4.2", license: "New BSD", url: "https://code.google.com/p/markdownj/", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause")
 libraryLicense(name: "Maven", version: "2.2.1", license: "Apache 2.0", url: "http://maven.apache.org/", licenseUrl: "http://maven.apache.org/license.html")
 libraryLicense(name: "plexus-util", version: "2.0.6", license: "Apache 2.0", url: "http://maven.apache.org/", libraryNames:['plexus-utils-2.0.6.jar'], licenseUrl: "http://apache.org/licenses/LICENSE-2.0")
+libraryLicense(name: "plexus-archiver", libraryName: "plexus-archiver-2.4.4.jar", version: "2.4.4", license: "Apache 2.0", url: "http://plexus.codehaus.org/plexus-components/plexus-archiver", licenseUrl: "http://apache.org/licenses/LICENSE-2.0")
 libraryLicense(name: "aether-api", version: "1.13.1", libraryNames: ["aether-api-1.13.1.jar"], license: "Apache 2.0", url: "http://maven.apache.org/", licenseUrl: "http://maven.apache.org/license.html")
 libraryLicense(name: "aether-api-0.9.0.M2.jar", version: "0.9.0.M2", libraryNames: ["aether-api-0.9.0.M2.jar"], license: "Eclipse Public License v1.0", url: "http://nexus.sonatype.org/", licenseUrl: "http://www.eclipse.org/org/documents/epl-v10.html")
 libraryLicense(name: "maven-2.2.1-uber", version: "2.2.1", libraryNames: ["maven-2.2.1-uber.jar"], license: "Apache 2.0", url: "http://maven.apache.org/", licenseUrl: "http://maven.apache.org/license.html")
diff --git a/images/src/org/intellij/images/completion/ImageLookupInfoProvider.java b/images/src/org/intellij/images/completion/ImageLookupInfoProvider.java
index 60ace38..16ba763 100644
--- a/images/src/org/intellij/images/completion/ImageLookupInfoProvider.java
+++ b/images/src/org/intellij/images/completion/ImageLookupInfoProvider.java
@@ -40,7 +40,7 @@
       }
     }, project);
 
-    return s[0] == null ? null : Couple.newOne(file.getName(), s[0]);
+    return s[0] == null ? null : Couple.of(file.getName(), s[0]);
   }
 
   @NotNull
diff --git a/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java b/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java
index 7ba9cbc..c262c65 100644
--- a/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java
+++ b/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java
@@ -1,4 +1,3 @@
-
 /*
  * Copyright 2000-2014 JetBrains s.r.o.
  *
@@ -23,17 +22,11 @@
 
 import com.intellij.CommonBundle;
 import com.intellij.ProjectTopics;
-import com.intellij.compiler.impl.TranslatingCompilerFilesMonitor;
 import com.intellij.compiler.impl.javaCompiler.BackendCompiler;
-import com.intellij.compiler.impl.javaCompiler.api.CompilerAPICompiler;
 import com.intellij.compiler.impl.javaCompiler.eclipse.EclipseCompiler;
-import com.intellij.compiler.impl.javaCompiler.eclipse.EclipseEmbeddedCompiler;
 import com.intellij.compiler.impl.javaCompiler.javac.JavacCompiler;
-import com.intellij.compiler.options.ExternalBuildOptionListener;
-import com.intellij.compiler.server.BuildManager;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.ApplicationNamesInfo;
-import com.intellij.openapi.application.ex.ApplicationManagerEx;
 import com.intellij.openapi.compiler.CompilerBundle;
 import com.intellij.openapi.compiler.CompilerManager;
 import com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration;
@@ -80,7 +73,6 @@
 public class CompilerConfigurationImpl extends CompilerConfiguration implements PersistentStateComponent<Element>, ProjectComponent {
   private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.CompilerConfiguration");
   @NonNls public static final String TESTS_EXTERNAL_COMPILER_HOME_PROPERTY_NAME = "tests.external.compiler.home";
-  public static final int DEPENDENCY_FORMAT_VERSION = 55;
 
   @SuppressWarnings({"WeakerAccess"}) public String DEFAULT_COMPILER;
   @NotNull private BackendCompiler myDefaultJavaCompiler;
@@ -128,33 +120,6 @@
         myProcessorsProfilesMap = null; // clear cache
       }
     });
-
-    connection.subscribe(ExternalBuildOptionListener.TOPIC, new ExternalBuildOptionListener() {
-      @Override
-      public void externalBuildOptionChanged(boolean externalBuildEnabled) {
-    // this will schedule for compilation all files that might become compilable after resource patterns' changing
-        final TranslatingCompilerFilesMonitor monitor = TranslatingCompilerFilesMonitor.getInstance();
-        if (externalBuildEnabled) {
-          monitor.suspendProject(myProject);
-        }
-        else {
-          monitor.watchProject(myProject);
-          monitor.scanSourcesForCompilableFiles(myProject);
-          if (!myProject.isDefault()) {
-            final File buildSystem = BuildManager.getInstance().getBuildSystemDirectory();
-            final File[] subdirs = buildSystem.listFiles();
-            if (subdirs != null) {
-              final String prefix = myProject.getName().toLowerCase(Locale.US) + "_";
-              for (File subdir : subdirs) {
-                if (subdir.getName().startsWith(prefix)) {
-                  FileUtil.asyncDelete(subdir);
-                }
-              }
-            }
-          }
-        }
-      }
-    });
   }
 
   public Element getState() {
@@ -290,35 +255,14 @@
     myRegisteredCompilers.add(JAVAC_EXTERNAL_BACKEND);
 
     if (!ApplicationManager.getApplication().isUnitTestMode()) {
-      //final BackendCompiler JIKES_BACKEND = new JikesCompiler(myProject);
-      //myRegisteredCompilers.add(JIKES_BACKEND);
-
       if (EclipseCompiler.isInitialized()) {
         final EclipseCompiler eclipse = new EclipseCompiler(myProject);
         myRegisteredCompilers.add(eclipse);
       }
-
-      if (ApplicationManagerEx.getApplicationEx().isInternal()) {
-        try {
-          final EclipseEmbeddedCompiler eclipseEmbedded = new EclipseEmbeddedCompiler(myProject);
-          myRegisteredCompilers.add(eclipseEmbedded);
-        }
-        catch (NoClassDefFoundError e) {
-          // eclipse jar must be not in the classpath
-        }
-        try {
-          CompilerAPICompiler inProcessJavaCompiler = new CompilerAPICompiler(myProject);
-          myRegisteredCompilers.add(inProcessJavaCompiler);
-        }
-        catch (NoClassDefFoundError e) {
-          // wrong JDK
-        }
-      }
     }
 
-    final BackendCompiler[] compilers = Extensions.getExtensions(BackendCompiler.EP_NAME, myProject);
     final Set<FileType> types = new HashSet<FileType>();
-    for (BackendCompiler compiler : compilers) {
+    for (BackendCompiler compiler : Extensions.getExtensions(BackendCompiler.EP_NAME, myProject)) {
       myRegisteredCompilers.add(compiler);
       types.addAll(compiler.getCompilableFileTypes());
     }
@@ -327,7 +271,7 @@
     for (FileType type : types) {
       compilerManager.addCompilableFileType(type);
     }
-
+    
     myDefaultJavaCompiler = JAVAC_EXTERNAL_BACKEND;
     for (BackendCompiler compiler : myRegisteredCompilers) {
       if (compiler.getId().equals(DEFAULT_COMPILER)) {
@@ -757,7 +701,7 @@
         continue;
       }
       final String dir = moduleElement.getAttributeValue("generatedDirName", (String)null);
-      modulesToProcess.add(Couple.newOne(name, dir));
+      modulesToProcess.add(Couple.of(name, dir));
     }
 
     myDefaultProcessorsProfile.setEnabled(false);
diff --git a/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java b/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java
index 64356bf..5cb7a24 100644
--- a/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java
+++ b/java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java
@@ -16,10 +16,6 @@
 package com.intellij.compiler;
 
 import com.intellij.compiler.impl.*;
-import com.intellij.compiler.impl.javaCompiler.AnnotationProcessingCompiler;
-import com.intellij.compiler.impl.javaCompiler.JavaCompiler;
-import com.intellij.compiler.impl.resourceCompiler.ResourceCompiler;
-import com.intellij.compiler.impl.rmiCompiler.RmicCompiler;
 import com.intellij.openapi.Disposable;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.compiler.*;
@@ -34,12 +30,6 @@
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.Chunk;
-import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.graph.CachingSemiGraph;
-import com.intellij.util.graph.Graph;
-import com.intellij.util.graph.GraphGenerator;
 import com.intellij.util.messages.MessageBus;
 import com.intellij.util.messages.MessageBusConnection;
 import org.jetbrains.annotations.NotNull;
@@ -54,28 +44,20 @@
   private final Project myProject;
 
   private final List<Compiler> myCompilers = new ArrayList<Compiler>();
-  private final List<TranslatingCompiler> myTranslators = new ArrayList<TranslatingCompiler>();
 
   private final List<CompileTask> myBeforeTasks = new ArrayList<CompileTask>();
   private final List<CompileTask> myAfterTasks = new ArrayList<CompileTask>();
   private final Set<FileType> myCompilableTypes = new HashSet<FileType>();
   private final CompilationStatusListener myEventPublisher;
   private final Semaphore myCompilationSemaphore = new Semaphore(1, true);
-  private final Map<Compiler, Set<FileType>> myCompilerToInputTypes = new HashMap<Compiler, Set<FileType>>();
-  private final Map<Compiler, Set<FileType>> myCompilerToOutputTypes = new HashMap<Compiler, Set<FileType>>();
   private final Set<ModuleType> myValidationDisabledModuleTypes = new HashSet<ModuleType>();
   private final Set<LocalFileSystem.WatchRequest> myWatchRoots;
 
-  public CompilerManagerImpl(final Project project, CompilerConfigurationImpl compilerConfiguration, MessageBus messageBus) {
+  public CompilerManagerImpl(final Project project, MessageBus messageBus) {
     myProject = project;
     myEventPublisher = messageBus.syncPublisher(CompilerTopics.COMPILATION_STATUS);
 
     // predefined compilers
-    addTranslatingCompiler(new AnnotationProcessingCompiler(project), new HashSet<FileType>(Arrays.asList(StdFileTypes.JAVA)), new HashSet<FileType>(Arrays.asList(StdFileTypes.JAVA, StdFileTypes.CLASS)));
-    addTranslatingCompiler(new JavaCompiler(project), new HashSet<FileType>(Arrays.asList(StdFileTypes.JAVA)), new HashSet<FileType>(Arrays.asList(StdFileTypes.CLASS)));
-    addCompiler(new ResourceCompiler(project, compilerConfiguration));
-    addCompiler(new RmicCompiler());
-
     for(Compiler compiler: Extensions.getExtensions(Compiler.EP_NAME, myProject)) {
       addCompiler(compiler);
     }
@@ -87,7 +69,7 @@
     }
 
     addCompilableFileType(StdFileTypes.JAVA);
-
+    
     final File projectGeneratedSrcRoot = CompilerPaths.getGeneratedDataDirectory(project);
     projectGeneratedSrcRoot.mkdirs();
     final LocalFileSystem lfs = LocalFileSystem.getInstance();
@@ -100,28 +82,6 @@
         }
       }
     });
-
-    //
-    //addCompiler(new DummyTransformingCompiler()); // this one is for testing purposes only
-    //addCompiler(new DummySourceGeneratingCompiler(myProject)); // this one is for testing purposes only
-    /*
-    // for testing only
-    ApplicationManager.getApplication().invokeLater(new Runnable() {
-      public void run() {
-        ApplicationManager.getApplication().runWriteAction(new Runnable() {
-          public void run() {
-            FileTypeManager.getInstance().registerFileType(DummyTranslatingCompiler.INPUT_FILE_TYPE, DummyTranslatingCompiler.FILETYPE_EXTENSION);
-            addTranslatingCompiler(
-              new DummyTranslatingCompiler(),
-              new HashSet<FileType>(Arrays.asList(DummyTranslatingCompiler.INPUT_FILE_TYPE)),
-              new HashSet<FileType>(Arrays.asList( StdFileTypes.JAVA))
-            );
-          }
-        });
-
-      }
-    });
-    */
   }
 
   public Semaphore getCompilationSemaphore() {
@@ -132,68 +92,32 @@
     return myCompilationSemaphore.availablePermits() == 0;
   }
 
-  public void addTranslatingCompiler(@NotNull final TranslatingCompiler compiler, final Set<FileType> inputTypes, final Set<FileType> outputTypes) {
-    myTranslators.add(compiler);
-    myCompilerToInputTypes.put(compiler, inputTypes);
-    myCompilerToOutputTypes.put(compiler, outputTypes);
-
-    final List<Chunk<Compiler>> chunks = ModuleCompilerUtil.getSortedChunks(createCompilerGraph((List<Compiler>)(List)myTranslators));
-
-    myTranslators.clear();
-    for (Chunk<Compiler> chunk : chunks) {
-      for (Compiler chunkCompiler : chunk.getNodes()) {
-        myTranslators.add((TranslatingCompiler)chunkCompiler);
-      }
-    }
-  }
-
-  @NotNull
-  public Set<FileType> getRegisteredInputTypes(@NotNull final TranslatingCompiler compiler) {
-    final Set<FileType> inputs = myCompilerToInputTypes.get(compiler);
-    return inputs != null? Collections.unmodifiableSet(inputs) : Collections.<FileType>emptySet();
-  }
-
-  @NotNull
-  public Set<FileType> getRegisteredOutputTypes(@NotNull final TranslatingCompiler compiler) {
-    final Set<FileType> outs = myCompilerToOutputTypes.get(compiler);
-    return outs != null? Collections.unmodifiableSet(outs) : Collections.<FileType>emptySet();
-  }
-
   public final void addCompiler(@NotNull Compiler compiler) {
-    if (compiler instanceof TranslatingCompiler) {
-      myTranslators.add((TranslatingCompiler)compiler);
+    myCompilers.add(compiler);
+    // supporting file instrumenting compilers and validators for external build
+    // Since these compilers are IDE-specific and use PSI, it is ok to run them before and after the build in the IDE
+    if (compiler instanceof SourceInstrumentingCompiler) {
+      addBeforeTask(new FileProcessingCompilerAdapterTask((FileProcessingCompiler)compiler));
     }
-    else {
-      myCompilers.add(compiler);
-      // supporting file instrumenting compilers and validators for external build
-      // Since these compilers are IDE-specific and use PSI, it is ok to run them before and after the build in the IDE
-      if (compiler instanceof SourceInstrumentingCompiler) {
-        addBeforeTask(new FileProcessingCompilerAdapterTask((FileProcessingCompiler)compiler));
-      }
-      else if (compiler instanceof Validator) {
-        addAfterTask(new FileProcessingCompilerAdapterTask((FileProcessingCompiler)compiler));
-      }
+    else if (compiler instanceof Validator) {
+      addAfterTask(new FileProcessingCompilerAdapterTask((FileProcessingCompiler)compiler));
     }
   }
 
+  @Deprecated
+  public void addTranslatingCompiler(@NotNull TranslatingCompiler compiler, Set<FileType> inputTypes, Set<FileType> outputTypes) {
+    // empty
+  }
+
   public final void removeCompiler(@NotNull Compiler compiler) {
-    if (compiler instanceof TranslatingCompiler) {
-      myTranslators.remove(compiler);
-    }
-    else {
-      if (myCompilers.remove(compiler)) {
-        for (List<CompileTask> tasks : Arrays.asList(myBeforeTasks, myAfterTasks)) {
-          for (Iterator<CompileTask> iterator = tasks.iterator(); iterator.hasNext(); ) {
-            CompileTask task = iterator.next();
-            if (task instanceof FileProcessingCompilerAdapterTask && ((FileProcessingCompilerAdapterTask)task).getCompiler() == compiler) {
-              iterator.remove();
-            }
-          }
+    for (List<CompileTask> tasks : Arrays.asList(myBeforeTasks, myAfterTasks)) {
+      for (Iterator<CompileTask> iterator = tasks.iterator(); iterator.hasNext(); ) {
+        CompileTask task = iterator.next();
+        if (task instanceof FileProcessingCompilerAdapterTask && ((FileProcessingCompilerAdapterTask)task).getCompiler() == compiler) {
+          iterator.remove();
         }
       }
     }
-    myCompilerToInputTypes.remove(compiler);
-    myCompilerToOutputTypes.remove(compiler);
   }
 
   @NotNull
@@ -209,11 +133,6 @@
         compilers.add((T)item);
       }
     }
-    for (final Compiler item : myTranslators) {
-      if (compilerClass.isAssignableFrom(item.getClass()) && filter.acceptCompiler(item)) {
-        compilers.add((T)item);
-      }
-    }
     final T[] array = (T[])Array.newInstance(compilerClass, compilers.size());
     return compilers.toArray(array);
   }
@@ -263,11 +182,11 @@
   }
 
   public void compile(@NotNull Module module, CompileStatusNotification callback) {
-    new CompileDriver(myProject).compile(createModuleCompileScope(module, false), new ListenerNotificator(callback), true);
+    new CompileDriver(myProject).compile(createModuleCompileScope(module, false), new ListenerNotificator(callback));
   }
 
   public void compile(@NotNull CompileScope scope, CompileStatusNotification callback) {
-    new CompileDriver(myProject).compile(scope, new ListenerNotificator(callback), false);
+    new CompileDriver(myProject).compile(scope, new ListenerNotificator(callback));
   }
 
   public void make(CompileStatusNotification callback) {
@@ -326,66 +245,10 @@
     }
   }
 
-  // Compiler tests support
-
-  private static List<String> ourDeletedPaths;
-  private static List<String> ourRecompiledPaths;
-  private static List<String> ourCompiledPaths;
-
-  public static void testSetup() {
-    ourDeletedPaths = new ArrayList<String>();
-    ourRecompiledPaths = new ArrayList<String>();
-    ourCompiledPaths = new ArrayList<String>();
-  }
-
-  public static void addDeletedPath(String path) {
-    ourDeletedPaths.add(path);
-  }
-
-  public static void addRecompiledPath(String path) {
-    ourRecompiledPaths.add(path);
-  }
-
-  public static void addCompiledPath(String path) {
-    ourCompiledPaths.add(path);
-  }
-
-  public static String[] getPathsToDelete() {
-    return ArrayUtil.toStringArray(ourDeletedPaths);
-  }
-
-  public static String[] getPathsToRecompile() {
-    return ArrayUtil.toStringArray(ourRecompiledPaths);
-  }
-
-  public static String[] getPathsToCompile() {
-    return ArrayUtil.toStringArray(ourCompiledPaths);
-  }
-
-  public static void clearPathsToCompile() {
-    if (ourCompiledPaths != null) {
-      ourCompiledPaths.clear();
-    }
-  }
-
   public boolean isExcludedFromCompilation(@NotNull VirtualFile file) {
     return CompilerConfiguration.getInstance(myProject).isExcludedFromCompilation(file);
   }
 
-  private static final OutputToSourceMapping OUTPUT_TO_SOURCE_MAPPING = new OutputToSourceMapping() {
-    public String getSourcePath(final String outputPath) {
-      final LocalFileSystem lfs = LocalFileSystem.getInstance();
-      final VirtualFile outputFile = lfs.findFileByPath(outputPath);
-
-      final VirtualFile sourceFile = outputFile != null ? TranslatingCompilerFilesMonitor.getSourceFileByOutput(outputFile) : null;
-      return sourceFile != null? sourceFile.getPath() : null;
-    }
-  };
-  @NotNull
-  public OutputToSourceMapping getJavaCompilerOutputMapping() {
-    return OUTPUT_TO_SOURCE_MAPPING;
-  }
-
   @NotNull
   public CompileScope createFilesCompileScope(@NotNull final VirtualFile[] files) {
     CompileScope[] scopes = new CompileScope[files.length];
@@ -438,32 +301,6 @@
     return !myValidationDisabledModuleTypes.contains(ModuleType.get(module));
   }
 
-  private Graph<Compiler> createCompilerGraph(final List<Compiler> compilers) {
-    return GraphGenerator.create(CachingSemiGraph.create(new GraphGenerator.SemiGraph<Compiler>() {
-      public Collection<Compiler> getNodes() {
-        return compilers;
-      }
-
-      public Iterator<Compiler> getIn(Compiler compiler) {
-        final Set<FileType> compilerInput = myCompilerToInputTypes.get(compiler);
-        if (compilerInput == null || compilerInput.isEmpty()) {
-          return Collections.<Compiler>emptySet().iterator();
-        }
-
-        final Set<Compiler> inCompilers = new HashSet<Compiler>();
-
-        for (Map.Entry<Compiler, Set<FileType>> entry : myCompilerToOutputTypes.entrySet()) {
-          final Set<FileType> outputs = entry.getValue();
-          Compiler comp = entry.getKey();
-          if (outputs != null && ContainerUtil.intersects(compilerInput, outputs)) {
-            inCompilers.add(comp);
-          }
-        }
-        return inCompilers.iterator();
-      }
-    }));
-  }
-  
   private class ListenerNotificator implements CompileStatusNotification {
     private final @Nullable CompileStatusNotification myDelegate;
 
diff --git a/java/compiler/impl/src/com/intellij/compiler/CompilerSettingsUsageCollector.java b/java/compiler/impl/src/com/intellij/compiler/CompilerSettingsUsageCollector.java
index 06bf055..7110947 100644
--- a/java/compiler/impl/src/com/intellij/compiler/CompilerSettingsUsageCollector.java
+++ b/java/compiler/impl/src/com/intellij/compiler/CompilerSettingsUsageCollector.java
@@ -23,7 +23,6 @@
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -38,12 +37,8 @@
   @Override
   public Set<UsageDescriptor> getUsages(@Nullable Project project) throws CollectUsagesException {
     final CompilerWorkspaceConfiguration wsConfig = CompilerWorkspaceConfiguration.getInstance(project);
-    if (!wsConfig.useOutOfProcessBuild()) {
-      return Collections.emptySet();
-    }
     
     final Set<UsageDescriptor> result = new HashSet<UsageDescriptor>();
-    result.add(new UsageDescriptor("external_build", 1));
     if (wsConfig.MAKE_PROJECT_ON_SAVE) {
       result.add(new UsageDescriptor("auto_make", 1));
     }
diff --git a/java/compiler/impl/src/com/intellij/compiler/DependencyProcessor.java b/java/compiler/impl/src/com/intellij/compiler/DependencyProcessor.java
deleted file mode 100644
index 3907eb8..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/DependencyProcessor.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.compiler;
-
-import com.intellij.compiler.make.CacheCorruptedException;
-import com.intellij.compiler.make.CachingSearcher;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.extensions.ExtensionPointName;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Aug 19, 2008
- */
-public interface DependencyProcessor {
-  ExtensionPointName<DependencyProcessor> EXTENSION_POINT_NAME = ExtensionPointName.create("com.intellij.compiler.makeDependencyProcessor");
-  
-  void processDependencies(CompileContext context, int classQualifiedName, CachingSearcher searcher) throws CacheCorruptedException;
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/OutputParser.java b/java/compiler/impl/src/com/intellij/compiler/OutputParser.java
index 37f6882..8897a24 100644
--- a/java/compiler/impl/src/com/intellij/compiler/OutputParser.java
+++ b/java/compiler/impl/src/com/intellij/compiler/OutputParser.java
@@ -15,7 +15,6 @@
  */
 package com.intellij.compiler;
 
-import com.intellij.compiler.impl.javaCompiler.FileObject;
 import com.intellij.openapi.compiler.CompilerMessageCategory;
 import com.intellij.openapi.util.text.StringUtil;
 import org.jetbrains.annotations.NonNls;
@@ -27,12 +26,12 @@
   protected final List<ParserAction> myParserActions = new ArrayList<ParserAction>(10);
 
   public interface Callback {
-    @NonNls String getNextLine();        
-    @NonNls String getCurrentLine();
+    String getNextLine();        
+    String getCurrentLine();
     void pushBack(String line);
     void setProgressText(String text);
-    void fileProcessed(@NonNls String path);
-    void fileGenerated(@NonNls FileObject path);
+    void fileProcessed(String path);
+    void fileGenerated(String path);
     void message(CompilerMessageCategory category, String message, @NonNls String url, int lineNum, int columnNum);
   }
 
@@ -65,8 +64,4 @@
   protected static void addMessage(Callback callback, CompilerMessageCategory type, String text, String url, int line, int column){
     callback.message(type, text, url, line, column);
   }
-
-  public boolean isTrimLines() {
-    return true;
-  }
 }
\ No newline at end of file
diff --git a/java/compiler/impl/src/com/intellij/compiler/SymbolTable.java b/java/compiler/impl/src/com/intellij/compiler/SymbolTable.java
deleted file mode 100644
index 48603f5..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/SymbolTable.java
+++ /dev/null
@@ -1,121 +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: Eugene Zhuravlev
- * Date: Mar 3, 2003
- * Time: 12:34:44 PM
- */
-package com.intellij.compiler;
-
-import com.intellij.compiler.make.CacheCorruptedException;
-import com.intellij.openapi.compiler.CompilerBundle;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.util.containers.SLRUCache;
-import com.intellij.util.io.PersistentEnumerator;
-import com.intellij.util.io.PersistentStringEnumerator;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-import java.io.IOException;
-
-public class SymbolTable {
-  private final PersistentStringEnumerator myTrie;
-
-  // both caches should have equal size
-  private static final int STRING_CACHE_SIZE = 1024;
-
-  private final SLRUCache<Integer, String> myIndexStringCache = new SLRUCache<Integer, String>(STRING_CACHE_SIZE * 2, STRING_CACHE_SIZE) {
-    @NotNull
-    public String createValue(Integer key) {
-      try {
-        return myTrie.valueOf(key.intValue());
-      }
-      catch (IOException e) {
-        throw new RuntimeException(e);
-      }
-    }
-  };
-  
-  private final SLRUCache<String, Integer> myStringIndexCache = new SLRUCache<String, Integer>(STRING_CACHE_SIZE * 2, STRING_CACHE_SIZE) {
-    @NotNull
-    public Integer createValue(String key) {
-      try {
-        return myTrie.enumerate(key);
-      }
-      catch (IOException e) {
-        throw new RuntimeException(e);
-      }
-    }
-  };
-
-
-  public SymbolTable(File file) throws CacheCorruptedException {
-    try {
-      if (!file.exists()) {
-        FileUtil.createIfDoesntExist(file);
-      }
-      myTrie = new PersistentStringEnumerator(file);
-    }
-    catch (PersistentEnumerator.CorruptedException e) {
-      throw new CacheCorruptedException(CompilerBundle.message("error.compiler.caches.corrupted"), e);
-    }
-    catch (IOException e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public synchronized int getId(@NotNull String symbol) throws CacheCorruptedException {
-    if (symbol.length() == 0) {
-      return -1;
-    }
-    try {
-      return myStringIndexCache.get(symbol);
-    }
-    catch (RuntimeException e) {
-      if (e.getCause() instanceof IOException) {
-        throw new CacheCorruptedException(e.getCause());
-      }
-      throw e;
-    }
-  }
-
-  public synchronized String getSymbol(int id) throws CacheCorruptedException {
-    if (id == -1) {
-      return "";
-    }
-    try {
-      return myIndexStringCache.get(id);
-    }
-    catch (RuntimeException e) {
-      if (e.getCause() instanceof IOException) {
-        throw new CacheCorruptedException(e.getCause());
-      }
-      throw e;
-    }
-  }
-
-  public synchronized void dispose() throws CacheCorruptedException {
-    try {
-      myIndexStringCache.clear();
-      myStringIndexCache.clear();
-      myTrie.close(); // will call "flush()" if needed
-    }
-    catch (IOException e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/actions/BuildArtifactAction.java b/java/compiler/impl/src/com/intellij/compiler/actions/BuildArtifactAction.java
index ca18aca..a77064f 100644
--- a/java/compiler/impl/src/com/intellij/compiler/actions/BuildArtifactAction.java
+++ b/java/compiler/impl/src/com/intellij/compiler/actions/BuildArtifactAction.java
@@ -15,7 +15,6 @@
  */
 package com.intellij.compiler.actions;
 
-import com.intellij.compiler.CompilerWorkspaceConfiguration;
 import com.intellij.notification.NotificationGroup;
 import com.intellij.notification.NotificationType;
 import com.intellij.openapi.actionSystem.AnActionEvent;
@@ -126,13 +125,8 @@
     final CompileScope scope = ArtifactCompileScope.createArtifactsScope(project, artifacts, rebuild);
 
     ArtifactsWorkspaceSettings.getInstance(project).setArtifactsToBuild(artifacts);
-    if (!rebuild || CompilerWorkspaceConfiguration.getInstance(project).useOutOfProcessBuild()) {
-      //in external build we can set 'rebuild' flag per target type
-      CompilerManager.getInstance(project).make(scope, null);
-    }
-    else {
-      CompilerManager.getInstance(project).compile(scope, null);
-    }
+    //in external build we can set 'rebuild' flag per target type
+    CompilerManager.getInstance(project).make(scope, null);
   }
 
   private static Set<Artifact> getArtifacts(final List<ArtifactPopupItem> items, final Project project) {
diff --git a/java/compiler/impl/src/com/intellij/compiler/actions/ProcessAnnotationsAction.java b/java/compiler/impl/src/com/intellij/compiler/actions/ProcessAnnotationsAction.java
deleted file mode 100644
index eae7060..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/actions/ProcessAnnotationsAction.java
+++ /dev/null
@@ -1,208 +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.compiler.actions;
-
-import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.compiler.CompilerWorkspaceConfiguration;
-import com.intellij.compiler.impl.FileSetCompileScope;
-import com.intellij.compiler.impl.ModuleCompileScope;
-import com.intellij.compiler.impl.javaCompiler.AnnotationProcessingCompiler;
-import com.intellij.compiler.impl.resourceCompiler.ResourceCompiler;
-import com.intellij.idea.ActionsBundle;
-import com.intellij.openapi.actionSystem.*;
-import com.intellij.openapi.compiler.CompilerBundle;
-import com.intellij.openapi.compiler.CompilerFilter;
-import com.intellij.openapi.compiler.CompilerManager;
-import com.intellij.openapi.fileTypes.FileType;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.ProjectFileIndex;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.*;
-import com.intellij.util.containers.ContainerUtil;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jps.model.java.compiler.AnnotationProcessingConfiguration;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-public class ProcessAnnotationsAction extends CompileActionBase {
-
-  protected void doAction(DataContext dataContext, Project project) {
-    final Module module = LangDataKeys.MODULE_CONTEXT.getData(dataContext);
-    final CompilerFilter filter = new CompilerFilter() {
-      public boolean acceptCompiler(com.intellij.openapi.compiler.Compiler compiler) {
-        // EclipseLink CanonicalModelProcessor reads input from output hence adding ResourcesCompiler
-        return compiler instanceof AnnotationProcessingCompiler || compiler instanceof ResourceCompiler;
-      }
-    };
-    if (module != null) {
-      CompilerManager.getInstance(project).make(new ModuleCompileScope(module, false), filter, null);
-    }
-    else {
-      final FileSetCompileScope scope = getCompilableFiles(project, CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext));
-      if (scope != null) {
-        CompilerManager.getInstance(project).make(scope, filter, null);
-      }
-    }
-  }
-
-  public void update(AnActionEvent event) {
-    super.update(event);
-    Presentation presentation = event.getPresentation();
-    if (!presentation.isEnabled()) {
-      return;
-    }
-    DataContext dataContext = event.getDataContext();
-    presentation.setVisible(false);
-
-    Project project = CommonDataKeys.PROJECT.getData(dataContext);
-    if (project == null) {
-      presentation.setEnabled(false);
-      return;
-    }
-
-    if (CompilerWorkspaceConfiguration.getInstance(project).useOutOfProcessBuild()) {
-      presentation.setEnabled(false);
-      return;
-    }
-    
-    final CompilerConfiguration compilerConfiguration = CompilerConfiguration.getInstance(project);
-    
-    final Module module = LangDataKeys.MODULE.getData(dataContext);
-    final Module moduleContext = LangDataKeys.MODULE_CONTEXT.getData(dataContext);
-
-    if (module == null) {
-      presentation.setEnabled(false);
-      return;
-    }
-    final AnnotationProcessingConfiguration profile = compilerConfiguration.getAnnotationProcessingConfiguration(module);
-    if (!profile.isEnabled() || (!profile.isObtainProcessorsFromClasspath() && profile.getProcessors().isEmpty())) {
-      presentation.setEnabled(false);
-      return;
-    }
-
-    presentation.setVisible(true);
-    presentation.setText(createPresentationText(""), true);
-    final FileSetCompileScope scope = getCompilableFiles(project, CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext));
-    if (moduleContext == null && scope == null) {
-      presentation.setEnabled(false);
-      return;
-    }
-
-    String elementDescription = null;
-    if (moduleContext != null) {
-      elementDescription = CompilerBundle.message("action.compile.description.module", moduleContext.getName());
-    }
-    else {
-      PsiPackage aPackage = null;
-      final Collection<VirtualFile> files = scope.getRootFiles();
-      if (files.size() == 1) {
-        final PsiDirectory directory = PsiManager.getInstance(project).findDirectory(files.iterator().next());
-        if (directory != null) {
-          aPackage = JavaDirectoryService.getInstance().getPackage(directory);
-        }
-      }
-      else {
-        PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
-        if (element instanceof PsiPackage) {
-          aPackage = (PsiPackage)element;
-        }
-      }
-
-      if (aPackage != null) {
-        String name = aPackage.getQualifiedName();
-        if (name.length() == 0) {
-          //noinspection HardCodedStringLiteral
-          name = "<default>";
-        }
-        elementDescription = "'" + name + "'";
-      }
-      else if (files.size() == 1) {
-        final VirtualFile file = files.iterator().next();
-        FileType fileType = file.getFileType();
-        if (CompilerManager.getInstance(project).isCompilableFileType(fileType)) {
-          elementDescription = "'" + file.getName() + "'";
-        }
-        else {
-          if (!ActionPlaces.MAIN_MENU.equals(event.getPlace())) {
-            // the action should be invisible in popups for non-java files
-            presentation.setEnabled(false);
-            presentation.setVisible(false);
-            return;
-          }
-        }
-      }
-      else {
-        elementDescription = CompilerBundle.message("action.compile.description.selected.files");
-      }
-    }
-
-    if (elementDescription == null) {
-      presentation.setEnabled(false);
-      return;
-    }
-
-    presentation.setText(createPresentationText(elementDescription), true);
-    presentation.setEnabled(true);
-  }
-
-  private static String createPresentationText(final String elementDescription) {
-    int length = elementDescription.length();
-    String target = length > 23 ? (StringUtil.startsWithChar(elementDescription, '\'') ? "'..." : "...") + elementDescription.substring(length - 20, length) : elementDescription;
-    return MessageFormat.format(ActionsBundle.actionText(StringUtil.isEmpty(target)? "RunAPT" : "RunAPT.1"), target);
-  }
-
-  @Nullable
-  private static FileSetCompileScope getCompilableFiles(Project project, VirtualFile[] files) {
-    if (files == null || files.length == 0) {
-      return null;
-    }
-    final PsiManager psiManager = PsiManager.getInstance(project);
-    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
-    final CompilerManager compilerManager = CompilerManager.getInstance(project);
-    final List<VirtualFile> filesToCompile = new ArrayList<VirtualFile>();
-    final List<Module> affectedModules = new ArrayList<Module>();
-    for (final VirtualFile file : files) {
-      if (!fileIndex.isInSourceContent(file)) {
-        continue;
-      }
-      if (!file.isInLocalFileSystem()) {
-        continue;
-      }
-      if (file.isDirectory()) {
-        final PsiDirectory directory = psiManager.findDirectory(file);
-        if (directory == null || JavaDirectoryService.getInstance().getPackage(directory) == null) {
-          continue;
-        }
-      }
-      else {
-        FileType fileType = file.getFileType();
-        if (!(compilerManager.isCompilableFileType(fileType))) {
-          continue;
-        }
-      }
-      filesToCompile.add(file);
-      ContainerUtil.addIfNotNull(fileIndex.getModuleForFile(file), affectedModules);
-    }
-    if (filesToCompile.isEmpty()) return null;
-    return new FileSetCompileScope(filesToCompile, affectedModules.toArray(new Module[affectedModules.size()]));
-  }
-}
\ No newline at end of file
diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/BuildPropertiesImpl.java b/java/compiler/impl/src/com/intellij/compiler/ant/BuildPropertiesImpl.java
index 8c517df..fccf0c2 100644
--- a/java/compiler/impl/src/com/intellij/compiler/ant/BuildPropertiesImpl.java
+++ b/java/compiler/impl/src/com/intellij/compiler/ant/BuildPropertiesImpl.java
@@ -115,11 +115,11 @@
         javac2.add(new PathElement(propertyRelativePath(PROPERTY_JAVAC2_HOME, "jgoodies-forms.jar")));
         add(javac2);
         //noinspection HardCodedStringLiteral
-        register.add(new Tag("taskdef", Couple.newOne("name", "javac2"), Couple.newOne("classname", "com.intellij.ant.Javac2"),
-                             Couple.newOne("classpathref", PROPERTY_JAVAC2_CLASSPATH_ID)));
-        register.add(new Tag("taskdef", Couple.newOne("name", "instrumentIdeaExtensions"),
-                             Couple.newOne("classname", "com.intellij.ant.InstrumentIdeaExtensions"),
-                             Couple.newOne("classpathref", PROPERTY_JAVAC2_CLASSPATH_ID)));
+        register.add(new Tag("taskdef", Couple.of("name", "javac2"), Couple.of("classname", "com.intellij.ant.Javac2"),
+                             Couple.of("classpathref", PROPERTY_JAVAC2_CLASSPATH_ID)));
+        register.add(new Tag("taskdef", Couple.of("name", "instrumentIdeaExtensions"),
+                             Couple.of("classname", "com.intellij.ant.InstrumentIdeaExtensions"),
+                             Couple.of("classpathref", PROPERTY_JAVAC2_CLASSPATH_ID)));
       }
       if (customCompilers.length > 0) {
         for (ChunkCustomCompilerExtension ext : customCompilers) {
diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/CompileModuleChunkTarget.java b/java/compiler/impl/src/com/intellij/compiler/ant/CompileModuleChunkTarget.java
index b8ec7db..f31f05c 100644
--- a/java/compiler/impl/src/com/intellij/compiler/ant/CompileModuleChunkTarget.java
+++ b/java/compiler/impl/src/com/intellij/compiler/ant/CompileModuleChunkTarget.java
@@ -42,14 +42,14 @@
                                   GenerationOptions genOptions) {
     final String moduleChunkName = moduleChunk.getName();
     //noinspection HardCodedStringLiteral
-    final Tag compilerArgs = new Tag("compilerarg", Couple.newOne("line", BuildProperties.propertyRef(
+    final Tag compilerArgs = new Tag("compilerarg", Couple.of("line", BuildProperties.propertyRef(
       BuildProperties.getModuleChunkCompilerArgsProperty(moduleChunkName))));
     //noinspection HardCodedStringLiteral
-    final Couple<String> classpathRef = Couple.newOne("refid", BuildProperties.getClasspathProperty(moduleChunkName));
+    final Couple<String> classpathRef = Couple.of("refid", BuildProperties.getClasspathProperty(moduleChunkName));
     final Tag classpathTag = new Tag("classpath", classpathRef);
     //noinspection HardCodedStringLiteral
     final Tag bootclasspathTag =
-      new Tag("bootclasspath", Couple.newOne("refid", BuildProperties.getBootClasspathProperty(moduleChunkName)));
+      new Tag("bootclasspath", Couple.of("refid", BuildProperties.getBootClasspathProperty(moduleChunkName)));
     final PatternSetRef compilerExcludes = new PatternSetRef(BuildProperties.getExcludedFromCompilationProperty(moduleChunkName));
 
     final String mainTargetName = BuildProperties.getCompileTargetName(moduleChunkName);
@@ -82,7 +82,7 @@
 
     if (sourceRoots.length > 0) {
       final String outputPathRef = BuildProperties.propertyRef(BuildProperties.getOutputPathProperty(moduleChunkName));
-      final Tag srcTag = new Tag("src", Couple.newOne("refid", BuildProperties.getSourcepathProperty(moduleChunkName)));
+      final Tag srcTag = new Tag("src", Couple.of("refid", BuildProperties.getSourcepathProperty(moduleChunkName)));
       productionTarget.add(new Mkdir(outputPathRef));
       createCustomCompilerTasks(project, moduleChunk, genOptions, false, customCompilers, compilerArgs, bootclasspathTag,
                                 classpathTag, compilerExcludes, srcTag, outputPathRef, productionTarget);
@@ -101,8 +101,8 @@
     if (testSourceRoots.length > 0) {
 
       final String testOutputPathRef = BuildProperties.propertyRef(BuildProperties.getOutputPathForTestsProperty(moduleChunkName));
-      final Tag srcTag = new Tag("src", Couple.newOne("refid", BuildProperties.getTestSourcepathProperty(moduleChunkName)));
-      final Couple<String> testClasspathRef = Couple.newOne("refid", BuildProperties.getTestClasspathProperty(moduleChunkName));
+      final Tag srcTag = new Tag("src", Couple.of("refid", BuildProperties.getTestSourcepathProperty(moduleChunkName)));
+      final Couple<String> testClasspathRef = Couple.of("refid", BuildProperties.getTestClasspathProperty(moduleChunkName));
       final Tag testClassPath = new Tag("classpath", testClasspathRef);
       testsTarget.add(new Mkdir(testOutputPathRef));
       createCustomCompilerTasks(project, moduleChunk, genOptions, true, customCompilers, compilerArgs, bootclasspathTag,
@@ -153,7 +153,7 @@
                                                 String outputPathRef,
                                                 Target target) {
     if (customCompilers.length > 1) {
-      target.add(new Tag("fail", Couple.newOne("message", CompilerBundle.message(
+      target.add(new Tag("fail", Couple.of("message", CompilerBundle.message(
         "generated.ant.build.compile.modules.fail.custom.compilers"))));
     }
     for (ChunkCustomCompilerExtension ext : customCompilers) {
@@ -182,7 +182,7 @@
                                           File baseDir,
                                           final GenerationOptions genOptions) {
     //noinspection HardCodedStringLiteral
-    final Tag filesSelector = new Tag("type", Couple.newOne("type", "file"));
+    final Tag filesSelector = new Tag("type", Couple.of("type", "file"));
     final PatternSetRef excludes = CompilerExcludes.isAvailable(project) ? new PatternSetRef(
       BuildProperties.getExcludedFromCompilationProperty(chunk.getName())) : null;
     final PatternSetRef resourcePatternsPatternSet = new PatternSetRef(BuildProperties.PROPERTY_COMPILER_RESOURCE_PATTERNS);
diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/PropertyFileGeneratorImpl.java b/java/compiler/impl/src/com/intellij/compiler/ant/PropertyFileGeneratorImpl.java
index 00509d5..0cb7e10 100644
--- a/java/compiler/impl/src/com/intellij/compiler/ant/PropertyFileGeneratorImpl.java
+++ b/java/compiler/impl/src/com/intellij/compiler/ant/PropertyFileGeneratorImpl.java
@@ -85,7 +85,7 @@
   }
 
   public void addProperty(String name, String value) {
-    myProperties.add(Couple.newOne(name, value));
+    myProperties.add(Couple.of(name, value));
   }
 
   @Override
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/AnnotationConstantValue.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/AnnotationConstantValue.java
deleted file mode 100644
index 4d4bfc4..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/AnnotationConstantValue.java
+++ /dev/null
@@ -1,85 +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.compiler.classParsing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Arrays;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Apr 2, 2004
- */
-public class AnnotationConstantValue extends ConstantValue {
-  public static final AnnotationConstantValue[] EMPTY_ARRAY = new AnnotationConstantValue[0];
-  public static final AnnotationConstantValue[][] EMPTY_ARRAY_ARRAY = new AnnotationConstantValue[0][];
-  public final int myQName;
-  public final AnnotationNameValuePair[] myMemberValues;
-
-  public AnnotationConstantValue(int qName, AnnotationNameValuePair[] memberValues) {
-    myQName = qName;
-    myMemberValues = memberValues;
-  }
-
-  public int getAnnotationQName() {
-    return myQName;
-  }
-
-  /**
-   * @return an array of Integer -> ConstantValue pairs
-   */
-  public AnnotationNameValuePair[] getMemberValues() {
-    return myMemberValues;
-  }
-
-  public AnnotationConstantValue(DataInput in) throws IOException {
-    myQName = in.readInt();
-    final int size = in.readInt();
-    myMemberValues = new AnnotationNameValuePair[size];
-    for (int idx = 0; idx < myMemberValues.length; idx++) {
-      final int name = in.readInt();
-      final ConstantValue constantValue = MemberInfoExternalizer.loadConstantValue(in);
-      myMemberValues[idx] = new AnnotationNameValuePair(name, constantValue);
-    }
-  }
-
-  public void save(DataOutput out) throws IOException {
-    out.writeInt(myQName);
-    out.writeInt(myMemberValues.length);
-    for (int idx = 0; idx < myMemberValues.length; idx++) {
-      final AnnotationNameValuePair nameValuePair = myMemberValues[idx];
-      out.writeInt(nameValuePair.getName());
-      MemberInfoExternalizer.saveConstantValue(out, nameValuePair.getValue());
-    }
-  }
-
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    if (!(o instanceof AnnotationConstantValue)) return false;
-
-    final AnnotationConstantValue annotationConstantValue = (AnnotationConstantValue)o;
-
-    if (myQName != annotationConstantValue.myQName) return false;
-    if (!Arrays.equals(myMemberValues, annotationConstantValue.myMemberValues)) return false;
-
-    return true;
-  }
-
-  public int hashCode() {
-    return myQName;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/AnnotationNameValuePair.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/AnnotationNameValuePair.java
deleted file mode 100644
index e559875..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/AnnotationNameValuePair.java
+++ /dev/null
@@ -1,38 +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.compiler.classParsing;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Apr 8, 2004
- */
-public class AnnotationNameValuePair {
-  private final int myName;
-  private final ConstantValue myValue;
-
-  public AnnotationNameValuePair(int name, ConstantValue value) {
-    myName = name;
-    myValue = value;
-  }
-
-  public int getName() {
-    return myName;
-  }
-
-  public ConstantValue getValue() {
-    return myValue;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/AnnotationPrimitiveConstantValue.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/AnnotationPrimitiveConstantValue.java
deleted file mode 100644
index 24ade71..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/AnnotationPrimitiveConstantValue.java
+++ /dev/null
@@ -1,72 +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.compiler.classParsing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Apr 2, 2004
- */
-public class AnnotationPrimitiveConstantValue extends ConstantValue{
-  private final char myValueTag;
-  private final ConstantValue myValue;
-
-  public AnnotationPrimitiveConstantValue(char valueTag, ConstantValue value) {
-    myValueTag = valueTag;
-    myValue = value;
-  }
-
-  public AnnotationPrimitiveConstantValue(DataInput in) throws IOException {
-    myValueTag = in.readChar();
-    myValue = MemberInfoExternalizer.loadConstantValue(in);
-  }
-
-  public char getValueTag() {
-    return myValueTag;
-  }
-
-  public ConstantValue getValue() {
-    return myValue;
-  }
-
-  public void save(DataOutput out) throws IOException {
-    out.writeChar(myValueTag);
-    MemberInfoExternalizer.saveConstantValue(out, myValue);
-  }
-
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    if (!(o instanceof AnnotationPrimitiveConstantValue)) return false;
-
-    final AnnotationPrimitiveConstantValue memberValue = (AnnotationPrimitiveConstantValue)o;
-
-    if (myValueTag != memberValue.myValueTag) return false;
-    if (!myValue.equals(memberValue.myValue)) return false;
-
-    return true;
-  }
-
-  public int hashCode() {
-    int result;
-    result = (int)myValueTag;
-    result = 29 * result + myValue.hashCode();
-    return result;
-  }
-
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/ClassFileReader.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/ClassFileReader.java
deleted file mode 100644
index bd80570..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/ClassFileReader.java
+++ /dev/null
@@ -1,770 +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.
- */
-
-/**
- * created at Jan 2, 2002
- * @author Jeka
- */
-package com.intellij.compiler.classParsing;
-
-import com.intellij.compiler.SymbolTable;
-import com.intellij.compiler.make.CacheCorruptedException;
-import com.intellij.openapi.compiler.CompilerBundle;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.psi.CommonClassNames;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.cls.BytePointer;
-import com.intellij.util.cls.ClsFormatException;
-import com.intellij.util.cls.ClsUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-public class ClassFileReader {
-  private final File myFile;
-  private byte[] myData;
-  private int[] myConstantPoolOffsets = null; // the last offset points to the constant pool end
-
-  private String myQualifiedName;
-  private String myGenericSignature;
-  private List<ReferenceInfo> myReferences;
-  private List<FieldInfo> myFields;
-  private List<MethodInfo> myMethods;
-  private String mySourceFileName;
-  private String mySuperClassName;
-  private String[] mySuperInterfaces;
-  private final SymbolTable mySymbolTable;
-  private AnnotationConstantValue[] myRuntimeVisibleAnnotations;
-  private AnnotationConstantValue[] myRuntimeInvisibleAnnotations;
-  private static final String CONSTRUCTOR_NAME = "<init>";
-  private boolean myParsingDone;
-
-  public ClassFileReader(@NotNull File file, SymbolTable symbolTable, @Nullable final byte[] fileContent) {
-    mySymbolTable = symbolTable;
-    myFile = file;
-    myData = fileContent;
-  }
-
-  public String getPath() {
-    return myFile.getAbsolutePath();
-  }
-
-  public Collection<ReferenceInfo> getReferences() throws ClsFormatException {
-    parseConstantPool();
-    return myReferences;
-  }
-
-  public MethodInfo[] getMethods() throws ClsFormatException{
-    parseMembers();
-    return myMethods.toArray(new MethodInfo[myMethods.size()]);
-  }
-
-  public FieldInfo[] getFields() throws ClsFormatException{
-    parseMembers();
-    return myFields.toArray(new FieldInfo[myFields.size()]);
-  }
-
-  private void parseMembers() throws ClsFormatException {
-    if (myParsingDone) {
-      return;
-    }
-    initConstantPool();
-    myMethods = new ArrayList<MethodInfo>();
-    myFields = new ArrayList<FieldInfo>();
-    BytePointer ptr = new BytePointer(getData(), getConstantPoolEnd());
-    ptr.offset += 2; // access flags
-    ptr.offset += 2; // this class
-    ptr.offset += 2; // super class
-    int count = ClsUtil.readU2(ptr); // interface count
-    ptr.offset += 2 * count; // skip interface infos
-    count = ClsUtil.readU2(ptr); // field count
-    while (count-- > 0) {
-      FieldInfo field = (FieldInfo)readMemberStructure(ptr, true);
-      String name = getSymbol(field.getName());
-      if (name.indexOf('$') < 0 && name.indexOf('<') < 0){ // skip synthetic fields
-        myFields.add(field);
-      }
-    }
-    count = ClsUtil.readU2(ptr); // method count
-    while (count-- > 0) {
-      MethodInfo method = (MethodInfo)readMemberStructure(ptr, false);
-      String name = getSymbol(method.getName());
-      if (name.indexOf('$') < 0 && name.indexOf('<') < 0) { // skip synthetic methods
-        myMethods.add(method);
-      }
-      else
-      if (CONSTRUCTOR_NAME.equals(name)) { // store constructors
-        myMethods.add(method);
-      }
-    }
-
-    final ClsAttributeTable attributeTable = readAttributes(ptr);
-    mySourceFileName = attributeTable.sourceFile;
-    myGenericSignature = attributeTable.genericSignature;
-    myRuntimeVisibleAnnotations = attributeTable.runtimeVisibleAnnotations;
-    myRuntimeInvisibleAnnotations = attributeTable.runtimeInvisibleAnnotations;
-    myParsingDone = true;
-  }
-
-  private String getSymbol(final int id) throws ClsFormatException {
-    try {
-      return mySymbolTable.getSymbol(id);
-    }
-    catch (CacheCorruptedException e) {
-      throw new ClsFormatException(e.getLocalizedMessage());
-    }
-  }
-
-  private MemberInfo readMemberStructure(BytePointer ptr, boolean isField) throws ClsFormatException {
-    int flags = ClsUtil.readU2(ptr);
-    int nameIndex = ClsUtil.readU2(ptr);
-    int descriptorIndex = ClsUtil.readU2(ptr);
-
-    BytePointer p = new BytePointer(getData(), getOffsetInConstantPool(nameIndex));
-    String name = ClsUtil.readUtf8Info(p);
-    p.offset = getOffsetInConstantPool(descriptorIndex);
-    String descriptor = ClsUtil.readUtf8Info(p);
-
-    if (isField) {
-      final ClsAttributeTable attributeTable = readAttributes(ptr);
-      return new FieldInfo(
-        getSymbolId(name),
-        getSymbolId(descriptor),
-        attributeTable.genericSignature != null? getSymbolId(attributeTable.genericSignature) : -1,
-        flags,
-        attributeTable.constantValue,
-        attributeTable.runtimeVisibleAnnotations,
-        attributeTable.runtimeInvisibleAnnotations
-      );
-    }
-    else {
-      final ClsAttributeTable attributeTable = readAttributes(ptr);
-      int[] intExceptions = null;
-      if (attributeTable.exceptions != null) {
-        intExceptions = ArrayUtil.newIntArray(attributeTable.exceptions.length);
-        for (int idx = 0; idx < intExceptions.length; idx++) {
-          intExceptions[idx]  = getSymbolId(attributeTable.exceptions[idx]);
-        }
-      }
-      return new MethodInfo(
-        getSymbolId(name),
-        getSymbolId(descriptor),
-        attributeTable.genericSignature != null? getSymbolId(attributeTable.genericSignature) : -1,
-        flags,
-        intExceptions,
-        CONSTRUCTOR_NAME.equals(name),
-        attributeTable.runtimeVisibleAnnotations,
-        attributeTable.runtimeInvisibleAnnotations,
-        attributeTable.runtimeVisibleParameterAnnotations,
-        attributeTable.runtimeInvisibleParameterAnnotations,
-        attributeTable.annotationDefault
-      );
-    }
-  }
-
-  private int getSymbolId(final String symbol)  throws ClsFormatException{
-    try {
-      return mySymbolTable.getId(symbol);
-    }
-    catch (CacheCorruptedException e) {
-      throw new ClsFormatException(e.getLocalizedMessage());
-    }
-  }
-
-  public String getQualifiedName() throws ClsFormatException {
-    if (myQualifiedName == null) {
-      BytePointer ptr = new BytePointer(getData(), getConstantPoolEnd() + 2);
-      ptr.offset = getOffsetInConstantPool(ClsUtil.readU2(ptr));
-      int tag = ClsUtil.readU1(ptr);
-      if (tag != ClsUtil.CONSTANT_Class){
-        throw new ClsFormatException();
-      }
-      ptr.offset = getOffsetInConstantPool(ClsUtil.readU2(ptr));
-      myQualifiedName = ClsUtil.readUtf8Info(ptr, '/', '.'); // keep '$' in the names
-    }
-    return myQualifiedName;
-  }
-
-  /**
-   * @return fully qualified name of the class' superclass. In case there is no super return ""
-   */
-  public String getSuperClass() throws ClsFormatException {
-    if (mySuperClassName == null) {
-      BytePointer ptr = new BytePointer(getData(), getConstantPoolEnd() + 4);
-      int index = ClsUtil.readU2(ptr);
-      if (index == 0) {
-        if (CommonClassNames.JAVA_LANG_OBJECT.equals(getQualifiedName())) {
-          mySuperClassName = "";
-        }
-        else {
-          throw new ClsFormatException();
-        }
-      }
-      else {
-        ptr.offset = getOffsetInConstantPool(index);
-        mySuperClassName = readClassInfo(ptr); // keep '$' in the name for anonymous classes
-        if (isInterface()) {
-          if (!CommonClassNames.JAVA_LANG_OBJECT.equals(mySuperClassName)) {
-            throw new ClsFormatException();
-          }
-        }
-        /*
-        else {
-          if (!MakeUtil.isAnonymous(mySuperClassName)) {
-            mySuperClassName = mySuperClassName.replace('$', '.');
-          }
-        }
-        */
-      }
-    }
-    return mySuperClassName;
-  }
-
-  public String[] getSuperInterfaces() throws ClsFormatException {
-    if (mySuperInterfaces == null) {
-      BytePointer ptr = new BytePointer(getData(), getConstantPoolEnd() + 6);
-      int count = ClsUtil.readU2(ptr);
-      mySuperInterfaces = ArrayUtil.newStringArray(count);
-      BytePointer auxPtr = new BytePointer(ptr.bytes, 0);
-      for (int idx = 0; idx < mySuperInterfaces.length; idx++) {
-        auxPtr.offset = getOffsetInConstantPool(ClsUtil.readU2(ptr));
-        mySuperInterfaces[idx] = readClassInfo(auxPtr);
-      }
-    }
-    return mySuperInterfaces;
-  }
-
-
-  public String getSourceFileName() throws ClsFormatException {
-    parseMembers();
-    final String fName = mySourceFileName;
-    return fName != null? fName : "";
-  }
-
-  public String getGenericSignature() throws ClsFormatException {
-    parseMembers();
-    final String genericSignature = myGenericSignature;
-    return genericSignature != null && !genericSignature.isEmpty() ? genericSignature : null;
-  }
-
-  public AnnotationConstantValue[] getRuntimeVisibleAnnotations() throws ClsFormatException {
-    parseMembers();
-    final AnnotationConstantValue[] annotations = myRuntimeVisibleAnnotations;
-    return annotations != null? annotations : AnnotationConstantValue.EMPTY_ARRAY;
-  }
-
-  public AnnotationConstantValue[] getRuntimeInvisibleAnnotations() throws ClsFormatException {
-    parseMembers();
-    final AnnotationConstantValue[] annotations = myRuntimeInvisibleAnnotations;
-    return annotations != null? annotations : AnnotationConstantValue.EMPTY_ARRAY;
-  }
-
-  private boolean isInterface(){
-    return (getAccessFlags() & ClsUtil.ACC_INTERFACE) != 0;
-  }
-
-// helper methods
-  private void parseConstantPool() throws ClsFormatException {
-    if (myReferences != null) {
-      return;
-    }
-    myReferences = new ArrayList<ReferenceInfo>();
-    initConstantPool();
-    final BytePointer ptr = new BytePointer(getData(), 0);
-    ConstantPoolIterator iterator = new ConstantPoolIterator(ptr);
-    while (iterator.hasMoreEntries()) {
-      final int tag = ClsUtil.readU1(ptr);
-      if (tag == ClsUtil.CONSTANT_Fieldref || tag == ClsUtil.CONSTANT_Methodref || tag == ClsUtil.CONSTANT_InterfaceMethodref) {
-        //ptr.offset -= 1; // position to the beginning of the structure
-        MemberReferenceInfo refInfo = readRefStructure(tag, ptr);
-        if (refInfo != null) {
-          myReferences.add(refInfo);
-        }
-        /*
-        String name = mySymbolTable.getSymbol(refInfo.getMemberInfo().getName());
-        if (name.indexOf('$') < 0 && name.indexOf('<') < 0) { // skip refs to synthetic members
-          myReferences.add(refInfo);
-        }
-        else if ("<init>".equals(name)) { // add instance initializers (constructors)
-          myReferences.add(refInfo);
-        }
-        else {
-          System.out.println("ReferenceInfo thrown out: " + mySymbolTable.getSymbol(refInfo.getClassName()) + "." + mySymbolTable.getSymbol(refInfo.getMemberInfo().getName()));
-          ourWasteReferenceObjectsCounter += 1;
-        }
-        */
-      }
-      else if (tag == ClsUtil.CONSTANT_Class) {
-        ptr.offset -= 1; // position to the beginning of the structure
-        String className = readClassInfo(ptr);
-        myReferences.add(new ReferenceInfo(getSymbolId(className)));
-      }
-      iterator.next();
-    }
-    //System.out.println("ourWasteReferenceObjectsCounter = " + ourWasteReferenceObjectsCounter);
-  }
-
-  private MemberReferenceInfo readRefStructure(int tag, BytePointer ptr) throws ClsFormatException {
-    /*
-    if (tag != ClsUtil.CONSTANT_Fieldref && tag != ClsUtil.CONSTANT_Methodref && tag != ClsUtil.CONSTANT_InterfaceMethodref) {
-      throw new ClsFormatException();
-    }
-    */
-    int classInfoIndex = ClsUtil.readU2(ptr);
-    int nameTypeInfoIndex = ClsUtil.readU2(ptr);
-
-    ptr.offset = getOffsetInConstantPool(classInfoIndex);
-    if (ClsUtil.CONSTANT_Class != ClsUtil.readU1(ptr)) {
-      throw new ClsFormatException();
-    }
-    ptr.offset = getOffsetInConstantPool(ClsUtil.readU2(ptr));
-    String className = ClsUtil.readUtf8Info(ptr, '/', '.'); // keep '$' in names
-
-    ptr.offset = getOffsetInConstantPool(nameTypeInfoIndex);
-    if (ClsUtil.CONSTANT_NameAndType != ClsUtil.readU1(ptr)) {
-      throw new ClsFormatException();
-    }
-    int memberNameIndex = ClsUtil.readU2(ptr);
-    int descriptorIndex = ClsUtil.readU2(ptr);
-
-    ptr.offset = getOffsetInConstantPool(memberNameIndex);
-    String memberName = ClsUtil.readUtf8Info(ptr);
-
-    if ((memberName.indexOf('$') >= 0 || memberName.indexOf('<') >= 0) && !CONSTRUCTOR_NAME.equals(memberName)) { // skip refs to synthetic members
-      return null;
-    }
-
-    ptr.offset = getOffsetInConstantPool(descriptorIndex);
-    String descriptor = ClsUtil.readUtf8Info(ptr);
-
-    MemberInfo info = ClsUtil.CONSTANT_Fieldref == tag? new FieldInfo(getSymbolId(memberName), getSymbolId(descriptor)) : new MethodInfo(getSymbolId(memberName), getSymbolId(descriptor), CONSTRUCTOR_NAME.equals(memberName));
-    return new MemberReferenceInfo(getSymbolId(className), info);
-  }
-
-  public int getAccessFlags(){
-    try{
-      int offset = getConstantPoolEnd();
-      byte[] data = getData();
-      if (offset + 2 > data.length){
-        throw new ClsFormatException();
-      }
-      int b1 = data[offset++] & 0xFF;
-      int b2 = data[offset++] & 0xFF;
-      return (b1 << 8) + b2;
-    }
-    catch(ClsFormatException e){
-      return 0;
-    }
-  }
-
-  private byte[] getData(){
-    if (myData == null) {
-      try{
-        myData = FileUtil.loadFileBytes(myFile);
-      }
-      catch(IOException e){
-        myData = ArrayUtil.EMPTY_BYTE_ARRAY;
-      }
-    }
-    return myData;
-  }
-
-  private int getOffsetInConstantPool(int index) throws ClsFormatException {
-    initConstantPool();
-    if (index < 1 || index >= myConstantPoolOffsets.length){
-      throw new ClsFormatException();
-    }
-    return myConstantPoolOffsets[index - 1];
-  }
-
-  private int getConstantPoolEnd() throws ClsFormatException {
-    initConstantPool();
-    return myConstantPoolOffsets[myConstantPoolOffsets.length - 1];
-  }
-
-  private void initConstantPool() throws ClsFormatException {
-    if (myConstantPoolOffsets == null){
-      BytePointer ptr = new BytePointer(getData(), 0);
-      ConstantPoolIterator iterator = new ConstantPoolIterator(ptr);
-      myConstantPoolOffsets = new int[iterator.getEntryCount()];
-      myConstantPoolOffsets[0] = iterator.getCurrentOffset();
-      int index = 1;
-      while (iterator.hasMoreEntries()) {
-        int tag = ClsUtil.readU1(ptr);
-        if (tag == ClsUtil.CONSTANT_Long || tag == ClsUtil.CONSTANT_Double) {
-          myConstantPoolOffsets[index++] = ptr.offset + 8; // takes 2 entries!
-        }
-        iterator.next();
-        myConstantPoolOffsets[index++] = iterator.getCurrentOffset();
-      }
-    }
-  }
-
-  private String readClassInfo(BytePointer ptr) throws ClsFormatException{
-    final int tag = ClsUtil.readU1(ptr);
-    if (tag != ClsUtil.CONSTANT_Class){
-      throw new ClsFormatException(CompilerBundle.message("class.parsing.error.wrong.record.tag.expected.another", tag, ClsUtil.CONSTANT_Class));
-    }
-    int index = ClsUtil.readU2(ptr);
-    return ClsUtil.readUtf8Info(new BytePointer(ptr.bytes, getOffsetInConstantPool(index)), '/', '.');
-  }
-
-  @SuppressWarnings({"HardCodedStringLiteral"})
-  private ClsAttributeTable readAttributes(BytePointer ptr) throws ClsFormatException {
-    int count = ClsUtil.readU2(ptr); // attributeCount
-    final ClsAttributeTable attributes = new ClsAttributeTable();
-    while (count-- > 0) {
-      final String attrName = readAttributeName(ptr);
-      if ("Exceptions".equals(attrName)) {
-        attributes.exceptions = readExceptions(ptr);
-      }
-      else if ("Signature".equals(attrName)) {
-        attributes.genericSignature = readSignatureAttribute(ptr);
-      }
-      else if ("SourceFile".equals(attrName)) {
-        attributes.sourceFile = readSourceFileAttribute(ptr);
-      }
-      else if ("ConstantValue".equals(attrName)){
-        attributes.constantValue = readFieldConstantValue(ptr);
-      }
-      else if ("RuntimeVisibleAnnotations".equals(attrName)) {
-        attributes.runtimeVisibleAnnotations = readAnnotations(ptr);
-      }
-      else if ("RuntimeInvisibleAnnotations".equals(attrName)) {
-        attributes.runtimeInvisibleAnnotations = readAnnotations(ptr);
-      }
-      else if ("RuntimeVisibleParameterAnnotations".equals(attrName)) {
-        attributes.runtimeVisibleParameterAnnotations = readParameterAnnotations(ptr);
-      }
-      else if ("RuntimeInvisibleParameterAnnotations".equals(attrName)) {
-        attributes.runtimeInvisibleParameterAnnotations = readParameterAnnotations(ptr);
-      }
-      else if ("AnnotationDefault".equals(attrName)) {
-        attributes.annotationDefault = readAnnotationMemberValue(new BytePointer(ptr.bytes, ptr.offset + 6));
-      }
-      gotoNextAttribute(ptr);
-    }
-    return attributes;
-  }
-
-  private String readAttributeName(BytePointer p) throws ClsFormatException {
-    final BytePointer ptr = new BytePointer(p.bytes, p.offset);
-    final int nameIndex = ClsUtil.readU2(ptr);
-    ptr.offset = getOffsetInConstantPool(nameIndex);
-    return ClsUtil.readUtf8Info(ptr);
-  }
-
-  private static void gotoNextAttribute(BytePointer ptr) throws ClsFormatException {
-    ptr.offset += 2; // skip name index
-    final int length = ClsUtil.readU4(ptr);    // important! Do not inline since ptr.offset is also changed inside ClsUtil.readU4() method
-    ptr.offset += length;
-  }
-
-  /**
-      Signature_attribute {
-        u2 attribute_name_index;    (must be equal to "Signature")
-        u4 attribute_length;        (must be equal to 2)
-        u2 signature_index;
-      }
-   */
-  private String readSignatureAttribute(BytePointer p) throws ClsFormatException {
-    final BytePointer ptr = new BytePointer(p.bytes, p.offset + 2); // position to the length
-    if (ClsUtil.readU4(ptr) != 2) {
-      return null;
-    }
-    ptr.offset = getOffsetInConstantPool(ClsUtil.readU2(ptr));
-    return ClsUtil.readUtf8Info(ptr);
-  }
-
-  private String[] readExceptions(BytePointer p) throws ClsFormatException{
-    final BytePointer ptr = new BytePointer(p.bytes, p.offset + 6); // position to the count of exceptions
-    int count = ClsUtil.readU2(ptr);
-    final ArrayList<String> array = new ArrayList<String>(count);
-    while (count-- > 0) {
-      int idx = ClsUtil.readU2(ptr);
-      if (idx != 0) {
-        final String exceptionClass = readClassInfo(new BytePointer(ptr.bytes, getOffsetInConstantPool(idx)));
-        array.add(exceptionClass);
-      }
-    }
-    return ArrayUtil.toStringArray(array);
-  }
-
-  private String readSourceFileAttribute(BytePointer p) throws ClsFormatException {
-    BytePointer ptr = new BytePointer(p.bytes, p.offset + 2); // position to the length
-    if (ClsUtil.readU4(ptr) != 2) {
-      return null;
-    }
-    ptr.offset = getOffsetInConstantPool(ClsUtil.readU2(ptr));
-    String path = ClsUtil.readUtf8Info(ptr);
-    // jdk version 1.3.0 puts full path to the source, but later versions store only short name
-    final int slashIndex = path.lastIndexOf('/');
-    if (slashIndex >= 0) {
-      path = path.substring(slashIndex + 1, path.length());
-    }
-    return path;
-  }
-
-  private ConstantValue readFieldConstantValue(BytePointer p) throws ClsFormatException{
-    final BytePointer ptr = new BytePointer(p.bytes, p.offset + 2);
-    if (ClsUtil.readU4(ptr) != 2) {
-      throw new ClsFormatException(); // attribute length must be 2
-    }
-    int valueIndex = ClsUtil.readU2(ptr);
-    ptr.offset = getOffsetInConstantPool(valueIndex);
-    return readConstant(ptr);
-  }
-
-  private ConstantValue readConstant(final BytePointer ptr) throws ClsFormatException {
-    final int tag = ClsUtil.readU1(ptr);
-    switch (tag) {
-      case ClsUtil.CONSTANT_Integer :
-        int value = ClsUtil.readU4(ptr);
-        return new IntegerConstantValue(value);
-      case ClsUtil.CONSTANT_Float:
-        float floatValue = ClsUtil.readFloat(ptr);
-        return new FloatConstantValue(floatValue);
-      case ClsUtil.CONSTANT_Long :
-        int high = ClsUtil.readU4(ptr);
-        int low = ClsUtil.readU4(ptr);
-        long v = ((long)high << 32) | (low & 0xFFFFFFFFL);
-        return new LongConstantValue(v);
-      case ClsUtil.CONSTANT_Double :
-        double doubleValue = ClsUtil.readDouble(ptr);
-        return new DoubleConstantValue(doubleValue);
-      case ClsUtil.CONSTANT_String :
-        int stringIndex = ClsUtil.readU2(ptr);
-        ptr.offset = getOffsetInConstantPool(stringIndex);
-        return new StringConstantValue(ClsUtil.readUtf8Info(ptr));
-      default : throw new ClsFormatException();
-    }
-  }
-
-  private AnnotationConstantValue[] readAnnotations(BytePointer p) throws ClsFormatException {
-    final BytePointer ptr = new BytePointer(p.bytes, p.offset + 6);
-    return readAnnotationsArray(ptr);
-  }
-
-  private AnnotationConstantValue[][] readParameterAnnotations(BytePointer p) throws ClsFormatException {
-    final BytePointer ptr = new BytePointer(p.bytes, p.offset + 6); // position to the number of parameters
-    final int numberOfParams = ClsUtil.readU1(ptr);
-    if (numberOfParams == 0) {
-      return null;
-    }
-    final AnnotationConstantValue[][] annotations = new AnnotationConstantValue[numberOfParams][];
-    for (int parameterIndex = 0; parameterIndex < numberOfParams; parameterIndex++) {
-      annotations[parameterIndex] = readAnnotationsArray(ptr);
-    }
-    return annotations;
-  }
-
-  private AnnotationConstantValue[] readAnnotationsArray(BytePointer ptr) throws ClsFormatException {
-    final int numberOfAnnotations = ClsUtil.readU2(ptr);
-    if (numberOfAnnotations == 0) {
-      return AnnotationConstantValue.EMPTY_ARRAY;
-    }
-    AnnotationConstantValue[] annotations = new AnnotationConstantValue[numberOfAnnotations];
-    for (int attributeIndex = 0; attributeIndex < numberOfAnnotations; attributeIndex++) {
-      annotations[attributeIndex] = readAnnotation(ptr);
-    }
-    return annotations;
-  }
-
-  private AnnotationConstantValue readAnnotation(BytePointer ptr) throws ClsFormatException {
-    final int classInfoIndex = ClsUtil.readU2(ptr);
-    final String qName = readAnnotationClassName(new BytePointer(ptr.bytes, getOffsetInConstantPool(classInfoIndex)));
-    final List<AnnotationNameValuePair> memberValues = new ArrayList<AnnotationNameValuePair>();
-    final int numberOfPairs = ClsUtil.readU2(ptr);
-    for (int idx = 0; idx < numberOfPairs; idx++) {
-      final int memberNameIndex = ClsUtil.readU2(ptr);
-      final String memberName = ClsUtil.readUtf8Info(ptr.bytes, getOffsetInConstantPool(memberNameIndex));
-      final ConstantValue memberValue = readAnnotationMemberValue(ptr);
-      memberValues.add(new AnnotationNameValuePair(getSymbolId(memberName), memberValue));
-    }
-    return new AnnotationConstantValue(getSymbolId(qName), memberValues.toArray(new AnnotationNameValuePair[memberValues.size()]));
-  }
-
-  private String readAnnotationClassName(BytePointer ptr) throws ClsFormatException {
-    // TODO: need this method because because of incomplete class format spec at the moment of writing
-    // it is not clear what structure is expected: CONSTANT_Utf8 or CONSTANT_Class
-    final int tag = ClsUtil.readU1(ptr);
-    if (tag == ClsUtil.CONSTANT_Utf8) {
-      return ClsUtil.getTypeText(ptr.bytes, ptr.offset + 2); //skip length
-    }
-    if (tag == ClsUtil.CONSTANT_Class){
-      ptr.offset -= 1; // rollback
-      return readClassInfo(ptr);
-    }
-    //noinspection HardCodedStringLiteral
-    throw new ClsFormatException(CompilerBundle.message("class.parsing.error.wrong.record.tag.expected.another", tag, "CONSTANT_Utf8(" + ClsUtil.CONSTANT_Utf8 + ") / CONSTANT_Class(" + ClsUtil.CONSTANT_Class + ")"));
-  }
-
-  private ConstantValue readAnnotationMemberValue(BytePointer ptr) throws ClsFormatException {
-    final char tag = (char)ClsUtil.readU1(ptr);
-    switch (tag) {
-      case 'B':
-      case 'C':
-      case 'D':
-      case 'F':
-      case 'I':
-      case 'J':
-      case 'S':
-      case 'Z': {
-        final int valueIndex = ClsUtil.readU2(ptr);
-        return new AnnotationPrimitiveConstantValue(tag, readConstant(new BytePointer(ptr.bytes, getOffsetInConstantPool(valueIndex))));
-      }
-      case 's': {
-        final int valueIndex = ClsUtil.readU2(ptr);
-        return new StringConstantValue(ClsUtil.readUtf8Info(ptr.bytes, getOffsetInConstantPool(valueIndex)));
-      }
-      case 'e': {
-        final int typeNameIndex = ClsUtil.readU2(ptr);
-        final int constantNameIndex = ClsUtil.readU2(ptr);
-        final String typeName = ClsUtil.readUtf8Info(ptr.bytes, getOffsetInConstantPool(typeNameIndex));
-        final String constantName = ClsUtil.readUtf8Info(ptr.bytes, getOffsetInConstantPool(constantNameIndex));
-        return new EnumConstantValue(getSymbolId(typeName), getSymbolId(constantName));
-      }
-      case 'c' : {
-        final int classInfoIndex = ClsUtil.readU2(ptr);
-        BytePointer p = new BytePointer(ptr.bytes, getOffsetInConstantPool(classInfoIndex));
-        final int recordTag = ClsUtil.readU1(p);
-        if (recordTag != ClsUtil.CONSTANT_Utf8) {
-          throw new ClsFormatException(CompilerBundle.message("class.parsing.error.wrong.record.tag.expected.another", recordTag, ClsUtil.CONSTANT_Utf8));
-        }
-        p.offset += 2; //Skip length
-        final String className = ClsUtil.getTypeText(p.bytes, p.offset);
-        return new ClassInfoConstantValue(getSymbolId(className));
-      }
-      case '@' : {
-        return readAnnotation(ptr);
-      }
-      case '[' : {
-        final int numberOfValues = ClsUtil.readU2(ptr);
-        final ConstantValue[] values = new ConstantValue[numberOfValues];
-        for (int idx = 0; idx < numberOfValues; idx++) {
-          values[idx] = readAnnotationMemberValue(ptr);
-        }
-        return new ConstantValueArray(values);
-      }
-      default : throw new ClsFormatException(CompilerBundle.message("class.parsing.error.wrong.tag.annotation.member.value", tag));
-    }
-  }
-
-  private static class ClsAttributeTable {
-    public String[] exceptions;
-    public String genericSignature;
-    public String sourceFile;
-    public ConstantValue constantValue;
-    public AnnotationConstantValue[] runtimeVisibleAnnotations;
-    public AnnotationConstantValue[] runtimeInvisibleAnnotations;
-    public AnnotationConstantValue[][] runtimeVisibleParameterAnnotations;
-    public AnnotationConstantValue[][] runtimeInvisibleParameterAnnotations;
-    public ConstantValue annotationDefault;
-  }
-
-  private static class ConstantPoolIterator {
-    private final BytePointer myPtr;
-    private final int myEntryCount;
-    private int myCurrentEntryIndex;
-    private int myCurrentOffset;
-
-    public ConstantPoolIterator(BytePointer ptr) throws ClsFormatException {
-      myPtr = ptr;
-      myPtr.offset = 0;
-      int magic = ClsUtil.readU4(myPtr);
-      if (magic != ClsUtil.MAGIC){
-        throw new ClsFormatException();
-      }
-      myPtr.offset += 2; // minor version
-      myPtr.offset += 2; // major version
-      myEntryCount = ClsUtil.readU2(myPtr);
-      if (myEntryCount < 1){
-        throw new ClsFormatException();
-      }
-      myCurrentEntryIndex = 1; // Entry at index 0 is included in the count but is not present in the constant pool
-      myCurrentOffset = myPtr.offset;
-    }
-
-    public int getEntryCount() {
-      return myEntryCount;
-    }
-
-    public int getCurrentOffset() {
-      return myCurrentOffset;
-    }
-
-    /**
-     *  tests if there are unread entries
-     */
-    public boolean hasMoreEntries() {
-      return myCurrentEntryIndex < myEntryCount;
-    }
-
-    /**
-     * Positions the pointer to the next entry
-     */
-    public void next() throws ClsFormatException {
-      myPtr.offset = myCurrentOffset;
-      int tag = ClsUtil.readU1(myPtr);
-      switch(tag){
-        default:
-          throw new ClsFormatException();
-
-        case ClsUtil.CONSTANT_Class:
-        case ClsUtil.CONSTANT_String:
-          myPtr.offset += 2;
-        break;
-
-        case ClsUtil.CONSTANT_Fieldref:
-        case ClsUtil.CONSTANT_Methodref:
-        case ClsUtil.CONSTANT_InterfaceMethodref:
-        case ClsUtil.CONSTANT_Integer:
-        case ClsUtil.CONSTANT_Float:
-        case ClsUtil.CONSTANT_NameAndType:
-          myPtr.offset += 4;
-        break;
-
-        case ClsUtil.CONSTANT_Long:
-        case ClsUtil.CONSTANT_Double:
-          myPtr.offset += 8;
-          myCurrentEntryIndex++; // takes 2 entries
-        break;
-
-        case ClsUtil.CONSTANT_Utf8:
-          int length = ClsUtil.readU2(myPtr);
-          myPtr.offset += length;
-        break;
-
-        case ClsUtil.CONSTANT_MethodHandle:
-          myPtr.offset += 3;
-          break;
-        case ClsUtil.CONSTANT_MethodType:
-          myPtr.offset += 2;
-          break;
-        case ClsUtil.CONSTANT_InvokeDynamic:
-          myPtr.offset += 4;
-          break;
-      }
-      myCurrentEntryIndex++;
-      myCurrentOffset = myPtr.offset;
-    }
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/ClassInfo.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/ClassInfo.java
deleted file mode 100644
index 2d816ef..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/ClassInfo.java
+++ /dev/null
@@ -1,229 +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.compiler.classParsing;
-
-import com.intellij.compiler.SymbolTable;
-import com.intellij.compiler.make.CacheCorruptedException;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.cls.ClsFormatException;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Collection;
-
-/**
-  @author Eugene Zhuravlev
-*/
-public final class ClassInfo implements Cloneable {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.classParsing.ClassInfo");
-
-  private static final ReferenceInfo[] EMPTY_REF_ARRAY = new ReferenceInfo[0];
-
-  private final int myQualifiedName;
-  private final int myGenericSignature;
-  private final int mySuperQualifiedName;
-  private final int myFlags;
-  private String myPath;
-  private final String mySourceFileName;
-  private final int[] mySuperInterfaces;
-  private final FieldInfo[] myFields;
-  private final MethodInfo[] myMethods;
-  private ReferenceInfo[] myReferences;
-  private final AnnotationConstantValue[] myRuntimeVisibleAnnotations;
-  private final AnnotationConstantValue[] myRuntimeInvisibleAnnotations;
-  private boolean myIsDirty = false;
-
-  public ClassInfo(ClassFileReader reader, SymbolTable symbolTable) throws CacheCorruptedException {
-    try {
-      final int qName = symbolTable.getId(reader.getQualifiedName());
-      myQualifiedName = qName;
-
-      final String genericSignature = reader.getGenericSignature();
-      myGenericSignature = genericSignature != null? symbolTable.getId(genericSignature) : -1;
-
-      myPath = reader.getPath();
-
-      final String superClass = reader.getSuperClass();
-      final int superQName = "".equals(superClass)? -1 : symbolTable.getId(superClass);
-      mySuperQualifiedName = superQName;
-
-      LOG.assertTrue(superQName != qName);
-
-      final String[] superInterfaces = reader.getSuperInterfaces();
-      mySuperInterfaces = ArrayUtil.newIntArray(superInterfaces.length);
-      for (int idx = 0; idx < superInterfaces.length; idx++) {
-        mySuperInterfaces[idx] = symbolTable.getId(superInterfaces[idx]);
-      }
-
-      final String sourceFileName = reader.getSourceFileName();
-      mySourceFileName = sourceFileName != null? sourceFileName : "";
-
-      myFlags = reader.getAccessFlags();
-
-      myRuntimeVisibleAnnotations = reader.getRuntimeVisibleAnnotations();
-      myRuntimeInvisibleAnnotations = reader.getRuntimeInvisibleAnnotations();
-
-      final Collection<ReferenceInfo> refs = reader.getReferences();
-      myReferences = refs.toArray(new ReferenceInfo[refs.size()]);
-
-      myFields = reader.getFields();
-      myMethods = reader.getMethods();
-    }
-    catch (ClsFormatException e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public ClassInfo(DataInput in) throws IOException {
-    myQualifiedName = in.readInt();
-    mySuperQualifiedName = in.readInt();
-    myGenericSignature = in.readInt();
-    myFlags = in.readInt();
-    myPath = in.readUTF();
-    mySourceFileName = in.readUTF();
-
-    final int ifaceCount = in.readInt();
-    mySuperInterfaces = new int[ifaceCount];
-    for (int idx = 0; idx < ifaceCount; idx++) {
-      mySuperInterfaces[idx] = in.readInt();
-    }
-
-    final int fieldCount = in.readInt();
-    myFields = new FieldInfo[fieldCount];
-    for (int idx = 0; idx < fieldCount; idx++) {
-      myFields[idx] = new FieldInfo(in);
-    }
-
-    final int methodCount = in.readInt();
-    myMethods = new MethodInfo[methodCount];
-    for (int idx = 0; idx < methodCount; idx++) {
-      myMethods[idx] = new MethodInfo(in);
-    }
-
-    final int refCount = in.readInt();
-    myReferences = refCount > 0? new ReferenceInfo[refCount] : EMPTY_REF_ARRAY;
-    for (int idx = 0; idx < refCount; idx++) {
-      myReferences[idx] = MemberInfoExternalizer.loadReferenceInfo(in);
-    }
-
-    myRuntimeVisibleAnnotations = MemberInfoExternalizer.readAnnotationConstantValueArray1(in);
-    myRuntimeInvisibleAnnotations = MemberInfoExternalizer.readAnnotationConstantValueArray1(in);
-  }
-
-  public ClassInfo clone()  {
-    try {
-      return (ClassInfo)super.clone();
-    }
-    catch (CloneNotSupportedException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public void save(DataOutput out) throws IOException {
-    out.writeInt(myQualifiedName);
-    out.writeInt(mySuperQualifiedName);
-    out.writeInt(myGenericSignature);
-    out.writeInt(myFlags);
-    out.writeUTF(myPath);
-    out.writeUTF(mySourceFileName);
-    out.writeInt(mySuperInterfaces.length);
-    for (int ifaceQName : mySuperInterfaces) {
-      out.writeInt(ifaceQName);
-    }
-
-    out.writeInt(myFields.length);
-    for (FieldInfo field : myFields) {
-      field.save(out);
-    }
-
-    out.writeInt(myMethods.length);
-    for (MethodInfo method : myMethods) {
-      method.save(out);
-    }
-
-    out.writeInt(myReferences.length);
-    for (ReferenceInfo info : myReferences) {
-      MemberInfoExternalizer.saveReferenceInfo(out, info);
-    }
-
-    MemberInfoExternalizer.writeConstantValueArray1(out, myRuntimeVisibleAnnotations);
-    MemberInfoExternalizer.writeConstantValueArray1(out, myRuntimeInvisibleAnnotations);
-  }
-
-  public boolean isDirty() {
-    return myIsDirty;
-  }
-
-  public int getQualifiedName() throws IOException {
-    return myQualifiedName;
-  }
-
-  public int getGenericSignature() throws IOException {
-    return myGenericSignature;
-  }
-
-  public int getSuperQualifiedName() throws IOException {
-    return mySuperQualifiedName;
-  }
-
-  public int[] getSuperInterfaces() throws IOException {
-    return mySuperInterfaces;
-  }
-
-  public int getFlags() throws IOException {
-    return myFlags;
-  }
-
-  public String getPath() throws IOException {
-    return myPath;
-  }
-
-  public void setPath(String path) {
-    myIsDirty |= !Comparing.equal(myPath, path);
-    myPath = path;
-  }
-
-  public String getSourceFileName() throws IOException {
-    return mySourceFileName;
-  }
-
-  public AnnotationConstantValue[] getRuntimeVisibleAnnotations() throws IOException {
-    return myRuntimeVisibleAnnotations;
-  }
-
-  public AnnotationConstantValue[] getRuntimeInvisibleAnnotations() throws IOException {
-    return myRuntimeInvisibleAnnotations;
-  }
-
-  public ReferenceInfo[] getReferences() {
-    return myReferences;
-  }
-
-  public void clearReferences() {
-    myReferences = EMPTY_REF_ARRAY;
-  }
-
-  public FieldInfo[] getFields() {
-    return myFields;
-  }
-
-  public MethodInfo[] getMethods() {
-    return myMethods;
-  }
-}
\ No newline at end of file
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/ClassInfoConstantValue.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/ClassInfoConstantValue.java
deleted file mode 100644
index a444d32..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/ClassInfoConstantValue.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.compiler.classParsing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class ClassInfoConstantValue extends ConstantValue{
-  private final int myValue;
-
-  public ClassInfoConstantValue(int value) {
-    myValue = value;
-  }
-
-  public ClassInfoConstantValue(DataInput in) throws IOException{
-    myValue = in.readInt();
-  }
-
-  public int getValue() {
-    return myValue;
-  }
-
-  public void save(DataOutput out) throws IOException {
-    super.save(out);
-    out.writeInt(myValue);
-  }
-
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    if (!(o instanceof ClassInfoConstantValue)) return false;
-
-    final ClassInfoConstantValue classInfoConstantValue = (ClassInfoConstantValue)o;
-
-    if (myValue != classInfoConstantValue.myValue) return false;
-
-    return true;
-  }
-
-  public int hashCode() {
-    return myValue;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/ConstantValue.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/ConstantValue.java
deleted file mode 100644
index 31615b2..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/ConstantValue.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.
- */
-
-/**
- * created at Feb 24, 2002
- * @author Jeka
- */
-package com.intellij.compiler.classParsing;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class ConstantValue {
-  public static final ConstantValue EMPTY_CONSTANT_VALUE = new ConstantValue();
-
-  protected ConstantValue() {
-  }
-
-  public void save(DataOutput out) throws IOException {
-  }
-
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/ConstantValueArray.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/ConstantValueArray.java
deleted file mode 100644
index 850564a..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/ConstantValueArray.java
+++ /dev/null
@@ -1,68 +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.compiler.classParsing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Arrays;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Apr 2, 2004
- */
-public class ConstantValueArray extends ConstantValue{
-  private final ConstantValue[] myValue;
-
-  public ConstantValueArray(ConstantValue[] value) {
-    myValue = value;
-  }
-
-  public ConstantValueArray(DataInput in) throws IOException {
-    final int size = in.readInt();
-    myValue = new ConstantValue[size];
-    for (int idx = 0; idx < size; idx++) {
-      myValue[idx] = MemberInfoExternalizer.loadConstantValue(in);
-    }
-  }
-
-  public ConstantValue[] getValue() {
-    return myValue;
-  }
-
-  public void save(DataOutput out) throws IOException {
-    out.writeInt(myValue.length);
-    for (int idx = 0; idx < myValue.length; idx++) {
-      MemberInfoExternalizer.saveConstantValue(out, myValue[idx]);
-    }
-  }
-
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    if (!(o instanceof ConstantValueArray)) return false;
-
-    final ConstantValueArray constantValueArray = (ConstantValueArray)o;
-
-    if (!Arrays.equals(myValue, constantValueArray.myValue)) return false;
-
-    return true;
-  }
-
-  public int hashCode() {
-    return 0;
-  }
-
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/DoubleConstantValue.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/DoubleConstantValue.java
deleted file mode 100644
index 7e7b8e6..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/DoubleConstantValue.java
+++ /dev/null
@@ -1,50 +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.
- */
-
-/**
- * created at Feb 24, 2002
- * @author Jeka
- */
-package com.intellij.compiler.classParsing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class DoubleConstantValue extends ConstantValue{
-  private final double myValue;
-
-  public DoubleConstantValue(double value) {
-    myValue = value;
-  }
-
-  public DoubleConstantValue(DataInput in) throws IOException{
-    myValue = in.readDouble();
-  }
-
-  public double getValue() {
-    return myValue;
-  }
-
-  public void save(DataOutput out) throws IOException {
-    super.save(out);
-    out.writeDouble(myValue);
-  }
-
-  public boolean equals(Object obj) {
-    return (obj instanceof DoubleConstantValue) && (((DoubleConstantValue)obj).myValue == myValue);
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/EnumConstantValue.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/EnumConstantValue.java
deleted file mode 100644
index 548bda1..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/EnumConstantValue.java
+++ /dev/null
@@ -1,73 +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.
- */
-
-/**
- * created at Feb 24, 2002
- * @author Jeka
- */
-package com.intellij.compiler.classParsing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class EnumConstantValue extends ConstantValue{
-  private final int myTypeName;
-  private final int myConstantName;
-
-  public EnumConstantValue(int typeName, int constantName) {
-    myTypeName = typeName;
-    myConstantName = constantName;
-  }
-
-  public EnumConstantValue(DataInput in) throws IOException{
-    myTypeName = in.readInt();
-    myConstantName = in.readInt();
-  }
-
-  public int getTypeName() {
-    return myTypeName;
-  }
-
-  public int getConstantName() {
-    return myConstantName;
-  }
-
-  public void save(DataOutput out) throws IOException {
-    super.save(out);
-    out.writeInt(myTypeName);
-    out.writeInt(myConstantName);
-  }
-
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    if (!(o instanceof EnumConstantValue)) return false;
-
-    final EnumConstantValue enumConstantValue = (EnumConstantValue)o;
-
-    if (myConstantName != enumConstantValue.myConstantName) return false;
-    if (myTypeName != enumConstantValue.myTypeName) return false;
-
-    return true;
-  }
-
-  public int hashCode() {
-    int result;
-    result = myTypeName;
-    result = 29 * result + myConstantName;
-    return result;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/FieldInfo.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/FieldInfo.java
deleted file mode 100644
index 4611f08..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/FieldInfo.java
+++ /dev/null
@@ -1,55 +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.
- */
-
-/**
- * created at Jan 10, 2002
- * @author Jeka
- */
-package com.intellij.compiler.classParsing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class FieldInfo extends MemberInfo {
-  public static final FieldInfo[] EMPTY_ARRAY = new FieldInfo[0];
-  private final ConstantValue myConstantValue;
-
-  public FieldInfo(int name, int descriptor) {
-    super(name, descriptor);
-    myConstantValue = ConstantValue.EMPTY_CONSTANT_VALUE;
-  }
-
-  public FieldInfo(int name, int descriptor, final int genericSignature, int flags, ConstantValue value, final AnnotationConstantValue[] runtimeVisibleAnnotations, final AnnotationConstantValue[] runtimeInvisibleAnnotations) {
-    super(name, descriptor, genericSignature, flags, runtimeVisibleAnnotations, runtimeInvisibleAnnotations);
-    myConstantValue = value == null ? ConstantValue.EMPTY_CONSTANT_VALUE : value;
-  }
-
-  public FieldInfo(DataInput in) throws IOException {
-    super(in);
-    myConstantValue = MemberInfoExternalizer.loadConstantValue(in);
-  }
-
-  public ConstantValue getConstantValue() {
-    return myConstantValue;
-  }
-
-  public void save(DataOutput out) throws IOException {
-    super.save(out);
-    MemberInfoExternalizer.saveConstantValue(out, myConstantValue);
-  }
-
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/FloatConstantValue.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/FloatConstantValue.java
deleted file mode 100644
index f818cbf..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/FloatConstantValue.java
+++ /dev/null
@@ -1,50 +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.
- */
-
-/**
- * created at Feb 24, 2002
- * @author Jeka
- */
-package com.intellij.compiler.classParsing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class FloatConstantValue extends ConstantValue{
-  private final float myValue;
-
-  public FloatConstantValue(float value) {
-    myValue = value;
-  }
-
-  public FloatConstantValue(DataInput in) throws IOException{
-    myValue = in.readFloat();
-  }
-
-  public float getValue() {
-    return myValue;
-  }
-
-  public void save(DataOutput out) throws IOException {
-    super.save(out);
-    out.writeFloat(myValue);
-  }
-
-  public boolean equals(Object obj) {
-    return (obj instanceof FloatConstantValue) && (((FloatConstantValue)obj).myValue == myValue);
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/GenericMethodSignature.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/GenericMethodSignature.java
deleted file mode 100644
index 10c01b4..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/GenericMethodSignature.java
+++ /dev/null
@@ -1,98 +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.compiler.classParsing;
-
-import com.intellij.openapi.compiler.CompilerBundle;
-import com.intellij.util.ArrayUtil;
-
-import java.text.CharacterIterator;
-import java.text.StringCharacterIterator;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Mar 4, 2004
- */
-public class GenericMethodSignature {
-  private final String myFormalTypeParams;
-  private final String[] myParamSignatures;
-  private final String myReturnTypeSignature;
-  private final String myThrowsSignature;
-
-  private GenericMethodSignature(String formalTypeParams, String[] paramSignatures, String returnTypeSignature, String throwsSignature) {
-    myFormalTypeParams = formalTypeParams;
-    myParamSignatures = paramSignatures;
-    myReturnTypeSignature = returnTypeSignature;
-    myThrowsSignature = throwsSignature;
-  }
-
-  public String getFormalTypeParams() {
-    return myFormalTypeParams;
-  }
-
-  public String[] getParamSignatures() {
-    return myParamSignatures;
-  }
-
-  public String getReturnTypeSignature() {
-    return myReturnTypeSignature;
-  }
-
-  public String getThrowsSignature() {
-    return myThrowsSignature;
-  }
-
-  public static GenericMethodSignature parse(String methodSignature) throws SignatureParsingException {
-    final StringCharacterIterator it = new StringCharacterIterator(methodSignature);
-
-    final StringBuilder formals = new StringBuilder();
-    if (it.current() == '<') {
-      SignatureParser.INSTANCE.parseFormalTypeParameters(it, formals);
-    }
-
-    if (it.current() != '(') {
-      throw new SignatureParsingException(CompilerBundle.message("error.signature.parsing.expected.other.symbol", "(", formals.toString()));
-    }
-
-    it.next(); // skip '('
-
-    final String[] paramSignatures;
-    if (it.current() != ')') {
-      final List<String> params = new ArrayList<String>();
-      while (it.current() != ')') {
-        final StringBuilder typeSignature = new StringBuilder();
-        SignatureParser.INSTANCE.parseTypeSignature(it, typeSignature);
-        params.add(typeSignature.toString());
-      }
-      paramSignatures = ArrayUtil.toStringArray(params);
-    }
-    else {
-      paramSignatures = ArrayUtil.EMPTY_STRING_ARRAY;
-    }
-    it.next(); // skip ')'
-
-    final StringBuilder returnTypeSignature = new StringBuilder();
-    SignatureParser.INSTANCE.parseReturnType(it, returnTypeSignature);
-
-    final StringBuilder throwsSignature = new StringBuilder();
-    if (it.current() != CharacterIterator.DONE) {
-      SignatureParser.INSTANCE.parseThrowsSignature(it, throwsSignature);
-    }
-    
-    return new GenericMethodSignature(formals.toString(), paramSignatures, returnTypeSignature.toString(), throwsSignature.toString());
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/IntegerConstantValue.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/IntegerConstantValue.java
deleted file mode 100644
index d59a727..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/IntegerConstantValue.java
+++ /dev/null
@@ -1,50 +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.
- */
-
-/**
- * created at Feb 24, 2002
- * @author Jeka
- */
-package com.intellij.compiler.classParsing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class IntegerConstantValue extends ConstantValue{
-  private final int myValue;
-
-  public IntegerConstantValue(int value) {
-    myValue = value;
-  }
-
-  public IntegerConstantValue(DataInput in) throws IOException{
-    myValue = in.readInt();
-  }
-
-  public int getValue() {
-    return myValue;
-  }
-
-  public void save(DataOutput out) throws IOException {
-    super.save(out);
-    out.writeInt(myValue);
-  }
-
-  public boolean equals(Object obj) {
-    return (obj instanceof IntegerConstantValue) && (((IntegerConstantValue)obj).myValue == myValue);
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/LongConstantValue.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/LongConstantValue.java
deleted file mode 100644
index 2cbe2d7..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/LongConstantValue.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.
- */
-
-/**
- * created at Feb 24, 2002
- * @author Jeka
- */
-package com.intellij.compiler.classParsing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class LongConstantValue extends ConstantValue{
-  private final long myValue;
-
-  public LongConstantValue(long value) {
-    myValue = value;
-  }
-  public LongConstantValue(DataInput in) throws IOException{
-    myValue = in.readLong();
-  }
-
-  public long getValue() {
-    return myValue;
-  }
-
-  public void save(DataOutput out) throws IOException {
-    super.save(out);
-    out.writeLong(myValue);
-  }
-
-  public boolean equals(Object obj) {
-    return (obj instanceof LongConstantValue) && (((LongConstantValue)obj).myValue == myValue);
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/MemberInfo.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/MemberInfo.java
deleted file mode 100644
index 3394a58..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/MemberInfo.java
+++ /dev/null
@@ -1,152 +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.
- */
-
-/**
- * created at Jan 8, 2002
- * @author Jeka
- */
-package com.intellij.compiler.classParsing;
-
-import com.intellij.util.cls.ClsUtil;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-public abstract class MemberInfo {
-  public static final MemberInfo[] EMPTY_MEMBER_INFO_ARRAY = new MemberInfo[0];
-  private static final int FLAG_INFO_UNAVAILABLE = 0x8000;
-  private final int myName;
-  private final int myDescriptor;
-  private final int myGenericSignature;
-  private final int myFlags;
-  private final AnnotationConstantValue[] myRuntimeVisibleAnnotations;
-  private final AnnotationConstantValue[] myRuntimeInvisibleAnnotations;
-
-  protected MemberInfo(int name, int descriptor) {
-    this(name, descriptor, -1, FLAG_INFO_UNAVAILABLE, AnnotationConstantValue.EMPTY_ARRAY, AnnotationConstantValue.EMPTY_ARRAY);
-  }
-
-  protected MemberInfo(int name, int descriptor, int genericSignature, int flags, final AnnotationConstantValue[] runtimeVisibleAnnotations, final AnnotationConstantValue[] runtimeInvisibleAnnotations) {
-    myDescriptor = descriptor;
-    myGenericSignature = genericSignature;
-    myName = name;
-    myFlags = flags;
-    myRuntimeVisibleAnnotations = runtimeVisibleAnnotations != null? runtimeVisibleAnnotations : AnnotationConstantValue.EMPTY_ARRAY;
-    myRuntimeInvisibleAnnotations = runtimeInvisibleAnnotations != null? runtimeInvisibleAnnotations : AnnotationConstantValue.EMPTY_ARRAY;
-  }
-
-  protected MemberInfo(DataInput in) throws IOException {
-    myName = in.readInt();
-    myDescriptor = in.readInt();
-    myGenericSignature = in.readInt();
-    myFlags = in.readInt();
-    myRuntimeVisibleAnnotations = loadAnnotations(in);
-    myRuntimeInvisibleAnnotations = loadAnnotations(in);
-  }
-
-  public void save(DataOutput out) throws IOException {
-    out.writeInt(myName);
-    out.writeInt(myDescriptor);
-    out.writeInt(myGenericSignature);
-    out.writeInt(myFlags);
-    saveAnnotations(out, myRuntimeVisibleAnnotations);
-    saveAnnotations(out, myRuntimeInvisibleAnnotations);
-  }
-
-  public int getName() {
-    return myName;
-  }
-
-  public int getDescriptor() {
-    return myDescriptor;
-  }
-
-  public int getGenericSignature() {
-    return myGenericSignature;
-  }
-
-  public boolean isFlagInfoAvailable() {
-    return myFlags != FLAG_INFO_UNAVAILABLE;
-  }
-
-  public int getFlags() {
-    return myFlags;
-  }
-
-  public boolean isPublic() {
-    return ClsUtil.isPublic(myFlags);
-  }
-
-  public boolean isProtected() {
-    return ClsUtil.isProtected(myFlags);
-  }
-
-  public boolean isFinal() {
-    return ClsUtil.isFinal(myFlags);
-  }
-
-  public boolean isPrivate() {
-    return ClsUtil.isPrivate(myFlags);
-  }
-
-  public boolean isPackageLocal() {
-    return ClsUtil.isPackageLocal(myFlags);
-  }
-
-  public boolean isStatic() {
-    return ClsUtil.isStatic(myFlags);
-  }
-
-  public boolean equals(Object obj) {
-    if (!(obj instanceof MemberInfo)) return false;
-    MemberInfo info = (MemberInfo)obj;
-    return (myName == info.myName) && (myDescriptor == info.myDescriptor);
-  }
-
-  public int hashCode() {
-    return myName + myDescriptor;
-  }
-
-  public AnnotationConstantValue[] getRuntimeVisibleAnnotations() {
-    return myRuntimeVisibleAnnotations;
-  }
-
-  public AnnotationConstantValue[] getRuntimeInvisibleAnnotations() {
-    return myRuntimeInvisibleAnnotations;
-  }
-
-  protected final void saveAnnotations(DataOutput out, final AnnotationConstantValue[] annotations) throws IOException {
-    out.writeInt(annotations.length);
-    for (AnnotationConstantValue annotation : annotations) {
-      MemberInfoExternalizer.saveConstantValue(out, annotation);
-    }
-  }
-
-  protected final AnnotationConstantValue[] loadAnnotations(DataInput in) throws IOException {
-    final int size = in.readInt();
-    if (size == 0) {
-      return AnnotationConstantValue.EMPTY_ARRAY;
-    }
-    final AnnotationConstantValue[] annotations = new AnnotationConstantValue[size];
-    for (int idx = 0; idx < size; idx++) {
-      annotations[idx] = (AnnotationConstantValue)MemberInfoExternalizer.loadConstantValue(in);
-    }
-    return annotations;
-  }
-
-}
-
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/MemberInfoExternalizer.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/MemberInfoExternalizer.java
deleted file mode 100644
index a807bd5..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/MemberInfoExternalizer.java
+++ /dev/null
@@ -1,219 +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.
- */
-
-/**
- * created at Jan 10, 2002
- * @author Jeka
- */
-package com.intellij.compiler.classParsing;
-
-import com.intellij.openapi.diagnostic.Logger;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class MemberInfoExternalizer {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.classParsing.MemberInfoExternalizer");
-
-  public static final byte FIELD_INFO_TAG = 1;
-  public static final byte METHOD_INFO_TAG = 2;
-
-  public static final byte DECLARATION_INFO_TAG = 9;
-
-  public static final byte REFERENCE_INFO_TAG = 11;
-  public static final byte MEMBER_REFERENCE_INFO_TAG = 12;
-
-  public static final byte LONG_CONSTANT_TAG = 3;
-  public static final byte FLOAT_CONSTANT_TAG = 4;
-  public static final byte DOUBLE_CONSTANT_TAG = 5;
-  public static final byte INTEGER_CONSTANT_TAG = 6;
-  public static final byte STRING_CONSTANT_TAG = 7;
-  public static final byte CONSTANT_TAG = 8;
-  public static final byte ANNOTATION_CONSTANT_TAG = 13;
-  public static final byte ANNOTATION_PRIMITIVE_CONSTANT_TAG = 14;
-  public static final byte CONSTANT_VALUE_ARRAY_TAG = 15;
-  public static final byte CLASS_CONSTANT_VALUE_TAG = 16;
-  public static final byte ENUM_CONSTANT_VALUE_TAG = 17;
-
-  public static MemberInfo loadMemberInfo(DataInput in) throws IOException {
-    byte tag = in.readByte();
-    if (tag == METHOD_INFO_TAG) {
-      return new MethodInfo(in);
-    }
-    else if (tag == FIELD_INFO_TAG) {
-      return new FieldInfo(in);
-    }
-    LOG.error("Unknown member info");
-    return null;
-  }
-
-  public static ReferenceInfo loadReferenceInfo(DataInput in) throws IOException {
-    final byte tag = in.readByte();
-    if (tag == REFERENCE_INFO_TAG) {
-      return new ReferenceInfo(in);
-    }
-    else if (tag == MEMBER_REFERENCE_INFO_TAG) {
-      return new MemberReferenceInfo(in);
-    }
-    LOG.error("Unknown declaration info tag: " + tag);
-    return null;
-  }
-
-  public static ConstantValue loadConstantValue(DataInput in) throws IOException {
-    final byte tag = in.readByte();
-    if (tag == LONG_CONSTANT_TAG) {
-      return new LongConstantValue(in);
-    }
-    else if (tag == FLOAT_CONSTANT_TAG) {
-      return new FloatConstantValue(in);
-    }
-    else if (tag == DOUBLE_CONSTANT_TAG) {
-      return new DoubleConstantValue(in);
-    }
-    else if (tag == INTEGER_CONSTANT_TAG) {
-      return new IntegerConstantValue(in);
-    }
-    else if (tag == STRING_CONSTANT_TAG) {
-      return new StringConstantValue(in);
-    }
-    else if (tag == CONSTANT_TAG) {
-      return ConstantValue.EMPTY_CONSTANT_VALUE;
-    }
-    else if (tag == ANNOTATION_CONSTANT_TAG) {
-      return new AnnotationConstantValue(in);
-    }
-    else if (tag == ANNOTATION_PRIMITIVE_CONSTANT_TAG) {
-      return new AnnotationPrimitiveConstantValue(in);
-    }
-    else if (tag == CONSTANT_VALUE_ARRAY_TAG) {
-      return new ConstantValueArray(in);
-    }
-    else if (tag == CLASS_CONSTANT_VALUE_TAG) {
-      return new ClassInfoConstantValue(in);
-    }
-    else if (tag == ENUM_CONSTANT_VALUE_TAG) {
-      return new EnumConstantValue(in);
-    }
-    LOG.error("Unknown constant value type " + tag);
-    return null;
-  }
-
-  public static void saveMemberInfo(DataOutput out, MemberInfo info) throws IOException {
-    if (info instanceof MethodInfo) {
-      out.writeByte(METHOD_INFO_TAG);
-    }
-    else if (info instanceof FieldInfo){
-      out.writeByte(FIELD_INFO_TAG);
-    }
-    else {
-      LOG.error("Unknown member info");
-    }
-    info.save(out);
-  }
-
-  public static void saveReferenceInfo(DataOutput out, ReferenceInfo info) throws IOException {
-    if (info instanceof MemberReferenceInfo) {
-      out.writeByte(MEMBER_REFERENCE_INFO_TAG);
-    }
-    else{
-      out.writeByte(REFERENCE_INFO_TAG);
-    }
-    info.save(out);
-  }
-
-  public static void saveConstantValue(DataOutput out, ConstantValue value) throws IOException {
-    if (value instanceof LongConstantValue) {
-      out.writeByte(LONG_CONSTANT_TAG);
-    }
-    else if (value instanceof FloatConstantValue){
-      out.writeByte(FLOAT_CONSTANT_TAG);
-    }
-    else if (value instanceof DoubleConstantValue){
-      out.writeByte(DOUBLE_CONSTANT_TAG);
-    }
-    else if (value instanceof IntegerConstantValue){
-      out.writeByte(INTEGER_CONSTANT_TAG);
-    }
-    else if (value instanceof StringConstantValue){
-      out.writeByte(STRING_CONSTANT_TAG);
-    }
-    else if (value instanceof AnnotationConstantValue) {
-      out.writeByte(ANNOTATION_CONSTANT_TAG);
-    }
-    else if (value instanceof AnnotationPrimitiveConstantValue) {
-      out.writeByte(ANNOTATION_PRIMITIVE_CONSTANT_TAG);
-    }
-    else if (value instanceof ConstantValueArray) {
-      out.writeByte(CONSTANT_VALUE_ARRAY_TAG);
-    }
-    else if (value instanceof ClassInfoConstantValue) {
-      out.writeByte(CLASS_CONSTANT_VALUE_TAG);
-    }
-    else if (value instanceof EnumConstantValue) {
-      out.writeByte(ENUM_CONSTANT_VALUE_TAG);
-    }
-    else {
-      out.writeByte(CONSTANT_TAG);
-    }
-    if (value != null) {
-      value.save(out);
-    }
-  }
-
-  public static AnnotationConstantValue[] readAnnotationConstantValueArray1(DataInput in) throws IOException {
-    final int size = in.readInt();
-    final AnnotationConstantValue[] array = size > 0? new AnnotationConstantValue[size] : AnnotationConstantValue.EMPTY_ARRAY;
-    for (int idx = 0; idx < size; idx++) {
-      array[idx] = (AnnotationConstantValue)loadConstantValue(in);
-    }
-    return array;
-  }
-
-  public static AnnotationConstantValue[][] readAnnotationConstantValueArray2(DataInput in) throws IOException {
-    final int size = in.readInt();
-    final AnnotationConstantValue[][] array = size > 0? new AnnotationConstantValue[size][] : AnnotationConstantValue.EMPTY_ARRAY_ARRAY;
-    for (int idx = 0; idx < size; idx++) {
-      array[idx] = readAnnotationConstantValueArray1(in);
-    }
-    return array;
-  }
-
-  public static void writeConstantValueArray1(DataOutput writer, final ConstantValue[] array) throws IOException {
-    if (array != null && array.length > 0) {
-      writer.writeInt(array.length);
-      for (ConstantValue value : array) {
-        saveConstantValue(writer, value);
-      }
-    }
-    else {
-      writer.writeInt(0);
-    }
-  }
-
-  public static void writeConstantValueArray2(DataOutput writer, final ConstantValue[][] array) throws IOException {
-    if (array != null && array.length > 0) {
-      writer.writeInt(array.length);
-      for (ConstantValue[] aArray : array) {
-        writeConstantValueArray1(writer, aArray);
-      }
-    }
-    else {
-      writer.writeInt(0);
-    }
-  }
-
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/MemberReferenceInfo.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/MemberReferenceInfo.java
deleted file mode 100644
index 63d7c54..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/MemberReferenceInfo.java
+++ /dev/null
@@ -1,73 +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.
- */
-
-/**
- * created at Jan 8, 2002
- * @author Jeka
- */
-package com.intellij.compiler.classParsing;
-
-import org.jetbrains.annotations.NonNls;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class MemberReferenceInfo extends ReferenceInfo {
-  private final MemberInfo myMemberInfo;
-
-  public MemberReferenceInfo(int declaringClass, MemberInfo memberInfo) {
-    super(declaringClass);
-    myMemberInfo = memberInfo;
-  }
-
-  public MemberReferenceInfo(DataInput in) throws IOException {
-    super(in);
-    myMemberInfo = MemberInfoExternalizer.loadMemberInfo(in);
-  }
-
-  public MemberInfo getMemberInfo() {
-    return myMemberInfo;
-  }
-
-  public boolean isFieldReference() {
-    return myMemberInfo instanceof FieldInfo;
-  }
-
-  public boolean isMethodReference() {
-    return myMemberInfo instanceof MethodInfo;
-  }
-
-  public void save(DataOutput out) throws IOException {
-    super.save(out);
-    MemberInfoExternalizer.saveMemberInfo(out, myMemberInfo);
-  }
-
-  public boolean equals(Object o) {
-    if (!super.equals(o)) {
-      return false;
-    }
-    return myMemberInfo.equals(((MemberReferenceInfo)o).myMemberInfo);
-  }
-
-  public int hashCode() {
-    return super.hashCode() + myMemberInfo.hashCode();
-  }
-
-  public @NonNls String toString() { // for debug purposes
-    return "Member reference: [class name=" + getClassName() + ", member name = " + myMemberInfo.getName() + ", member descriptor=" + myMemberInfo.getDescriptor() + ", member signature=" + myMemberInfo.getGenericSignature() + "]";
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/MethodInfo.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/MethodInfo.java
deleted file mode 100644
index c18d9ae..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/MethodInfo.java
+++ /dev/null
@@ -1,263 +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.
- */
-
-/**
- * created at Jan 10, 2002
- * @author Jeka
- */
-package com.intellij.compiler.classParsing;
-
-import com.intellij.compiler.SymbolTable;
-import com.intellij.compiler.make.CacheCorruptedException;
-import com.intellij.compiler.make.CacheUtils;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.cls.ClsUtil;
-import gnu.trove.TIntHashSet;
-import org.jetbrains.annotations.NonNls;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.ArrayList;
-
-public class MethodInfo extends MemberInfo {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.classParsing.MethodInfo");
-
-  private static final int[] EXCEPTION_INFO_UNAVAILABLE = ArrayUtil.EMPTY_INT_ARRAY;
-  public static final MethodInfo[] EMPTY_ARRAY = new MethodInfo[0];
-
-  private final int[] myThrownExceptions;
-  // cached (lazy initialized) data
-  private String mySignature = null;
-  private String[] myParameterDescriptors = null;
-  private String myReturnTypeSignature = null;
-  private final boolean myIsConstructor;
-  private final AnnotationConstantValue[][] myRuntimeVisibleParameterAnnotations;
-  private final AnnotationConstantValue[][] myRuntimeInvisibleParameterAnnotations;
-  private final ConstantValue myAnnotationDefault;
-
-  public MethodInfo(int name, int descriptor, boolean isConstructor) {
-    super(name, descriptor);
-    myIsConstructor = isConstructor;
-    myThrownExceptions = EXCEPTION_INFO_UNAVAILABLE;
-    myRuntimeVisibleParameterAnnotations = AnnotationConstantValue.EMPTY_ARRAY_ARRAY;
-    myRuntimeInvisibleParameterAnnotations = AnnotationConstantValue.EMPTY_ARRAY_ARRAY;
-    myAnnotationDefault = ConstantValue.EMPTY_CONSTANT_VALUE;
-  }
-
-  public MethodInfo(int name,
-                    int descriptor,
-                    final int genericSignature,
-                    int flags,
-                    int[] exceptions,
-                    boolean isConstructor,
-                    final AnnotationConstantValue[] runtimeVisibleAnnotations,
-                    final AnnotationConstantValue[] runtimeInvisibleAnnotations,
-                    final AnnotationConstantValue[][] runtimeVisibleParameterAnnotations,
-                    final AnnotationConstantValue[][] runtimeInvisibleParameterAnnotations, ConstantValue annotationDefault) {
-
-    super(name, descriptor, genericSignature, flags, runtimeVisibleAnnotations, runtimeInvisibleAnnotations);
-    myThrownExceptions = exceptions != null? exceptions : ArrayUtil.EMPTY_INT_ARRAY;
-    myIsConstructor = isConstructor;
-    myRuntimeVisibleParameterAnnotations = runtimeVisibleParameterAnnotations == null? AnnotationConstantValue.EMPTY_ARRAY_ARRAY : runtimeVisibleParameterAnnotations; 
-    myRuntimeInvisibleParameterAnnotations = runtimeInvisibleParameterAnnotations == null? AnnotationConstantValue.EMPTY_ARRAY_ARRAY : runtimeInvisibleParameterAnnotations;
-    myAnnotationDefault = annotationDefault;
-  }
-
-  public MethodInfo(DataInput in) throws IOException {
-    super(in);
-    myIsConstructor = in.readBoolean();
-    int count = in.readInt();
-    if (count == -1) {
-      myThrownExceptions = EXCEPTION_INFO_UNAVAILABLE;
-    }
-    else {
-      myThrownExceptions = ArrayUtil.newIntArray(count);
-      for (int idx = 0; idx < count; idx++) {
-        myThrownExceptions[idx] = in.readInt();
-      }
-    }
-    myRuntimeVisibleParameterAnnotations = loadParameterAnnotations(in);
-    myRuntimeInvisibleParameterAnnotations = loadParameterAnnotations(in);
-    myAnnotationDefault = MemberInfoExternalizer.loadConstantValue(in);
-  }
-
-  public void save(DataOutput out) throws IOException {
-    super.save(out);
-    out.writeBoolean(myIsConstructor);
-    if (isExceptionInfoAvailable()) {
-      out.writeInt(myThrownExceptions.length);
-    }
-    else {
-      out.writeInt(-1);
-    }
-    for (int thrownException : myThrownExceptions) {
-      out.writeInt(thrownException);
-    }
-    saveParameterAnnotations(out, myRuntimeVisibleParameterAnnotations);
-    saveParameterAnnotations(out, myRuntimeInvisibleParameterAnnotations);
-    MemberInfoExternalizer.saveConstantValue(out, myAnnotationDefault);
-  }
-
-  private boolean isExceptionInfoAvailable() {
-    return myThrownExceptions != EXCEPTION_INFO_UNAVAILABLE;
-  }
-
-  public boolean areExceptionsEqual(MethodInfo info) {
-    if (myThrownExceptions.length != info.myThrownExceptions.length) {
-      return false;
-    }
-    if (myThrownExceptions.length != 0) { // optimization
-      TIntHashSet exceptionsSet = new TIntHashSet();
-      for (int thrownException : myThrownExceptions) {
-        exceptionsSet.add(thrownException);
-      }
-      for (int exception : info.myThrownExceptions) {
-        if (!exceptionsSet.contains(exception)) {
-          return false;
-        }
-      }
-    }
-    return true;
-  }
-
-  public int[] getThrownExceptions() {
-    return myThrownExceptions;
-  }
-
-  public String getDescriptor(SymbolTable symbolTable) throws CacheCorruptedException {
-    if (mySignature == null) {
-      final String descriptor = symbolTable.getSymbol(getDescriptor());
-      final String name = symbolTable.getSymbol(getName());
-      mySignature = CacheUtils.getMethodSignature(name, descriptor);
-    }
-    return mySignature;
-  }
-
-  public String getReturnTypeDescriptor(SymbolTable symbolTable) throws CacheCorruptedException {
-    if (myReturnTypeSignature == null) {
-      String descriptor = symbolTable.getSymbol(getDescriptor());
-      myReturnTypeSignature = descriptor.substring(descriptor.indexOf(')') + 1, descriptor.length());
-    }
-    return myReturnTypeSignature;
-  }
-
-  public String[] getParameterDescriptors(SymbolTable symbolTable) throws CacheCorruptedException {
-    if (myParameterDescriptors == null) {
-      String descriptor = symbolTable.getSymbol(getDescriptor());
-      int endIndex = descriptor.indexOf(')');
-      if (endIndex <= 0) {
-        LOG.error("Corrupted method descriptor: " + descriptor);
-      }
-      myParameterDescriptors = parseParameterDescriptors(descriptor.substring(1, endIndex));
-    }
-    return myParameterDescriptors;
-  }
-
-  public boolean isAbstract() {
-    return ClsUtil.isAbstract(getFlags());
-  }
-
-  public boolean isConstructor() {
-    return myIsConstructor;
-  }
-
-  private String[] parseParameterDescriptors(String signature) {
-    ArrayList<String> list = new ArrayList<String>();
-    String paramSignature = parseFieldType(signature);
-    while (paramSignature != null && !"".equals(paramSignature)) {
-      list.add(paramSignature);
-      signature = signature.substring(paramSignature.length());
-      paramSignature = parseFieldType(signature);
-    }
-    return ArrayUtil.toStringArray(list);
-  }
-
-  private @NonNls String parseFieldType(@NonNls String signature) {
-    if (signature.length() == 0) {
-      return null;
-    }
-    if (signature.charAt(0) == 'B') {
-      return "B";
-    }
-    if (signature.charAt(0) == 'C') {
-      return "C";
-    }
-    if (signature.charAt(0) == 'D') {
-      return "D";
-    }
-    if (signature.charAt(0) == 'F') {
-      return "F";
-    }
-    if (signature.charAt(0) == 'I') {
-      return "I";
-    }
-    if (signature.charAt(0) == 'J') {
-      return "J";
-    }
-    if (signature.charAt(0) == 'S') {
-      return "S";
-    }
-    if (signature.charAt(0) == 'Z') {
-      return "Z";
-    }
-    if (signature.charAt(0) == 'L') {
-      return signature.substring(0, signature.indexOf(";") + 1);
-    }
-    if (signature.charAt(0) == '[') {
-      String s = parseFieldType(signature.substring(1));
-      return (s != null)? ("[" + s) : null;
-    }
-    return null;
-  }
-
-  public AnnotationConstantValue[][] getRuntimeVisibleParameterAnnotations() {
-    return myRuntimeVisibleParameterAnnotations;
-  }
-
-  public AnnotationConstantValue[][] getRuntimeInvisibleParameterAnnotations() {
-    return myRuntimeInvisibleParameterAnnotations;
-  }
-
-  public String toString() {
-    return mySignature;
-  }
-
-  private AnnotationConstantValue[][] loadParameterAnnotations(DataInput in) throws IOException {
-    final int size = in.readInt();
-    if (size == 0) {
-      return AnnotationConstantValue.EMPTY_ARRAY_ARRAY;
-    }
-    final AnnotationConstantValue[][] paramAnnotations = new AnnotationConstantValue[size][];
-    for (int idx = 0; idx < size; idx++) {
-      paramAnnotations[idx] = loadAnnotations(in);
-    }
-    return paramAnnotations;
-  }
-
-  private void saveParameterAnnotations(DataOutput out, AnnotationConstantValue[][] parameterAnnotations) throws IOException {
-    out.writeInt(parameterAnnotations.length);
-    for (AnnotationConstantValue[] parameterAnnotation : parameterAnnotations) {
-      saveAnnotations(out, parameterAnnotation);
-    }
-  }
-
-  public ConstantValue getAnnotationDefault() {
-    return myAnnotationDefault;
-  }
-
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/ReferenceInfo.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/ReferenceInfo.java
deleted file mode 100644
index 3cf9a19..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/ReferenceInfo.java
+++ /dev/null
@@ -1,65 +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 Eugene Zhuravlev
- */
-package com.intellij.compiler.classParsing;
-
-import org.jetbrains.annotations.NonNls;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class ReferenceInfo {
-  private final int myClassName;
-
-  public ReferenceInfo(int declaringClassName) {
-    myClassName = declaringClassName;
-  }
-
-  public ReferenceInfo(DataInput in) throws IOException {
-    this(in.readInt());
-  }
-
-  public @NonNls String toString() { // for debug purposes
-    return "Class reference[class name=" + String.valueOf(getClassName()) + "]";
-  }
-
-  public void save(DataOutput out) throws IOException {
-    out.writeInt(myClassName);
-  }
-
-  public int getClassName() {
-    return myClassName;
-  }
-
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    if (o == null || getClass() != o.getClass()) return false;
-
-    ReferenceInfo that = (ReferenceInfo)o;
-
-    if (myClassName != that.myClassName) return false;
-
-    return true;
-  }
-
-  public int hashCode() {
-    return myClassName;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/SignatureParser.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/SignatureParser.java
deleted file mode 100644
index d195cf3..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/SignatureParser.java
+++ /dev/null
@@ -1,259 +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.compiler.classParsing;
-
-import com.intellij.openapi.compiler.CompilerBundle;
-
-import java.text.CharacterIterator;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Mar 4, 2004
- */
-
-public class SignatureParser {
-  public static final SignatureParser INSTANCE = new SignatureParser();
-
-  public void parseIdentifier(CharacterIterator it, final StringBuilder buf) {
-    while (Character.isJavaIdentifierPart(it.current())) {
-      buf.append(it.current());
-      it.next();
-    }
-  }
-
-  public void parseFormalTypeParameters(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    if (it.current() != '<') {
-      throw new SignatureParsingException(CompilerBundle.message("error.signature.parsing.expected.other.symbol", "<", buf.toString()));
-    }
-
-    buf.append(it.current()); // skip '<'
-    it.next();
-
-    while (it.current() != '>') {
-      parseFormalTypeParameter(it, buf);
-    }
-
-    buf.append(it.current());
-    it.next();
-  }
-
-  public void parseFormalTypeParameter(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    parseIdentifier(it, buf);
-    parseClassBound(it, buf);
-    while (it.current() == ':') {
-      parseInterfaceBound(it, buf);
-    }
-  }
-
-  public void parseClassBound(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    if (it.current() != ':') {
-      throw new SignatureParsingException(CompilerBundle.message("error.signature.parsing.expected.other.symbol", ":", buf.toString()));
-    }
-    buf.append(it.current());
-    it.next();
-
-    final char current = it.current();
-    if (current != CharacterIterator.DONE && current != ':') {
-      parseFieldTypeSignature(it, buf);
-    }
-  }
-
-  public void parseInterfaceBound(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    if (it.current() != ':') {
-      throw new SignatureParsingException(CompilerBundle.message("error.signature.parsing.expected.other.symbol", ":", buf.toString()));
-    }
-    buf.append(it.current());
-    it.next();
-    parseFieldTypeSignature(it, buf);
-  }
-
-  public void parseSuperclassSignature(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    parseClassTypeSignature(it, buf);
-  }
-
-  public void parseSuperinterfaceSignature(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    parseClassTypeSignature(it, buf);
-  }
-
-  public void parseFieldTypeSignature(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    if (it.current() == 'L') {
-      parseClassTypeSignature(it, buf);
-    }
-    else if (it.current() == '[') {
-      parseArrayTypeSignature(it, buf);
-    }
-    else if (it.current() == 'T') {
-      parseTypeVariableSignature(it, buf);
-    }
-    else {
-      //noinspection HardCodedStringLiteral
-      throw new SignatureParsingException(CompilerBundle.message("error.signature.parsing.expected.other.symbol", "'L' / '[' / 'T'", buf.toString()));
-    }
-  }
-
-  public void parseClassTypeSignature(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    buf.append(it.current());
-    it.next();     // consume 'L'
-    parseSimpleClassTypeSignature(it, buf);
-    while (it.current() == '/' || it.current() == '.') { // Eclipse compiler generates '.' for inner classes 
-      parseClassTypeSignatureSuffix(it, buf);
-    }
-    if (it.current() != ';') {
-      throw new SignatureParsingException(CompilerBundle.message("error.signature.parsing.expected.other.symbol", ";", buf.toString()));
-    }
-    buf.append(it.current());
-    it.next(); // consume ';'
-  }
-
-  public void parseSimpleClassTypeSignature(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    parseIdentifier(it, buf);
-    if (it.current() == '<') {
-      parseTypeArguments(it, buf);
-    }
-  }
-
-  public void parseClassTypeSignatureSuffix(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    buf.append(it.current());
-    it.next();
-    parseSimpleClassTypeSignature(it, buf);
-  }
-
-  public void parseTypeVariableSignature(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    buf.append(it.current());
-    it.next(); // consume 'T'
-    parseIdentifier(it, buf);
-    if (it.current() != ';') {
-      throw new SignatureParsingException(CompilerBundle.message("error.signature.parsing.expected.other.symbol", ";", buf.toString()));
-    }
-    buf.append(it.current());
-    it.next(); // consume ';'
-  }
-
-  public void parseTypeArguments(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    buf.append(it.current());
-    it.next(); // consume '<'
-    while (it.current() != '>') {
-      parseTypeArgument(it, buf);
-    }
-    buf.append(it.current());
-    it.next(); // consume '>'
-  }
-
-  public void parseTypeArgument(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    if (it.current() == '*') {
-      parseWildcardIndicator(it, buf);
-    }
-    else {
-      if (it.current() == '+' || it.current() == '-') {
-        parseWildcardIndicator(it, buf);
-      }
-      parseFieldTypeSignature(it, buf);
-    }
-  }
-
-  public void parseWildcardIndicator(CharacterIterator it, final StringBuilder buf) {
-    buf.append(it.current());
-    it.next();
-  }
-
-  public void parseArrayTypeSignature(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    buf.append(it.current());
-    it.next(); // consume '['
-    parseTypeSignature(it, buf);
-  }
-
-  public void parseTypeSignature(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    char current = it.current();
-    if (current == 'B' || current == 'C' || current == 'D' || current == 'F' || current == 'I' || current == 'J' || current == 'S' || current == 'Z') {
-      buf.append(it.current());
-      it.next(); // base type
-    }
-    else if (current == 'L' || current == '[' || current == 'T') {
-      parseFieldTypeSignature(it, buf);
-    }
-    else {
-      throw new SignatureParsingException(CompilerBundle.message("error.signature.parsing.unknown.type.signature"));
-    }
-  }
-
-  public void parseReturnType(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    if (it.current() == 'V') {
-      buf.append(it.current());
-      it.next();
-    }
-    else {
-      parseTypeSignature(it, buf);
-    }
-  }
-
-  public void parseThrowsSignature(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    if (it.current() != '^') {
-      throw new SignatureParsingException(CompilerBundle.message("error.signature.parsing.expected.other.symbol", "^", buf.toString()));
-    }
-    buf.append(it.current());
-    it.next();
-    if (it.current() == 'T') {
-      parseTypeVariableSignature(it, buf);
-    }
-    else {
-      parseClassTypeSignature(it, buf);
-    }
-  }
-
-  public void parseMethodSignature(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    if (it.current() == '<') {
-      parseFormalTypeParameters(it, buf);
-    }
-
-    if (it.current() != '(') {
-      throw new SignatureParsingException(CompilerBundle.message("error.signature.parsing.expected.other.symbol", "(", buf.toString()));
-    }
-
-    buf.append(it.current());
-    it.next(); // skip '('
-
-    while (it.current() != ')') {
-      parseTypeSignature(it, buf);
-    }
-
-    buf.append(it.current());
-    it.next(); // skip ')'
-
-    parseReturnType(it, buf);
-
-    if (it.current() != CharacterIterator.DONE) {
-      parseThrowsSignature(it, buf);
-    }
-  }
-
-  public void parseClassSignature(CharacterIterator it, final StringBuilder buf) throws SignatureParsingException {
-    if (it.current() == '<') {
-      buf.append(it.current());
-      it.next();
-      while (it.current() != '>') {
-        parseFormalTypeParameter(it, buf);
-      }
-      buf.append(it.current());
-      it.next();
-    }
-
-    parseClassTypeSignature(it, buf);
-
-    while (it.current() != CharacterIterator.DONE) {
-      parseClassTypeSignature(it, buf);
-    }
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/SignatureParsingException.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/SignatureParsingException.java
deleted file mode 100644
index 7246b19..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/SignatureParsingException.java
+++ /dev/null
@@ -1,26 +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.compiler.classParsing;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Mar 4, 2004
- */
-public class SignatureParsingException extends Exception{
-  public SignatureParsingException(String message) {
-    super(message);
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/classParsing/StringConstantValue.java b/java/compiler/impl/src/com/intellij/compiler/classParsing/StringConstantValue.java
deleted file mode 100644
index faf560f..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/classParsing/StringConstantValue.java
+++ /dev/null
@@ -1,52 +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.
- */
-
-/**
- * created at Feb 24, 2002
- * @author Jeka
- */
-package com.intellij.compiler.classParsing;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class StringConstantValue extends ConstantValue{
-  private final String myValue;
-
-  public StringConstantValue(String value) {
-    myValue = value;
-  }
-
-  public StringConstantValue(DataInput in) throws IOException{
-    myValue = in.readUTF();
-  }
-
-  public String getValue() {
-    return myValue;
-  }
-
-  public void save(DataOutput out) throws IOException {
-    super.save(out);
-    out.writeUTF(myValue);
-  }
-
-  public boolean equals(Object obj) {
-    return
-      (obj instanceof StringConstantValue) &&
-      ((myValue == null)? ((StringConstantValue)obj).myValue == null : myValue.equals(((StringConstantValue)obj).myValue));
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/AdditionalCompileScopeProvider.java b/java/compiler/impl/src/com/intellij/compiler/impl/AdditionalCompileScopeProvider.java
deleted file mode 100644
index 0b9ed31..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/AdditionalCompileScopeProvider.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.compiler.impl;
-
-import com.intellij.openapi.compiler.CompilerFilter;
-import com.intellij.openapi.extensions.ExtensionPointName;
-import com.intellij.openapi.compiler.CompileScope;
-import com.intellij.openapi.project.Project;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author nik
- */
-public abstract class AdditionalCompileScopeProvider {
-  public static final ExtensionPointName<AdditionalCompileScopeProvider> EXTENSION_POINT_NAME = ExtensionPointName.create("com.intellij.compiler.additionalCompileScopeProvider");
-
-  @Nullable
-  public abstract CompileScope getAdditionalScope(@NotNull CompileScope baseScope, @NotNull CompilerFilter filter, @NotNull Project project);
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextExProxy.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextExProxy.java
deleted file mode 100644
index a8bad56..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextExProxy.java
+++ /dev/null
@@ -1,183 +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.compiler.impl;
-
-import com.intellij.compiler.make.DependencyCache;
-import com.intellij.openapi.compiler.CompileScope;
-import com.intellij.openapi.compiler.CompilerMessage;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Key;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.pom.Navigatable;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collection;
-import java.util.Set;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Dec 4, 2007
- */
-public class CompileContextExProxy implements CompileContextEx {
-  private final CompileContextEx myDelegate;
-
-  public CompileContextExProxy(CompileContextEx delegate) {
-    myDelegate = delegate;
-  }
-
-  public Project getProject() {
-    return myDelegate.getProject();
-  }
-
-  public DependencyCache getDependencyCache() {
-    return myDelegate.getDependencyCache();
-  }
-
-  public VirtualFile getSourceFileByOutputFile(final VirtualFile outputFile) {
-    return myDelegate.getSourceFileByOutputFile(outputFile);
-  }
-
-  public void addMessage(final CompilerMessage message) {
-    myDelegate.addMessage(message);
-  }
-
-  @NotNull
-  public Set<VirtualFile> getTestOutputDirectories() {
-    return myDelegate.getTestOutputDirectories();
-  }
-
-  public boolean isInTestSourceContent(@NotNull final VirtualFile fileOrDir) {
-    return myDelegate.isInTestSourceContent(fileOrDir);
-  }
-
-  public boolean isInSourceContent(@NotNull final VirtualFile fileOrDir) {
-    return myDelegate.isInSourceContent(fileOrDir);
-  }
-
-  public void addScope(final CompileScope additionalScope) {
-    myDelegate.addScope(additionalScope);
-  }
-
-  public void addMessage(final CompilerMessageCategory category,
-                         final String message, @Nullable final String url, final int lineNum, final int columnNum) {
-    myDelegate.addMessage(category, message, url, lineNum, columnNum);
-  }
-
-  public void addMessage(final CompilerMessageCategory category, final String message, @Nullable final String url,
-                         final int lineNum,
-                         final int columnNum,
-                         final Navigatable navigatable) {
-    myDelegate.addMessage(category, message, url, lineNum, columnNum, navigatable);
-  }
-
-  public CompilerMessage[] getMessages(final CompilerMessageCategory category) {
-    return myDelegate.getMessages(category);
-  }
-
-  public int getMessageCount(final CompilerMessageCategory category) {
-    return myDelegate.getMessageCount(category);
-  }
-
-  public ProgressIndicator getProgressIndicator() {
-    return myDelegate.getProgressIndicator();
-  }
-
-  public CompileScope getCompileScope() {
-    return myDelegate.getCompileScope();
-  }
-
-  public CompileScope getProjectCompileScope() {
-    return myDelegate.getProjectCompileScope();
-  }
-
-  public void requestRebuildNextTime(final String message) {
-    myDelegate.requestRebuildNextTime(message);
-  }
-
-  public boolean isRebuildRequested() {
-    return myDelegate.isRebuildRequested();
-  }
-
-  @Nullable
-  public String getRebuildReason() {
-    return myDelegate.getRebuildReason();
-  }
-
-  public Module getModuleByFile(final VirtualFile file) {
-    return myDelegate.getModuleByFile(file);
-  }
-
-  public VirtualFile[] getSourceRoots(final Module module) {
-    return myDelegate.getSourceRoots(module);
-  }
-
-  public VirtualFile[] getAllOutputDirectories() {
-    return myDelegate.getAllOutputDirectories();
-  }
-
-  public VirtualFile getModuleOutputDirectory(final Module module) {
-    return myDelegate.getModuleOutputDirectory(module);
-  }
-
-  public VirtualFile getModuleOutputDirectoryForTests(final Module module) {
-    return myDelegate.getModuleOutputDirectoryForTests(module);
-  }
-
-  public boolean isMake() {
-    return myDelegate.isMake();
-  }
-
-  public boolean isAnnotationProcessorsEnabled() {
-    return myDelegate.isAnnotationProcessorsEnabled();
-  }
-
-  public boolean isRebuild() {
-    return myDelegate.isRebuild();
-  }
-
-  public <T> T getUserData(@NotNull final Key<T> key) {
-    return myDelegate.getUserData(key);
-  }
-
-  public <T> void putUserData(@NotNull final Key<T> key, final T value) {
-    myDelegate.putUserData(key, value);
-  }
-
-  public void recalculateOutputDirs() {
-    myDelegate.recalculateOutputDirs();
-  }
-
-  public void markGenerated(Collection<VirtualFile> files) {
-    myDelegate.markGenerated(files);
-  }
-
-  public boolean isGenerated(VirtualFile file) {
-    return myDelegate.isGenerated(file);
-  }
-
-  public long getStartCompilationStamp() {
-    return myDelegate.getStartCompilationStamp();
-  }
-
-  public void assignModule(@NotNull VirtualFile root, @NotNull Module module, boolean isTestSource, com.intellij.openapi.compiler.Compiler compiler) {
-    myDelegate.assignModule(root, module, isTestSource, compiler);
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextImpl.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextImpl.java
index 764bf1d..17e2dfe 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextImpl.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextImpl.java
@@ -24,24 +24,21 @@
 import com.intellij.compiler.CompilerConfiguration;
 import com.intellij.compiler.CompilerMessageImpl;
 import com.intellij.compiler.CompilerWorkspaceConfiguration;
-import com.intellij.compiler.make.DependencyCache;
 import com.intellij.compiler.progress.CompilerTask;
 import com.intellij.execution.impl.ExecutionManagerImpl;
 import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.compiler.Compiler;
+import com.intellij.openapi.compiler.CompileScope;
+import com.intellij.openapi.compiler.CompilerMessage;
+import com.intellij.openapi.compiler.CompilerMessageCategory;
+import com.intellij.openapi.compiler.CompilerPaths;
 import com.intellij.openapi.compiler.ex.CompileContextEx;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
 import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.CompilerModuleExtension;
 import com.intellij.openapi.roots.ModuleRootManager;
 import com.intellij.openapi.roots.ProjectFileIndex;
 import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.UserDataHolderBase;
 import com.intellij.openapi.vfs.VfsUtil;
 import com.intellij.openapi.vfs.VfsUtilCore;
@@ -49,14 +46,9 @@
 import com.intellij.openapi.vfs.VirtualFileManager;
 import com.intellij.pom.Navigatable;
 import com.intellij.util.containers.HashMap;
-import com.intellij.util.containers.HashSet;
-import com.intellij.util.containers.OrderedSet;
-import com.intellij.util.indexing.FileBasedIndex;
-import gnu.trove.TIntHashSet;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.io.File;
 import java.util.*;
 
 public class CompileContextImpl extends UserDataHolderBase implements CompileContextEx {
@@ -66,7 +58,6 @@
   private final Map<CompilerMessageCategory, Collection<CompilerMessage>> myMessages = new EnumMap<CompilerMessageCategory, Collection<CompilerMessage>>(CompilerMessageCategory.class);
   private final boolean myShouldUpdateProblemsView;
   private CompileScope myCompileScope;
-  private final DependencyCache myDependencyCache;
   private final boolean myMake;
   private final boolean myIsRebuild;
   private final boolean myIsAnnotationProcessorsEnabled;
@@ -74,11 +65,7 @@
   private String myRebuildReason;
   private final Map<VirtualFile, Module> myRootToModuleMap = new HashMap<VirtualFile, Module>();
   private final Map<Module, Set<VirtualFile>> myModuleToRootsMap = new HashMap<Module, Set<VirtualFile>>();
-  private final Map<VirtualFile, Pair<SourceGeneratingCompiler, Module>> myOutputRootToSourceGeneratorMap = new HashMap<VirtualFile, Pair<SourceGeneratingCompiler, Module>>();
   private final Set<VirtualFile> myGeneratedTestRoots = new java.util.HashSet<VirtualFile>();
-  private VirtualFile[] myOutputDirectories;
-  private Set<VirtualFile> myTestOutputDirectories;
-  private final TIntHashSet myGeneratedSources = new TIntHashSet();
   private final ProjectFileIndex myProjectFileIndex; // cached for performance reasons
   private final ProjectCompileScope myProjectCompileScope;
   private final long myStartCompilationStamp;
@@ -87,11 +74,10 @@
   public CompileContextImpl(final Project project,
                             final CompilerTask compilerSession,
                             CompileScope compileScope,
-                            DependencyCache dependencyCache, boolean isMake, boolean isRebuild) {
+                            boolean isMake, boolean isRebuild) {
     myProject = project;
     myTask = compilerSession;
     myCompileScope = compileScope;
-    myDependencyCache = dependencyCache;
     myMake = isMake;
     myIsRebuild = isRebuild;
     myStartCompilationStamp = System.currentTimeMillis();
@@ -108,110 +94,22 @@
         compilerSession.setSessionId(sessionId);
       }
     }
-    recalculateOutputDirs();
     final CompilerWorkspaceConfiguration workspaceConfig = CompilerWorkspaceConfiguration.getInstance(myProject);
-    myShouldUpdateProblemsView = workspaceConfig.useOutOfProcessBuild() && workspaceConfig.MAKE_PROJECT_ON_SAVE;
+    myShouldUpdateProblemsView = workspaceConfig.MAKE_PROJECT_ON_SAVE;
   }
 
   public boolean shouldUpdateProblemsView() {
     return myShouldUpdateProblemsView;
   }
 
-  public void recalculateOutputDirs() {
-    final Module[] allModules = ModuleManager.getInstance(myProject).getModules();
-
-    final Set<VirtualFile> allDirs = new OrderedSet<VirtualFile>();
-    final Set<VirtualFile> testOutputDirs = new java.util.HashSet<VirtualFile>();
-    final Set<VirtualFile> productionOutputDirs = new java.util.HashSet<VirtualFile>();
-
-    for (Module module : allModules) {
-      final CompilerModuleExtension manager = CompilerModuleExtension.getInstance(module);
-      final VirtualFile output = manager.getCompilerOutputPath();
-      if (output != null && output.isValid()) {
-        allDirs.add(output);
-        productionOutputDirs.add(output);
-      }
-      final VirtualFile testsOutput = manager.getCompilerOutputPathForTests();
-      if (testsOutput != null && testsOutput.isValid()) {
-        allDirs.add(testsOutput);
-        testOutputDirs.add(testsOutput);
-      }
-    }
-    myOutputDirectories = VfsUtil.toVirtualFileArray(allDirs);
-    // need this to ensure that the sent contains only _dedicated_ test output dirs
-    // Directories that are configured for both test and production classes must not be added in the resulting set
-    testOutputDirs.removeAll(productionOutputDirs);
-    myTestOutputDirectories = Collections.unmodifiableSet(testOutputDirs);
-  }
-
-  public void markGenerated(Collection<VirtualFile> files) {
-    for (final VirtualFile file : files) {
-      myGeneratedSources.add(FileBasedIndex.getFileId(file));
-    }
-  }
-
   public long getStartCompilationStamp() {
     return myStartCompilationStamp;
   }
 
-  public boolean isGenerated(VirtualFile file) {
-    if (myGeneratedSources.contains(FileBasedIndex.getFileId(file))) {
-      return true;
-    }
-    if (VfsUtilCore.isUnder(file, myRootToModuleMap.keySet())) {
-      return true;
-    }
-    final Module module = getModuleByFile(file);
-    if (module != null) {
-      final String procGenRoot = CompilerPaths.getAnnotationProcessorsGenerationPath(module);
-      if (procGenRoot != null && VfsUtil.isAncestor(new File(procGenRoot), new File(file.getPath()), true)) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  /*
-  private JBZipFile lookupZip(String outputDir) {
-    synchronized (myOpenZipFiles) {
-      JBZipFile zip = myOpenZipFiles.get(outputDir);
-      if (zip == null) {
-        final File zipFile = CompilerPathsEx.getZippedOutputPath(myProject, outputDir);
-        try {
-          try {
-            zip = new JBZipFile(zipFile);
-          }
-          catch (FileNotFoundException e) {
-            try {
-              zipFile.createNewFile();
-              zip = new JBZipFile(zipFile);
-            }
-            catch (IOException e1) {
-              zipFile.getParentFile().mkdirs();
-              zipFile.createNewFile();
-              zip = new JBZipFile(zipFile);
-            }
-          }
-          myOpenZipFiles.put(outputDir, zip);
-        }
-        catch (IOException e) {
-          LOG.info(e);
-          addMessage(CompilerMessageCategory.ERROR, "Cannot create zip file " + zipFile.getPath() + ": " + e.getMessage(), null, -1, -1);
-        }
-      }
-      return zip;
-    }
-  }
-  */
-
   public Project getProject() {
     return myProject;
   }
 
-  public DependencyCache getDependencyCache() {
-    return myDependencyCache;
-  }
-
   public CompilerMessage[] getMessages(CompilerMessageCategory category) {
     Collection<CompilerMessage> collection = myMessages.get(category);
     if (collection == null) {
@@ -221,40 +119,16 @@
   }
 
   public void addMessage(CompilerMessageCategory category, String message, String url, int lineNum, int columnNum) {
-    CompilerMessageImpl msg = new CompilerMessageImpl(myProject, category, message, findPresentableFileForMessage(url), lineNum, columnNum, null);
+    final CompilerMessageImpl msg = new CompilerMessageImpl(myProject, category, message, findFileByUrl(url), lineNum, columnNum, null);
     addMessage(msg);
   }
 
   public void addMessage(CompilerMessageCategory category, String message, String url, int lineNum, int columnNum,
                          Navigatable navigatable) {
-    CompilerMessageImpl msg = new CompilerMessageImpl(myProject, category, message, findPresentableFileForMessage(url), lineNum, columnNum, navigatable);
+    final CompilerMessageImpl msg = new CompilerMessageImpl(myProject, category, message, findFileByUrl(url), lineNum, columnNum, navigatable);
     addMessage(msg);
   }
 
-  @Nullable
-  private VirtualFile findPresentableFileForMessage(@Nullable final String url) {
-    final VirtualFile file = findFileByUrl(url);
-    if (file == null) {
-      return null;
-    }
-    return ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile>() {
-      @Override
-      public VirtualFile compute() {
-        if (file.isValid()) {
-          for (final Map.Entry<VirtualFile, Pair<SourceGeneratingCompiler, Module>> entry : myOutputRootToSourceGeneratorMap.entrySet()) {
-            final VirtualFile root = entry.getKey();
-            if (VfsUtilCore.isAncestor(root, file, false)) {
-              final Pair<SourceGeneratingCompiler, Module> pair = entry.getValue();
-              final VirtualFile presentableFile = pair.getFirst().getPresentableFile(CompileContextImpl.this, pair.getSecond(), root, file);
-              return presentableFile != null ? presentableFile : file;
-            }
-          }
-        }
-        return file;
-      }
-    });
-  }
-
   @Nullable 
   private static VirtualFile findFileByUrl(@Nullable String url) {
     if (url == null) {
@@ -312,10 +186,6 @@
     if (!myRebuildRequested) {
       myRebuildRequested = true;
       myRebuildReason = message;
-      final boolean isOutOfProcessBuild = myDependencyCache == null;
-      if (!isOutOfProcessBuild) {
-        addMessage(CompilerMessageCategory.ERROR, message, null, -1, -1);
-      }
     }
   }
 
@@ -329,38 +199,9 @@
   }
 
   public ProgressIndicator getProgressIndicator() {
-    //if (myProgressIndicatorProxy != null) {
-    //  return myProgressIndicatorProxy;
-    //}
     return myTask.getIndicator();
   }
 
-  public void assignModule(@NotNull VirtualFile root, @NotNull Module module, final boolean isTestSource, @Nullable Compiler compiler) {
-    try {
-      myRootToModuleMap.put(root, module);
-      Set<VirtualFile> set = myModuleToRootsMap.get(module);
-      if (set == null) {
-        set = new HashSet<VirtualFile>();
-        myModuleToRootsMap.put(module, set);
-      }
-      set.add(root);
-      if (isTestSource) {
-        myGeneratedTestRoots.add(root);
-      }
-      if (compiler instanceof SourceGeneratingCompiler) {
-        myOutputRootToSourceGeneratorMap.put(root, Pair.create((SourceGeneratingCompiler)compiler, module));
-      }
-    }
-    finally {
-      myModuleToRootsCache.remove(module);
-    }
-  }
-
-  @Nullable
-  public VirtualFile getSourceFileByOutputFile(VirtualFile outputFile) {
-    return TranslatingCompilerFilesMonitor.getSourceFileByOutput(outputFile);
-  }
-
   public Module getModuleByFile(VirtualFile file) {
     final Module module = myProjectFileIndex.getModuleForFile(file);
     if (module != null) {
@@ -419,15 +260,6 @@
     return true;
   }
 
-  public VirtualFile[] getAllOutputDirectories() {
-    return myOutputDirectories;
-  }
-
-  @NotNull
-  public Set<VirtualFile> getTestOutputDirectories() {
-    return myTestOutputDirectories;
-  }
-
   public VirtualFile getModuleOutputDirectory(Module module) {
     return CompilerPaths.getModuleOutputDirectory(module, false);
   }
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
index cc2b19b..f50fa0a 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
@@ -22,86 +22,54 @@
 package com.intellij.compiler.impl;
 
 import com.intellij.CommonBundle;
-import com.intellij.compiler.*;
-import com.intellij.compiler.make.CacheCorruptedException;
-import com.intellij.compiler.make.CacheUtils;
-import com.intellij.compiler.make.ChangedConstantsDependencyProcessor;
-import com.intellij.compiler.make.DependencyCache;
-import com.intellij.compiler.options.CompilerConfigurable;
+import com.intellij.compiler.CompilerConfiguration;
+import com.intellij.compiler.CompilerWorkspaceConfiguration;
+import com.intellij.compiler.ModuleCompilerUtil;
+import com.intellij.compiler.ProblemsView;
 import com.intellij.compiler.progress.CompilerTask;
 import com.intellij.compiler.server.BuildManager;
 import com.intellij.compiler.server.CustomBuilderMessageHandler;
 import com.intellij.compiler.server.DefaultMessageHandler;
-import com.intellij.diagnostic.IdeErrorsDialog;
-import com.intellij.diagnostic.PluginException;
-import com.intellij.notification.Notification;
-import com.intellij.notification.NotificationListener;
-import com.intellij.notification.NotificationType;
-import com.intellij.notification.Notifications;
-import com.intellij.openapi.application.*;
+import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.compiler.Compiler;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
 import com.intellij.openapi.compiler.ex.CompilerPathsEx;
-import com.intellij.openapi.compiler.generic.GenericCompiler;
 import com.intellij.openapi.deployment.DeploymentUtil;
 import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.extensions.Extensions;
-import com.intellij.openapi.extensions.PluginId;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.module.LanguageLevelUtil;
 import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.options.ShowSettingsUtil;
 import com.intellij.openapi.progress.ProcessCanceledException;
 import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.progress.ProgressManager;
-import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ProjectBundle;
 import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.CompilerModuleExtension;
-import com.intellij.openapi.roots.CompilerProjectExtension;
 import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
 import com.intellij.openapi.roots.ui.configuration.CommonContentEntriesEditor;
 import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService;
 import com.intellij.openapi.ui.MessageType;
 import com.intellij.openapi.ui.Messages;
-import com.intellij.openapi.util.*;
+import com.intellij.openapi.util.Key;
+import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.registry.Registry;
 import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.*;
-import com.intellij.openapi.vfs.newvfs.ManagingFS;
-import com.intellij.openapi.vfs.newvfs.RefreshQueue;
+import com.intellij.openapi.vfs.LocalFileSystem;
+import com.intellij.openapi.vfs.VirtualFileManager;
 import com.intellij.openapi.wm.StatusBar;
 import com.intellij.openapi.wm.ToolWindowId;
 import com.intellij.openapi.wm.ToolWindowManager;
 import com.intellij.openapi.wm.WindowManager;
 import com.intellij.packaging.artifacts.Artifact;
-import com.intellij.packaging.artifacts.ArtifactManager;
-import com.intellij.packaging.impl.artifacts.ArtifactImpl;
-import com.intellij.packaging.impl.artifacts.ArtifactUtil;
-import com.intellij.packaging.impl.compiler.ArtifactCompileScope;
 import com.intellij.packaging.impl.compiler.ArtifactCompilerUtil;
 import com.intellij.packaging.impl.compiler.ArtifactsCompiler;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.PsiDocumentManager;
 import com.intellij.util.Chunk;
-import com.intellij.util.Function;
 import com.intellij.util.StringBuilderSpinAllocator;
 import com.intellij.util.ThrowableRunnable;
-import com.intellij.util.concurrency.Semaphore;
-import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.HashMap;
 import com.intellij.util.containers.MultiMap;
-import com.intellij.util.containers.OrderedSet;
 import com.intellij.util.messages.MessageBus;
 import gnu.trove.THashSet;
-import gnu.trove.TIntHashSet;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -112,8 +80,7 @@
 import org.jetbrains.jps.model.java.JavaSourceRootType;
 
 import javax.swing.*;
-import javax.swing.event.HyperlinkEvent;
-import java.io.*;
+import java.io.File;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 
@@ -122,78 +89,20 @@
 public class CompileDriver {
 
   private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.CompileDriver");
-  // to be used in tests only for debug output
-  public static volatile boolean ourDebugMode = false;
 
   private final Project myProject;
-  private final Map<Pair<IntermediateOutputCompiler, Module>, Couple<VirtualFile>> myGenerationCompilerModuleToOutputDirMap; // [IntermediateOutputCompiler, Module] -> [ProductionSources, TestSources]
-  private final String myCachesDirectoryPath;
-  private boolean myShouldClearOutputDirectory;
 
   private final Map<Module, String> myModuleOutputPaths = new HashMap<Module, String>();
   private final Map<Module, String> myModuleTestOutputPaths = new HashMap<Module, String>();
 
-  @NonNls private static final String VERSION_FILE_NAME = "version.dat";
-  @NonNls private static final String LOCK_FILE_NAME = "in_progress.dat";
-
-  private static final boolean GENERATE_CLASSPATH_INDEX = "true".equals(System.getProperty("generate.classpath.index"));
-  private static final String PROP_PERFORM_INITIAL_REFRESH = "compiler.perform.outputs.refresh.on.start";
-  private static final Key<Boolean> REFRESH_DONE_KEY = Key.create("_compiler.initial.refresh.done_");
   private static final Key<Boolean> COMPILATION_STARTED_AUTOMATICALLY = Key.create("compilation_started_automatically");
 
-  private static final FileProcessingCompilerAdapterFactory FILE_PROCESSING_COMPILER_ADAPTER_FACTORY = new FileProcessingCompilerAdapterFactory() {
-    public FileProcessingCompilerAdapter create(CompileContext context, FileProcessingCompiler compiler) {
-      return new FileProcessingCompilerAdapter(context, compiler);
-    }
-  };
-  private static final FileProcessingCompilerAdapterFactory FILE_PACKAGING_COMPILER_ADAPTER_FACTORY = new FileProcessingCompilerAdapterFactory() {
-    public FileProcessingCompilerAdapter create(CompileContext context, FileProcessingCompiler compiler) {
-      return new PackagingCompilerAdapter(context, (PackagingCompiler)compiler);
-    }
-  };
   private CompilerFilter myCompilerFilter = CompilerFilter.ALL;
-  private static final CompilerFilter SOURCE_PROCESSING_ONLY = new CompilerFilter() {
-    public boolean acceptCompiler(Compiler compiler) {
-      return compiler instanceof SourceProcessingCompiler;
-    }
-  };
-  private static final CompilerFilter ALL_EXCEPT_SOURCE_PROCESSING = new CompilerFilter() {
-    public boolean acceptCompiler(Compiler compiler) {
-      return !SOURCE_PROCESSING_ONLY.acceptCompiler(compiler);
-    }
-  };
 
-  private Set<File> myAllOutputDirectories;
   private static final long ONE_MINUTE_MS = 60L /*sec*/ * 1000L /*millisec*/;
 
   public CompileDriver(Project project) {
     myProject = project;
-    myCachesDirectoryPath = CompilerPaths.getCacheStoreDirectory(myProject).getPath().replace('/', File.separatorChar);
-    myShouldClearOutputDirectory = CompilerWorkspaceConfiguration.getInstance(myProject).CLEAR_OUTPUT_DIRECTORY;
-
-    myGenerationCompilerModuleToOutputDirMap = new HashMap<Pair<IntermediateOutputCompiler, Module>, Couple<VirtualFile>>();
-
-    if (!useOutOfProcessBuild()) {
-      final LocalFileSystem lfs = LocalFileSystem.getInstance();
-      final IntermediateOutputCompiler[] generatingCompilers = CompilerManager.getInstance(myProject).getCompilers(IntermediateOutputCompiler.class, myCompilerFilter);
-      final Module[] allModules = ModuleManager.getInstance(myProject).getModules();
-      final CompilerConfiguration config = CompilerConfiguration.getInstance(project);
-      for (Module module : allModules) {
-        for (IntermediateOutputCompiler compiler : generatingCompilers) {
-          final VirtualFile productionOutput = lookupVFile(lfs, CompilerPaths.getGenerationOutputPath(compiler, module, false));
-          final VirtualFile testOutput = lookupVFile(lfs, CompilerPaths.getGenerationOutputPath(compiler, module, true));
-          final Pair<IntermediateOutputCompiler, Module> pair = Pair.create(compiler, module);
-          final Couple<VirtualFile> outputs = Couple.newOne(productionOutput, testOutput);
-          myGenerationCompilerModuleToOutputDirMap.put(pair, outputs);
-        }
-        if (config.getAnnotationProcessingConfiguration(module).isEnabled()) {
-          final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module);
-          if (path != null) {
-            lookupVFile(lfs, path);  // ensure the file is created and added to VFS
-          }
-        }
-      }
-    }
   }
 
   public void setCompilerFilter(CompilerFilter compilerFilter) {
@@ -201,24 +110,12 @@
   }
 
   public void rebuild(CompileStatusNotification callback) {
-    final CompileScope compileScope;
-    ProjectCompileScope projectScope = new ProjectCompileScope(myProject);
-    if (useOutOfProcessBuild()) {
-      compileScope = projectScope;
-    }
-    else {
-      CompileScope scopeWithArtifacts = ArtifactCompileScope.createScopeWithArtifacts(projectScope, ArtifactUtil.getArtifactWithOutputPaths(myProject));
-      compileScope = addAdditionalRoots(scopeWithArtifacts, ALL_EXCEPT_SOURCE_PROCESSING);
-    }
-    doRebuild(callback, null, true, compileScope);
+    doRebuild(callback, null, new ProjectCompileScope(myProject));
   }
 
   public void make(CompileScope scope, CompileStatusNotification callback) {
-    if (!useOutOfProcessBuild()) {
-      scope = addAdditionalRoots(scope, ALL_EXCEPT_SOURCE_PROCESSING);
-    }
-    if (validateCompilerConfiguration(scope, false)) {
-      startup(scope, false, false, callback, null, true);
+    if (validateCompilerConfiguration(scope)) {
+      startup(scope, false, false, callback, null);
     }
     else {
       callback.finished(true, 0, 0, DummyCompileContext.getInstance());
@@ -229,80 +126,39 @@
     if (LOG.isDebugEnabled()) {
       LOG.debug("isUpToDate operation started");
     }
-    if (!useOutOfProcessBuild()) {
-      scope = addAdditionalRoots(scope, ALL_EXCEPT_SOURCE_PROCESSING);
-    }
 
     final CompilerTask task = new CompilerTask(myProject, "Classes up-to-date check", true, false, false, isCompilationStartedAutomatically(scope));
-    final DependencyCache cache = useOutOfProcessBuild()? null : createDependencyCache();
-    final CompileContextImpl compileContext = new CompileContextImpl(myProject, task, scope, cache, true, false);
-
-    if (!useOutOfProcessBuild()) {
-      checkCachesVersion(compileContext, ManagingFS.getInstance().getCreationTimestamp());
-      if (compileContext.isRebuildRequested()) {
-        if (LOG.isDebugEnabled()) {
-          LOG.debug("Rebuild requested, up-to-date=false");
-        }
-        return false;
-      }
-
-      for (Map.Entry<Pair<IntermediateOutputCompiler, Module>, Couple<VirtualFile>> entry : myGenerationCompilerModuleToOutputDirMap.entrySet()) {
-        final Couple<VirtualFile> outputs = entry.getValue();
-        final Pair<IntermediateOutputCompiler, Module> key = entry.getKey();
-        final Module module = key.getSecond();
-        compileContext.assignModule(outputs.getFirst(), module, false, key.getFirst());
-        compileContext.assignModule(outputs.getSecond(), module, true, key.getFirst());
-      }
-    }
+    final CompileContextImpl compileContext = new CompileContextImpl(myProject, task, scope, true, false);
 
     final Ref<ExitStatus> result = new Ref<ExitStatus>();
 
-    final Runnable compileWork;
-    if (useOutOfProcessBuild()) {
-      compileWork = new Runnable() {
-        public void run() {
-          final ProgressIndicator indicator = compileContext.getProgressIndicator();
-          if (indicator.isCanceled() || myProject.isDisposed()) {
-            return;
-          }
-          try {
-            final RequestFuture future = compileInExternalProcess(compileContext, true);
-            if (future != null) {
-              while (!future.waitFor(200L , TimeUnit.MILLISECONDS)) {
-                if (indicator.isCanceled()) {
-                  future.cancel(false);
-                }
+    task.start(new Runnable() {
+      public void run() {
+        final ProgressIndicator indicator = compileContext.getProgressIndicator();
+        if (indicator.isCanceled() || myProject.isDisposed()) {
+          return;
+        }
+        try {
+          final RequestFuture future = compileInExternalProcess(compileContext, true);
+          if (future != null) {
+            while (!future.waitFor(200L, TimeUnit.MILLISECONDS)) {
+              if (indicator.isCanceled()) {
+                future.cancel(false);
               }
             }
           }
-          catch (Throwable e) {
-            LOG.error(e);
-          }
-          finally {
-            result.set(COMPILE_SERVER_BUILD_STATUS.get(compileContext));
-            if (!myProject.isDisposed()) {
-              CompilerCacheManager.getInstance(myProject).flushCaches();
-            }
-          }
         }
-      };
-    }
-    else {
-      compileWork = new Runnable() {
-        public void run() {
-          try {
-            myAllOutputDirectories = getAllOutputDirectories(compileContext);
-            // need this for updating zip archives experiment, uncomment if the feature is turned on
-            //myOutputFinder = new OutputPathFinder(myAllOutputDirectories);
-            result.set(doCompile(compileContext, false, false, true));
-          }
-          finally {
+        catch (Throwable e) {
+          LOG.error(e);
+        }
+        finally {
+          result.set(COMPILE_SERVER_BUILD_STATUS.get(compileContext));
+          if (!myProject.isDisposed()) {
             CompilerCacheManager.getInstance(myProject).flushCaches();
           }
         }
-      };
-    }
-    task.start(compileWork, null);
+      }
+    }, null);
 
     if (LOG.isDebugEnabled()) {
       LOG.debug("isUpToDate operation finished");
@@ -311,17 +167,9 @@
     return ExitStatus.UP_TO_DATE.equals(result.get());
   }
 
-  private DependencyCache createDependencyCache() {
-    return new DependencyCache(myCachesDirectoryPath + File.separator + ".dependency-info");
-  }
-
-  public void compile(CompileScope scope, CompileStatusNotification callback, boolean clearingOutputDirsPossible) {
-    myShouldClearOutputDirectory &= clearingOutputDirsPossible;
-    if (containsFileIndexScopes(scope)) {
-      scope = addAdditionalRoots(scope, ALL_EXCEPT_SOURCE_PROCESSING);
-    }
-    if (validateCompilerConfiguration(scope, false)) {
-      startup(scope, false, true, callback, null, true);
+  public void compile(CompileScope scope, CompileStatusNotification callback) {
+    if (validateCompilerConfiguration(scope)) {
+      startup(scope, false, true, callback, null);
     }
     else {
       callback.finished(true, 0, 0, DummyCompileContext.getInstance());
@@ -339,116 +187,15 @@
     return scope instanceof FileIndexCompileScope;
   }
 
-  private static class CompileStatus {
-    final int CACHE_FORMAT_VERSION;
-    final boolean COMPILATION_IN_PROGRESS;
-    final long VFS_CREATION_STAMP;
-
-    private CompileStatus(int cacheVersion, boolean isCompilationInProgress, long vfsStamp) {
-      CACHE_FORMAT_VERSION = cacheVersion;
-      COMPILATION_IN_PROGRESS = isCompilationInProgress;
-      VFS_CREATION_STAMP = vfsStamp;
-    }
-  }
-
-  private CompileStatus readStatus() {
-    final boolean isInProgress = getLockFile().exists();
-    int version = -1;
-    long vfsStamp = -1L;
-    try {
-      final File versionFile = new File(myCachesDirectoryPath, VERSION_FILE_NAME);
-      DataInputStream in = new DataInputStream(new FileInputStream(versionFile));
-      try {
-        version = in.readInt();
-        try {
-          vfsStamp = in.readLong();
-        }
-        catch (IOException ignored) {
-        }
-      }
-      finally {
-        in.close();
-      }
-    }
-    catch (FileNotFoundException e) {
-      // ignore
-    }
-    catch (IOException e) {
-      LOG.info(e);  // may happen in case of IDEA crashed and the file is not written properly
-      return null;
-    }
-    return new CompileStatus(version, isInProgress, vfsStamp);
-  }
-
-  private void writeStatus(CompileStatus status, CompileContext context) {
-    final File statusFile = new File(myCachesDirectoryPath, VERSION_FILE_NAME);
-
-    final File lockFile = getLockFile();
-    try {
-      FileUtil.createIfDoesntExist(statusFile);
-      DataOutputStream out = new DataOutputStream(new FileOutputStream(statusFile));
-      try {
-        out.writeInt(status.CACHE_FORMAT_VERSION);
-        out.writeLong(status.VFS_CREATION_STAMP);
-      }
-      finally {
-        out.close();
-      }
-      if (status.COMPILATION_IN_PROGRESS) {
-        FileUtil.createIfDoesntExist(lockFile);
-      }
-      else {
-        deleteFile(lockFile);
-      }
-    }
-    catch (IOException e) {
-      context.addMessage(CompilerMessageCategory.ERROR, CompilerBundle.message("compiler.error.exception", e.getMessage()), null, -1, -1);
-    }
-  }
-
-  private File getLockFile() {
-    return new File(CompilerPaths.getCompilerSystemDirectory(myProject), LOCK_FILE_NAME);
-  }
-
-  private void doRebuild(CompileStatusNotification callback,
-                         CompilerMessage message,
-                         final boolean checkCachesVersion,
-                         final CompileScope compileScope) {
-    if (validateCompilerConfiguration(compileScope, !useOutOfProcessBuild())) {
-      startup(compileScope, true, false, callback, message, checkCachesVersion);
+  private void doRebuild(CompileStatusNotification callback, CompilerMessage message, final CompileScope compileScope) {
+    if (validateCompilerConfiguration(compileScope)) {
+      startup(compileScope, true, false, callback, message);
     }
     else {
       callback.finished(true, 0, 0, DummyCompileContext.getInstance());
     }
   }
 
-  private CompileScope addAdditionalRoots(CompileScope originalScope, final CompilerFilter filter) {
-    CompileScope scope = attachIntermediateOutputDirectories(originalScope, filter);
-
-    final AdditionalCompileScopeProvider[] scopeProviders = Extensions.getExtensions(AdditionalCompileScopeProvider.EXTENSION_POINT_NAME);
-    CompileScope baseScope = scope;
-    for (AdditionalCompileScopeProvider scopeProvider : scopeProviders) {
-      final CompileScope additionalScope = scopeProvider.getAdditionalScope(baseScope, filter, myProject);
-      if (additionalScope != null) {
-        scope = new CompositeScope(scope, additionalScope);
-      }
-    }
-    return scope;
-  }
-
-  private CompileScope attachIntermediateOutputDirectories(CompileScope originalScope, CompilerFilter filter) {
-    CompileScope scope = originalScope;
-    final Set<Module> affected = new HashSet<Module>(Arrays.asList(originalScope.getAffectedModules()));
-    for (Map.Entry<Pair<IntermediateOutputCompiler, Module>, Couple<VirtualFile>> entry : myGenerationCompilerModuleToOutputDirMap.entrySet()) {
-      final Module module = entry.getKey().getSecond();
-      if (affected.contains(module) && filter.acceptCompiler(entry.getKey().getFirst())) {
-        final Couple<VirtualFile> outputs = entry.getValue();
-        scope = new CompositeScope(scope, new FileSetCompileScope(Arrays.asList(outputs.getFirst(), outputs.getSecond()), new Module[]{module}));
-      }
-    }
-    return scope;
-  }
-
   public static void setCompilationStartedAutomatically(CompileScope scope) {
     //todo[nik] pass this option as a parameter to compile/make methods instead
     scope.putUserData(COMPILATION_STARTED_AUTOMATICALLY, Boolean.TRUE);
@@ -458,31 +205,6 @@
     return Boolean.TRUE.equals(scope.getUserData(COMPILATION_STARTED_AUTOMATICALLY));
   }
 
-  private void attachAnnotationProcessorsOutputDirectories(CompileContextEx context) {
-    final LocalFileSystem lfs = LocalFileSystem.getInstance();
-    final CompilerConfiguration config = CompilerConfiguration.getInstance(myProject);
-    final Set<Module> affected = new HashSet<Module>(Arrays.asList(context.getCompileScope().getAffectedModules()));
-    for (Module module : affected) {
-      if (!config.getAnnotationProcessingConfiguration(module).isEnabled()) {
-        continue;
-      }
-      final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module);
-      if (path == null) {
-        continue;
-      }
-      final VirtualFile vFile = lfs.findFileByPath(path);
-      if (vFile == null) {
-        continue;
-      }
-      if (ModuleRootManager.getInstance(module).getFileIndex().isInSourceContent(vFile)) {
-        // no need to add, is already marked as source
-        continue;
-      }
-      context.addScope(new FileSetCompileScope(Collections.singletonList(vFile), new Module[]{module}));
-      context.assignModule(vFile, module, false, null);
-    }
-  }
-
   @Nullable
   private RequestFuture compileInExternalProcess(final @NotNull CompileContextImpl compileContext, final boolean onlyCheckUpToDate)
     throws Exception {
@@ -648,140 +370,87 @@
                        final boolean isRebuild,
                        final boolean forceCompile,
                        final CompileStatusNotification callback,
-                       final CompilerMessage message,
-                       final boolean checkCachesVersion) {
+                       final CompilerMessage message) {
     ApplicationManager.getApplication().assertIsDispatchThread();
 
-    final boolean useExtProcessBuild = useOutOfProcessBuild();
-
     final String contentName =
       forceCompile ? CompilerBundle.message("compiler.content.name.compile") : CompilerBundle.message("compiler.content.name.make");
     final boolean isUnitTestMode = ApplicationManager.getApplication().isUnitTestMode();
     final CompilerTask compileTask = new CompilerTask(myProject, contentName, isUnitTestMode, true, true, isCompilationStartedAutomatically(scope));
 
     StatusBar.Info.set("", myProject, "Compiler");
-    if (useExtProcessBuild) {
-      // ensure the project model seen by build process is up-to-date
-      myProject.save();
-      if (!isUnitTestMode) {
-        ApplicationManager.getApplication().saveSettings();
-      }
+    // ensure the project model seen by build process is up-to-date
+    myProject.save();
+    if (!isUnitTestMode) {
+      ApplicationManager.getApplication().saveSettings();
     }
     PsiDocumentManager.getInstance(myProject).commitAllDocuments();
     FileDocumentManager.getInstance().saveAllDocuments();
 
-    final DependencyCache dependencyCache = useExtProcessBuild ? null: createDependencyCache();
-    final CompileContextImpl compileContext =
-      new CompileContextImpl(myProject, compileTask, scope, dependencyCache, !isRebuild && !forceCompile, isRebuild);
+    final CompileContextImpl compileContext = new CompileContextImpl(myProject, compileTask, scope, !isRebuild && !forceCompile, isRebuild);
 
-    if (!useExtProcessBuild) {
-      for (Map.Entry<Pair<IntermediateOutputCompiler, Module>, Couple<VirtualFile>> entry : myGenerationCompilerModuleToOutputDirMap.entrySet()) {
-        final Couple<VirtualFile> outputs = entry.getValue();
-        final Pair<IntermediateOutputCompiler, Module> key = entry.getKey();
-        final Module module = key.getSecond();
-        compileContext.assignModule(outputs.getFirst(), module, false, key.getFirst());
-        compileContext.assignModule(outputs.getSecond(), module, true, key.getFirst());
-      }
-      attachAnnotationProcessorsOutputDirectories(compileContext);
-    }
+    final Runnable compileWork = new Runnable() {
+      public void run() {
+        final ProgressIndicator indicator = compileContext.getProgressIndicator();
+        if (indicator.isCanceled() || myProject.isDisposed()) {
+          if (callback != null) {
+            callback.finished(true, 0, 0, compileContext);
+          }
+          return;
+        }
+        try {
+          LOG.info("COMPILATION STARTED (BUILD PROCESS)");
+          if (message != null) {
+            compileContext.addMessage(message);
+          }
+          if (isRebuild) {
+            CompilerUtil.runInContext(compileContext, "Clearing build system data...", new ThrowableRunnable<Throwable>() {
+              @Override
+              public void run() throws Throwable {
+                CompilerCacheManager.getInstance(myProject).clearCaches(compileContext);
+              }
+            });
+          }
+          final boolean beforeTasksOk = executeCompileTasks(compileContext, true);
 
-    final Runnable compileWork;
-    if (useExtProcessBuild) {
-      compileWork = new Runnable() {
-        public void run() {
-          final ProgressIndicator indicator = compileContext.getProgressIndicator();
-          if (indicator.isCanceled() || myProject.isDisposed()) {
-            if (callback != null) {
-              callback.finished(true, 0, 0, compileContext);
-            }
+          final int errorCount = compileContext.getMessageCount(CompilerMessageCategory.ERROR);
+          if (!beforeTasksOk || errorCount > 0) {
+            COMPILE_SERVER_BUILD_STATUS.set(compileContext, errorCount > 0 ? ExitStatus.ERRORS : ExitStatus.CANCELLED);
             return;
           }
-          try {
-            LOG.info("COMPILATION STARTED (BUILD PROCESS)");
-            if (message != null) {
-              compileContext.addMessage(message);
-            }
-            if (isRebuild) {
-              CompilerUtil.runInContext(compileContext, "Clearing build system data...", new ThrowableRunnable<Throwable>() {
-                @Override
-                public void run() throws Throwable {
-                  CompilerCacheManager.getInstance(myProject).clearCaches(compileContext);
-                }
-              });
-            }
-            final boolean beforeTasksOk = executeCompileTasks(compileContext, true);
 
-            final int errorCount = compileContext.getMessageCount(CompilerMessageCategory.ERROR);
-            if (!beforeTasksOk || errorCount > 0) {
-              COMPILE_SERVER_BUILD_STATUS.set(compileContext, errorCount > 0? ExitStatus.ERRORS : ExitStatus.CANCELLED);
-              return;
+          final RequestFuture future = compileInExternalProcess(compileContext, false);
+          if (future != null) {
+            while (!future.waitFor(200L, TimeUnit.MILLISECONDS)) {
+              if (indicator.isCanceled()) {
+                future.cancel(false);
+              }
             }
-
-            final RequestFuture future = compileInExternalProcess(compileContext, false);
-            if (future != null) {
-              while (!future.waitFor(200L , TimeUnit.MILLISECONDS)) {
-                if (indicator.isCanceled()) {
-                  future.cancel(false);
-                }
-              }
-              if (!executeCompileTasks(compileContext, false)) {
-                COMPILE_SERVER_BUILD_STATUS.set(compileContext, ExitStatus.CANCELLED);
-              }
-              if (compileContext.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
-                COMPILE_SERVER_BUILD_STATUS.set(compileContext, ExitStatus.ERRORS);
-              }
+            if (!executeCompileTasks(compileContext, false)) {
+              COMPILE_SERVER_BUILD_STATUS.set(compileContext, ExitStatus.CANCELLED);
+            }
+            if (compileContext.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
+              COMPILE_SERVER_BUILD_STATUS.set(compileContext, ExitStatus.ERRORS);
             }
           }
-          catch (Throwable e) {
-            LOG.error(e); // todo
-          }
-          finally {
-            CompilerCacheManager.getInstance(myProject).flushCaches();
+        }
+        catch (Throwable e) {
+          LOG.error(e); // todo
+        }
+        finally {
+          CompilerCacheManager.getInstance(myProject).flushCaches();
 
-            final long duration = notifyCompilationCompleted(compileContext, callback, COMPILE_SERVER_BUILD_STATUS.get(compileContext), true);
-            CompilerUtil.logDuration(
-              "\tCOMPILATION FINISHED (BUILD PROCESS); Errors: " +
+          final long duration = notifyCompilationCompleted(compileContext, callback, COMPILE_SERVER_BUILD_STATUS.get(compileContext));
+          CompilerUtil.logDuration(
+            "\tCOMPILATION FINISHED (BUILD PROCESS); Errors: " +
               compileContext.getMessageCount(CompilerMessageCategory.ERROR) +
               "; warnings: " +
               compileContext.getMessageCount(CompilerMessageCategory.WARNING),
-              duration
-            );
-          }
+            duration
+          );
         }
-      };
-    }
-    else {
-      compileWork = new Runnable() {
-        public void run() {
-          if (compileContext.getProgressIndicator().isCanceled()) {
-            if (callback != null) {
-              callback.finished(true, 0, 0, compileContext);
-            }
-            return;
-          }
-          try {
-            if (myProject.isDisposed()) {
-              return;
-            }
-            LOG.info("COMPILATION STARTED");
-            if (message != null) {
-              compileContext.addMessage(message);
-            }
-            else {
-              if (!isUnitTestMode) {
-                notifyDeprecatedImplementation();
-              }
-            }
-            
-            TranslatingCompilerFilesMonitor.getInstance().ensureInitializationCompleted(myProject, compileContext.getProgressIndicator());
-            doCompile(compileContext, isRebuild, forceCompile, callback, checkCachesVersion);
-          }
-          finally {
-            FileUtil.delete(CompilerPaths.getRebuildMarkerFile(myProject));
-          }
-        }
-      };
-    }
+      }
+    };
 
     compileTask.start(compileWork, new Runnable() {
       public void run() {
@@ -791,121 +460,24 @@
               "Make", "Rebuild", Messages.getQuestionIcon()
           );
           if (rv == Messages.OK /*yes, please, do run make*/) {
-            startup(scope, false, false, callback, null, checkCachesVersion);
+            startup(scope, false, false, callback, null);
             return;
           }
         }
-        startup(scope, isRebuild, forceCompile, callback, message, checkCachesVersion);
+        startup(scope, isRebuild, forceCompile, callback, message);
       }
     });
   }
 
-  private static final Key<Boolean> OLD_IMPLEMENTATION_WARNING_SHOWN = Key.create("_old_make_implementation_warning_shown_"); 
-  private void notifyDeprecatedImplementation() {
-    if (OLD_IMPLEMENTATION_WARNING_SHOWN.get(myProject, Boolean.FALSE).booleanValue()) {
-      return;
-    }
-    OLD_IMPLEMENTATION_WARNING_SHOWN.set(myProject, Boolean.TRUE);
-    final NotificationListener hyperlinkHandler = new NotificationListener.Adapter() {
-      @Override
-      protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
-        notification.expire();
-        if (!myProject.isDisposed()) {
-          ShowSettingsUtil.getInstance().editConfigurable(myProject, new CompilerConfigurable(myProject));
-        }
-      }
-    };
-    final Notification notification = new Notification(
-      "Compile", "Deprecated make implementation",
-      "Old implementation of \"Make\" feature is enabled for this project.<br>It has been deprecated and will be removed soon.<br>Please enable newer 'external build' feature in <a href=\"#\">Settings | Compiler</a>.",
-      NotificationType.WARNING, 
-      hyperlinkHandler
-    );
-    Notifications.Bus.notify(notification, myProject);
-  }
-
   @Nullable @TestOnly
   public static ExitStatus getExternalBuildExitStatus(CompileContext context) {
     return context.getUserData(COMPILE_SERVER_BUILD_STATUS);
   }
 
-  private void doCompile(final CompileContextImpl compileContext,
-                         final boolean isRebuild,
-                         final boolean forceCompile,
-                         final CompileStatusNotification callback,
-                         final boolean checkCachesVersion) {
-    ExitStatus status = ExitStatus.ERRORS;
-    boolean wereExceptions = false;
-    final long vfsTimestamp = (ManagingFS.getInstance()).getCreationTimestamp();
-    try {
-      if (checkCachesVersion) {
-        checkCachesVersion(compileContext, vfsTimestamp);
-        if (compileContext.isRebuildRequested()) {
-          return;
-        }
-      }
-      writeStatus(new CompileStatus(CompilerConfigurationImpl.DEPENDENCY_FORMAT_VERSION, true, vfsTimestamp), compileContext);
-      if (compileContext.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
-        return;
-      }
-
-      myAllOutputDirectories = getAllOutputDirectories(compileContext);
-      status = doCompile(compileContext, isRebuild, forceCompile, false);
-    }
-    catch (Throwable ex) {
-      if (ApplicationManager.getApplication().isUnitTestMode()) {
-        throw new RuntimeException(ex);
-      }
-      wereExceptions = true;
-      final PluginId pluginId = IdeErrorsDialog.findPluginId(ex);
-
-      final StringBuilder message = new StringBuilder();
-      message.append("Internal error");
-      if (pluginId != null) {
-        message.append(" (Plugin: ").append(pluginId).append(")");
-      }
-      message.append(": ").append(ex.getMessage());
-      compileContext.addMessage(CompilerMessageCategory.ERROR, message.toString(), null, -1, -1);
-      
-      if (pluginId != null) {
-        throw new PluginException(ex, pluginId);
-      }
-      throw new RuntimeException(ex);
-    }
-    finally {
-      dropDependencyCache(compileContext);
-      CompilerCacheManager.getInstance(myProject).flushCaches();
-      if (compileContext.isRebuildRequested()) {
-        ApplicationManager.getApplication().invokeLater(new Runnable() {
-          public void run() {
-            final CompilerMessageImpl msg = new CompilerMessageImpl(myProject, CompilerMessageCategory.INFORMATION, compileContext.getRebuildReason());
-            doRebuild(callback, msg, false, compileContext.getCompileScope());
-          }
-        }, ModalityState.NON_MODAL);
-      }
-      else {
-        if (!myProject.isDisposed()) {
-          writeStatus(new CompileStatus(CompilerConfigurationImpl.DEPENDENCY_FORMAT_VERSION, wereExceptions, vfsTimestamp), compileContext);
-        }
-        final long duration = notifyCompilationCompleted(compileContext, callback, status, false);
-        CompilerUtil.logDuration(
-          "\tCOMPILATION FINISHED; Errors: " +
-          compileContext.getMessageCount(CompilerMessageCategory.ERROR) +
-          "; warnings: " +
-          compileContext.getMessageCount(CompilerMessageCategory.WARNING),
-          duration
-        );
-      }
-    }
-  }
-
   /** @noinspection SSBasedInspection*/
-  private long notifyCompilationCompleted(final CompileContextImpl compileContext,
-                                          final CompileStatusNotification callback,
-                                          final ExitStatus _status,
-                                          final boolean refreshOutputRoots) {
+  private long notifyCompilationCompleted(final CompileContextImpl compileContext, final CompileStatusNotification callback, final ExitStatus _status) {
     final long duration = System.currentTimeMillis() - compileContext.getStartCompilationStamp();
-    if (refreshOutputRoots && !myProject.isDisposed()) {
+    if (!myProject.isDisposed()) {
       // refresh on output roots is required in order for the order enumerator to see all roots via VFS
       final Set<File> outputs = new HashSet<File>();
       final Module[] affectedModules = compileContext.getCompileScope().getAffectedModules();
@@ -965,29 +537,6 @@
     return duration;
   }
 
-  private void checkCachesVersion(final CompileContextImpl compileContext, final long currentVFSTimestamp) {
-    if (CompilerPaths.getRebuildMarkerFile(compileContext.getProject()).exists()) {
-      compileContext.requestRebuildNextTime("Compiler caches are out of date, project rebuild is required");
-      return;
-    }
-    final CompileStatus compileStatus = readStatus();
-    if (compileStatus == null) {
-      compileContext.requestRebuildNextTime(CompilerBundle.message("error.compiler.caches.corrupted"));
-    }
-    else if (compileStatus.CACHE_FORMAT_VERSION != -1 &&
-             compileStatus.CACHE_FORMAT_VERSION != CompilerConfigurationImpl.DEPENDENCY_FORMAT_VERSION) {
-      compileContext.requestRebuildNextTime(CompilerBundle.message("error.caches.old.format"));
-    }
-    else if (compileStatus.COMPILATION_IN_PROGRESS) {
-      compileContext.requestRebuildNextTime(CompilerBundle.message("error.previous.compilation.failed"));
-    }
-    else if (compileStatus.VFS_CREATION_STAMP >= 0L){
-      if (currentVFSTimestamp != compileStatus.VFS_CREATION_STAMP) {
-        compileContext.requestRebuildNextTime(CompilerBundle.message("error.vfs.was.rebuilt"));
-      }
-    }
-  }
-
   private static String createStatusMessage(final ExitStatus status, final int warningCount, final int errorCount, long duration) {
     String message;
     if (status == ExitStatus.CANCELLED) {
@@ -1010,751 +559,7 @@
     return message;
   }
 
-  private ExitStatus doCompile(final CompileContextEx context, boolean isRebuild, final boolean forceCompile, final boolean onlyCheckStatus) {
-    try {
-      if (isRebuild) {
-        deleteAll(context);
-      }
-      else if (forceCompile) {
-        if (myShouldClearOutputDirectory) {
-          clearAffectedOutputPathsIfPossible(context);
-        }
-      }
-      if (context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
-        if (LOG.isDebugEnabled()) {
-          logErrorMessages(context);
-        }
-        return ExitStatus.ERRORS;
-      }
-
-      if (!onlyCheckStatus) {
-          if (!executeCompileTasks(context, true)) {
-            if (LOG.isDebugEnabled()) {
-              LOG.debug("Compilation cancelled");
-            }
-            return ExitStatus.CANCELLED;
-          }
-        }
-
-      if (context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
-        if (LOG.isDebugEnabled()) {
-          logErrorMessages(context);
-        }
-        return ExitStatus.ERRORS;
-      }
-
-      boolean needRecalcOutputDirs = false;
-      if (Registry.is(PROP_PERFORM_INITIAL_REFRESH) || !Boolean.valueOf(REFRESH_DONE_KEY.get(myProject, Boolean.FALSE))) {
-        REFRESH_DONE_KEY.set(myProject, Boolean.TRUE);
-        final long refreshStart = System.currentTimeMillis();
-
-        //need this to make sure the VFS is built
-        final List<VirtualFile> outputsToRefresh = new ArrayList<VirtualFile>();
-
-        final VirtualFile[] all = context.getAllOutputDirectories();
-
-        final ProgressIndicator progressIndicator = context.getProgressIndicator();
-
-        //final int totalCount = all.length + myGenerationCompilerModuleToOutputDirMap.size() * 2;
-        progressIndicator.pushState();
-        progressIndicator.setText("Inspecting output directories...");
-        try {
-          for (VirtualFile output : all) {
-            if (output.isValid()) {
-              walkChildren(output, context);
-            }
-            else {
-              needRecalcOutputDirs = true;
-              final File file = new File(output.getPath());
-              if (!file.exists()) {
-                final boolean created = file.mkdirs();
-                if (!created) {
-                  context.addMessage(CompilerMessageCategory.ERROR, "Failed to create output directory " + file.getPath(), null, 0, 0);
-                  return ExitStatus.ERRORS;
-                }
-              }
-              output = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
-              if (output == null) {
-                context.addMessage(CompilerMessageCategory.ERROR, "Failed to locate output directory " + file.getPath(), null, 0, 0);
-                return ExitStatus.ERRORS;
-              }
-            }
-            outputsToRefresh.add(output);
-          }
-          for (Pair<IntermediateOutputCompiler, Module> pair : myGenerationCompilerModuleToOutputDirMap.keySet()) {
-            final Couple<VirtualFile> generated = myGenerationCompilerModuleToOutputDirMap.get(pair);
-            walkChildren(generated.getFirst(), context);
-            outputsToRefresh.add(generated.getFirst());
-            walkChildren(generated.getSecond(), context);
-            outputsToRefresh.add(generated.getSecond());
-          }
-
-          RefreshQueue.getInstance().refresh(false, true, null, outputsToRefresh);
-          if (progressIndicator.isCanceled()) {
-            return ExitStatus.CANCELLED;
-          }
-        }
-        finally {
-          progressIndicator.popState();
-        }
-
-        final long initialRefreshTime = System.currentTimeMillis() - refreshStart;
-        CompilerUtil.logDuration("Initial VFS refresh", initialRefreshTime);
-      }
-
-      //DumbService.getInstance(myProject).waitForSmartMode();
-      final Semaphore semaphore = new Semaphore();
-      semaphore.down();
-      DumbService.getInstance(myProject).runWhenSmart(new Runnable() {
-        public void run() {
-          semaphore.up();
-        }
-      });
-      while (!semaphore.waitFor(500)) {
-        if (context.getProgressIndicator().isCanceled()) {
-          return ExitStatus.CANCELLED;
-        }
-      }
-
-      if (needRecalcOutputDirs) {
-        context.recalculateOutputDirs();
-      }
-
-      boolean didSomething = false;
-
-      final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
-      GenericCompilerRunner runner = new GenericCompilerRunner(context, isRebuild, onlyCheckStatus,
-                                                               compilerManager.getCompilers(GenericCompiler.class, myCompilerFilter));
-      try {
-        didSomething |= generateSources(compilerManager, context, forceCompile, onlyCheckStatus);
-
-        didSomething |= invokeFileProcessingCompilers(compilerManager, context, SourceInstrumentingCompiler.class,
-                                                      FILE_PROCESSING_COMPILER_ADAPTER_FACTORY, forceCompile, true, onlyCheckStatus);
-
-        didSomething |= invokeFileProcessingCompilers(compilerManager, context, SourceProcessingCompiler.class,
-                                                      FILE_PROCESSING_COMPILER_ADAPTER_FACTORY, forceCompile, true, onlyCheckStatus);
-
-        final CompileScope intermediateSources = attachIntermediateOutputDirectories(new CompositeScope(CompileScope.EMPTY_ARRAY) {
-          @NotNull
-          public Module[] getAffectedModules() {
-            return context.getCompileScope().getAffectedModules();
-          }
-        }, SOURCE_PROCESSING_ONLY);
-        context.addScope(intermediateSources);
-
-        didSomething |= translate(context, compilerManager, forceCompile, isRebuild, onlyCheckStatus);
-
-        didSomething |= invokeFileProcessingCompilers(compilerManager, context, ClassInstrumentingCompiler.class,
-                                                      FILE_PROCESSING_COMPILER_ADAPTER_FACTORY, isRebuild, false, onlyCheckStatus);
-        didSomething |= runner.invokeCompilers(GenericCompiler.CompileOrderPlace.CLASS_INSTRUMENTING);
-
-        // explicitly passing forceCompile = false because in scopes that is narrower than ProjectScope it is impossible
-        // to understand whether the class to be processed is in scope or not. Otherwise compiler may process its items even if
-        // there were changes in completely independent files.
-        didSomething |= invokeFileProcessingCompilers(compilerManager, context, ClassPostProcessingCompiler.class,
-                                                      FILE_PROCESSING_COMPILER_ADAPTER_FACTORY, isRebuild, false, onlyCheckStatus);
-        didSomething |= runner.invokeCompilers(GenericCompiler.CompileOrderPlace.CLASS_POST_PROCESSING);
-
-        didSomething |= invokeFileProcessingCompilers(compilerManager, context, PackagingCompiler.class,
-                                                      FILE_PACKAGING_COMPILER_ADAPTER_FACTORY,
-                                                      isRebuild, false, onlyCheckStatus);
-        didSomething |= runner.invokeCompilers(GenericCompiler.CompileOrderPlace.PACKAGING);
-
-        didSomething |= invokeFileProcessingCompilers(compilerManager, context, Validator.class, FILE_PROCESSING_COMPILER_ADAPTER_FACTORY,
-                                                      forceCompile, true, onlyCheckStatus);
-        didSomething |= runner.invokeCompilers(GenericCompiler.CompileOrderPlace.VALIDATING);
-      }
-      catch (ExitException e) {
-        if (LOG.isDebugEnabled()) {
-          LOG.debug(e);
-          logErrorMessages(context);
-        }
-        return e.getExitStatus();
-      }
-      finally {
-        // drop in case it has not been dropped yet.
-        dropDependencyCache(context);
-        final VirtualFile[] allOutputDirs = context.getAllOutputDirectories();
-
-        if (didSomething && GENERATE_CLASSPATH_INDEX) {
-          CompilerUtil.runInContext(context, "Generating classpath index...", new ThrowableRunnable<RuntimeException>(){
-            public void run() {
-              int count = 0;
-              for (VirtualFile file : allOutputDirs) {
-                context.getProgressIndicator().setFraction((double)++count / allOutputDirs.length);
-                createClasspathIndex(file);
-              }
-            }
-          });
-        }
-
-      }
-
-      if (!onlyCheckStatus) {
-          if (!executeCompileTasks(context, false)) {
-            return ExitStatus.CANCELLED;
-          }
-          final int constantSearchesCount = ChangedConstantsDependencyProcessor.getConstantSearchesCount(context);
-          LOG.debug("Constants searches: " + constantSearchesCount);
-        }
-
-      if (context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
-        if (LOG.isDebugEnabled()) {
-          logErrorMessages(context);
-        }
-        return ExitStatus.ERRORS;
-      }
-      if (!didSomething) {
-        return ExitStatus.UP_TO_DATE;
-      }
-      return ExitStatus.SUCCESS;
-    }
-    catch (ProcessCanceledException e) {
-      return ExitStatus.CANCELLED;
-    }
-  }
-
-  private void clearAffectedOutputPathsIfPossible(final CompileContextEx context) {
-    final List<File> scopeOutputs = new ReadAction<List<File>>() {
-      protected void run(@NotNull final Result<List<File>> result) {
-        final MultiMap<File, Module> outputToModulesMap = new MultiMap<File, Module>();
-        for (Module module : ModuleManager.getInstance(myProject).getModules()) {
-          final CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module);
-          if (compilerModuleExtension == null) {
-            continue;
-          }
-          final String outputPathUrl = compilerModuleExtension.getCompilerOutputUrl();
-          if (outputPathUrl != null) {
-            final String path = VirtualFileManager.extractPath(outputPathUrl);
-            outputToModulesMap.putValue(new File(path), module);
-          }
-
-          final String outputPathForTestsUrl = compilerModuleExtension.getCompilerOutputUrlForTests();
-          if (outputPathForTestsUrl != null) {
-            final String path = VirtualFileManager.extractPath(outputPathForTestsUrl);
-            outputToModulesMap.putValue(new File(path), module);
-          }
-        }
-        final Set<Module> affectedModules = new HashSet<Module>(Arrays.asList(context.getCompileScope().getAffectedModules()));
-        List<File> scopeOutputs = new ArrayList<File>(affectedModules.size() * 2);
-        for (File output : outputToModulesMap.keySet()) {
-          if (affectedModules.containsAll(outputToModulesMap.get(output))) {
-            scopeOutputs.add(output);
-          }
-        }
-
-        final Set<Artifact> artifactsToBuild = ArtifactCompileScope.getArtifactsToBuild(myProject, context.getCompileScope(), true);
-        for (Artifact artifact : artifactsToBuild) {
-          final String outputFilePath = ((ArtifactImpl)artifact).getOutputDirectoryPathToCleanOnRebuild();
-          if (outputFilePath != null) {
-            scopeOutputs.add(new File(FileUtil.toSystemDependentName(outputFilePath)));
-          }
-        }
-        result.setResult(scopeOutputs);
-      }
-    }.execute().getResultObject();
-    if (scopeOutputs.size() > 0) {
-      CompilerUtil.runInContext(context, CompilerBundle.message("progress.clearing.output"), new ThrowableRunnable<RuntimeException>() {
-        public void run() {
-          CompilerUtil.clearOutputDirectories(scopeOutputs);
-        }
-      });
-    }
-  }
-
-  private static void logErrorMessages(final CompileContext context) {
-    final CompilerMessage[] errors = context.getMessages(CompilerMessageCategory.ERROR);
-    if (errors.length > 0) {
-      LOG.debug("Errors reported: ");
-      for (CompilerMessage error : errors) {
-        LOG.debug("\t" + error.getMessage());
-      }
-    }
-  }
-
-  private static void walkChildren(VirtualFile from, final CompileContext context) {
-    VfsUtilCore.visitChildrenRecursively(from, new VirtualFileVisitor() {
-      @Override
-      public boolean visitFile(@NotNull VirtualFile file) {
-        if (file.isDirectory()) {
-          context.getProgressIndicator().checkCanceled();
-          context.getProgressIndicator().setText2(file.getPresentableUrl());
-        }
-        return true;
-      }
-    });
-  }
-
-  private static void createClasspathIndex(final VirtualFile file) {
-    try {
-      BufferedWriter writer = new BufferedWriter(new FileWriter(new File(VfsUtilCore.virtualToIoFile(file), "classpath.index")));
-      try {
-        writeIndex(writer, file, file);
-      }
-      finally {
-        writer.close();
-      }
-    }
-    catch (IOException e) {
-      // Ignore. Failed to create optional classpath index
-    }
-  }
-
-  private static void writeIndex(final BufferedWriter writer, final VirtualFile root, final VirtualFile file) throws IOException {
-    VfsUtilCore.visitChildrenRecursively(file, new VirtualFileVisitor() {
-      @Override
-      public boolean visitFile(@NotNull VirtualFile file) {
-        try {
-          writer.write(VfsUtilCore.getRelativePath(file, root, '/'));
-          writer.write('\n');
-          return true;
-        }
-        catch (IOException e) {
-          throw new VisitorException(e);
-        }
-      }
-    }, IOException.class);
-  }
-
-  private static void dropDependencyCache(final CompileContextEx context) {
-    CompilerUtil.runInContext(context, CompilerBundle.message("progress.saving.caches"), new ThrowableRunnable<RuntimeException>(){
-      public void run() {
-        context.getDependencyCache().resetState();
-      }
-    });
-  }
-
-  private boolean generateSources(final CompilerManager compilerManager,
-                                  CompileContextEx context,
-                                  final boolean forceCompile,
-                                  final boolean onlyCheckStatus) throws ExitException {
-    boolean didSomething = false;
-
-    final SourceGeneratingCompiler[] sourceGenerators = compilerManager.getCompilers(SourceGeneratingCompiler.class, myCompilerFilter);
-    for (final SourceGeneratingCompiler sourceGenerator : sourceGenerators) {
-      if (context.getProgressIndicator().isCanceled()) {
-        throw new ExitException(ExitStatus.CANCELLED);
-      }
-
-      final boolean generatedSomething = generateOutput(context, sourceGenerator, forceCompile, onlyCheckStatus);
-
-      if (context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
-        throw new ExitException(ExitStatus.ERRORS);
-      }
-      didSomething |= generatedSomething;
-    }
-    return didSomething;
-  }
-
-  private boolean translate(final CompileContextEx context,
-                            final CompilerManager compilerManager,
-                            final boolean forceCompile,
-                            boolean isRebuild,
-                            final boolean onlyCheckStatus) throws ExitException {
-
-    boolean didSomething = false;
-
-    final TranslatingCompiler[] translators = compilerManager.getCompilers(TranslatingCompiler.class, myCompilerFilter);
-
-
-    final List<Chunk<Module>> sortedChunks = Collections.unmodifiableList(ApplicationManager.getApplication().runReadAction(new Computable<List<Chunk<Module>>>() {
-      public List<Chunk<Module>> compute() {
-        final ModuleManager moduleManager = ModuleManager.getInstance(myProject);
-        return ModuleCompilerUtil.getSortedModuleChunks(myProject, Arrays.asList(moduleManager.getModules()));
-      }
-    }));
-
-    final DumbService dumbService = DumbService.getInstance(myProject);
-    try {
-      final Set<Module> processedModules = new HashSet<Module>();
-      VirtualFile[] snapshot = null;
-      final Map<Chunk<Module>, Collection<VirtualFile>> chunkMap = new HashMap<Chunk<Module>, Collection<VirtualFile>>();
-      int total = 0;
-      int processed = 0;
-      for (final Chunk<Module> currentChunk : sortedChunks) {
-        final TranslatorsOutputSink sink = new TranslatorsOutputSink(context, translators);
-        final Set<FileType> generatedTypes = new HashSet<FileType>();
-        Collection<VirtualFile> chunkFiles = chunkMap.get(currentChunk);
-        final Set<VirtualFile> filesToRecompile = new HashSet<VirtualFile>();
-        final Set<VirtualFile> allDependent = new HashSet<VirtualFile>();
-        try {
-          int round = 0;
-          boolean compiledSomethingForThisChunk = false;
-          Collection<VirtualFile> dependentFiles = Collections.emptyList();
-          final Function<Pair<int[], Set<VirtualFile>>, Pair<int[], Set<VirtualFile>>> dependencyFilter = new DependentClassesCumulativeFilter();
-          
-          do {
-            for (int currentCompiler = 0, translatorsLength = translators.length; currentCompiler < translatorsLength; currentCompiler++) {
-              sink.setCurrentCompilerIndex(currentCompiler);
-              final TranslatingCompiler compiler = translators[currentCompiler];
-              if (context.getProgressIndicator().isCanceled()) {
-                throw new ExitException(ExitStatus.CANCELLED);
-              }
-
-              dumbService.waitForSmartMode();
-
-              if (snapshot == null || ContainerUtil.intersects(generatedTypes, compilerManager.getRegisteredInputTypes(compiler))) {
-                // rescan snapshot if previously generated files may influence the input of this compiler
-                final Set<VirtualFile> prevSnapshot = round > 0 && snapshot != null? new HashSet<VirtualFile>(Arrays.asList(snapshot)) : Collections.<VirtualFile>emptySet();
-                snapshot = ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile[]>() {
-                  public VirtualFile[] compute() {
-                    return context.getCompileScope().getFiles(null, true);
-                  }
-                });
-                recalculateChunkToFilesMap(context, sortedChunks, snapshot, chunkMap);
-                if (round == 0) {
-                  chunkFiles = chunkMap.get(currentChunk);
-                }
-                else {
-                  final Set<VirtualFile> newFiles = new HashSet<VirtualFile>(chunkMap.get(currentChunk));
-                  newFiles.removeAll(prevSnapshot);
-                  newFiles.removeAll(chunkFiles);
-                  if (!newFiles.isEmpty()) {
-                    final ArrayList<VirtualFile> merged = new ArrayList<VirtualFile>(chunkFiles.size() + newFiles.size());
-                    merged.addAll(chunkFiles);
-                    merged.addAll(newFiles);
-                    chunkFiles = merged;
-                  }
-                }
-                total = snapshot.length * translatorsLength;
-              }
-
-              final CompileContextEx _context;
-              if (compiler instanceof IntermediateOutputCompiler) {
-                // wrap compile context so that output goes into intermediate directories
-                final IntermediateOutputCompiler _compiler = (IntermediateOutputCompiler)compiler;
-                _context = new CompileContextExProxy(context) {
-                  public VirtualFile getModuleOutputDirectory(final Module module) {
-                    return getGenerationOutputDir(_compiler, module, false);
-                  }
-  
-                  public VirtualFile getModuleOutputDirectoryForTests(final Module module) {
-                    return getGenerationOutputDir(_compiler, module, true);
-                  }
-                };
-              }
-              else {
-                _context = context;
-              }
-              final boolean compiledSomething =
-                compileSources(_context, currentChunk, compiler, chunkFiles, round == 0? forceCompile : true, isRebuild, onlyCheckStatus, sink);
-  
-              processed += chunkFiles.size();
-              _context.getProgressIndicator().setFraction(((double)processed) / total);
-  
-              if (compiledSomething) {
-                generatedTypes.addAll(compilerManager.getRegisteredOutputTypes(compiler));
-              }
-  
-              didSomething |= compiledSomething;
-              compiledSomethingForThisChunk |= didSomething;
-
-              if (_context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
-                break; // break the loop over compilers
-              }
-            }
-
-            final boolean hasUnprocessedTraverseRoots = context.getDependencyCache().hasUnprocessedTraverseRoots();
-            if (!isRebuild && (compiledSomethingForThisChunk || hasUnprocessedTraverseRoots)) {
-              final Set<VirtualFile> compiledWithErrors = CacheUtils.getFilesCompiledWithErrors(context);
-              filesToRecompile.removeAll(sink.getCompiledSources());
-              filesToRecompile.addAll(compiledWithErrors);
-
-              dependentFiles = CacheUtils.findDependentFiles(context, compiledWithErrors, dependencyFilter);
-              if (!processedModules.isEmpty()) {
-                for (Iterator<VirtualFile> it = dependentFiles.iterator(); it.hasNext();) {
-                  final VirtualFile next = it.next();
-                  final Module module = context.getModuleByFile(next);
-                  if (module != null && processedModules.contains(module)) {
-                    it.remove();
-                  }
-                }
-              }
-              
-              if (ourDebugMode) {
-                if (!dependentFiles.isEmpty()) {
-                  for (VirtualFile dependentFile : dependentFiles) {
-                    System.out.println("FOUND TO RECOMPILE: " + dependentFile.getPresentableUrl());
-                  }
-                }
-                else {
-                  System.out.println("NO FILES TO RECOMPILE");
-                }
-              }
-
-              if (!dependentFiles.isEmpty()) {
-                filesToRecompile.addAll(dependentFiles);
-                allDependent.addAll(dependentFiles);
-                if (context.getProgressIndicator().isCanceled() || context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
-                  break;
-                }
-                final List<VirtualFile> filesInScope = getFilesInScope(context, currentChunk, dependentFiles);
-                if (filesInScope.isEmpty()) {
-                  break;
-                }
-                context.getDependencyCache().clearTraverseRoots();
-                chunkFiles = filesInScope;
-                total += chunkFiles.size() * translators.length;
-              }
-              
-              didSomething |= (hasUnprocessedTraverseRoots != context.getDependencyCache().hasUnprocessedTraverseRoots());
-            }
-
-            round++;
-          }
-          while (!dependentFiles.isEmpty() && context.getMessageCount(CompilerMessageCategory.ERROR) == 0);
-
-          if (CompilerConfiguration.MAKE_ENABLED) {
-            if (!context.getProgressIndicator().isCanceled()) {
-              // when cancelled pretend nothing was compiled and next compile will compile everything from the scratch
-              final ProgressIndicator indicator = context.getProgressIndicator();
-              final DependencyCache cache = context.getDependencyCache();
-
-              indicator.pushState();
-              indicator.setText(CompilerBundle.message("progress.updating.caches"));
-              indicator.setText2("");
-
-              cache.update();
-
-              indicator.setText(CompilerBundle.message("progress.saving.caches"));
-              cache.resetState();
-              processedModules.addAll(currentChunk.getNodes());
-              indicator.popState();
-            }
-          }
-
-          if (context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
-            throw new ExitException(ExitStatus.ERRORS);
-          }
-
-        }
-        catch (CacheCorruptedException e) {
-          LOG.info(e);
-          context.requestRebuildNextTime(e.getMessage());
-        }
-        finally {
-          final int errorCount = context.getMessageCount(CompilerMessageCategory.ERROR);
-          if (errorCount != 0) {
-            filesToRecompile.addAll(allDependent);
-          }
-          if (filesToRecompile.size() > 0) {
-            sink.add(null, Collections.<TranslatingCompiler.OutputItem>emptyList(), VfsUtilCore.toVirtualFileArray(filesToRecompile));
-          }
-          if (errorCount == 0) {
-            // perform update only if there were no errors, so it is guaranteed that the file was processd by all neccesary compilers
-            sink.flushPostponedItems();
-          }
-        }
-      }
-    }
-    catch (ProcessCanceledException e) {
-      ProgressManager.getInstance().executeNonCancelableSection(new Runnable() {
-        public void run() {
-          try {
-            final Collection<VirtualFile> deps = CacheUtils.findDependentFiles(context, Collections.<VirtualFile>emptySet(), null);
-            if (deps.size() > 0) {
-              TranslatingCompilerFilesMonitor.getInstance().update(context, null, Collections.<TranslatingCompiler.OutputItem>emptyList(),
-                                                                   VfsUtilCore.toVirtualFileArray(deps));
-            }
-          }
-          catch (IOException ignored) {
-            LOG.info(ignored);
-          }
-          catch (CacheCorruptedException ignored) {
-            LOG.info(ignored);
-          }
-          catch (ExitException e1) {
-            LOG.info(e1);
-          }
-        }
-      });
-      throw e;
-    }
-    finally {
-      dropDependencyCache(context);
-      if (didSomething) {
-        TranslatingCompilerFilesMonitor.getInstance().updateOutputRootsLayout(myProject);
-      }
-    }
-    return didSomething;
-  }
-
-  private static List<VirtualFile> getFilesInScope(final CompileContextEx context, final Chunk<Module> chunk, final Collection<VirtualFile> files) {
-    final List<VirtualFile> filesInScope = new ArrayList<VirtualFile>(files.size());
-    ApplicationManager.getApplication().runReadAction(new Runnable() {
-      public void run() {
-        for (VirtualFile file : files) {
-          if (context.getCompileScope().belongs(file.getUrl())) {
-            final Module module = context.getModuleByFile(file);
-            if (chunk.getNodes().contains(module)) {
-              filesInScope.add(file);
-            }
-          }
-        }
-      }
-    });
-    return filesInScope;
-  }
-
-  private static void recalculateChunkToFilesMap(CompileContextEx context, List<Chunk<Module>> allChunks, VirtualFile[] snapshot, Map<Chunk<Module>, Collection<VirtualFile>> chunkMap) {
-    final Map<Module, List<VirtualFile>> moduleToFilesMap = CompilerUtil.buildModuleToFilesMap(context, snapshot);
-    for (Chunk<Module> moduleChunk : allChunks) {
-      List<VirtualFile> files = Collections.emptyList();
-      for (Module module : moduleChunk.getNodes()) {
-        final List<VirtualFile> moduleFiles = moduleToFilesMap.get(module);
-        if (moduleFiles != null) {
-          files = ContainerUtil.concat(files, moduleFiles);
-        }
-      }
-      chunkMap.put(moduleChunk, files);
-    }
-  }
-
-  private interface FileProcessingCompilerAdapterFactory {
-    FileProcessingCompilerAdapter create(CompileContext context, FileProcessingCompiler compiler);
-  }
-
-  private boolean invokeFileProcessingCompilers(final CompilerManager compilerManager,
-                                                CompileContextEx context,
-                                                Class<? extends FileProcessingCompiler> fileProcessingCompilerClass,
-                                                FileProcessingCompilerAdapterFactory factory,
-                                                boolean forceCompile,
-                                                final boolean checkScope,
-                                                final boolean onlyCheckStatus) throws ExitException {
-    boolean didSomething = false;
-    final FileProcessingCompiler[] compilers = compilerManager.getCompilers(fileProcessingCompilerClass, myCompilerFilter);
-    if (compilers.length > 0) {
-      try {
-        CacheDeferredUpdater cacheUpdater = new CacheDeferredUpdater();
-        try {
-          for (final FileProcessingCompiler compiler : compilers) {
-            if (context.getProgressIndicator().isCanceled()) {
-              throw new ExitException(ExitStatus.CANCELLED);
-            }
-
-            CompileContextEx _context = context;
-            if (compiler instanceof IntermediateOutputCompiler) {
-              final IntermediateOutputCompiler _compiler = (IntermediateOutputCompiler)compiler;
-              _context = new CompileContextExProxy(context) {
-                public VirtualFile getModuleOutputDirectory(final Module module) {
-                  return getGenerationOutputDir(_compiler, module, false);
-                }
-
-                public VirtualFile getModuleOutputDirectoryForTests(final Module module) {
-                  return getGenerationOutputDir(_compiler, module, true);
-                }
-              };
-            }
-
-            final boolean processedSomething = processFiles(factory.create(_context, compiler), forceCompile, checkScope, onlyCheckStatus, cacheUpdater);
-
-            if (context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
-              throw new ExitException(ExitStatus.ERRORS);
-            }
-
-            didSomething |= processedSomething;
-          }
-        }
-        finally {
-          cacheUpdater.doUpdate();
-        }
-      }
-      catch (IOException e) {
-        LOG.info(e);
-        context.requestRebuildNextTime(e.getMessage());
-        throw new ExitException(ExitStatus.ERRORS);
-      }
-      catch (ProcessCanceledException e) {
-        throw e;
-      }
-      catch (ExitException e) {
-        throw e;
-      }
-      catch (Exception e) {
-        context.addMessage(CompilerMessageCategory.ERROR, CompilerBundle.message("compiler.error.exception", e.getMessage()), null, -1, -1);
-        LOG.error(e);
-      }
-    }
-
-    return didSomething;
-  }
-
-  private static Map<Module, Set<GeneratingCompiler.GenerationItem>> buildModuleToGenerationItemMap(GeneratingCompiler.GenerationItem[] items) {
-    final Map<Module, Set<GeneratingCompiler.GenerationItem>> map = new HashMap<Module, Set<GeneratingCompiler.GenerationItem>>();
-    for (GeneratingCompiler.GenerationItem item : items) {
-      Module module = item.getModule();
-      LOG.assertTrue(module != null);
-      Set<GeneratingCompiler.GenerationItem> itemSet = map.get(module);
-      if (itemSet == null) {
-        itemSet = new HashSet<GeneratingCompiler.GenerationItem>();
-        map.put(module, itemSet);
-      }
-      itemSet.add(item);
-    }
-    return map;
-  }
-
-  private void deleteAll(final CompileContextEx context) {
-    CompilerUtil.runInContext(context, CompilerBundle.message("progress.clearing.output"), new ThrowableRunnable<RuntimeException>() {
-      public void run() {
-        final boolean isTestMode = ApplicationManager.getApplication().isUnitTestMode();
-        final VirtualFile[] allSources = context.getProjectCompileScope().getFiles(null, true);
-        if (myShouldClearOutputDirectory) {
-          CompilerUtil.clearOutputDirectories(myAllOutputDirectories);
-        }
-        else { // refresh is still required
-          try {
-            for (final Compiler compiler : CompilerManager.getInstance(myProject).getCompilers(Compiler.class)) {
-              try {
-                if (compiler instanceof GeneratingCompiler) {
-                  final StateCache<ValidityState> cache = getGeneratingCompilerCache((GeneratingCompiler)compiler);
-                  final Iterator<String> urlIterator = cache.getUrlsIterator();
-                  while (urlIterator.hasNext()) {
-                    context.getProgressIndicator().checkCanceled();
-                    deleteFile(new File(VirtualFileManager.extractPath(urlIterator.next())));
-                  }
-                }
-                else if (compiler instanceof TranslatingCompiler) {
-                  final ArrayList<Trinity<File, String, Boolean>> toDelete = new ArrayList<Trinity<File, String, Boolean>>();
-                  ApplicationManager.getApplication().runReadAction(new Runnable() {
-                    public void run() {
-                      TranslatingCompilerFilesMonitor.getInstance().collectFiles(
-                        context, 
-                        (TranslatingCompiler)compiler, Arrays.<VirtualFile>asList(allSources).iterator(), 
-                        true /*pass true to make sure that every source in scope file is processed*/, 
-                        false /*important! should pass false to enable collection of files to delete*/,
-                        new ArrayList<VirtualFile>(), 
-                        toDelete
-                      );
-                    }
-                  });
-                  for (Trinity<File, String, Boolean> trinity : toDelete) {
-                    context.getProgressIndicator().checkCanceled();
-                    final File file = trinity.getFirst();
-                    deleteFile(file);
-                    if (isTestMode) {
-                      CompilerManagerImpl.addDeletedPath(file.getPath());
-                    }
-                  }
-                }
-              }
-              catch (IOException e) {
-                LOG.info(e);
-              }
-            }
-            pruneEmptyDirectories(context.getProgressIndicator(), myAllOutputDirectories); // to avoid too much files deleted events
-          }
-          finally {
-            CompilerUtil.refreshIODirectories(myAllOutputDirectories);
-          }
-        }
-        dropScopesCaches();
-
-        clearCompilerSystemDirectory(context);
-      }
-    });
-  }
-
+  /*
   private void dropScopesCaches() {
     // hack to be sure the classpath will include the output directories
     ApplicationManager.getApplication().runReadAction(new Runnable() {
@@ -1763,421 +568,7 @@
       }
     });
   }
-
-  private static void pruneEmptyDirectories(ProgressIndicator progress, final Set<File> directories) {
-    for (File directory : directories) {
-      doPrune(progress, directory, directories);
-    }
-  }
-
-  private static boolean doPrune(ProgressIndicator progress, final File directory, final Set<File> outPutDirectories) {
-    progress.checkCanceled();
-    final File[] files = directory.listFiles();
-    boolean isEmpty = true;
-    if (files != null) {
-      for (File file : files) {
-        if (!outPutDirectories.contains(file)) {
-          if (doPrune(progress, file, outPutDirectories)) {
-            deleteFile(file);
-          }
-          else {
-            isEmpty = false;
-          }
-        }
-        else {
-          isEmpty = false;
-        }
-      }
-    }
-    else {
-      isEmpty = false;
-    }
-
-    return isEmpty;
-  }
-
-  private Set<File> getAllOutputDirectories(CompileContext context) {
-    final Set<File> outputDirs = new OrderedSet<File>();
-    final Module[] modules = ModuleManager.getInstance(myProject).getModules();
-    for (final String path : CompilerPathsEx.getOutputPaths(modules)) {
-      outputDirs.add(new File(path));
-    }
-    for (Pair<IntermediateOutputCompiler, Module> pair : myGenerationCompilerModuleToOutputDirMap.keySet()) {
-      outputDirs.add(new File(CompilerPaths.getGenerationOutputPath(pair.getFirst(), pair.getSecond(), false)));
-      outputDirs.add(new File(CompilerPaths.getGenerationOutputPath(pair.getFirst(), pair.getSecond(), true)));
-    }
-    final CompilerConfiguration config = CompilerConfiguration.getInstance(myProject);
-    if (context.isAnnotationProcessorsEnabled()) {
-      for (Module module : modules) {
-        if (config.getAnnotationProcessingConfiguration(module).isEnabled()) {
-          final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module);
-          if (path != null) {
-            outputDirs.add(new File(path));
-          }
-        }
-      }
-    }
-    for (Artifact artifact : ArtifactManager.getInstance(myProject).getArtifacts()) {
-      final String path = ((ArtifactImpl)artifact).getOutputDirectoryPathToCleanOnRebuild();
-      if (path != null) {
-        outputDirs.add(new File(FileUtil.toSystemDependentName(path)));
-      }
-    }
-    return outputDirs;
-  }
-
-  private void clearCompilerSystemDirectory(final CompileContextEx context) {
-    CompilerCacheManager.getInstance(myProject).clearCaches(context);
-    FileUtil.delete(CompilerPathsEx.getZipStoreDirectory(myProject));
-    dropDependencyCache(context);
-
-    for (Pair<IntermediateOutputCompiler, Module> pair : myGenerationCompilerModuleToOutputDirMap.keySet()) {
-      final File[] outputs = {
-        new File(CompilerPaths.getGenerationOutputPath(pair.getFirst(), pair.getSecond(), false)),
-        new File(CompilerPaths.getGenerationOutputPath(pair.getFirst(), pair.getSecond(), true))
-      };
-      for (File output : outputs) {
-        final File[] files = output.listFiles();
-        if (files != null) {
-          for (final File file : files) {
-            final boolean deleteOk = deleteFile(file);
-            if (!deleteOk) {
-              context.addMessage(CompilerMessageCategory.ERROR, CompilerBundle.message("compiler.error.failed.to.delete", file.getPath()),
-                                 null, -1, -1);
-            }
-          }
-        }
-      }
-    }
-  }
-
-  /**
-   * @param file a file to delete
-   * @return true if and only if the file existed and was successfully deleted
-   * Note: the behaviour is different from FileUtil.delete() which returns true if the file absent on the disk
-   */
-  private static boolean deleteFile(final File file) {
-    File[] files = file.listFiles();
-    if (files != null) {
-      for (File file1 : files) {
-        deleteFile(file1);
-      }
-    }
-
-    for (int i = 0; i < 10; i++){
-      if (file.delete()) {
-        return true;
-      }
-      if (!file.exists()) {
-        return false;
-      }
-      try {
-        Thread.sleep(50);
-      }
-      catch (InterruptedException ignored) {
-      }
-    }
-    return false;
-  }
-
-  private VirtualFile getGenerationOutputDir(final IntermediateOutputCompiler compiler, final Module module, final boolean forTestSources) {
-    final Couple<VirtualFile> outputs =
-      myGenerationCompilerModuleToOutputDirMap.get(Pair.create(compiler, module));
-    return forTestSources? outputs.getSecond() : outputs.getFirst();
-  }
-
-  private boolean generateOutput(final CompileContextEx context,
-                                 final GeneratingCompiler compiler,
-                                 final boolean forceGenerate,
-                                 final boolean onlyCheckStatus) throws ExitException {
-    final GeneratingCompiler.GenerationItem[] allItems = compiler.getGenerationItems(context);
-    final List<GeneratingCompiler.GenerationItem> toGenerate = new ArrayList<GeneratingCompiler.GenerationItem>();
-    final List<File> filesToRefresh = new ArrayList<File>();
-    final List<File> generatedFiles = new ArrayList<File>();
-    final List<Module> affectedModules = new ArrayList<Module>();
-    try {
-      final StateCache<ValidityState> cache = getGeneratingCompilerCache(compiler);
-      final Set<String> pathsToRemove = new HashSet<String>(cache.getUrls());
-
-      final Map<GeneratingCompiler.GenerationItem, String> itemToOutputPathMap = new HashMap<GeneratingCompiler.GenerationItem, String>();
-      ApplicationManager.getApplication().runReadAction(new ThrowableComputable<Void, IOException>() {
-        @Override
-        public Void compute() throws IOException {
-          for (final GeneratingCompiler.GenerationItem item : allItems) {
-
-            final Module itemModule = item.getModule();
-            final String outputDirPath = CompilerPaths.getGenerationOutputPath(compiler, itemModule, item.isTestSource());
-            final String outputPath = outputDirPath + "/" + item.getPath();
-            itemToOutputPathMap.put(item, outputPath);
-            final ValidityState savedState = cache.getState(outputPath);
-
-            if (forceGenerate || savedState == null || !savedState.equalsTo(item.getValidityState())) {
-              final String outputPathUrl = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, outputPath);
-              if (context.getCompileScope().belongs(outputPathUrl)) {
-                toGenerate.add(item);
-              }
-              else {
-                pathsToRemove.remove(outputPath);
-              }
-            }
-            else {
-              pathsToRemove.remove(outputPath);
-            }
-          }
-          return null;
-        }
-      });
-
-      if (onlyCheckStatus) {
-        if (toGenerate.isEmpty() && pathsToRemove.isEmpty()) {
-          return false;
-        }
-        if (LOG.isDebugEnabled()) {
-          if (!toGenerate.isEmpty()) {
-            LOG.debug("Found items to generate, compiler " + compiler.getDescription());
-          }
-          if (!pathsToRemove.isEmpty()) {
-            LOG.debug("Found paths to remove, compiler " + compiler.getDescription());
-          }
-        }
-        throw new ExitException(ExitStatus.CANCELLED);
-      }
-
-      if (!pathsToRemove.isEmpty()) {
-        CompilerUtil.runInContext(context, CompilerBundle.message("progress.synchronizing.output.directory"), new ThrowableRunnable<IOException>(){
-          public void run() throws IOException {
-            for (final String path : pathsToRemove) {
-              final File file = new File(path);
-              final boolean deleted = deleteFile(file);
-              if (deleted) {
-                cache.remove(path);
-                filesToRefresh.add(file);
-              }
-            }
-          }
-        });
-      }
-
-      final Map<Module, Set<GeneratingCompiler.GenerationItem>> moduleToItemMap =
-          buildModuleToGenerationItemMap(toGenerate.toArray(new GeneratingCompiler.GenerationItem[toGenerate.size()]));
-      List<Module> modules = new ArrayList<Module>(moduleToItemMap.size());
-      for (final Module module : moduleToItemMap.keySet()) {
-        modules.add(module);
-      }
-      ModuleCompilerUtil.sortModules(myProject, modules);
-
-      for (final Module module : modules) {
-        CompilerUtil.runInContext(context, "Generating output from "+compiler.getDescription(),new ThrowableRunnable<IOException>(){
-          public void run() throws IOException {
-            final Set<GeneratingCompiler.GenerationItem> items = moduleToItemMap.get(module);
-            if (items != null && !items.isEmpty()) {
-              final GeneratingCompiler.GenerationItem[][] productionAndTestItems = splitGenerationItems(items);
-              for (GeneratingCompiler.GenerationItem[] _items : productionAndTestItems) {
-                if (_items.length == 0) continue;
-                final VirtualFile outputDir = getGenerationOutputDir(compiler, module, _items[0].isTestSource());
-                final GeneratingCompiler.GenerationItem[] successfullyGenerated = compiler.generate(context, _items, outputDir);
-
-                CompilerUtil.runInContext(context, CompilerBundle.message("progress.updating.caches"), new ThrowableRunnable<IOException>() {
-                  public void run() throws IOException {
-                    if (successfullyGenerated.length > 0) {
-                      affectedModules.add(module);
-                    }
-                    for (final GeneratingCompiler.GenerationItem item : successfullyGenerated) {
-                      final String fullOutputPath = itemToOutputPathMap.get(item);
-                      cache.update(fullOutputPath, item.getValidityState());
-                      final File file = new File(fullOutputPath);
-                      filesToRefresh.add(file);
-                      generatedFiles.add(file);
-                      context.getProgressIndicator().setText2(file.getPath());
-                    }
-                  }
-                });
-              }
-            }
-          }
-        });
-      }
-    }
-    catch (IOException e) {
-      LOG.info(e);
-      context.requestRebuildNextTime(e.getMessage());
-      throw new ExitException(ExitStatus.ERRORS);
-    }
-    finally {
-      CompilerUtil.refreshIOFiles(filesToRefresh);
-      if (!generatedFiles.isEmpty()) {
-        List<VirtualFile> vFiles = DumbService.getInstance(myProject).runReadActionInSmartMode(new Computable<List<VirtualFile>>() {
-          public List<VirtualFile> compute() {
-            final ArrayList<VirtualFile> vFiles = new ArrayList<VirtualFile>(generatedFiles.size());
-            for (File generatedFile : generatedFiles) {
-              final VirtualFile vFile = LocalFileSystem.getInstance().findFileByIoFile(generatedFile);
-              if (vFile != null) {
-                vFiles.add(vFile);
-              }
-            }
-            return vFiles;
-          }
-        });
-        if (forceGenerate) {
-          context.addScope(new FileSetCompileScope(vFiles, affectedModules.toArray(new Module[affectedModules.size()])));
-        }
-        context.markGenerated(vFiles);
-      }
-    }
-    return !toGenerate.isEmpty() || !filesToRefresh.isEmpty();
-  }
-
-  private static GeneratingCompiler.GenerationItem[][] splitGenerationItems(final Set<GeneratingCompiler.GenerationItem> items) {
-    final List<GeneratingCompiler.GenerationItem> production = new ArrayList<GeneratingCompiler.GenerationItem>();
-    final List<GeneratingCompiler.GenerationItem> tests = new ArrayList<GeneratingCompiler.GenerationItem>();
-    for (GeneratingCompiler.GenerationItem item : items) {
-      if (item.isTestSource()) {
-        tests.add(item);
-      }
-      else {
-        production.add(item);
-      }
-    }
-    return new GeneratingCompiler.GenerationItem[][]{
-      production.toArray(new GeneratingCompiler.GenerationItem[production.size()]),
-      tests.toArray(new GeneratingCompiler.GenerationItem[tests.size()])
-    };
-  }
-
-  private boolean compileSources(final CompileContextEx context,
-                                 final Chunk<Module> moduleChunk,
-                                 final TranslatingCompiler compiler,
-                                 final Collection<VirtualFile> srcSnapshot,
-                                 final boolean forceCompile,
-                                 final boolean isRebuild,
-                                 final boolean onlyCheckStatus,
-                                 TranslatingCompiler.OutputSink sink) throws ExitException {
-
-    final Set<VirtualFile> toCompile = new HashSet<VirtualFile>();
-    final List<Trinity<File, String, Boolean>> toDelete = new ArrayList<Trinity<File, String, Boolean>>();
-    context.getProgressIndicator().pushState();
-
-    final boolean[] wereFilesDeleted = {false};
-    try {
-      ApplicationManager.getApplication().runReadAction(new Runnable() {
-        public void run() {
-          TranslatingCompilerFilesMonitor.getInstance().collectFiles(
-            context, compiler, srcSnapshot.iterator(), forceCompile, isRebuild, toCompile, toDelete
-          );
-        }
-      });
-
-      if (onlyCheckStatus) {
-        if (toDelete.isEmpty() && toCompile.isEmpty()) {
-          return false;
-        }
-        if (LOG.isDebugEnabled() || ourDebugMode) {
-          if (!toDelete.isEmpty()) {
-            final StringBuilder message = new StringBuilder();
-            message.append("Found items to delete, compiler ").append(compiler.getDescription());
-            for (Trinity<File, String, Boolean> trinity : toDelete) {
-              message.append("\n").append(trinity.getFirst());
-            }
-            LOG.debug(message.toString());
-            if (ourDebugMode) {
-              System.out.println(message);
-            }
-          }
-          if (!toCompile.isEmpty()) {
-            final String message = "Found items to compile, compiler " + compiler.getDescription();
-            LOG.debug(message);
-            if (ourDebugMode) {
-              System.out.println(message);
-            }
-          }
-        }
-        throw new ExitException(ExitStatus.CANCELLED);
-      }
-
-      if (!toDelete.isEmpty()) {
-        try {
-          wereFilesDeleted[0] = syncOutputDir(context, toDelete);
-        }
-        catch (CacheCorruptedException e) {
-          LOG.info(e);
-          context.requestRebuildNextTime(e.getMessage());
-        }
-      }
-
-      if ((wereFilesDeleted[0] || !toCompile.isEmpty()) && context.getMessageCount(CompilerMessageCategory.ERROR) == 0) {
-        compiler.compile(context, moduleChunk, VfsUtilCore.toVirtualFileArray(toCompile), sink);
-      }
-    }
-    finally {
-      context.getProgressIndicator().popState();
-    }
-    return !toCompile.isEmpty() || wereFilesDeleted[0];
-  }
-
-  private static boolean syncOutputDir(final CompileContextEx context, final Collection<Trinity<File, String, Boolean>> toDelete) throws CacheCorruptedException {
-    final DependencyCache dependencyCache = context.getDependencyCache();
-    final boolean isTestMode = ApplicationManager.getApplication().isUnitTestMode();
-
-    final List<File> filesToRefresh = new ArrayList<File>();
-    final boolean[] wereFilesDeleted = {false};
-    CompilerUtil.runInContext(context, CompilerBundle.message("progress.synchronizing.output.directory"), new ThrowableRunnable<CacheCorruptedException>(){
-      public void run() throws CacheCorruptedException {
-        final long start = System.currentTimeMillis();
-        try {
-          for (final Trinity<File, String, Boolean> trinity : toDelete) {
-            final File outputPath = trinity.getFirst();
-            context.getProgressIndicator().checkCanceled();
-            context.getProgressIndicator().setText2(outputPath.getPath());
-            filesToRefresh.add(outputPath);
-            if (isTestMode) {
-              LOG.assertTrue(outputPath.exists());
-            }
-            if (!deleteFile(outputPath)) {
-              if (isTestMode) {
-                if (outputPath.exists()) {
-                  LOG.error("Was not able to delete output file: " + outputPath.getPath());
-                }
-                else {
-                  CompilerManagerImpl.addDeletedPath(outputPath.getPath());
-                }
-              }
-              continue;
-            }
-            wereFilesDeleted[0] = true;
-
-            // update zip here
-            //final String outputDir = myOutputFinder.lookupOutputPath(outputPath);
-            //if (outputDir != null) {
-            //  try {
-            //    context.updateZippedOuput(outputDir, FileUtil.toSystemIndependentName(outputPath.getPath()).substring(outputDir.length() + 1));
-            //  }
-            //  catch (IOException e) {
-            //    LOG.info(e);
-            //  }
-            //}
-
-            final String className = trinity.getSecond();
-            if (className != null) {
-              final int id = dependencyCache.getSymbolTable().getId(className);
-              dependencyCache.addTraverseRoot(id);
-              final boolean sourcePresent = trinity.getThird().booleanValue();
-              if (!sourcePresent) {
-                dependencyCache.markSourceRemoved(id);
-              }
-            }
-            if (isTestMode) {
-              CompilerManagerImpl.addDeletedPath(outputPath.getPath());
-            }
-          }
-        }
-        finally {
-          CompilerUtil.logDuration("Sync output directory", System.currentTimeMillis() - start);
-          CompilerUtil.refreshIOFiles(filesToRefresh);
-        }
-      }
-    });
-    return wereFilesDeleted[0];
-  }
+  */
 
   // [mike] performance optimization - this method is accessed > 15,000 times in Aurora
   private String getModuleOutputPath(final Module module, boolean inTestSourceContent) {
@@ -2191,152 +582,9 @@
     return path;
   }
 
-  private boolean processFiles(final FileProcessingCompilerAdapter adapter,
-                               final boolean forceCompile,
-                               final boolean checkScope,
-                               final boolean onlyCheckStatus, final CacheDeferredUpdater cacheUpdater) throws ExitException, IOException {
-    final CompileContextEx context = (CompileContextEx)adapter.getCompileContext();
-    final FileProcessingCompilerStateCache cache = getFileProcessingCompilerCache(adapter.getCompiler());
-    final FileProcessingCompiler.ProcessingItem[] items = adapter.getProcessingItems();
-    if (context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
-      return false;
-    }
-    if (LOG.isDebugEnabled() && items.length > 0) {
-      LOG.debug("Start processing files by " + adapter.getCompiler().getDescription());
-    }
-    final CompileScope scope = context.getCompileScope();
-    final List<FileProcessingCompiler.ProcessingItem> toProcess = new ArrayList<FileProcessingCompiler.ProcessingItem>();
-    final Set<String> allUrls = new HashSet<String>();
-    final IOException[] ex = {null};
-    DumbService.getInstance(myProject).runReadActionInSmartMode(new Runnable() {
-      public void run() {
-        try {
-          for (FileProcessingCompiler.ProcessingItem item : items) {
-            final VirtualFile file = item.getFile();
-            final String url = file.getUrl();
-            allUrls.add(url);
-            if (!forceCompile && cache.getTimestamp(url) == file.getTimeStamp()) {
-              final ValidityState state = cache.getExtState(url);
-              final ValidityState itemState = item.getValidityState();
-              if (state != null ? state.equalsTo(itemState) : itemState == null) {
-                continue;
-              }
-            }
-            if (LOG.isDebugEnabled()) {
-              LOG.debug("Adding item to process: " + url + "; saved ts= " + cache.getTimestamp(url) + "; VFS ts=" + file.getTimeStamp());
-            }
-            toProcess.add(item);
-          }
-        }
-        catch (IOException e) {
-          ex[0] = e;
-        }
-      }
-    });
-
-    if (ex[0] != null) {
-      throw ex[0];
-    }
-
-    final Collection<String> urls = cache.getUrls();
-    final List<String> urlsToRemove = new ArrayList<String>();
-    if (!urls.isEmpty()) {
-      CompilerUtil.runInContext(context, CompilerBundle.message("progress.processing.outdated.files"), new ThrowableRunnable<IOException>(){
-        public void run() throws IOException {
-          ApplicationManager.getApplication().runReadAction(new Runnable() {
-            public void run() {
-              for (final String url : urls) {
-                if (!allUrls.contains(url)) {
-                  if (!checkScope || scope.belongs(url)) {
-                    urlsToRemove.add(url);
-                  }
-                }
-              }
-            }
-          });
-          if (!onlyCheckStatus && !urlsToRemove.isEmpty()) {
-            for (final String url : urlsToRemove) {
-              adapter.processOutdatedItem(context, url, cache.getExtState(url));
-              cache.remove(url);
-            }
-          }
-        }
-      });
-    }
-
-    if (onlyCheckStatus) {
-      if (urlsToRemove.isEmpty() && toProcess.isEmpty()) {
-        return false;
-      }
-      if (LOG.isDebugEnabled()) {
-        if (!urlsToRemove.isEmpty()) {
-          LOG.debug("Found urls to remove, compiler " + adapter.getCompiler().getDescription());
-          for (String url : urlsToRemove) {
-            LOG.debug("\t" + url);
-          }
-        }
-        if (!toProcess.isEmpty()) {
-          LOG.debug("Found items to compile, compiler " + adapter.getCompiler().getDescription());
-          for (FileProcessingCompiler.ProcessingItem item : toProcess) {
-            LOG.debug("\t" + item.getFile().getPresentableUrl());
-          }
-        }
-      }
-      throw new ExitException(ExitStatus.CANCELLED);
-    }
-
-    if (toProcess.isEmpty()) {
-      return false;
-    }
-
-    final FileProcessingCompiler.ProcessingItem[] processed =
-      adapter.process(toProcess.toArray(new FileProcessingCompiler.ProcessingItem[toProcess.size()]));
-
-    if (processed.length == 0) {
-      return true;
-    }
-    CompilerUtil.runInContext(context, CompilerBundle.message("progress.updating.caches"), new ThrowableRunnable<IOException>() {
-      public void run() {
-        final List<VirtualFile> vFiles = new ArrayList<VirtualFile>(processed.length);
-        for (FileProcessingCompiler.ProcessingItem aProcessed : processed) {
-          final VirtualFile file = aProcessed.getFile();
-          vFiles.add(file);
-          if (LOG.isDebugEnabled()) {
-            LOG.debug("\tFile processed " + file.getPresentableUrl() + "; ts=" + file.getTimeStamp());
-          }
-
-          //final String path = file.getPath();
-          //final String outputDir = myOutputFinder.lookupOutputPath(path);
-          //if (outputDir != null) {
-          //  context.updateZippedOuput(outputDir, path.substring(outputDir.length() + 1));
-          //}
-        }
-        LocalFileSystem.getInstance().refreshFiles(vFiles);
-        if (LOG.isDebugEnabled()) {
-          LOG.debug("Files after VFS refresh:");
-          for (VirtualFile file : vFiles) {
-            LOG.debug("\t" + file.getPresentableUrl() + "; ts=" + file.getTimeStamp());
-          }
-        }
-        for (FileProcessingCompiler.ProcessingItem item : processed) {
-          cacheUpdater.addFileForUpdate(item, cache);
-        }
-      }
-    });
-    return true;
-  }
-
-  private FileProcessingCompilerStateCache getFileProcessingCompilerCache(FileProcessingCompiler compiler) throws IOException {
-    return CompilerCacheManager.getInstance(myProject).getFileProcessingCompilerCache(compiler);
-  }
-
-  private StateCache<ValidityState> getGeneratingCompilerCache(final GeneratingCompiler compiler) throws IOException {
-    return CompilerCacheManager.getInstance(myProject).getGeneratingCompilerCache(compiler);
-  }
-
   public void executeCompileTask(final CompileTask task, final CompileScope scope, final String contentName, final Runnable onTaskFinished) {
     final CompilerTask progressManagerTask = new CompilerTask(myProject, contentName, false, false, true, isCompilationStartedAutomatically(scope));
-    final CompileContextImpl compileContext = new CompileContextImpl(myProject, progressManagerTask, scope, null, false, false);
+    final CompileContextImpl compileContext = new CompileContextImpl(myProject, progressManagerTask, scope, false, false);
 
     FileDocumentManager.getInstance().saveAllDocuments();
 
@@ -2391,16 +639,13 @@
     return true;
   }
 
-  private boolean validateCompilerConfiguration(final CompileScope scope, boolean checkOutputAndSourceIntersection) {
+  private boolean validateCompilerConfiguration(final CompileScope scope) {
     try {
-      final Module[] scopeModules = scope.getAffectedModules()/*ModuleManager.getInstance(myProject).getModules()*/;
+      final Module[] scopeModules = scope.getAffectedModules();
       final List<String> modulesWithoutOutputPathSpecified = new ArrayList<String>();
-      boolean isProjectCompilePathSpecified = true;
       final List<String> modulesWithoutJdkAssigned = new ArrayList<String>();
-      final Set<File> nonExistingOutputPaths = new HashSet<File>();
       final CompilerConfiguration config = CompilerConfiguration.getInstance(myProject);
       final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
-      final boolean useOutOfProcessBuild = useOutOfProcessBuild();
       for (final Module module : scopeModules) {
         if (!compilerManager.isValidationEnabled(module)) {
           continue;
@@ -2422,52 +667,16 @@
           modulesWithoutOutputPathSpecified.add(module.getName());
         }
         else {
-          if (outputPath != null) {
-            if (!useOutOfProcessBuild) {
-              final File file = new File(outputPath.replace('/', File.separatorChar));
-              if (!file.exists()) {
-                nonExistingOutputPaths.add(file);
-              }
-            }
-          }
-          else {
+          if (outputPath == null) {
             if (hasSources) {
               modulesWithoutOutputPathSpecified.add(module.getName());
             }
           }
-          if (testsOutputPath != null) {
-            if (!useOutOfProcessBuild) {
-              final File f = new File(testsOutputPath.replace('/', File.separatorChar));
-              if (!f.exists()) {
-                nonExistingOutputPaths.add(f);
-              }
-            }
-          }
-          else {
+          if (testsOutputPath == null) {
             if (hasTestSources) {
               modulesWithoutOutputPathSpecified.add(module.getName());
             }
           }
-          if (!useOutOfProcessBuild) {
-            if (config.getAnnotationProcessingConfiguration(module).isEnabled()) {
-              final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module);
-              if (path == null) {
-                final CompilerProjectExtension extension = CompilerProjectExtension.getInstance(module.getProject());
-                if (extension == null || extension.getCompilerOutputUrl() == null) {
-                  isProjectCompilePathSpecified = false;
-                }
-                else {
-                  modulesWithoutOutputPathSpecified.add(module.getName());
-                }
-              }
-              else {
-                final File file = new File(path);
-                if (!file.exists()) {
-                  nonExistingOutputPaths.add(file);
-                }
-              }
-            }
-          }
         }
       }
       if (!modulesWithoutJdkAssigned.isEmpty()) {
@@ -2475,79 +684,17 @@
         return false;
       }
 
-      if (!isProjectCompilePathSpecified) {
-        final String message = CompilerBundle.message("error.project.output.not.specified");
-        if (ApplicationManager.getApplication().isUnitTestMode()) {
-          LOG.error(message);
-        }
-  
-        Messages.showMessageDialog(myProject, message, CommonBundle.getErrorTitle(), Messages.getErrorIcon());
-        ProjectSettingsService.getInstance(myProject).openProjectSettings();
-        return false;
-      }
-
       if (!modulesWithoutOutputPathSpecified.isEmpty()) {
         showNotSpecifiedError("error.output.not.specified", modulesWithoutOutputPathSpecified, CommonContentEntriesEditor.NAME);
         return false;
       }
 
-      if (!nonExistingOutputPaths.isEmpty()) {
-        for (File file : nonExistingOutputPaths) {
-          final boolean succeeded = file.mkdirs();
-          if (!succeeded) {
-            if (file.exists()) {
-              // for overlapping paths, this one might have been created as an intermediate path on a previous iteration
-              continue;
-            }
-            Messages.showMessageDialog(myProject, CompilerBundle.message("error.failed.to.create.directory", file.getPath()),
-                                       CommonBundle.getErrorTitle(), Messages.getErrorIcon());
-            return false;
-          }
-        }
-        final Boolean refreshSuccess =
-          new WriteAction<Boolean>() {
-            @Override
-            protected void run(@NotNull Result<Boolean> result) throws Throwable {
-              LocalFileSystem.getInstance().refreshIoFiles(nonExistingOutputPaths);
-              Boolean res = Boolean.TRUE;
-              for (File file : nonExistingOutputPaths) {
-                if (LocalFileSystem.getInstance().findFileByIoFile(file) == null) {
-                  res = Boolean.FALSE;
-                  break;
-                }
-              }
-              result.setResult(res);
-            }
-          }.execute().getResultObject();
-  
-        if (!refreshSuccess.booleanValue()) {
-          return false;
-        }
-        dropScopesCaches();
-      }
-
-      if (checkOutputAndSourceIntersection && myShouldClearOutputDirectory) {
-        if (!validateOutputAndSourcePathsIntersection()) {
-          return false;
-        }
-        // myShouldClearOutputDirectory may change in validateOutputAndSourcePathsIntersection()
-        CompilerPathsEx.CLEAR_ALL_OUTPUTS_KEY.set(scope, myShouldClearOutputDirectory);
-      }
-      else {
-        CompilerPathsEx.CLEAR_ALL_OUTPUTS_KEY.set(scope, false);
-      }
       final List<Chunk<Module>> chunks = ModuleCompilerUtil.getSortedModuleChunks(myProject, Arrays.asList(scopeModules));
       for (final Chunk<Module> chunk : chunks) {
         final Set<Module> chunkModules = chunk.getNodes();
         if (chunkModules.size() <= 1) {
           continue; // no need to check one-module chunks
         }
-        for (Module chunkModule : chunkModules) {
-          if (config.getAnnotationProcessingConfiguration(chunkModule).isEnabled()) {
-            showCyclesNotSupportedForAnnotationProcessors(chunkModules.toArray(new Module[chunkModules.size()]));
-            return false;
-          }
-        }
         Sdk jdk = null;
         LanguageLevel languageLevel = null;
         for (final Module module : chunkModules) {
@@ -2574,14 +721,6 @@
           }
         }
       }
-      if (!useOutOfProcessBuild) {
-        final Compiler[] allCompilers = compilerManager.getCompilers(Compiler.class);
-        for (Compiler compiler : allCompilers) {
-          if (!compiler.validateConfiguration(scope)) {
-            return false;
-          }
-        }
-      }
       return true;
     }
     catch (Throwable e) {
@@ -2590,10 +729,6 @@
     }
   }
 
-  private boolean useOutOfProcessBuild() {
-    return CompilerWorkspaceConfiguration.getInstance(myProject).useOutOfProcessBuild();
-  }
-
   private void showCyclicModulesHaveDifferentLanguageLevel(Module[] modulesInChunk) {
     LOG.assertTrue(modulesInChunk.length > 0);
     String moduleNameToSelect = modulesInChunk[0].getName();
@@ -2612,15 +747,6 @@
     showConfigurationDialog(moduleNameToSelect, null);
   }
 
-  private void showCyclesNotSupportedForAnnotationProcessors(Module[] modulesInChunk) {
-    LOG.assertTrue(modulesInChunk.length > 0);
-    String moduleNameToSelect = modulesInChunk[0].getName();
-    final String moduleNames = getModulesString(modulesInChunk);
-    Messages.showMessageDialog(myProject, CompilerBundle.message("error.annotation.processing.not.supported.for.module.cycles", moduleNames),
-                               CommonBundle.getErrorTitle(), Messages.getErrorIcon());
-    showConfigurationDialog(moduleNameToSelect, null);
-  }
-
   private static String getModulesString(Module[] modulesInChunk) {
     final StringBuilder moduleNames = StringBuilderSpinAllocator.alloc();
     try {
@@ -2675,228 +801,7 @@
     showConfigurationDialog(nameToSelect, editorNameToSelect);
   }
 
-  private boolean validateOutputAndSourcePathsIntersection() {
-    final Module[] allModules = ModuleManager.getInstance(myProject).getModules();
-    List<VirtualFile> allOutputs = new ArrayList<VirtualFile>();
-    ContainerUtil.addAll(allOutputs, CompilerPathsEx.getOutputDirectories(allModules));
-    for (Artifact artifact : ArtifactManager.getInstance(myProject).getArtifacts()) {
-      ContainerUtil.addIfNotNull(artifact.getOutputFile(), allOutputs);
-    }
-    final Set<VirtualFile> affectedOutputPaths = new HashSet<VirtualFile>();
-    CompilerUtil.computeIntersectingPaths(myProject, allOutputs, affectedOutputPaths);
-    affectedOutputPaths.addAll(ArtifactCompilerUtil.getArtifactOutputsContainingSourceFiles(myProject));
-
-    if (!affectedOutputPaths.isEmpty()) {
-      if (CompilerUtil.askUserToContinueWithNoClearing(myProject, affectedOutputPaths)) {
-        myShouldClearOutputDirectory = false;
-        return true;
-      }
-      else {
-        return false;
-      }
-    }
-    return true;
-  }
-
   private void showConfigurationDialog(String moduleNameToSelect, String tabNameToSelect) {
     ProjectSettingsService.getInstance(myProject).showModuleConfigurationDialog(moduleNameToSelect, tabNameToSelect);
   }
-
-  private static VirtualFile lookupVFile(final LocalFileSystem lfs, final String path) {
-    final File file = new File(path);
-
-    VirtualFile vFile = lfs.findFileByIoFile(file);
-    if (vFile != null) {
-      return vFile;
-    }
-
-    final boolean justCreated = file.mkdirs();
-    vFile = lfs.refreshAndFindFileByIoFile(file);
-
-    if (vFile == null) {
-      assert false: "Virtual file not found for " + file.getPath() + "; mkdirs() exit code is " + justCreated + "; file exists()? " + file.exists();
-    }
-
-    return vFile;
-  }
-
-  private static class CacheDeferredUpdater {
-    private final Map<VirtualFile, List<Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem>>> myData = new java.util.HashMap<VirtualFile, List<Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem>>>();
-
-    public void addFileForUpdate(final FileProcessingCompiler.ProcessingItem item, FileProcessingCompilerStateCache cache) {
-      final VirtualFile file = item.getFile();
-      List<Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem>> list = myData.get(file);
-      if (list == null) {
-        list = new ArrayList<Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem>>();
-        myData.put(file, list);
-      }
-      list.add(Pair.create(cache, item));
-    }
-
-    public void doUpdate() throws IOException {
-      ApplicationManager.getApplication().runReadAction(new ThrowableComputable<Void, IOException>() {
-        @Override
-        public Void compute() throws IOException {
-          for (Map.Entry<VirtualFile, List<Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem>>> entry : myData.entrySet()) {
-            for (Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem> pair : entry.getValue()) {
-              final FileProcessingCompiler.ProcessingItem item = pair.getSecond();
-              pair.getFirst().update(entry.getKey(), item.getValidityState());
-            }
-          }
-          return null;
-        }
-      });
-    }
-  }
-
-  private static class TranslatorsOutputSink implements TranslatingCompiler.OutputSink {
-    final Map<String, Collection<TranslatingCompiler.OutputItem>> myPostponedItems = new HashMap<String, Collection<TranslatingCompiler.OutputItem>>();
-    private final CompileContextEx myContext;
-    private final TranslatingCompiler[] myCompilers;
-    private int myCurrentCompilerIdx;
-    private final Set<VirtualFile> myCompiledSources = new HashSet<VirtualFile>();
-    //private LinkedBlockingQueue<Future> myFutures = new LinkedBlockingQueue<Future>();
-
-    private TranslatorsOutputSink(CompileContextEx context, TranslatingCompiler[] compilers) {
-      myContext = context;
-      myCompilers = compilers;
-    }
-
-    public void setCurrentCompilerIndex(int index) {
-      myCurrentCompilerIdx = index;
-    }
-
-    public Set<VirtualFile> getCompiledSources() {
-      return Collections.unmodifiableSet(myCompiledSources);
-    }
-
-    public void add(final String outputRoot, final Collection<TranslatingCompiler.OutputItem> items, final VirtualFile[] filesToRecompile) {
-      for (TranslatingCompiler.OutputItem item : items) {
-        final VirtualFile file = item.getSourceFile();
-        if (file != null) {
-          myCompiledSources.add(file);
-        }
-      }
-      final TranslatingCompiler compiler = myCompilers[myCurrentCompilerIdx];
-      if (compiler instanceof IntermediateOutputCompiler) {
-        final LocalFileSystem lfs = LocalFileSystem.getInstance();
-        final List<VirtualFile> outputs = new ArrayList<VirtualFile>();
-        for (TranslatingCompiler.OutputItem item : items) {
-          final VirtualFile vFile = lfs.findFileByPath(item.getOutputPath());
-          if (vFile != null) {
-            outputs.add(vFile);
-          }
-        }
-        myContext.markGenerated(outputs);
-      }
-      final int nextCompilerIdx = myCurrentCompilerIdx + 1;
-      try {
-        if (nextCompilerIdx < myCompilers.length ) {
-          final Map<String, Collection<TranslatingCompiler.OutputItem>> updateNow = new java.util.HashMap<String, Collection<TranslatingCompiler.OutputItem>>();
-          // process postponed
-          for (Map.Entry<String, Collection<TranslatingCompiler.OutputItem>> entry : myPostponedItems.entrySet()) {
-            final String outputDir = entry.getKey();
-            final Collection<TranslatingCompiler.OutputItem> postponed = entry.getValue();
-            for (Iterator<TranslatingCompiler.OutputItem> it = postponed.iterator(); it.hasNext();) {
-              TranslatingCompiler.OutputItem item = it.next();
-              boolean shouldPostpone = false;
-              for (int idx = nextCompilerIdx; idx < myCompilers.length; idx++) {
-                shouldPostpone = myCompilers[idx].isCompilableFile(item.getSourceFile(), myContext);
-                if (shouldPostpone) {
-                  break;
-                }
-              }
-              if (!shouldPostpone) {
-                // the file is not compilable by the rest of compilers, so it is safe to update it now
-                it.remove();
-                addItemToMap(updateNow, outputDir, item);
-              }
-            }
-          }
-          // process items from current compilation
-          for (TranslatingCompiler.OutputItem item : items) {
-            boolean shouldPostpone = false;
-            for (int idx = nextCompilerIdx; idx < myCompilers.length; idx++) {
-              shouldPostpone = myCompilers[idx].isCompilableFile(item.getSourceFile(), myContext);
-              if (shouldPostpone) {
-                break;
-              }
-            }
-            if (shouldPostpone) {
-              // the file is compilable by the next compiler in row, update should be postponed
-              addItemToMap(myPostponedItems, outputRoot, item);
-            }
-            else {
-              addItemToMap(updateNow, outputRoot, item);
-            }
-          }
-
-          if (updateNow.size() == 1) {
-            final Map.Entry<String, Collection<TranslatingCompiler.OutputItem>> entry = updateNow.entrySet().iterator().next();
-            final String outputDir = entry.getKey();
-            final Collection<TranslatingCompiler.OutputItem> itemsToUpdate = entry.getValue();
-            TranslatingCompilerFilesMonitor.getInstance().update(myContext, outputDir, itemsToUpdate, filesToRecompile);
-          }
-          else {
-            for (Map.Entry<String, Collection<TranslatingCompiler.OutputItem>> entry : updateNow.entrySet()) {
-              final String outputDir = entry.getKey();
-              final Collection<TranslatingCompiler.OutputItem> itemsToUpdate = entry.getValue();
-              TranslatingCompilerFilesMonitor.getInstance().update(myContext, outputDir, itemsToUpdate, VirtualFile.EMPTY_ARRAY);
-            }
-            if (filesToRecompile.length > 0) {
-              TranslatingCompilerFilesMonitor.getInstance().update(myContext, null, Collections.<TranslatingCompiler.OutputItem>emptyList(), filesToRecompile);
-            }
-          }
-        }
-        else {
-          TranslatingCompilerFilesMonitor.getInstance().update(myContext, outputRoot, items, filesToRecompile);
-        }
-      }
-      catch (IOException e) {
-        LOG.info(e);
-        myContext.requestRebuildNextTime(e.getMessage());
-      }
-    }
-
-    private static void addItemToMap(Map<String, Collection<TranslatingCompiler.OutputItem>> map, String outputDir, TranslatingCompiler.OutputItem item) {
-      Collection<TranslatingCompiler.OutputItem> collection = map.get(outputDir);
-      if (collection == null) {
-        collection = new ArrayList<TranslatingCompiler.OutputItem>();
-        map.put(outputDir, collection);
-      }
-      collection.add(item);
-    }
-
-    public void flushPostponedItems() {
-      final TranslatingCompilerFilesMonitor filesMonitor = TranslatingCompilerFilesMonitor.getInstance();
-      try {
-        for (Map.Entry<String, Collection<TranslatingCompiler.OutputItem>> entry : myPostponedItems.entrySet()) {
-          final String outputDir = entry.getKey();
-          final Collection<TranslatingCompiler.OutputItem> items = entry.getValue();
-          filesMonitor.update(myContext, outputDir, items, VirtualFile.EMPTY_ARRAY);
-        }
-      }
-      catch (IOException e) {
-        LOG.info(e);
-        myContext.requestRebuildNextTime(e.getMessage());
-      }
-    }
-  }
-
-  private static class DependentClassesCumulativeFilter implements Function<Pair<int[], Set<VirtualFile>>, Pair<int[], Set<VirtualFile>>> {
-
-    private final TIntHashSet myProcessedNames = new TIntHashSet();
-    private final Set<VirtualFile> myProcessedFiles = new HashSet<VirtualFile>();
-
-    public Pair<int[], Set<VirtualFile>> fun(Pair<int[], Set<VirtualFile>> deps) {
-      final TIntHashSet currentDeps = new TIntHashSet(deps.getFirst());
-      currentDeps.removeAll(myProcessedNames.toArray());
-      myProcessedNames.addAll(deps.getFirst());
-
-      final Set<VirtualFile> depFiles = new HashSet<VirtualFile>(deps.getSecond());
-      depFiles.removeAll(myProcessedFiles);
-      myProcessedFiles.addAll(deps.getSecond());
-      return Pair.create(currentDeps.toArray(), depFiles);
-    }
-  }
 }
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompilerCacheManager.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompilerCacheManager.java
index 5c147ee..c30eb73 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/CompilerCacheManager.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompilerCacheManager.java
@@ -27,8 +27,6 @@
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 
-import java.io.DataInput;
-import java.io.DataOutput;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -124,35 +122,6 @@
     return (FileProcessingCompilerStateCache)cache;
   }
 
-  public synchronized StateCache<ValidityState> getGeneratingCompilerCache(final GeneratingCompiler compiler) throws IOException {
-    Object cache = myCompilerToCacheMap.get(compiler);
-    if (cache == null) {
-      final File cacheDir = getCompilerRootDir(compiler);
-      final StateCache<ValidityState> stateCache = new StateCache<ValidityState>(new File(cacheDir, "timestamps")) {
-        public ValidityState read(DataInput stream) throws IOException {
-          return compiler.createValidityState(stream);
-        }
-  
-        public void write(ValidityState validityState, DataOutput out) throws IOException {
-          validityState.save(out);
-        }
-      };
-      myCompilerToCacheMap.put(compiler, stateCache);
-      myCacheDisposables.add(new Disposable() {
-        public void dispose() {
-          try {
-            stateCache.close();
-          }
-          catch (IOException e) {
-            LOG.info(e);
-          }
-        }
-      });
-      cache = stateCache;
-    }
-    return (StateCache<ValidityState>)cache;
-  }
-
   public static String getCompilerIdString(Compiler compiler) {
     @NonNls String description = compiler.getDescription();
     return description.replaceAll("\\s+", "_").replaceAll("[\\.\\?]", "_").toLowerCase();
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/FileProcessingCompilerAdapterTask.java b/java/compiler/impl/src/com/intellij/compiler/impl/FileProcessingCompilerAdapterTask.java
index 8848a40..514eb3c 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/FileProcessingCompilerAdapterTask.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/FileProcessingCompilerAdapterTask.java
@@ -15,7 +15,6 @@
  */
 package com.intellij.compiler.impl;
 
-import com.intellij.compiler.CompilerWorkspaceConfiguration;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.compiler.*;
 import com.intellij.openapi.diagnostic.Logger;
@@ -53,9 +52,6 @@
   @Override
   public boolean execute(CompileContext context) {
     final Project project = context.getProject();
-    if (!CompilerWorkspaceConfiguration.getInstance(project).useOutOfProcessBuild()) {
-      return true;
-    }
 
     try {
       final FileProcessingCompiler.ProcessingItem[] items = myCompiler.getProcessingItems(context);
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/SourceUrlClassNamePair.java b/java/compiler/impl/src/com/intellij/compiler/impl/SourceUrlClassNamePair.java
deleted file mode 100644
index 6d9a60d..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/SourceUrlClassNamePair.java
+++ /dev/null
@@ -1,40 +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.compiler.impl;
-
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Jun 21, 2006
- */
-public class SourceUrlClassNamePair {
-  private final String mySourceUrl;
-  private final @Nullable String myClassName;
-
-  public SourceUrlClassNamePair(String url, @Nullable String className) {
-    mySourceUrl = url;
-    myClassName = className;
-  }
-
-  public String getSourceUrl() {
-    return mySourceUrl;
-  }
-
-  public @Nullable String getClassName() {
-    return myClassName;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java b/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java
index f9d2fbe..b631df7 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java
@@ -15,55 +15,27 @@
  */
 package com.intellij.compiler.impl;
 
-import com.intellij.ProjectTopics;
-import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.compiler.CompilerIOUtil;
-import com.intellij.compiler.CompilerWorkspaceConfiguration;
-import com.intellij.compiler.make.MakeUtil;
 import com.intellij.compiler.server.BuildManager;
-import com.intellij.openapi.Disposable;
 import com.intellij.openapi.application.Application;
 import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.application.ModalityState;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
 import com.intellij.openapi.components.ApplicationComponent;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.fileTypes.FileTypeManager;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.progress.ProgressManager;
-import com.intellij.openapi.progress.Task;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ProjectManager;
-import com.intellij.openapi.project.ProjectManagerAdapter;
-import com.intellij.openapi.roots.*;
-import com.intellij.openapi.startup.StartupManager;
-import com.intellij.openapi.util.*;
+import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.*;
-import com.intellij.openapi.vfs.newvfs.FileAttribute;
-import com.intellij.openapi.vfs.newvfs.ManagingFS;
 import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
-import com.intellij.openapi.vfs.newvfs.persistent.FSRecords;
-import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS;
-import com.intellij.util.Alarm;
-import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.containers.SLRUCache;
-import com.intellij.util.indexing.FileBasedIndex;
-import com.intellij.util.indexing.IndexInfrastructure;
-import com.intellij.util.io.*;
-import com.intellij.util.io.DataOutputStream;
-import com.intellij.util.messages.MessageBusConnection;
-import gnu.trove.*;
+import com.intellij.util.Function;
+import gnu.trove.THashSet;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
+import java.io.File;
+import java.util.Collection;
+import java.util.Set;
 
 /**
  * @author Eugene Zhuravlev
@@ -82,104 +54,7 @@
   private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.TranslatingCompilerFilesMonitor");
   public static boolean ourDebugMode = false;
 
-  private static final FileAttribute ourSourceFileAttribute = new FileAttribute("_make_source_file_info_", 3);
-  private static final FileAttribute ourOutputFileAttribute = new FileAttribute("_make_output_file_info_", 3);
-  private static final Key<Map<String, VirtualFile>> SOURCE_FILES_CACHE = Key.create("_source_url_to_vfile_cache_");
-
-  private final Object myDataLock = new Object();
-
-  private final TIntHashSet mySuspendedProjects = new TIntHashSet(); // projectId for all projects that should not be monitored
-
-  private final TIntObjectHashMap<TIntHashSet> mySourcesToRecompile = new TIntObjectHashMap<TIntHashSet>(); // ProjectId->set of source file paths
-  private PersistentHashMap<Integer, TIntObjectHashMap<Couple<Integer>>> myOutputRootsStorage; // ProjectId->map[moduleId->Pair(outputDirId, testOutputDirId)]
-  
-  // Map: projectId -> Map{output path -> [sourceUrl; className]}
-  private final SLRUCache<Integer, Outputs> myOutputsToDelete = new SLRUCache<Integer, Outputs>(3, 3) {
-    @Override
-    public Outputs getIfCached(Integer key) {
-      final Outputs value = super.getIfCached(key);
-      if (value != null) {
-        value.allocate();
-      }
-      return value;
-    }
-
-    @NotNull
-    @Override
-    public Outputs get(Integer key) {
-      final Outputs value = super.get(key);
-      value.allocate();
-      return value;
-    }
-
-    @NotNull
-    @Override
-    public Outputs createValue(Integer key) {
-      try {
-        final String dirName = FSRecords.getNames().valueOf(key);
-        final File storeFile;
-        if (StringUtil.isEmpty(dirName)) {
-          storeFile = null;
-        }
-        else {
-          final File compilerCacheDir = CompilerPaths.getCacheStoreDirectory(dirName);
-          storeFile = compilerCacheDir.exists()? new File(compilerCacheDir, "paths_to_delete.dat") : null;
-        }
-        return new Outputs(storeFile, loadPathsToDelete(storeFile));
-      }
-      catch (IOException e) {
-        LOG.info(e);
-        return new Outputs(null, new HashMap<String, SourceUrlClassNamePair>());
-      }
-    }
-
-    @Override
-    protected void onDropFromCache(Integer key, Outputs value) {
-      value.release();
-    }
-  };
-  private final SLRUCache<Project, File> myGeneratedDataPaths = new SLRUCache<Project, File>(8, 8) {
-    @NotNull
-    public File createValue(final Project project) {
-      Disposer.register(project, new Disposable() {
-        public void dispose() {
-          myGeneratedDataPaths.remove(project);
-        }
-      });
-      return CompilerPaths.getGeneratedDataDirectory(project);
-    }
-  };
-  private final SLRUCache<Integer, TIntObjectHashMap<Couple<Integer>>> myProjectOutputRoots = new SLRUCache<Integer, TIntObjectHashMap<Couple<Integer>>>(2, 2) {
-    protected void onDropFromCache(Integer key, TIntObjectHashMap<Couple<Integer>> value) {
-      try {
-        myOutputRootsStorage.put(key, value);
-      }
-      catch (IOException e) {
-        LOG.info(e);
-      }
-    }
-
-    @NotNull
-    public TIntObjectHashMap<Couple<Integer>> createValue(Integer key) {
-      TIntObjectHashMap<Couple<Integer>> map = null;
-      try {
-        ensureOutputStorageInitialized();
-        map = myOutputRootsStorage.get(key);
-      }
-      catch (IOException e) {
-        LOG.info(e);
-      }
-      return map != null? map : new TIntObjectHashMap<Couple<Integer>>();
-    }
-  };
-  private final ProjectManager myProjectManager;
-  private final TIntIntHashMap myInitInProgress = new TIntIntHashMap(); // projectId for successfully initialized projects
-  private final Object myAsyncScanLock = new Object();
-
-  public TranslatingCompilerFilesMonitor(VirtualFileManager vfsManager, ProjectManager projectManager, Application application) {
-    myProjectManager = projectManager;
-
-    projectManager.addProjectManagerListener(new MyProjectManagerListener());
+  public TranslatingCompilerFilesMonitor(VirtualFileManager vfsManager, Application application) {
     vfsManager.addVirtualFileListener(new MyVfsListener(), application);
   }
 
@@ -187,848 +62,23 @@
     return ApplicationManager.getApplication().getComponent(TranslatingCompilerFilesMonitor.class);
   }
 
-  public void suspendProject(Project project) {
-    final int projectId = getProjectId(project);
-
-    synchronized (myDataLock) {
-      if (!mySuspendedProjects.add(projectId)) {
-        return;
-      }
-      FileUtil.createIfDoesntExist(CompilerPaths.getRebuildMarkerFile(project));
-      // cleanup internal structures to free memory
-      mySourcesToRecompile.remove(projectId);
-      myOutputsToDelete.remove(projectId);
-      myGeneratedDataPaths.remove(project);
-    }
-
-    synchronized (myProjectOutputRoots) {
-      ensureOutputStorageInitialized();
-      myProjectOutputRoots.remove(projectId);
-      try {
-        myOutputRootsStorage.remove(projectId);
-      }
-      catch (IOException e) {
-        LOG.info(e);
-      }
-    }
-  }
-
-  public void watchProject(Project project) {
-    synchronized (myDataLock) {
-      int projectId = getProjectId(project);
-      mySuspendedProjects.remove(projectId);
-    }
-  }
-
-  public boolean isSuspended(Project project) {
-    return isSuspended(getProjectId(project));
-  }
-
-  public boolean isSuspended(int projectId) {
-    synchronized (myDataLock) {
-      return mySuspendedProjects.contains(projectId);
-    }
-  }
-
-  @Nullable
-  public static VirtualFile getSourceFileByOutput(VirtualFile outputFile) {
-    final OutputFileInfo outputFileInfo = loadOutputInfo(outputFile);
-    if (outputFileInfo != null) {
-      final String path = outputFileInfo.getSourceFilePath();
-      if (path != null) {
-        return LocalFileSystem.getInstance().findFileByPath(path);
-      }
-    }
-    return null;
-  }
-
-  public void collectFiles(CompileContext context, final TranslatingCompiler compiler, Iterator<VirtualFile> scopeSrcIterator, boolean forceCompile,
-                           final boolean isRebuild,
-                           Collection<VirtualFile> toCompile,
-                           Collection<Trinity<File, String, Boolean>> toDelete) {
-    final Project project = context.getProject();
-    final int projectId = getProjectId(project);
-    final CompilerConfiguration configuration = CompilerConfiguration.getInstance(project);
-    final boolean _forceCompile = forceCompile || isRebuild;
-    final Set<VirtualFile> selectedForRecompilation = new HashSet<VirtualFile>();
-    synchronized (myDataLock) {
-      final TIntHashSet pathsToRecompile = mySourcesToRecompile.get(projectId);
-      if (_forceCompile || pathsToRecompile != null && !pathsToRecompile.isEmpty()) {
-        if (ourDebugMode) {
-          System.out.println("Analysing potentially recompilable files for " + compiler.getDescription());
-        }
-        while (scopeSrcIterator.hasNext()) {
-          final VirtualFile file = scopeSrcIterator.next();
-          if (!file.isValid()) {
-            if (LOG.isDebugEnabled() || ourDebugMode) {
-              LOG.debug("Skipping invalid file " + file.getPresentableUrl());
-              if (ourDebugMode) {
-                System.out.println("\t SKIPPED(INVALID) " + file.getPresentableUrl());
-              }
-            }
-            continue;
-          }
-          final int fileId = getFileId(file);
-          if (_forceCompile) {
-            if (compiler.isCompilableFile(file, context) && !configuration.isExcludedFromCompilation(file)) {
-              toCompile.add(file);
-              if (ourDebugMode) {
-                System.out.println("\t INCLUDED " + file.getPresentableUrl());
-              }
-              selectedForRecompilation.add(file);
-              if (pathsToRecompile == null || !pathsToRecompile.contains(fileId)) {
-                loadInfoAndAddSourceForRecompilation(projectId, file);
-              }
-            }
-            else {
-              if (ourDebugMode) {
-                System.out.println("\t NOT COMPILABLE OR EXCLUDED " + file.getPresentableUrl());
-              }
-            }
-          }
-          else if (pathsToRecompile.contains(fileId)) {
-            if (compiler.isCompilableFile(file, context) && !configuration.isExcludedFromCompilation(file)) {
-              toCompile.add(file);
-              if (ourDebugMode) {
-                System.out.println("\t INCLUDED " + file.getPresentableUrl());
-              }
-              selectedForRecompilation.add(file);
-            }
-            else {
-              if (ourDebugMode) {
-                System.out.println("\t NOT COMPILABLE OR EXCLUDED " + file.getPresentableUrl());
-              }
-            }
-          }
-          else {
-            if (ourDebugMode) {
-              System.out.println("\t NOT INCLUDED " + file.getPresentableUrl());
-            }
-          }
-        }
-      }
-      // it is important that files to delete are collected after the files to compile (see what happens if forceCompile == true)
-      if (!isRebuild) {
-        final Outputs outputs = myOutputsToDelete.get(projectId);
-        try {
-          final VirtualFileManager vfm = VirtualFileManager.getInstance();
-          final LocalFileSystem lfs = LocalFileSystem.getInstance();
-          final List<String> zombieEntries = new ArrayList<String>();
-          final Map<String, VirtualFile> srcFileCache = getFileCache(context);
-          for (Map.Entry<String, SourceUrlClassNamePair> entry : outputs.getEntries()) {
-            final String outputPath = entry.getKey();
-            final SourceUrlClassNamePair classNamePair = entry.getValue();
-            final String sourceUrl = classNamePair.getSourceUrl();
-
-            final VirtualFile srcFile;
-            if (srcFileCache.containsKey(sourceUrl)) {
-              srcFile = srcFileCache.get(sourceUrl);
-            }
-            else {
-              srcFile = vfm.findFileByUrl(sourceUrl);
-              srcFileCache.put(sourceUrl, srcFile);
-            }
-
-            final boolean sourcePresent = srcFile != null;
-            if (sourcePresent) {
-              if (!compiler.isCompilableFile(srcFile, context)) {
-                continue; // do not collect files that were compiled by another compiler
-              }
-              if (!selectedForRecompilation.contains(srcFile)) {
-                if (!isMarkedForRecompilation(projectId, getFileId(srcFile))) {
-                  if (LOG.isDebugEnabled() || ourDebugMode) {
-                    final String message = "Found zombie entry (output is marked, but source is present and up-to-date): " + outputPath;
-                    LOG.debug(message);
-                    if (ourDebugMode) {
-                      System.out.println(message);
-                    }
-                  }
-                  zombieEntries.add(outputPath);
-                }
-                continue;
-              }
-            }
-            if (lfs.findFileByPath(outputPath) != null) {
-              //noinspection UnnecessaryBoxing
-              final File file = new File(outputPath);
-              toDelete.add(new Trinity<File, String, Boolean>(file, classNamePair.getClassName(), Boolean.valueOf(sourcePresent)));
-              if (LOG.isDebugEnabled() || ourDebugMode) {
-                final String message = "Found file to delete: " + file;
-                LOG.debug(message);
-                if (ourDebugMode) {
-                  System.out.println(message);
-                }
-              }
-            }
-            else {
-              if (LOG.isDebugEnabled() || ourDebugMode) {
-                final String message = "Found zombie entry marked for deletion: " + outputPath;
-                LOG.debug(message);
-                if (ourDebugMode) {
-                  System.out.println(message);
-                }
-              }
-              // must be gagbage entry, should cleanup
-              zombieEntries.add(outputPath);
-            }
-          }
-          for (String path : zombieEntries) {
-            unmarkOutputPathForDeletion(projectId, path);
-          }
-        }
-        finally {
-          outputs.release();
-        }
-      }
-    }
-  }
-
-  private static Map<String, VirtualFile> getFileCache(CompileContext context) {
-    Map<String, VirtualFile> cache = context.getUserData(SOURCE_FILES_CACHE);
-    if (cache == null) {
-      context.putUserData(SOURCE_FILES_CACHE, cache = new HashMap<String, VirtualFile>());
-    }
-    return cache;
-  }
-
-  private static int getFileId(final VirtualFile file) {
-    return FileBasedIndex.getFileId(file);
-  }
-
-  private static VirtualFile findFileById(int id) {
-    return IndexInfrastructure.findFileById((PersistentFS)ManagingFS.getInstance(), id);
-  }
-
-  public void update(final CompileContext context, @Nullable final String outputRoot, final Collection<TranslatingCompiler.OutputItem> successfullyCompiled, final VirtualFile[] filesToRecompile)
-      throws IOException {
-    final Project project = context.getProject();
-    final int projectId = getProjectId(project);
-    if (!successfullyCompiled.isEmpty()) {
-      final LocalFileSystem lfs = LocalFileSystem.getInstance();
-      // need read action here to ensure that no modifications were made to VFS while updating file attributes
-      ApplicationManager.getApplication().runReadAction(new ThrowableComputable<Void, IOException>() {
-        @Override
-        public Void compute() throws IOException {
-            final Map<VirtualFile, SourceFileInfo> compiledSources = new HashMap<VirtualFile, SourceFileInfo>();
-            final Set<VirtualFile> forceRecompile = new HashSet<VirtualFile>();
-
-            for (TranslatingCompiler.OutputItem item : successfullyCompiled) {
-              final VirtualFile sourceFile = item.getSourceFile();
-              final boolean isSourceValid = sourceFile.isValid();
-              SourceFileInfo srcInfo = compiledSources.get(sourceFile);
-              if (isSourceValid && srcInfo == null) {
-                srcInfo = loadSourceInfo(sourceFile);
-                if (srcInfo != null) {
-                  srcInfo.clearPaths(projectId);
-                }
-                else {
-                  srcInfo = new SourceFileInfo();
-                }
-                compiledSources.put(sourceFile, srcInfo);
-              }
-
-              final String outputPath = item.getOutputPath();
-              if (outputPath != null) { // can be null for packageinfo
-                final VirtualFile outputFile = lfs.findFileByPath(outputPath);
-
-                //assert outputFile != null : "Virtual file was not found for \"" + outputPath + "\"";
-
-                if (outputFile != null) {
-                  if (!sourceFile.equals(outputFile)) {
-                    final String className = outputRoot == null? null : MakeUtil.relativeClassPathToQName(outputPath.substring(outputRoot.length()), '/');
-                    if (isSourceValid) {
-                      srcInfo.addOutputPath(projectId, outputPath);
-                      saveOutputInfo(outputFile, new OutputFileInfo(sourceFile.getPath(), className));
-                    }
-                    else {
-                      markOutputPathForDeletion(projectId, outputPath, className, sourceFile.getUrl());
-                    }
-                  }
-                }
-                else {  // output file was not found
-                  LOG.warn("TranslatingCompilerFilesMonitor.update():  Virtual file was not found for \"" + outputPath + "\"");
-                  if (isSourceValid) {
-                    forceRecompile.add(sourceFile);
-                  }
-                }
-              }
-            }
-            final long compilationStartStamp = ((CompileContextEx)context).getStartCompilationStamp();
-            for (Map.Entry<VirtualFile, SourceFileInfo> entry : compiledSources.entrySet()) {
-              final SourceFileInfo info = entry.getValue();
-              final VirtualFile file = entry.getKey();
-
-              final long fileStamp = file.getTimeStamp();
-              info.updateTimestamp(projectId, fileStamp);
-              saveSourceInfo(file, info);
-              if (LOG.isDebugEnabled() || ourDebugMode) {
-                final String message = "Unschedule recompilation (successfully compiled) " + file.getPresentableUrl();
-                LOG.debug(message);
-                if (ourDebugMode) {
-                  System.out.println(message);
-                }
-              }
-              removeSourceForRecompilation(projectId, Math.abs(getFileId(file)));
-              if (fileStamp > compilationStartStamp && !((CompileContextEx)context).isGenerated(file) || forceRecompile.contains(file)) {
-                // changes were made during compilation, need to re-schedule compilation
-                // it is important to invoke removeSourceForRecompilation() before this call to make sure
-                // the corresponding output paths will be scheduled for deletion
-                addSourceForRecompilation(projectId, file, info);
-              }
-            }
-          return null;
-        }
-      });
-    }
-    
-    if (filesToRecompile.length > 0) {
-      ApplicationManager.getApplication().runReadAction(new Runnable() {
-        public void run() {
-          for (VirtualFile file : filesToRecompile) {
-            if (file.isValid()) {
-              loadInfoAndAddSourceForRecompilation(projectId, file);
-            }
-          }
-        }
-      });
-    }
-  }
-
-  public void updateOutputRootsLayout(Project project) {
-    final TIntObjectHashMap<Couple<Integer>> map = buildOutputRootsLayout(new ProjectRef(project));
-    final int projectId = getProjectId(project);
-    synchronized (myProjectOutputRoots) {
-      myProjectOutputRoots.put(projectId, map);
-    }
-  }
-
   @NotNull
   public String getComponentName() {
     return "TranslatingCompilerFilesMonitor";
   }
 
   public void initComponent() {
-    ensureOutputStorageInitialized();
   }
 
-  private static File getOutputRootsFile() {
-    return new File(CompilerPaths.getCompilerSystemDirectory(), "output_roots.dat");
-  }
-
-  private static void deleteStorageFiles(File tableFile) {
-    final File[] files = tableFile.getParentFile().listFiles();
-    if (files != null) {
-      final String name = tableFile.getName();
-      for (File file : files) {
-        if (file.getName().startsWith(name)) {
-          FileUtil.delete(file);
-        }
-      }
-    }
-  }
-
-  private static Map<String, SourceUrlClassNamePair> loadPathsToDelete(@Nullable final File file) {
-    final Map<String, SourceUrlClassNamePair> map = new HashMap<String, SourceUrlClassNamePair>();
-    try {
-      if (file != null && file.length() > 0) {
-        final DataInputStream is = new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
-        try {
-          final int size = is.readInt();
-          for (int i = 0; i < size; i++) {
-            final String _outputPath = CompilerIOUtil.readString(is);
-            final String srcUrl = CompilerIOUtil.readString(is);
-            final String className = CompilerIOUtil.readString(is);
-            map.put(FileUtil.toSystemIndependentName(_outputPath), new SourceUrlClassNamePair(srcUrl, className));
-          }
-        }
-        finally {
-          is.close();
-        }
-      }
-    }
-    catch (FileNotFoundException ignored) {
-    }
-    catch (IOException e) {
-      LOG.info(e);
-    }
-    return map;
-  }
-
-  private void ensureOutputStorageInitialized() {
-    if (myOutputRootsStorage != null) {
-      return;
-    }
-    final File rootsFile = getOutputRootsFile();
-    try {
-      initOutputRootsFile(rootsFile);
-    }
-    catch (IOException e) {
-      LOG.info(e);
-      deleteStorageFiles(rootsFile);
-      try {
-        initOutputRootsFile(rootsFile);
-      }
-      catch (IOException e1) {
-        LOG.error(e1);
-      }
-    }
-  }
-
-  private TIntObjectHashMap<Couple<Integer>> buildOutputRootsLayout(ProjectRef projRef) {
-    final TIntObjectHashMap<Couple<Integer>> map = new TIntObjectHashMap<Couple<Integer>>();
-    for (Module module : ModuleManager.getInstance(projRef.get()).getModules()) {
-      final CompilerModuleExtension manager = CompilerModuleExtension.getInstance(module);
-      if (manager != null) {
-        final VirtualFile output = manager.getCompilerOutputPath();
-        final int first = output != null? Math.abs(getFileId(output)) : -1;
-        final VirtualFile testsOutput = manager.getCompilerOutputPathForTests();
-        final int second = testsOutput != null? Math.abs(getFileId(testsOutput)) : -1;
-        map.put(getModuleId(module), Couple.newOne(first, second));
-      }
-    }
-    return map;
-  }
-
-  private void initOutputRootsFile(File rootsFile) throws IOException {
-    myOutputRootsStorage = new PersistentHashMap<Integer, TIntObjectHashMap<Couple<Integer>>>(rootsFile, EnumeratorIntegerDescriptor.INSTANCE, new DataExternalizer<TIntObjectHashMap<Couple<Integer>>>() {
-      public void save(@NotNull DataOutput out, TIntObjectHashMap<Couple<Integer>> value) throws IOException {
-        for (final TIntObjectIterator<Couple<Integer>> it = value.iterator(); it.hasNext();) {
-          it.advance();
-          DataInputOutputUtil.writeINT(out, it.key());
-          final Couple<Integer> pair = it.value();
-          DataInputOutputUtil.writeINT(out, pair.first);
-          DataInputOutputUtil.writeINT(out, pair.second);
-        }
-      }
-
-      public TIntObjectHashMap<Couple<Integer>> read(@NotNull DataInput in) throws IOException {
-        final DataInputStream _in = (DataInputStream)in;
-        final TIntObjectHashMap<Couple<Integer>> map = new TIntObjectHashMap<Couple<Integer>>();
-        while (_in.available() > 0) {
-          final int key = DataInputOutputUtil.readINT(_in);
-          final int first = DataInputOutputUtil.readINT(_in);
-          final int second = DataInputOutputUtil.readINT(_in);
-          map.put(key, Couple.newOne(first, second));
-        }
-        return map;
-      }
-    });
-  }
 
   public void disposeComponent() {
-    try {
-      synchronized (myProjectOutputRoots) {
-        myProjectOutputRoots.clear();
-      }
-    }
-    finally {
-      synchronized (myDataLock) {
-        myOutputsToDelete.clear();
-      }
-    }
-    
-    try {
-      final PersistentHashMap<Integer, TIntObjectHashMap<Couple<Integer>>> storage = myOutputRootsStorage;
-      if (storage != null) {
-        storage.close();
-      }
-    }
-    catch (IOException e) {
-      LOG.info(e);
-      deleteStorageFiles(getOutputRootsFile());
-    }
   }
 
-  private static void savePathsToDelete(final File file, final Map<String, SourceUrlClassNamePair> outputs) {
-    try {
-      FileUtil.createParentDirs(file);
-      final DataOutputStream os = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
-      try {
-        if (outputs != null) {
-          os.writeInt(outputs.size());
-          for (Map.Entry<String, SourceUrlClassNamePair> entry : outputs.entrySet()) {
-            CompilerIOUtil.writeString(entry.getKey(), os);
-            final SourceUrlClassNamePair pair = entry.getValue();
-            CompilerIOUtil.writeString(pair.getSourceUrl(), os);
-            CompilerIOUtil.writeString(pair.getClassName(), os);
-          }
-        }
-        else {
-          os.writeInt(0);
-        }
-      }
-      finally {
-        os.close();
-      }
-    }
-    catch (IOException e) {
-      LOG.error(e);
-    }
-  }
-
-  @Nullable
-  private static SourceFileInfo loadSourceInfo(final VirtualFile file) {
-    try {
-      final DataInputStream is = ourSourceFileAttribute.readAttribute(file);
-      if (is != null) {
-        try {
-          return new SourceFileInfo(is);
-        }
-        finally {
-          is.close();
-        }
-      }
-    }
-    catch (RuntimeException e) {
-      final Throwable cause = e.getCause();
-      if (cause instanceof IOException) {
-        LOG.info(e); // ignore IOExceptions
-      }
-      else {
-        throw e;
-      }
-    }
-    catch (IOException ignored) {
-      LOG.info(ignored);
-    }
-    return null;
-  }
-
-  public static void removeSourceInfo(VirtualFile file) {
-    saveSourceInfo(file, new SourceFileInfo());
-  }
-
-  private static void saveSourceInfo(VirtualFile file, SourceFileInfo descriptor) {
-    final java.io.DataOutputStream out = ourSourceFileAttribute.writeAttribute(file);
-    try {
-      try {
-        descriptor.save(out);
-      }
-      finally {
-        out.close();
-      }
-    }
-    catch (IOException ignored) {
-      LOG.info(ignored);
-    }
-  }
-
-  @Nullable
-  private static OutputFileInfo loadOutputInfo(final VirtualFile file) {
-    try {
-      final DataInputStream is = ourOutputFileAttribute.readAttribute(file);
-      if (is != null) {
-        try {
-          return new OutputFileInfo(is);
-        }
-        finally {
-          is.close();
-        }
-      }
-    }
-    catch (RuntimeException e) {
-      final Throwable cause = e.getCause();
-      if (cause instanceof IOException) {
-        LOG.info(e); // ignore IO exceptions
-      }
-      else {
-        throw e;
-      }
-    }
-    catch (IOException ignored) {
-      LOG.info(ignored);
-    }
-    return null;
-  }
-
-  private static void saveOutputInfo(VirtualFile file, OutputFileInfo descriptor) {
-    final java.io.DataOutputStream out = ourOutputFileAttribute.writeAttribute(file);
-    try {
-      try {
-        descriptor.save(out);
-      }
-      finally {
-        out.close();
-      }
-    }
-    catch (IOException ignored) {
-      LOG.info(ignored);
-    }
-  }
-
-  private static int getProjectId(Project project) {
-    try {
-      return FSRecords.getNames().enumerate(CompilerPaths.getCompilerSystemDirectoryName(project));
-    }
-    catch (IOException e) {
-      LOG.info(e);
-    }
-    return -1;
-  }
-
-  private static int getModuleId(Module module) {
-    try {
-      return FSRecords.getNames().enumerate(module.getName().toLowerCase(Locale.US));
-    }
-    catch (IOException e) {
-      LOG.info(e);
-    }
-    return -1;
-  }
-
-  private static class OutputFileInfo {
-    private final int mySourcePath;
-
-    private final int myClassName;
-
-    OutputFileInfo(final String sourcePath, @Nullable String className) throws IOException {
-      final PersistentStringEnumerator symtable = FSRecords.getNames();
-      mySourcePath = symtable.enumerate(sourcePath);
-      myClassName = className != null? symtable.enumerate(className) : -1;
-    }
-
-    OutputFileInfo(final DataInput in) throws IOException {
-      mySourcePath = in.readInt();
-      myClassName = in.readInt();
-    }
-
-    String getSourceFilePath() {
-      try {
-        return FSRecords.getNames().valueOf(mySourcePath);
-      }
-      catch (IOException e) {
-        LOG.info(e);
-      }
-      return null;
-    }
-
-    @Nullable
-    public String getClassName() {
-      try {
-        return myClassName < 0? null : FSRecords.getNames().valueOf(myClassName);
-      }
-      catch (IOException e) {
-        LOG.info(e);
-      }
-      return null;
-    }
-
-    public void save(final DataOutput out) throws IOException {
-      out.writeInt(mySourcePath);
-      out.writeInt(myClassName);
-    }
-  }
-
-  private static class SourceFileInfo {
-    private TIntLongHashMap myTimestamps; // ProjectId -> last compiled stamp
-    private TIntObjectHashMap<Serializable> myProjectToOutputPathMap; // ProjectId -> either a single output path or a set of output paths
-
-    private SourceFileInfo() {
-    }
-
-    private SourceFileInfo(@NotNull DataInput in) throws IOException {
-      final int projCount = DataInputOutputUtil.readINT(in);
-      for (int idx = 0; idx < projCount; idx++) {
-        final int projectId = DataInputOutputUtil.readINT(in);
-        final long stamp = DataInputOutputUtil.readTIME(in);
-        updateTimestamp(projectId, stamp);
-
-        final int pathsCount = DataInputOutputUtil.readINT(in);
-        for (int i = 0; i < pathsCount; i++) {
-          final int path = in.readInt();
-          addOutputPath(projectId, path);
-        }
-      }
-    }
-
-    public void save(@NotNull final DataOutput out) throws IOException {
-      final int[] projects = getProjectIds().toArray();
-      DataInputOutputUtil.writeINT(out, projects.length);
-      for (int projectId : projects) {
-        DataInputOutputUtil.writeINT(out, projectId);
-        DataInputOutputUtil.writeTIME(out, getTimestamp(projectId));
-        final Object value = myProjectToOutputPathMap != null? myProjectToOutputPathMap.get(projectId) : null;
-        if (value instanceof Integer) {
-          DataInputOutputUtil.writeINT(out, 1);
-          out.writeInt(((Integer)value).intValue());
-        }
-        else if (value instanceof TIntHashSet) {
-          final TIntHashSet set = (TIntHashSet)value;
-          DataInputOutputUtil.writeINT(out, set.size());
-          final IOException[] ex = new IOException[] {null};
-          set.forEach(new TIntProcedure() {
-            public boolean execute(final int value) {
-              try {
-                out.writeInt(value);
-                return true;
-              }
-              catch (IOException e) {
-                ex[0] = e;
-                return false;
-              }
-            }
-          });
-          if (ex[0] != null) {
-            throw ex[0];
-          }
-        }
-        else {
-          DataInputOutputUtil.writeINT(out, 0);
-        }
-      }
-    }
-
-    private void updateTimestamp(final int projectId, final long stamp) {
-      if (stamp > 0L) {
-        if (myTimestamps == null) {
-          myTimestamps = new TIntLongHashMap(1, 0.98f);
-        }
-        myTimestamps.put(projectId, stamp);
-      }
-      else {
-        if (myTimestamps != null) {
-          myTimestamps.remove(projectId);
-        }
-      }
-    }
-
-    TIntHashSet getProjectIds() {
-      final TIntHashSet result = new TIntHashSet();
-      if (myTimestamps != null) {
-        result.addAll(myTimestamps.keys());
-      }
-      if (myProjectToOutputPathMap != null) {
-        result.addAll(myProjectToOutputPathMap.keys());
-      }
-      return result;
-    }
-
-    private void addOutputPath(final int projectId, String outputPath) {
-      try {
-        addOutputPath(projectId, FSRecords.getNames().enumerate(outputPath));
-      }
-      catch (IOException e) {
-        LOG.info(e);
-      }
-    }
-
-    private void addOutputPath(final int projectId, final int outputPath) {
-      if (myProjectToOutputPathMap == null) {
-        myProjectToOutputPathMap = new TIntObjectHashMap<Serializable>(1, 0.98f);
-        myProjectToOutputPathMap.put(projectId, outputPath);
-      }
-      else {
-        final Object val = myProjectToOutputPathMap.get(projectId);
-        if (val == null)  {
-          myProjectToOutputPathMap.put(projectId, outputPath);
-        }
-        else {
-          TIntHashSet set;
-          if (val instanceof Integer)  {
-            set = new TIntHashSet();
-            set.add(((Integer)val).intValue());
-            myProjectToOutputPathMap.put(projectId, set);
-          }
-          else {
-            assert val instanceof TIntHashSet;
-            set = (TIntHashSet)val;
-          }
-          set.add(outputPath);
-        }
-      }
-    }
-
-    public boolean clearPaths(final int projectId){
-      if (myProjectToOutputPathMap != null) {
-        final Serializable removed = myProjectToOutputPathMap.remove(projectId);
-        return removed != null;
-      }
-      return false;
-    }
-
-    long getTimestamp(final int projectId) {
-      return myTimestamps == null? -1L : myTimestamps.get(projectId);
-    }
-
-    void processOutputPaths(final int projectId, final Proc proc){
-      if (myProjectToOutputPathMap != null) {
-        try {
-          final PersistentStringEnumerator symtable = FSRecords.getNames();
-          final Object val = myProjectToOutputPathMap.get(projectId);
-          if (val instanceof Integer)  {
-            proc.execute(projectId, symtable.valueOf(((Integer)val).intValue()));
-          }
-          else if (val instanceof TIntHashSet) {
-            ((TIntHashSet)val).forEach(new TIntProcedure() {
-              public boolean execute(final int value) {
-                try {
-                  proc.execute(projectId, symtable.valueOf(value));
-                  return true;
-                }
-                catch (IOException e) {
-                  LOG.info(e);
-                  return false;
-                }
-              }
-            });
-          }
-        }
-        catch (IOException e) {
-          LOG.info(e);
-        }
-      }
-    }
-
-    boolean isAssociated(int projectId, String outputPath) {
-      if (myProjectToOutputPathMap != null) {
-        try {
-          final Object val = myProjectToOutputPathMap.get(projectId);
-          if (val instanceof Integer)  {
-            return FileUtil.pathsEqual(outputPath, FSRecords.getNames().valueOf(((Integer)val).intValue()));
-          }
-          if (val instanceof TIntHashSet) {
-            final int _outputPath = FSRecords.getNames().enumerate(outputPath);
-            return ((TIntHashSet)val).contains(_outputPath);
-          }
-        }
-        catch (IOException e) {
-          LOG.info(e);
-        }
-      }
-      return false;
-    }
-  }
-
-  public List<String> getCompiledClassNames(VirtualFile srcFile, Project project) {
-    final SourceFileInfo info = loadSourceInfo(srcFile);
-    if (info == null) {
-      return Collections.emptyList();
-    }
-
-    final ArrayList<String> result = new ArrayList<String>();
-
-    info.processOutputPaths(getProjectId(project), new Proc() {
-      @Override
-      public boolean execute(int projectId, String outputPath) {
-        VirtualFile clsFile = LocalFileSystem.getInstance().findFileByPath(outputPath);
-        if (clsFile != null) {
-          OutputFileInfo outputInfo = loadOutputInfo(clsFile);
-          if (outputInfo != null) {
-            ContainerUtil.addIfNotNull(result, outputInfo.getClassName());
-          }
-        }
-        return true;
-      }
-    });
-    return result;
-  }
-
-
   private interface FileProcessor {
     void execute(VirtualFile file);
   }
 
-  private static void processRecursively(final VirtualFile fromFile, final boolean dbOnly, final boolean needReadAction, final FileProcessor processor) {
+  private static void processRecursively(final VirtualFile fromFile, final boolean dbOnly, final FileProcessor processor) {
     if (!(fromFile.getFileSystem() instanceof LocalFileSystem)) {
       return;
     }
@@ -1057,658 +107,134 @@
           return null; // skipping additional checks for the initial file and non-directory files
         }
         // optimization: for all files that are not under content of currently opened projects iterate over DB children
-        return isInContentOfOpenedProject(file, needReadAction)? null : ((NewVirtualFile)file).iterInDbChildren();
+        return isInContentOfOpenedProject(file)? null : ((NewVirtualFile)file).iterInDbChildren();
       }
     });
   }
 
-  private static boolean isInContentOfOpenedProject(@NotNull final VirtualFile file, boolean needReadAction) {
+  private static boolean isInContentOfOpenedProject(@NotNull final VirtualFile file) {
     // probably need a read action to ensure that the project was not disposed during the iteration over the project list
-    final Computable<Boolean> computation = new Computable<Boolean>() {
-      public Boolean compute() {
-        for (Project project : ProjectManager.getInstance().getOpenProjects()) {
-          if (!project.isInitialized()) {
-            continue;
-          }
-          if (ProjectRootManager.getInstance(project).getFileIndex().isInContent(file)) {
-            return Boolean.TRUE;
-          }
-        }
-        return Boolean.FALSE;
+    for (Project project : ProjectManager.getInstance().getOpenProjects()) {
+      if (!project.isInitialized() || !BuildManager.getInstance().isProjectWatched(project)) {
+        continue;
       }
-    };
-    return needReadAction? ApplicationManager.getApplication().runReadAction(computation) : computation.compute();
-  }
-  
-  // made public for tests
-  public void scanSourceContent(final ProjectRef projRef, final Collection<VirtualFile> roots, final int totalRootCount, final boolean isNewRoots) {
-    if (roots.isEmpty()) {
-      return;
-    }
-    final int projectId = getProjectId(projRef.get());
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("Scanning source content for project projectId=" + projectId + "; url=" + projRef.get().getPresentableUrl());
-    }
-
-    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(projRef.get()).getFileIndex();
-    final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
-    int processed = 0;
-    for (VirtualFile srcRoot : roots) {
-      if (indicator != null) {
-        projRef.get();
-        indicator.setText2(srcRoot.getPresentableUrl());
-        indicator.setFraction(++processed / (double)totalRootCount);
-      }
-      if (isNewRoots) {
-        fileIndex.iterateContentUnderDirectory(srcRoot, new ContentIterator() {
-          public boolean processFile(final VirtualFile file) {
-            if (!file.isDirectory()) {
-              if (!isMarkedForRecompilation(projectId, Math.abs(getFileId(file)))) {
-                final SourceFileInfo srcInfo = loadSourceInfo(file);
-                if (srcInfo == null || srcInfo.getTimestamp(projectId) != file.getTimeStamp()) {
-                  addSourceForRecompilation(projectId, file, srcInfo);
-                }
-              }
-            }
-            else {
-              projRef.get();
-            }
-            return true;
-          }
-        });
-      }
-      else {
-        final FileTypeManager fileTypeManager = FileTypeManager.getInstance();
-        VfsUtilCore.visitChildrenRecursively(srcRoot, new VirtualFileVisitor() {
-          @Override
-          public boolean visitFile(@NotNull VirtualFile file) {
-            if (fileTypeManager.isFileIgnored(file)) {
-              return false;
-            }
-            final int fileId = getFileId(file);
-            if (fileId > 0 /*file is valid*/) {
-              if (file.isDirectory()) {
-                projRef.get();
-              }
-              else if (!isMarkedForRecompilation(projectId, fileId)) {
-                final SourceFileInfo srcInfo = loadSourceInfo(file);
-                if (srcInfo != null) {
-                  addSourceForRecompilation(projectId, file, srcInfo);
-                }
-              }
-            }
-            return true;
-          }
-        });
-      }
-    }
-  }
-
-  public void ensureInitializationCompleted(Project project, ProgressIndicator indicator) {
-    final int id = getProjectId(project);
-    synchronized (myAsyncScanLock) {
-      while (myInitInProgress.containsKey(id)) {
-        if (!project.isOpen() || project.isDisposed() || (indicator != null && indicator.isCanceled())) {
-          // makes no sense to continue waiting
-          break;
-        }
-        try {
-          myAsyncScanLock.wait(500);
-        }
-        catch (InterruptedException ignored) {
-          break;
-        }
-      }
-    }
-  }
-
-  private void markOldOutputRoots(final ProjectRef projRef, final TIntObjectHashMap<Couple<Integer>> currentLayout) {
-    final int projectId = getProjectId(projRef.get());
-
-    final TIntHashSet rootsToMark = new TIntHashSet();
-    synchronized (myProjectOutputRoots) {
-      final TIntObjectHashMap<Couple<Integer>> oldLayout = myProjectOutputRoots.get(projectId);
-      for (final TIntObjectIterator<Couple<Integer>> it = oldLayout.iterator(); it.hasNext();) {
-        it.advance();
-        final Couple<Integer> currentRoots = currentLayout.get(it.key());
-        final Couple<Integer> oldRoots = it.value();
-        if (shouldMark(oldRoots.first, currentRoots != null? currentRoots.first : -1)) {
-          rootsToMark.add(oldRoots.first);
-        }
-        if (shouldMark(oldRoots.second, currentRoots != null? currentRoots.second : -1)) {
-          rootsToMark.add(oldRoots.second);
-        }
-      }
-    }
-
-    for (TIntIterator it = rootsToMark.iterator(); it.hasNext();) {
-      final int id = it.next();
-      final VirtualFile outputRoot = findFileById(id);
-      if (outputRoot != null) {
-        processOldOutputRoot(projectId, outputRoot);
-      }
-    }
-  }
-
-  private static boolean shouldMark(Integer oldOutputRoot, Integer currentOutputRoot) {
-    return oldOutputRoot != null && oldOutputRoot.intValue() > 0 && !Comparing.equal(oldOutputRoot, currentOutputRoot);
-  }
-
-  private void processOldOutputRoot(final int projectId, VirtualFile outputRoot) {
-    // recursively mark all corresponding sources for recompilation
-    VfsUtilCore.visitChildrenRecursively(outputRoot, new VirtualFileVisitor() {
-      @Override
-      public boolean visitFile(@NotNull VirtualFile file) {
-        if (!file.isDirectory()) {
-          // todo: possible optimization - process only those outputs that are not marked for deletion yet
-          final OutputFileInfo outputInfo = loadOutputInfo(file);
-          if (outputInfo != null) {
-            final String srcPath = outputInfo.getSourceFilePath();
-            final VirtualFile srcFile = srcPath != null? LocalFileSystem.getInstance().findFileByPath(srcPath) : null;
-            if (srcFile != null) {
-              loadInfoAndAddSourceForRecompilation(projectId, srcFile);
-            }
-          }
-        }
+      if (ProjectRootManager.getInstance(project).getFileIndex().isInContent(file)) {
         return true;
       }
-    });
-  }
-
-  public void scanSourcesForCompilableFiles(final Project project) {
-    final int projectId = getProjectId(project);
-    if (isSuspended(projectId)) {
-      return;
     }
-    startAsyncScan(projectId);
-    StartupManager.getInstance(project).runWhenProjectIsInitialized(new Runnable() {
-      public void run() {
-        new Task.Backgroundable(project, CompilerBundle.message("compiler.initial.scanning.progress.text"), false) {
-          public void run(@NotNull final ProgressIndicator indicator) {
-            final ProjectRef projRef = new ProjectRef(project);
-            if (LOG.isDebugEnabled()) {
-              LOG.debug("Initial sources scan for project hash=" + projectId + "; url="+ projRef.get().getPresentableUrl());
-            }
-            try {
-              final IntermediateOutputCompiler[] compilers =
-                  CompilerManager.getInstance(projRef.get()).getCompilers(IntermediateOutputCompiler.class);
-
-              final Set<VirtualFile> intermediateRoots = new HashSet<VirtualFile>();
-              if (compilers.length > 0) {
-                final Module[] modules = ModuleManager.getInstance(projRef.get()).getModules();
-                for (IntermediateOutputCompiler compiler : compilers) {
-                  for (Module module : modules) {
-                    if (module.isDisposed()) {
-                      continue;
-                    }
-                    final VirtualFile outputRoot = LocalFileSystem.getInstance().refreshAndFindFileByPath(CompilerPaths.getGenerationOutputPath(compiler, module, false));
-                    if (outputRoot != null) {
-                      intermediateRoots.add(outputRoot);
-                    }
-                    final VirtualFile testsOutputRoot = LocalFileSystem.getInstance().refreshAndFindFileByPath(CompilerPaths.getGenerationOutputPath(compiler, module, true));
-                    if (testsOutputRoot != null) {
-                      intermediateRoots.add(testsOutputRoot);
-                    }
-                  }
-                }
-              }
-
-              final List<VirtualFile> projectRoots = Arrays.asList(ProjectRootManager.getInstance(projRef.get()).getContentSourceRoots());
-              final int totalRootsCount = projectRoots.size() + intermediateRoots.size();
-              scanSourceContent(projRef, projectRoots, totalRootsCount, true);
-
-              if (!intermediateRoots.isEmpty()) {
-                final FileProcessor processor = new FileProcessor() {
-                  public void execute(final VirtualFile file) {
-                    if (!isMarkedForRecompilation(projectId, Math.abs(getFileId(file)))) {
-                      final SourceFileInfo srcInfo = loadSourceInfo(file);
-                      if (srcInfo == null || srcInfo.getTimestamp(projectId) != file.getTimeStamp()) {
-                        addSourceForRecompilation(projectId, file, srcInfo);
-                      }
-                    }
-                  }
-                };
-                int processed = projectRoots.size();
-                for (VirtualFile root : intermediateRoots) {
-                  projRef.get();
-                  indicator.setText2(root.getPresentableUrl());
-                  indicator.setFraction(++processed / (double)totalRootsCount);
-                  processRecursively(root, false, true, processor);
-                }
-              }
-              
-              markOldOutputRoots(projRef, buildOutputRootsLayout(projRef));
-            }
-            catch (ProjectRef.ProjectClosedException swallowed) {
-            }
-            finally {
-              terminateAsyncScan(projectId, false);
-            }
-          }
-        }.queue();
-      }
-    });
+    return false;
   }
-
-  private void terminateAsyncScan(int projectId, final boolean clearCounter) {
-    synchronized (myAsyncScanLock) {
-      int counter = myInitInProgress.remove(projectId);
-      if (clearCounter) {
-        myAsyncScanLock.notifyAll();
-      }
-      else {
-        if (--counter > 0) {
-          myInitInProgress.put(projectId, counter);
-        }
-        else {
-          myAsyncScanLock.notifyAll();
-        }
-      }
-    }
-  }
-
-  private void startAsyncScan(final int projectId) {
-    synchronized (myAsyncScanLock) {
-      int counter = myInitInProgress.get(projectId);
-      counter = (counter > 0)? counter + 1 : 1;
-      myInitInProgress.put(projectId, counter);
-      myAsyncScanLock.notifyAll();
-    }
-  }
-
-  private class MyProjectManagerListener extends ProjectManagerAdapter {
-
-    final Map<Project, MessageBusConnection> myConnections = new HashMap<Project, MessageBusConnection>();
-
-    public void projectOpened(final Project project) {
-      final MessageBusConnection conn = project.getMessageBus().connect();
-      myConnections.put(project, conn);
-      final ProjectRef projRef = new ProjectRef(project);
-      final int projectId = getProjectId(project);
-
-      if (CompilerWorkspaceConfiguration.getInstance(project).useOutOfProcessBuild()) {
-        suspendProject(project);
-      }
-      else {
-        watchProject(project);
-      }
-
-      conn.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {
-        private VirtualFile[] myRootsBefore;
-        private Alarm myAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD, project);
-
-        public void beforeRootsChange(final ModuleRootEvent event) {
-          if (isSuspended(projectId)) {
-            return;
-          }
-          try {
-            myRootsBefore = ProjectRootManager.getInstance(projRef.get()).getContentSourceRoots();
-          }
-          catch (ProjectRef.ProjectClosedException e) {
-            myRootsBefore = null;
-          }
-        }
-
-        public void rootsChanged(final ModuleRootEvent event) {
-          if (isSuspended(projectId)) {
-            return;
-          }
-          if (LOG.isDebugEnabled()) {
-            LOG.debug("Before roots changed for projectId=" + projectId + "; url="+ project.getPresentableUrl());
-          }
-          try {
-            final VirtualFile[] rootsBefore = myRootsBefore;
-            myRootsBefore = null;
-            final VirtualFile[] rootsAfter = ProjectRootManager.getInstance(projRef.get()).getContentSourceRoots();
-            final Set<VirtualFile> newRoots = new HashSet<VirtualFile>();
-            final Set<VirtualFile> oldRoots = new HashSet<VirtualFile>();
-            {
-              if (rootsAfter.length > 0) {
-                ContainerUtil.addAll(newRoots, rootsAfter);
-              }
-              if (rootsBefore != null) {
-                newRoots.removeAll(Arrays.asList(rootsBefore));
-              }
-            }
-            {
-              if (rootsBefore != null) {
-                ContainerUtil.addAll(oldRoots, rootsBefore);
-              }
-              if (!oldRoots.isEmpty() && rootsAfter.length > 0) {
-                oldRoots.removeAll(Arrays.asList(rootsAfter));
-              }
-            }
-
-            myAlarm.cancelAllRequests(); // need alarm to deal with multiple rootsChanged events
-            myAlarm.addRequest(new Runnable() {
-              public void run() {
-                startAsyncScan(projectId);
-                new Task.Backgroundable(project, CompilerBundle.message("compiler.initial.scanning.progress.text"), false) {
-                  public void run(@NotNull final ProgressIndicator indicator) {
-                    try {
-                      if (newRoots.size() > 0) {
-                        scanSourceContent(projRef, newRoots, newRoots.size(), true);
-                      }
-                      if (oldRoots.size() > 0) {
-                        scanSourceContent(projRef, oldRoots, oldRoots.size(), false);
-                      }
-                      markOldOutputRoots(projRef, buildOutputRootsLayout(projRef));
-                    }
-                    catch (ProjectRef.ProjectClosedException swallowed) {
-                      // ignored
-                    }
-                    finally {
-                      terminateAsyncScan(projectId, false);
-                    }
-                  }
-                }.queue();
-              }
-            }, 500, ModalityState.NON_MODAL);
-          }
-          catch (ProjectRef.ProjectClosedException e) {
-            LOG.info(e);
-          }
-        }
-      });
-
-      scanSourcesForCompilableFiles(project);
-    }
-
-    public void projectClosed(final Project project) {
-      final int projectId = getProjectId(project);
-      terminateAsyncScan(projectId, true);
-      final MessageBusConnection connection = myConnections.remove(project);
-      if (connection != null) {
-        connection.disconnect();
-      }
-      synchronized (myDataLock) {
-        mySourcesToRecompile.remove(projectId);
-        myOutputsToDelete.remove(projectId);  // drop cache to save memory
-      }
-    }
-  }
-
+  
   private class MyVfsListener extends VirtualFileAdapter {
     public void propertyChanged(@NotNull final VirtualFilePropertyEvent event) {
       if (VirtualFile.PROP_NAME.equals(event.getPropertyName())) {
         final VirtualFile eventFile = event.getFile();
-        final VirtualFile parent = event.getParent();
-        if (parent != null) {
-          final String oldName = (String)event.getOldValue();
-          final String root = parent.getPath() + "/" + oldName;
-          final Set<File> toMark = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
-          if (eventFile.isDirectory()) {
-            VfsUtilCore.visitChildrenRecursively(eventFile, new VirtualFileVisitor() {
-              private StringBuilder filePath = new StringBuilder(root);
-
-              @Override
-              public boolean visitFile(@NotNull VirtualFile child) {
-                if (child.isDirectory()) {
-                  if (!Comparing.equal(child, eventFile)) {
-                    filePath.append("/").append(child.getName());
+        if (isInContentOfOpenedProject(eventFile)) {
+          final VirtualFile parent = event.getParent();
+          if (parent != null) {
+            final String oldName = (String)event.getOldValue();
+            final String root = parent.getPath() + "/" + oldName;
+            final Set<File> toMark = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
+            if (eventFile.isDirectory()) {
+              VfsUtilCore.visitChildrenRecursively(eventFile, new VirtualFileVisitor() {
+                private StringBuilder filePath = new StringBuilder(root);
+  
+                @Override
+                public boolean visitFile(@NotNull VirtualFile child) {
+                  if (child.isDirectory()) {
+                    if (!Comparing.equal(child, eventFile)) {
+                      filePath.append("/").append(child.getName());
+                    }
+                  }
+                  else {
+                    String childPath = filePath.toString();
+                    if (!Comparing.equal(child, eventFile)) {
+                      childPath += "/" + child.getName();
+                    }
+                    toMark.add(new File(childPath));
+                  }
+                  return true;
+                }
+  
+                @Override
+                public void afterChildrenVisited(@NotNull VirtualFile file) {
+                  if (file.isDirectory() && !Comparing.equal(file, eventFile)) {
+                    filePath.delete(filePath.length() - file.getName().length() - 1, filePath.length());
                   }
                 }
-                else {
-                  String childPath = filePath.toString();
-                  if (!Comparing.equal(child, eventFile)) {
-                    childPath += "/" + child.getName();
-                  }
-                  toMark.add(new File(childPath));
-                }
-                return true;
-              }
-
-              @Override
-              public void afterChildrenVisited(@NotNull VirtualFile file) {
-                if (file.isDirectory() && !Comparing.equal(file, eventFile)) {
-                  filePath.delete(filePath.length() - file.getName().length() - 1, filePath.length());
-                }
-              }
-            });
+              });
+            }
+            else {
+              toMark.add(new File(root));
+            }
+            notifyFilesDeleted(toMark);
           }
-          else {
-            toMark.add(new File(root));
-          }
-          notifyFilesDeleted(toMark);
+          collectPathsAndNotify(eventFile, NOTIFY_CHANGED);
         }
-        markDirtyIfSource(eventFile, false);
       }
     }
 
     public void contentsChanged(@NotNull final VirtualFileEvent event) {
-      markDirtyIfSource(event.getFile(), false);
+      collectPathsAndNotify(event.getFile(), NOTIFY_CHANGED);
     }
 
     public void fileCreated(@NotNull final VirtualFileEvent event) {
-      processNewFile(event.getFile(), true);
+      collectPathsAndNotify(event.getFile(), NOTIFY_CHANGED);
     }
 
     public void fileCopied(@NotNull final VirtualFileCopyEvent event) {
-      processNewFile(event.getFile(), true);
+      collectPathsAndNotify(event.getFile(), NOTIFY_CHANGED);
     }
 
     public void fileMoved(@NotNull VirtualFileMoveEvent event) {
-      processNewFile(event.getFile(), true);
+      collectPathsAndNotify(event.getFile(), NOTIFY_CHANGED);
     }
 
     public void beforeFileDeletion(@NotNull final VirtualFileEvent event) {
-      final VirtualFile eventFile = event.getFile();
-      if ((LOG.isDebugEnabled() && eventFile.isDirectory()) || ourDebugMode) {
-        final String message = "Processing file deletion: " + eventFile.getPresentableUrl();
-        LOG.debug(message);
-        if (ourDebugMode) {
-          System.out.println(message);
-        }
-      }
-
-      final Set<File> pathsToMark = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
-
-      processRecursively(eventFile, true, false, new FileProcessor() {
-        private final TIntArrayList myAssociatedProjectIds = new TIntArrayList();
-        
-        public void execute(final VirtualFile file) {
-          final String filePath = file.getPath();
-          pathsToMark.add(new File(filePath));
-          myAssociatedProjectIds.clear();
-          try {
-            final OutputFileInfo outputInfo = loadOutputInfo(file);
-            if (outputInfo != null) {
-              final String srcPath = outputInfo.getSourceFilePath();
-              final VirtualFile srcFile = srcPath != null? LocalFileSystem.getInstance().findFileByPath(srcPath) : null;
-              if (srcFile != null) {
-                final SourceFileInfo srcInfo = loadSourceInfo(srcFile);
-                if (srcInfo != null) {
-                  final boolean srcWillBeDeleted = VfsUtil.isAncestor(eventFile, srcFile, false);
-                  for (int projectId : srcInfo.getProjectIds().toArray()) {
-                    if (isSuspended(projectId)) {
-                      continue;
-                    }
-                    if (srcInfo.isAssociated(projectId, filePath)) {
-                      myAssociatedProjectIds.add(projectId);
-                      if (srcWillBeDeleted) {
-                        if (LOG.isDebugEnabled() || ourDebugMode) {
-                          final String message = "Unschedule recompilation because of deletion " + srcFile.getPresentableUrl();
-                          LOG.debug(message);
-                          if (ourDebugMode) {
-                            System.out.println(message);
-                          }
-                        }
-                        removeSourceForRecompilation(projectId, Math.abs(getFileId(srcFile)));
-                      }
-                      else {
-                        addSourceForRecompilation(projectId, srcFile, srcInfo);
-                      }
-                    }
-                  }
-                }
-              }
-            }
-
-            final SourceFileInfo srcInfo = loadSourceInfo(file);
-            if (srcInfo != null) {
-              final TIntHashSet projects = srcInfo.getProjectIds();
-              if (!projects.isEmpty()) {
-                final ScheduleOutputsForDeletionProc deletionProc = new ScheduleOutputsForDeletionProc(file.getUrl());
-                deletionProc.setRootBeingDeleted(eventFile);
-                final int sourceFileId = Math.abs(getFileId(file));
-                for (int projectId : projects.toArray()) {
-                  if (isSuspended(projectId)) {
-                    continue;
-                  }
-                  if (srcInfo.isAssociated(projectId, filePath)) {
-                    myAssociatedProjectIds.add(projectId);
-                  }
-                  // mark associated outputs for deletion
-                  srcInfo.processOutputPaths(projectId, deletionProc);
-                  if (LOG.isDebugEnabled() || ourDebugMode) {
-                    final String message = "Unschedule recompilation because of deletion " + file.getPresentableUrl();
-                    LOG.debug(message);
-                    if (ourDebugMode) {
-                      System.out.println(message);
-                    }
-                  }
-                  removeSourceForRecompilation(projectId, sourceFileId);
-                }
-              }
-            }
-          }
-          finally {
-            // it is important that update of myOutputsToDelete is done at the end
-            // otherwise the filePath of the file that is about to be deleted may be re-scheduled for deletion in addSourceForRecompilation()
-            myAssociatedProjectIds.forEach(new TIntProcedure() {
-              public boolean execute(int projectId) {
-                unmarkOutputPathForDeletion(projectId, filePath);
-                return true;
-              }
-            });
-          }
-        }
-      });
-
-      notifyFilesDeleted(pathsToMark);
+      collectPathsAndNotify(event.getFile(), NOTIFY_DELETED);
     }
 
     public void beforeFileMovement(@NotNull final VirtualFileMoveEvent event) {
-      markDirtyIfSource(event.getFile(), true);
-    }
-
-    private void markDirtyIfSource(final VirtualFile file, final boolean fromMove) {
-      final Set<File> pathsToMark = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
-      processRecursively(file, false, false, new FileProcessor() {
-        public void execute(final VirtualFile file) {
-          pathsToMark.add(new File(file.getPath()));
-          final SourceFileInfo srcInfo = file.isValid()? loadSourceInfo(file) : null;
-          if (srcInfo != null) {
-            for (int projectId : srcInfo.getProjectIds().toArray()) {
-              if (isSuspended(projectId)) {
-                if (srcInfo.clearPaths(projectId)) {
-                  srcInfo.updateTimestamp(projectId, -1L);
-                  saveSourceInfo(file, srcInfo);
-                }
-              }
-              else {
-                addSourceForRecompilation(projectId, file, srcInfo);
-                // when the file is moved to a new location, we should 'forget' previous associations
-                if (fromMove) {
-                  if (srcInfo.clearPaths(projectId)) {
-                    saveSourceInfo(file, srcInfo);
-                  }
-                }
-              }
-            }
-          }
-          else {
-            processNewFile(file, false);
-          }
-        }
-      });
-      if (fromMove) {
-        notifyFilesDeleted(pathsToMark);
-      }
-      else if (!isIgnoredOrUnderIgnoredDirectory(file)) {
-        notifyFilesChanged(pathsToMark);
-      }
-    }
-
-    private void processNewFile(final VirtualFile file, final boolean notifyServer) {
-      boolean isInContent = false;
-      for (final Project project : myProjectManager.getOpenProjects()) {
-        if (!project.isInitialized()) {
-          continue; // the content of this project will be scanned during its post-startup activities
-        }
-        final int projectId = getProjectId(project);
-        final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
-        if (fileIndex.isInContent(file)) {
-          isInContent = true;
-        }
-        if (isSuspended(projectId)) {
-          continue;
-        }
-        if (fileIndex.isInSourceContent(file)) {
-          final TranslatingCompiler[] translators = CompilerManager.getInstance(project).getCompilers(TranslatingCompiler.class);
-          processRecursively(file, false, false, new FileProcessor() {
-            public void execute(final VirtualFile file) {
-              if (isCompilable(file)) {
-                loadInfoAndAddSourceForRecompilation(projectId, file);
-              }
-            }
-
-            boolean isCompilable(VirtualFile file) {
-              for (TranslatingCompiler translator : translators) {
-                if (translator.isCompilableFile(file, DummyCompileContext.getInstance())) {
-                  return true;
-                }
-              }
-              return false;
-            }
-          });
-        }
-        else {
-          if (belongsToIntermediateSources(file, project)) {
-            processRecursively(file, false, false, new FileProcessor() {
-              public void execute(final VirtualFile file) {
-                loadInfoAndAddSourceForRecompilation(projectId, file);
-              }
-            });
-          }
-        }
-      }
-      if (notifyServer && !isIgnoredOrUnderIgnoredDirectory(file)) {
-        final Set<File> pathsToMark = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
-        boolean dbOnly = !isInContent;
-        processRecursively(file, dbOnly, false, new FileProcessor() {
-          @Override
-          public void execute(VirtualFile file) {
-            pathsToMark.add(new File(file.getPath()));
-          }
-        });
-        notifyFilesChanged(pathsToMark);
-      }
+      collectPathsAndNotify(event.getFile(), NOTIFY_DELETED);
     }
   }
 
-  private boolean isIgnoredOrUnderIgnoredDirectory(final VirtualFile file) {
-    FileTypeManager fileTypeManager = FileTypeManager.getInstance();
+  
+  private static final Function<Collection<File>, Void> NOTIFY_CHANGED = new Function<Collection<File>, Void>() {
+    public Void fun(Collection<File> files) {
+      notifyFilesChanged(files);
+      return null;
+    }
+  };
+
+  private static final Function<Collection<File>, Void> NOTIFY_DELETED = new Function<Collection<File>, Void>() {
+    public Void fun(Collection<File> files) {
+      notifyFilesDeleted(files);
+      return null;
+    }
+  };
+  
+  private static void collectPathsAndNotify(final VirtualFile file, final Function<Collection<File>, Void> notification) {
+    final Set<File> pathsToMark = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
+    final boolean inContent = isInContentOfOpenedProject(file);
+    if (inContent || !isIgnoredOrUnderIgnoredDirectory(file)) {
+      processRecursively(file, !inContent, new FileProcessor() {
+        public void execute(final VirtualFile file) {
+          pathsToMark.add(new File(file.getPath()));
+        }
+      });
+    }
+    if (!pathsToMark.isEmpty()) {
+      notification.fun(pathsToMark);
+    }
+  }
+
+  private static boolean isIgnoredOrUnderIgnoredDirectory(final VirtualFile file) {
+    final FileTypeManager fileTypeManager = FileTypeManager.getInstance();
     if (fileTypeManager.isFileIgnored(file)) {
       return true;
     }
 
-    //optimization: if file is in content of some project it's definitely not ignored
-    boolean isInContent = ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
-      @Override
-      public Boolean compute() {
-        for (Project project : myProjectManager.getOpenProjects()) {
-          if (project.isInitialized() && ProjectRootManager.getInstance(project).getFileIndex().isInContent(file)) {
-            return true;
-          }
-        }
-        return false;
-      }
-    });
-    if (isInContent) {
-      return false;
-    }
-
     VirtualFile current = file.getParent();
     while (current != null) {
       if (fileTypeManager.isFileIgnored(current)) {
@@ -1731,207 +257,4 @@
     }
   }
 
-  private boolean belongsToIntermediateSources(VirtualFile file, Project project) {
-    return FileUtil.isAncestor(myGeneratedDataPaths.get(project), new File(file.getPath()), true);
-  }
-
-  private void loadInfoAndAddSourceForRecompilation(final int projectId, final VirtualFile srcFile) {
-    addSourceForRecompilation(projectId, srcFile, loadSourceInfo(srcFile));
-  }
-  private void addSourceForRecompilation(final int projectId, final VirtualFile srcFile, @Nullable final SourceFileInfo srcInfo) {
-    final boolean alreadyMarked;
-    synchronized (myDataLock) {
-      TIntHashSet set = mySourcesToRecompile.get(projectId);
-      if (set == null) {
-        set = new TIntHashSet();
-        mySourcesToRecompile.put(projectId, set);
-      }
-      alreadyMarked = !set.add(Math.abs(getFileId(srcFile)));
-      if (!alreadyMarked && (LOG.isDebugEnabled() || ourDebugMode)) {
-        final String message = "Scheduled recompilation " + srcFile.getPresentableUrl();
-        LOG.debug(message);
-        if (ourDebugMode) {
-          System.out.println(message);
-        }
-      }
-    }
-
-    if (!alreadyMarked && srcInfo != null) {
-      srcInfo.updateTimestamp(projectId, -1L);
-      srcInfo.processOutputPaths(projectId, new ScheduleOutputsForDeletionProc(srcFile.getUrl()));
-      saveSourceInfo(srcFile, srcInfo);
-    }
-  }
-
-  private void removeSourceForRecompilation(final int projectId, final int srcId) {
-    synchronized (myDataLock) {
-      TIntHashSet set = mySourcesToRecompile.get(projectId);
-      if (set != null) {
-        set.remove(srcId);
-        if (set.isEmpty()) {
-          mySourcesToRecompile.remove(projectId);
-        }
-      }
-    }
-  }
-  
-  public boolean isMarkedForCompilation(Project project, VirtualFile file) {
-    if (CompilerWorkspaceConfiguration.getInstance(project).useOutOfProcessBuild()) {
-      final CompilerManager compilerManager = CompilerManager.getInstance(project);
-      return !compilerManager.isUpToDate(compilerManager.createFilesCompileScope(new VirtualFile[]{file}));
-    }
-    return isMarkedForRecompilation(getProjectId(project), getFileId(file));
-  }
-  
-  private boolean isMarkedForRecompilation(int projectId, final int srcId) {
-    synchronized (myDataLock) {
-      final TIntHashSet set = mySourcesToRecompile.get(projectId);
-      return set != null && set.contains(srcId);
-    }
-  }
-  
-  private interface Proc {
-    boolean execute(final int projectId, String outputPath);
-  }
-  
-  private class ScheduleOutputsForDeletionProc implements Proc {
-    private final String mySrcUrl;
-    private final LocalFileSystem myFileSystem;
-    @Nullable
-    private VirtualFile myRootBeingDeleted;
-
-    private ScheduleOutputsForDeletionProc(final String srcUrl) {
-      mySrcUrl = srcUrl;
-      myFileSystem = LocalFileSystem.getInstance();
-    }
-
-    public void setRootBeingDeleted(@Nullable VirtualFile rootBeingDeleted) {
-      myRootBeingDeleted = rootBeingDeleted;
-    }
-
-    public boolean execute(final int projectId, String outputPath) {
-      final VirtualFile outFile = myFileSystem.findFileByPath(outputPath);
-      if (outFile != null) { // not deleted yet
-        if (myRootBeingDeleted != null && VfsUtil.isAncestor(myRootBeingDeleted, outFile, false)) {
-          unmarkOutputPathForDeletion(projectId, outputPath);
-        }
-        else {
-          final OutputFileInfo outputInfo = loadOutputInfo(outFile);
-          final String classname = outputInfo != null? outputInfo.getClassName() : null;
-          markOutputPathForDeletion(projectId, outputPath, classname, mySrcUrl);
-        }
-      }
-      return true;
-    }
-  }
-
-  private void markOutputPathForDeletion(final int projectId, final String outputPath, final String classname, final String srcUrl) {
-    final SourceUrlClassNamePair pair = new SourceUrlClassNamePair(srcUrl, classname);
-    synchronized (myDataLock) {
-      final Outputs outputs = myOutputsToDelete.get(projectId);
-      try {
-        outputs.put(outputPath, pair);
-        if (LOG.isDebugEnabled() || ourDebugMode) {
-          final String message = "ADD path to delete: " + outputPath + "; source: " + srcUrl;
-          LOG.debug(message);
-          if (ourDebugMode) {
-            System.out.println(message);
-          }
-        }
-      }
-      finally {
-        outputs.release();
-      }
-    }
-  }
-
-  private void unmarkOutputPathForDeletion(final int projectId, String outputPath) {
-    synchronized (myDataLock) {
-      final Outputs outputs = myOutputsToDelete.get(projectId);
-      try {
-        final SourceUrlClassNamePair val = outputs.remove(outputPath);
-        if (val != null) {
-          if (LOG.isDebugEnabled() || ourDebugMode) {
-            final String message = "REMOVE path to delete: " + outputPath;
-            LOG.debug(message);
-            if (ourDebugMode) {
-              System.out.println(message);
-            }
-          }
-        }
-      }
-      finally {
-        outputs.release();
-      }
-    }
-  }
-
-  public static final class ProjectRef extends Ref<Project> {
-    static class ProjectClosedException extends RuntimeException {
-    }
-
-    public ProjectRef(Project project) {
-      super(project);
-    }
-
-    public Project get() {
-      final Project project = super.get();
-      if (project != null && project.isDisposed()) {
-        throw new ProjectClosedException();
-      }
-      return project;
-    }
-  }
-  
-  private static class Outputs {
-    private boolean myIsDirty = false;
-    @Nullable
-    private final File myStoreFile;
-    private final Map<String, SourceUrlClassNamePair> myMap;
-    private final AtomicInteger myRefCount = new AtomicInteger(1);
-    
-    Outputs(@Nullable File storeFile, Map<String, SourceUrlClassNamePair> map) {
-      myStoreFile = storeFile;
-      myMap = map;
-    }
-
-    public Set<Map.Entry<String, SourceUrlClassNamePair>> getEntries() {
-      return Collections.unmodifiableSet(myMap.entrySet());
-    }
-    
-    public void put(String outputPath, SourceUrlClassNamePair pair) {
-      if (myStoreFile == null) {
-        return;
-      }
-      if (pair == null) {
-        remove(outputPath);
-      }
-      else {
-        myMap.put(outputPath, pair);
-        myIsDirty = true;
-      }
-    }
-    
-    public SourceUrlClassNamePair remove(String outputPath) {
-      if (myStoreFile == null) {
-        return null;
-      }
-      final SourceUrlClassNamePair removed = myMap.remove(outputPath);
-      myIsDirty |= removed != null;
-      return removed;
-    }
-    
-    void allocate() {
-      myRefCount.incrementAndGet();
-    }
-    
-    public void release() {
-      if (myRefCount.decrementAndGet() == 0) {
-        if (myIsDirty && myStoreFile != null) {
-          savePathsToDelete(myStoreFile, myMap);
-        }
-      }
-    }
-  }
-  
 }
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/AnnotationProcessingCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/AnnotationProcessingCompiler.java
deleted file mode 100644
index c7269a4..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/AnnotationProcessingCompiler.java
+++ /dev/null
@@ -1,151 +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: Eugene Zhuravlev
- * Date: Jan 17, 2003
- * Time: 3:22:59 PM
- */
-package com.intellij.compiler.impl.javaCompiler;
-
-import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.compiler.CompilerConfigurationImpl;
-import com.intellij.compiler.CompilerException;
-import com.intellij.compiler.impl.CompileContextExProxy;
-import com.intellij.compiler.impl.javaCompiler.javac.JavacCompiler;
-import com.intellij.compiler.make.CacheCorruptedException;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VfsUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.Chunk;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-public class AnnotationProcessingCompiler implements TranslatingCompiler{
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.javaCompiler.JavaCompiler");
-  private final Project myProject;
-  private final CompilerConfiguration myConfig;
-
-  public AnnotationProcessingCompiler(Project project) {
-    myProject = project;
-    myConfig = CompilerConfiguration.getInstance(project);
-  }
-
-  @NotNull
-  public String getDescription() {
-    return CompilerBundle.message("annotation.processing.compiler.description");
-  }
-
-  public boolean isCompilableFile(VirtualFile file, CompileContext context) {
-    if (!context.isAnnotationProcessorsEnabled()) {
-      return false;
-    } 
-    return file.getFileType() == StdFileTypes.JAVA && !isExcludedFromAnnotationProcessing(file, context);
-  }
-
-  public void compile(final CompileContext context, final Chunk<Module> moduleChunk, final VirtualFile[] files, OutputSink sink) {
-    if (!context.isAnnotationProcessorsEnabled()) {
-      return;
-    }
-    final LocalFileSystem lfs = LocalFileSystem.getInstance();
-    final CompileContextEx _context = new CompileContextExProxy((CompileContextEx)context) {
-      public VirtualFile getModuleOutputDirectory(Module module) {
-        final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module);
-        return path != null? lfs.findFileByPath(path) : null;
-      }
-
-      public VirtualFile getModuleOutputDirectoryForTests(Module module) {
-        return getModuleOutputDirectory(module);
-      }
-    };
-    final JavacCompiler javacCompiler = getBackEndCompiler();
-    final boolean processorMode = javacCompiler.setAnnotationProcessorMode(true);
-    final BackendCompilerWrapper wrapper = new BackendCompilerWrapper(moduleChunk, myProject, Arrays.asList(files), _context, javacCompiler, sink);
-    wrapper.setForceCompileTestsSeparately(true);
-    try {
-      wrapper.compile();
-    }
-    catch (CompilerException e) {
-      _context.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
-    }
-    catch (CacheCorruptedException e) {
-      LOG.info(e);
-      _context.requestRebuildNextTime(e.getMessage());
-    }
-    finally {
-      javacCompiler.setAnnotationProcessorMode(processorMode);
-      final Set<VirtualFile> dirsToRefresh = new HashSet<VirtualFile>();
-      ApplicationManager.getApplication().runReadAction(new Runnable() {
-        public void run() {
-          for (Module module : moduleChunk.getNodes()) {
-            final VirtualFile out = _context.getModuleOutputDirectory(module);
-            if (out != null) {
-              dirsToRefresh.add(out);
-            }
-          }
-        }
-      });
-      for (VirtualFile root : dirsToRefresh) {
-        root.refresh(false, true);
-      }
-    }
-  }
-
-  private boolean isExcludedFromAnnotationProcessing(VirtualFile file, CompileContext context) {
-    if (!context.isAnnotationProcessorsEnabled()) {
-      return true;
-    }
-    final Module module = context.getModuleByFile(file);
-    if (module != null) {
-      if (!myConfig.getAnnotationProcessingConfiguration(module).isEnabled()) {
-        return true;
-      }
-      final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module);
-      final VirtualFile generationDir = path != null? LocalFileSystem.getInstance().findFileByPath(path) : null;
-      if (generationDir != null && VfsUtil.isAncestor(generationDir, file, false)) {
-        return true;
-      }
-    }
-    return myConfig.isExcludedFromCompilation(file);
-  }
-
-  public boolean validateConfiguration(CompileScope scope) {
-    final JavacCompiler compiler = getBackEndCompiler();
-    final boolean previousValue = compiler.setAnnotationProcessorMode(true);
-    try {
-      return compiler.checkCompiler(scope);
-    }
-    finally {
-      compiler.setAnnotationProcessorMode(previousValue);
-    }
-  }
-
-  private JavacCompiler getBackEndCompiler() {
-    CompilerConfigurationImpl configuration = (CompilerConfigurationImpl)myConfig;
-    return configuration.getJavacCompiler();
-  }
-
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/BackendCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/BackendCompiler.java
index 9da4a39..5c20791 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/BackendCompiler.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/BackendCompiler.java
@@ -15,36 +15,26 @@
  */
 package com.intellij.compiler.impl.javaCompiler;
 
-import com.intellij.compiler.OutputParser;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompileScope;
 import com.intellij.openapi.extensions.ExtensionPointName;
 import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.options.Configurable;
-import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
-import java.io.IOException;
 import java.util.Set;
 
 public interface BackendCompiler {
   ExtensionPointName<BackendCompiler> EP_NAME = ExtensionPointName.create("com.intellij.java.compiler");
 
-  @NotNull @NonNls String getId(); // used for externalization
-  @NotNull String getPresentableName();
-  @NotNull Configurable createConfigurable();
-  @NotNull Set<FileType> getCompilableFileTypes();
-  @Nullable OutputParser createErrorParser(@NotNull String outputDir, Process process);
-  @Nullable OutputParser createOutputParser(@NotNull String outputDir);
-
-  boolean checkCompiler(final CompileScope scope);
-
-  @NotNull Process launchProcess(
-    @NotNull ModuleChunk chunk,
-    @NotNull String outputDir,
-    @NotNull CompileContext compileContext) throws IOException;
-
-  void compileFinished();
-
+  @NotNull 
+  String getId(); // used for externalization
+  
+  @NotNull 
+  String getPresentableName();
+  
+  @NotNull 
+  Configurable createConfigurable();
+  
+  @NotNull 
+  Set<FileType> getCompilableFileTypes();
+  
 }
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/BackendCompilerWrapper.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/BackendCompilerWrapper.java
deleted file mode 100644
index e845d03..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/BackendCompilerWrapper.java
+++ /dev/null
@@ -1,1015 +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.compiler.impl.javaCompiler;
-
-import com.intellij.codeInsight.NullableNotNullManager;
-import com.intellij.compiler.*;
-import com.intellij.compiler.classParsing.AnnotationConstantValue;
-import com.intellij.compiler.classParsing.MethodInfo;
-import com.intellij.compiler.impl.CompileDriver;
-import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.compiler.make.Cache;
-import com.intellij.compiler.make.CacheCorruptedException;
-import com.intellij.compiler.make.DependencyCache;
-import com.intellij.compiler.make.MakeUtil;
-import com.intellij.compiler.notNullVerification.NotNullVerifyingInstrumenter;
-import com.intellij.ide.util.projectWizard.JavaModuleBuilder;
-import com.intellij.openapi.application.Application;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.fileTypes.FileTypeManager;
-import com.intellij.openapi.module.JavaModuleType;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleType;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.JavaSdk;
-import com.intellij.openapi.projectRoots.JavaSdkType;
-import com.intellij.openapi.projectRoots.JavaSdkVersion;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.*;
-import com.intellij.openapi.util.*;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VfsUtilCore;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.VirtualFileVisitor;
-import com.intellij.psi.JavaPsiFacade;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.GlobalSearchScopes;
-import com.intellij.util.Chunk;
-import com.intellij.util.cls.ClsFormatException;
-import gnu.trove.THashMap;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.asm4.ClassReader;
-import org.jetbrains.asm4.ClassWriter;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.*;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
-/**
- * @author Eugene Zhuravlev
- * @since Jan 24, 2003
- */
-public class BackendCompilerWrapper {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.javaCompiler.BackendCompilerWrapper");
-
-  private final BackendCompiler myCompiler;
-
-  private final CompileContextEx myCompileContext;
-  private final List<VirtualFile> myFilesToCompile;
-  private final TranslatingCompiler.OutputSink mySink;
-  private final Chunk<Module> myChunk;
-  private final Project myProject;
-  private final Map<Module, VirtualFile> myModuleToTempDirMap = new THashMap<Module, VirtualFile>();
-  private final ProjectFileIndex myProjectFileIndex;
-  @NonNls private static final String PACKAGE_ANNOTATION_FILE_NAME = "package-info.java";
-  private static final FileObject myStopThreadToken = new FileObject(new File(""), new byte[0]);
-  public final Map<String, Set<CompiledClass>> myFileNameToSourceMap=  new THashMap<String, Set<CompiledClass>>();
-  private final Set<VirtualFile> myProcessedPackageInfos = new HashSet<VirtualFile>();
-  private final CompileStatistics myStatistics;
-  private volatile String myModuleName = null;
-  private boolean myForceCompileTestsSeparately = false;
-
-  public BackendCompilerWrapper(Chunk<Module> chunk, @NotNull final Project project,
-                                @NotNull List<VirtualFile> filesToCompile,
-                                @NotNull CompileContextEx compileContext,
-                                @NotNull BackendCompiler compiler, TranslatingCompiler.OutputSink sink) {
-    myChunk = chunk;
-    myProject = project;
-    myCompiler = compiler;
-    myCompileContext = compileContext;
-    myFilesToCompile = filesToCompile;
-    mySink = sink;
-    myProjectFileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
-    CompileStatistics stat = compileContext.getUserData(CompileStatistics.KEY);
-    if (stat == null) {
-      stat = new CompileStatistics();
-      compileContext.putUserData(CompileStatistics.KEY, stat);
-    }
-    myStatistics = stat;
-  }
-
-  public void compile() throws CompilerException, CacheCorruptedException {
-    Application application = ApplicationManager.getApplication();
-    try {
-      if (!myFilesToCompile.isEmpty()) {
-        if (application.isUnitTestMode()) {
-          saveTestData();
-        }
-        compileModules(buildModuleToFilesMap(myFilesToCompile));
-      }
-    }
-    catch (SecurityException e) {
-      throw new CompilerException(CompilerBundle.message("error.compiler.process.not.started", e.getMessage()), e);
-    }
-    catch (IllegalArgumentException e) {
-      throw new CompilerException(e.getMessage(), e);
-    }
-    finally {
-      for (final VirtualFile file : myModuleToTempDirMap.values()) {
-        if (file != null) {
-          final File ioFile = new File(file.getPath());
-          FileUtil.asyncDelete(ioFile);
-        }
-      }
-      myModuleToTempDirMap.clear();
-    }
-
-    if (!myFilesToCompile.isEmpty() && myCompileContext.getMessageCount(CompilerMessageCategory.ERROR) == 0) {
-      // package-info.java hack
-      final List<TranslatingCompiler.OutputItem> outputs = new ArrayList<TranslatingCompiler.OutputItem>();
-      ApplicationManager.getApplication().runReadAction(new Runnable() {
-        public void run() {
-          for (final VirtualFile file : myFilesToCompile) {
-            if (PACKAGE_ANNOTATION_FILE_NAME.equals(file.getName()) && !myProcessedPackageInfos.contains(file)) {
-              outputs.add(new OutputItemImpl(file));
-            }
-          }
-        }
-      });
-      if (!outputs.isEmpty()) {
-        mySink.add(null, outputs, VirtualFile.EMPTY_ARRAY);
-      }
-    }
-  }
-
-  public boolean isForceCompileTestsSeparately() {
-    return myForceCompileTestsSeparately;
-  }
-
-  public void setForceCompileTestsSeparately(boolean forceCompileTestsSeparately) {
-    myForceCompileTestsSeparately = forceCompileTestsSeparately;
-  }
-
-  private Map<Module, List<VirtualFile>> buildModuleToFilesMap(final List<VirtualFile> filesToCompile) {
-    if (myChunk.getNodes().size() == 1) {
-      return Collections.singletonMap(myChunk.getNodes().iterator().next(), Collections.unmodifiableList(filesToCompile));
-    }
-    return CompilerUtil.buildModuleToFilesMap(myCompileContext, filesToCompile);
-  }
-
-  private void compileModules(final Map<Module, List<VirtualFile>> moduleToFilesMap) throws CompilerException {
-    try {
-      compileChunk(new ModuleChunk(myCompileContext, myChunk, moduleToFilesMap));
-    }
-    catch (IOException e) {
-      throw new CompilerException(e.getMessage(), e);
-    }
-  }
-
-  private void compileChunk(ModuleChunk chunk) throws IOException {
-    final String chunkPresentableName = getPresentableNameFor(chunk);
-    myModuleName = chunkPresentableName;
-
-    // validate encodings
-    if (chunk.getModuleCount() > 1) {
-      validateEncoding(chunk, chunkPresentableName);
-      // todo: validation for bytecode target?
-    }
-
-    runTransformingCompilers(chunk);
-
-
-    final List<OutputDir> outs = new ArrayList<OutputDir>();
-    File fileToDelete = getOutputDirsToCompileTo(chunk, outs);
-
-    try {
-      for (final OutputDir outputDir : outs) {
-        chunk.setSourcesFilter(outputDir.getKind());
-        doCompile(chunk, outputDir.getPath());
-      }
-    }
-    finally {
-      if (fileToDelete != null) {
-        FileUtil.asyncDelete(fileToDelete);
-      }
-    }
-  }
-
-  private void validateEncoding(ModuleChunk chunk, String chunkPresentableName) {
-    final CompilerEncodingService es = CompilerEncodingService.getInstance(myProject);
-    Charset charset = null;
-    for (Module module : chunk.getModules()) {
-      final Charset moduleCharset = es.getPreferredModuleEncoding(module);
-      if (charset == null) {
-        charset = moduleCharset;
-      }
-      else {
-        if (!Comparing.equal(charset, moduleCharset)) {
-          // warn user
-          final Charset chunkEncoding = CompilerEncodingService.getPreferredModuleEncoding(chunk);
-          final StringBuilder message = new StringBuilder();
-          message.append("Modules in chunk [");
-          message.append(chunkPresentableName);
-          message.append("] configured to use different encodings.\n");
-          if (chunkEncoding != null) {
-            message.append("\"").append(chunkEncoding.name()).append("\" encoding will be used to compile the chunk");
-          }
-          else {
-            message.append("Default compiler encoding will be used to compile the chunk");
-          }
-          myCompileContext.addMessage(CompilerMessageCategory.INFORMATION, message.toString(), null, -1, -1);
-          break;
-        }
-      }
-    }
-  }
-
-
-  private static String getPresentableNameFor(final ModuleChunk chunk) {
-    return ApplicationManager.getApplication().runReadAction(new Computable<String>() {
-      public String compute() {
-        final Module[] modules = chunk.getModules();
-        StringBuilder moduleName = new StringBuilder(Math.min(128, modules.length * 8));
-        for (int idx = 0; idx < modules.length; idx++) {
-          final Module module = modules[idx];
-          if (idx > 0) {
-            moduleName.append(", ");
-          }
-          moduleName.append(module.getName());
-          if (moduleName.length() > 128 && idx + 1 < modules.length /*name is already too long and seems to grow longer*/) {
-            moduleName.append("...");
-            break;
-          }
-        }
-        return moduleName.toString();
-      }
-    });
-  }
-
-  @Nullable
-  private File getOutputDirsToCompileTo(ModuleChunk chunk, final List<OutputDir> dirs) throws IOException {
-    File fileToDelete = null;
-    if (chunk.getModuleCount() == 1) { // optimization
-      final Module module = chunk.getModules()[0];
-      ApplicationManager.getApplication().runReadAction(new Runnable() {
-        public void run() {
-          final String sourcesOutputDir = getOutputDir(module);
-          if (shouldCompileTestsSeparately(module)) {
-            if (sourcesOutputDir != null) {
-              dirs.add(new OutputDir(sourcesOutputDir, ModuleChunk.SOURCES));
-            }
-            final String testsOutputDir = getTestsOutputDir(module);
-            if (testsOutputDir == null) {
-              LOG.error("Tests output dir is null for module \"" + module.getName() + "\"");
-            }
-            else {
-              dirs.add(new OutputDir(testsOutputDir, ModuleChunk.TEST_SOURCES));
-            }
-          }
-          else { // both sources and test sources go into the same output
-            if (sourcesOutputDir == null) {
-              LOG.error("Sources output dir is null for module \"" + module.getName() + "\"");
-            }
-            else {
-              dirs.add(new OutputDir(sourcesOutputDir, ModuleChunk.ALL_SOURCES));
-            }
-          }
-        }
-      });
-    }
-    else { // chunk has several modules
-      final File outputDir = FileUtil.createTempDirectory("compile", "output");
-      fileToDelete = outputDir;
-      dirs.add(new OutputDir(outputDir.getPath(), ModuleChunk.ALL_SOURCES));
-    }
-    return fileToDelete;
-  }
-
-
-  private boolean shouldCompileTestsSeparately(Module module) {
-    if (myForceCompileTestsSeparately) {
-      return true;
-    }
-    final String moduleTestOutputDirectory = getTestsOutputDir(module);
-    if (moduleTestOutputDirectory == null) {
-      return false;
-    }
-    // here we have test output specified
-    final String moduleOutputDirectory = getOutputDir(module);
-    if (moduleOutputDirectory == null) {
-      // only test output is specified, so should return true
-      return true;
-    }
-    return !FileUtil.pathsEqual(moduleTestOutputDirectory, moduleOutputDirectory);
-  }
-
-  private void saveTestData() {
-    ApplicationManager.getApplication().runReadAction(new Runnable() {
-      public void run() {
-        for (VirtualFile file : myFilesToCompile) {
-          CompilerManagerImpl.addCompiledPath(file.getPath());
-        }
-      }
-    });
-  }
-
-  private final Object lock = new Object();
-
-  private class SynchedCompilerParsing extends CompilerParsingThread {
-    private final ClassParsingThread myClassParsingThread;
-
-    private SynchedCompilerParsing(Process process,
-                                  final CompileContext context,
-                                  OutputParser outputParser,
-                                  ClassParsingThread classParsingThread,
-                                  boolean readErrorStream,
-                                  boolean trimLines) {
-      super(process, outputParser, readErrorStream, trimLines,context);
-      myClassParsingThread = classParsingThread;
-    }
-
-    public void setProgressText(String text) {
-      synchronized (lock) {
-        super.setProgressText(text);
-      }
-    }
-
-    public void message(CompilerMessageCategory category, String message, String url, int lineNum, int columnNum) {
-      synchronized (lock) {
-        super.message(category, message, url, lineNum, columnNum);
-      }
-    }
-
-    public void fileProcessed(String path) {
-      synchronized (lock) {
-        sourceFileProcessed();
-      }
-    }
-
-    protected void processCompiledClass(final FileObject classFileToProcess) throws CacheCorruptedException {
-      synchronized (lock) {
-        myClassParsingThread.addPath(classFileToProcess);
-      }
-    }
-  }
-
-  private void doCompile(@NotNull final ModuleChunk chunk, @NotNull String outputDir) throws IOException {
-    myCompileContext.getProgressIndicator().checkCanceled();
-
-    if (ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
-      public Boolean compute() {
-        return chunk.getFilesToCompile().isEmpty() ? Boolean.TRUE : Boolean.FALSE;
-      }
-    }).booleanValue()) {
-      return; // should not invoke javac with empty sources list
-    }
-
-    ModuleType moduleType = ModuleType.get(chunk.getModules()[0]);
-    if ((chunk.getJdk() == null || !(chunk.getJdk().getSdkType() instanceof JavaSdkType)) &&
-        !(moduleType instanceof JavaModuleType || moduleType.createModuleBuilder() instanceof JavaModuleBuilder)) {
-      // TODO
-      // don't try to compile non-java type module
-      return;
-    }
-
-    int exitValue = 0;
-    try {
-      final Process process = myCompiler.launchProcess(chunk, outputDir, myCompileContext);
-      final long compilationStart = System.currentTimeMillis();
-      final ClassParsingThread classParsingThread = new ClassParsingThread(isJdk6(chunk.getJdk()), outputDir);
-      final Future<?> classParsingThreadFuture = ApplicationManager.getApplication().executeOnPooledThread(classParsingThread);
-
-      OutputParser errorParser = myCompiler.createErrorParser(outputDir, process);
-      CompilerParsingThread errorParsingThread = errorParser == null
-                                                 ? null
-                                                 : new SynchedCompilerParsing(process, myCompileContext, errorParser, classParsingThread,
-                                                                              true, errorParser.isTrimLines());
-      Future<?> errorParsingThreadFuture = null;
-      if (errorParsingThread != null) {
-        errorParsingThreadFuture = ApplicationManager.getApplication().executeOnPooledThread(errorParsingThread);
-      }
-
-      OutputParser outputParser = myCompiler.createOutputParser(outputDir);
-      CompilerParsingThread outputParsingThread = outputParser == null
-                                                  ? null
-                                                  : new SynchedCompilerParsing(process, myCompileContext, outputParser, classParsingThread,
-                                                                               false, outputParser.isTrimLines());
-      Future<?> outputParsingThreadFuture = null;
-      if (outputParsingThread != null) {
-        outputParsingThreadFuture = ApplicationManager.getApplication().executeOnPooledThread(outputParsingThread);
-      }
-
-      try {
-        exitValue = process.waitFor();
-      }
-      catch (InterruptedException e) {
-        process.destroy();
-        exitValue = process.exitValue();
-      }
-      catch (Error e) {
-        process.destroy();
-        exitValue = process.exitValue();
-        throw e;
-      }
-      finally {
-        if (CompileDriver.ourDebugMode) {
-          System.out.println("Compiler exit code is " + exitValue);
-        }
-        if (errorParsingThread != null) {
-          errorParsingThread.setProcessTerminated(true);
-        }
-        if (outputParsingThread != null) {
-          outputParsingThread.setProcessTerminated(true);
-        }
-        joinThread(errorParsingThreadFuture);
-        joinThread(outputParsingThreadFuture);
-        classParsingThread.stopParsing();
-        joinThread(classParsingThreadFuture);
-
-        registerParsingException(outputParsingThread);
-        registerParsingException(errorParsingThread);
-        assert outputParsingThread == null || !outputParsingThread.processing;
-        assert errorParsingThread == null || !errorParsingThread.processing;
-        assert classParsingThread == null || !classParsingThread.processing;
-      }
-    }
-    finally {
-      compileFinished(exitValue, chunk, outputDir);
-      myModuleName = null;
-    }
-  }
-
-  private static void joinThread(final Future<?> threadFuture) {
-    if (threadFuture != null) {
-      try {
-        threadFuture.get();
-      }
-      catch (InterruptedException ignored) {
-        LOG.info("Thread interrupted", ignored);
-      }
-      catch (ExecutionException ignored) {
-        LOG.info("Thread interrupted", ignored);
-      }
-    }
-  }
-
-  private void registerParsingException(final CompilerParsingThread outputParsingThread) {
-    Throwable error = outputParsingThread == null ? null : outputParsingThread.getError();
-    if (error != null) {
-      String message = error.getMessage();
-      if (error instanceof CacheCorruptedException) {
-        myCompileContext.requestRebuildNextTime(message);
-      }
-      else {
-        myCompileContext.addMessage(CompilerMessageCategory.ERROR, message, null, -1, -1);
-      }
-    }
-  }
-
-  private void runTransformingCompilers(final ModuleChunk chunk) {
-    final JavaSourceTransformingCompiler[] transformers =
-      CompilerManager.getInstance(myProject).getCompilers(JavaSourceTransformingCompiler.class);
-    if (transformers.length == 0) {
-      return;
-    }
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("Running transforming compilers...");
-    }
-    final Module[] modules = chunk.getModules();
-    for (final JavaSourceTransformingCompiler transformer : transformers) {
-      final Map<VirtualFile, VirtualFile> originalToCopyFileMap = new HashMap<VirtualFile, VirtualFile>();
-      final Application application = ApplicationManager.getApplication();
-      application.invokeAndWait(new Runnable() {
-        public void run() {
-          for (final Module module : modules) {
-            for (final VirtualFile file : chunk.getFilesToCompile(module)) {
-              final VirtualFile untransformed = chunk.getOriginalFile(file);
-              if (transformer.isTransformable(untransformed)) {
-                application.runWriteAction(new Runnable() {
-                  public void run() {
-                    try {
-                      // if untransformed != file, the file is already a (possibly transformed) copy of the original 'untransformed' file.
-                      // If this is the case, just use already created copy and do not copy file content once again
-                      final VirtualFile fileCopy = untransformed.equals(file)? createFileCopy(getTempDir(module), file) : file;
-                      originalToCopyFileMap.put(file, fileCopy);
-                    }
-                    catch (IOException e) {
-                      // skip it
-                    }
-                  }
-                });
-              }
-            }
-          }
-        }
-      }, myCompileContext.getProgressIndicator().getModalityState());
-
-      // do actual transform
-      for (final Module module : modules) {
-        final List<VirtualFile> filesToCompile = chunk.getFilesToCompile(module);
-        for (int j = 0; j < filesToCompile.size(); j++) {
-          final VirtualFile file = filesToCompile.get(j);
-          final VirtualFile fileCopy = originalToCopyFileMap.get(file);
-          if (fileCopy != null) {
-            final boolean ok = transformer.transform(myCompileContext, fileCopy, chunk.getOriginalFile(file));
-            if (ok) {
-              chunk.substituteWithTransformedVersion(module, j, fileCopy);
-            }
-          }
-        }
-      }
-    }
-  }
-
-  private VirtualFile createFileCopy(VirtualFile tempDir, final VirtualFile file) throws IOException {
-    final String fileName = file.getName();
-    if (tempDir.findChild(fileName) != null) {
-      int idx = 0;
-      while (true) {
-        //noinspection HardCodedStringLiteral
-        final String dirName = "dir" + idx++;
-        final VirtualFile dir = tempDir.findChild(dirName);
-        if (dir == null) {
-          tempDir = tempDir.createChildDirectory(this, dirName);
-          break;
-        }
-        if (dir.findChild(fileName) == null) {
-          tempDir = dir;
-          break;
-        }
-      }
-    }
-    return VfsUtilCore.copyFile(this, file, tempDir);
-  }
-
-  private VirtualFile getTempDir(Module module) throws IOException {
-    VirtualFile tempDir = myModuleToTempDirMap.get(module);
-    if (tempDir == null) {
-      final String projectName = myProject.getName();
-      final String moduleName = module.getName();
-      File tempDirectory = FileUtil.createTempDirectory(projectName, moduleName);
-      tempDir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempDirectory);
-      if (tempDir == null) {
-        LOG.error("Cannot locate temp directory " + tempDirectory.getPath());
-      }
-      myModuleToTempDirMap.put(module, tempDir);
-    }
-    return tempDir;
-  }
-
-  private void compileFinished(int exitValue, final ModuleChunk chunk, final String outputDir) {
-    if (exitValue != 0 && !myCompileContext.getProgressIndicator().isCanceled() && myCompileContext.getMessageCount(CompilerMessageCategory.ERROR) == 0) {
-      myCompileContext.addMessage(CompilerMessageCategory.ERROR, CompilerBundle.message("error.compiler.internal.error", exitValue), null, -1, -1);
-    }
-
-    myCompiler.compileFinished();
-    final List<File> toRefresh = new ArrayList<File>();
-    final Map<String, Collection<TranslatingCompiler.OutputItem>> results = new HashMap<String, Collection<TranslatingCompiler.OutputItem>>();
-    try {
-      final FileTypeManager typeManager = FileTypeManager.getInstance();
-      final String outputDirPath = outputDir.replace(File.separatorChar, '/');
-      try {
-        for (final Module module : chunk.getModules()) {
-          for (final VirtualFile root : chunk.getSourceRoots(module)) {
-            final String packagePrefix = myProjectFileIndex.getPackageNameByDirectory(root);
-            if (LOG.isDebugEnabled()) {
-              LOG.debug("Building output items for " + root.getPresentableUrl() + "; output dir = " + outputDirPath + "; packagePrefix = \"" + packagePrefix + "\"");
-            }
-            buildOutputItemsList(outputDirPath, module, root, typeManager, root, packagePrefix, toRefresh, results);
-          }
-        }
-      }
-      catch (CacheCorruptedException e) {
-        myCompileContext.requestRebuildNextTime(CompilerBundle.message("error.compiler.caches.corrupted"));
-        if (LOG.isDebugEnabled()) {
-          LOG.debug(e);
-        }
-      }
-    }
-    finally {
-      CompilerUtil.refreshIOFiles(toRefresh);
-      for (Iterator<Map.Entry<String, Collection<TranslatingCompiler.OutputItem>>> it = results.entrySet().iterator(); it.hasNext();) {
-        Map.Entry<String, Collection<TranslatingCompiler.OutputItem>> entry = it.next();
-        mySink.add(entry.getKey(), entry.getValue(), VirtualFile.EMPTY_ARRAY);
-        it.remove(); // to free memory
-      }
-    }
-    myFileNameToSourceMap.clear(); // clear the map before the next use
-  }
-
-  private void buildOutputItemsList(final String outputDir, final Module module, VirtualFile from,
-                                    final FileTypeManager typeManager,
-                                    final VirtualFile sourceRoot,
-                                    final String packagePrefix, final List<File> filesToRefresh, final Map<String, Collection<TranslatingCompiler.OutputItem>> results) throws CacheCorruptedException {
-    final Ref<CacheCorruptedException> exRef = new Ref<CacheCorruptedException>(null);
-    final ModuleFileIndex fileIndex = ModuleRootManager.getInstance(module).getFileIndex();
-    final GlobalSearchScope srcRootScope = GlobalSearchScope.moduleScope(module).intersectWith(
-        GlobalSearchScopes.directoryScope(myProject, sourceRoot, true));
-    
-    final ContentIterator contentIterator = new ContentIterator() {
-      public boolean processFile(final VirtualFile child) {
-        try {
-          if (child.isValid()) {
-            if (!child.isDirectory() && myCompiler.getCompilableFileTypes().contains(child.getFileType())) {
-              updateOutputItemsList(outputDir, child, sourceRoot, packagePrefix, filesToRefresh, results, srcRootScope);
-            }
-          }
-          return true;
-        }
-        catch (CacheCorruptedException e) {
-          exRef.set(e);
-          return false;
-        }
-      }
-    };
-    if (fileIndex.isInContent(from)) {
-      // use file index for iteration to handle 'inner modules' and excludes properly
-      fileIndex.iterateContentUnderDirectory(from, contentIterator);
-    }
-    else {
-      // seems to be a root for generated sources
-      VfsUtilCore.visitChildrenRecursively(from, new VirtualFileVisitor() {
-        @Override
-        public boolean visitFile(@NotNull VirtualFile file) {
-          if (!file.isDirectory()) {
-            contentIterator.processFile(file);
-          }
-          return true;
-        }
-      });
-    }
-    final CacheCorruptedException exc = exRef.get();
-    if (exc != null) {
-      throw exc;
-    }
-  }
-
-  private void putName(String sourceFileName, int classQName, String relativePathToSource, String pathToClass) {
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("Registering [sourceFileName, relativePathToSource, pathToClass] = [" + sourceFileName + "; " + relativePathToSource +
-                "; " + pathToClass + "]");
-    }
-    Set<CompiledClass> paths = myFileNameToSourceMap.get(sourceFileName);
-
-    if (paths == null) {
-      paths = new HashSet<CompiledClass>();
-      myFileNameToSourceMap.put(sourceFileName, paths);
-    }
-    paths.add(new CompiledClass(classQName, relativePathToSource, pathToClass));
-  }
-
-  private void updateOutputItemsList(final String outputDir, final VirtualFile srcFile,
-                                     VirtualFile sourceRoot,
-                                     final String packagePrefix, final List<File> filesToRefresh,
-                                     Map<String, Collection<TranslatingCompiler.OutputItem>> results,
-                                     final GlobalSearchScope srcRootScope) throws CacheCorruptedException {
-    final Cache newCache = myCompileContext.getDependencyCache().getNewClassesCache();
-    final Set<CompiledClass> paths = myFileNameToSourceMap.get(srcFile.getName());
-    if (paths == null || paths.isEmpty()) {
-      return;
-    }
-    final String filePath = "/" + calcPackagePath(srcFile, sourceRoot, packagePrefix);
-    for (final CompiledClass cc : paths) {
-      myCompileContext.getProgressIndicator().checkCanceled();
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Checking [pathToClass; relPathToSource] = " + cc);
-      }
-      
-      boolean pathsEquals = FileUtil.pathsEqual(filePath, cc.relativePathToSource);
-      if (!pathsEquals) {
-        final String qName = myCompileContext.getDependencyCache().resolve(cc.qName);
-        if (qName != null) {
-          pathsEquals = ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
-            public Boolean compute() {
-              final JavaPsiFacade facade = JavaPsiFacade.getInstance(myProject);
-              PsiClass psiClass = facade.findClass(qName, srcRootScope);
-              if (psiClass == null) {
-                final int dollarIndex = qName.indexOf("$");
-                if (dollarIndex >= 0) {
-                  final String topLevelClassName = qName.substring(0, dollarIndex);
-                  psiClass = facade.findClass(topLevelClassName, srcRootScope);
-                }
-              }
-              if (psiClass != null) {
-                final VirtualFile vFile = psiClass.getContainingFile().getVirtualFile();
-                return vFile != null && vFile.equals(srcFile);
-              }
-              return false;
-            }
-          });
-        }
-      }
-      
-      if (pathsEquals) {
-        final String outputPath = cc.pathToClass.replace(File.separatorChar, '/');
-        final Couple<String> realLocation = moveToRealLocation(outputDir, outputPath, srcFile, filesToRefresh);
-        if (realLocation != null) {
-          Collection<TranslatingCompiler.OutputItem> outputs = results.get(realLocation.getFirst());
-          if (outputs == null) {
-            outputs = new ArrayList<TranslatingCompiler.OutputItem>();
-            results.put(realLocation.getFirst(), outputs);
-          }
-          outputs.add(new OutputItemImpl(realLocation.getSecond(), srcFile));
-          if (PACKAGE_ANNOTATION_FILE_NAME.equals(srcFile.getName())) {
-            myProcessedPackageInfos.add(srcFile);
-          }
-          if (CompilerConfiguration.MAKE_ENABLED) {
-            newCache.setPath(cc.qName, realLocation.getSecond());
-          }
-          if (LOG.isDebugEnabled()) {
-            LOG.debug("Added output item: [outputDir; outputPath; sourceFile]  = [" + realLocation.getFirst() + "; " +
-                      realLocation.getSecond() + "; " + srcFile.getPresentableUrl() + "]");
-          }
-        }
-        else {
-          myCompileContext.addMessage(CompilerMessageCategory.ERROR, "Failed to copy from temporary location to output directory: " + outputPath + " (see idea.log for details)", null, -1, -1);
-          if (LOG.isDebugEnabled()) {
-            LOG.debug("Failed to move to real location: " + outputPath + "; from " + outputDir);
-          }
-        }
-      }
-    }
-  }
-
-  /**
-   *
-   * @param srcFile
-   * @param sourceRoot
-   * @param packagePrefix
-   * @return A 'package'-path to a given src file relative to a specified root. "/" slashes must be used
-   */
-  protected static String calcPackagePath(VirtualFile srcFile, VirtualFile sourceRoot, String packagePrefix) {
-    final String prefix = packagePrefix != null && packagePrefix.length() > 0 ? packagePrefix.replace('.', '/') + "/" : "";
-    return prefix + VfsUtilCore.getRelativePath(srcFile, sourceRoot, '/');
-  }
-
-  @Nullable
-  private Couple<String> moveToRealLocation(String tempOutputDir,
-                                            String pathToClass,
-                                            VirtualFile sourceFile,
-                                            final List<File> filesToRefresh) {
-    final Module module = myCompileContext.getModuleByFile(sourceFile);
-    if (module == null) {
-      final String message =
-        "Cannot determine module for source file: " + sourceFile.getPresentableUrl() + ";\nCorresponding output file: " + pathToClass;
-      LOG.info(message);
-      myCompileContext.addMessage(CompilerMessageCategory.WARNING, message, sourceFile.getUrl(), -1, -1);
-      // do not move: looks like source file has been invalidated, need recompilation
-      return Couple.newOne(tempOutputDir, pathToClass);
-    }
-    final String realOutputDir;
-    if (myCompileContext.isInTestSourceContent(sourceFile)) {
-      realOutputDir = getTestsOutputDir(module);
-      LOG.assertTrue(realOutputDir != null);
-    }
-    else {
-      realOutputDir = getOutputDir(module);
-      LOG.assertTrue(realOutputDir != null);
-    }
-
-    if (FileUtil.pathsEqual(tempOutputDir, realOutputDir)) { // no need to move
-      filesToRefresh.add(new File(pathToClass));
-      return Couple.newOne(realOutputDir, pathToClass);
-    }
-
-    final String realPathToClass = realOutputDir + pathToClass.substring(tempOutputDir.length());
-    final File fromFile = new File(pathToClass);
-    final File toFile = new File(realPathToClass);
-
-    boolean success = fromFile.renameTo(toFile);
-    if (!success) {
-      // assuming cause of the fail: intermediate dirs do not exist
-      FileUtil.createParentDirs(toFile);
-      // retry after making non-existent dirs
-      success = fromFile.renameTo(toFile);
-    }
-    if (!success) { // failed to move the file: e.g. because source and destination reside on different mountpoints.
-      try {
-        FileUtil.copy(fromFile, toFile);
-        FileUtil.delete(fromFile);
-        success = true;
-      }
-      catch (IOException e) {
-        LOG.info(e);
-        success = false;
-      }
-    }
-    if (success) {
-      filesToRefresh.add(toFile);
-      return Couple.newOne(realOutputDir, realPathToClass);
-    }
-    return null;
-  }
-
-  private final Map<Module, String> myModuleToTestsOutput = new HashMap<Module, String>();
-
-  private String getTestsOutputDir(final Module module) {
-    if (myModuleToTestsOutput.containsKey(module)) {
-      return myModuleToTestsOutput.get(module);
-    }
-    final VirtualFile outputDirectory = myCompileContext.getModuleOutputDirectoryForTests(module);
-    final String out = outputDirectory != null? outputDirectory.getPath() : null;
-    myModuleToTestsOutput.put(module, out);
-    return out;
-  }
-
-  private final Map<Module, String> myModuleToOutput = new HashMap<Module, String>();
-
-  private String getOutputDir(final Module module) {
-    if (myModuleToOutput.containsKey(module)) {
-      return myModuleToOutput.get(module);
-    }
-    final VirtualFile outputDirectory = myCompileContext.getModuleOutputDirectory(module);
-    final String out = outputDirectory != null? outputDirectory.getPath() : null;
-    myModuleToOutput.put(module, out);
-    return out;
-  }
-
-  private void sourceFileProcessed() {
-    myStatistics.incFilesCount();
-    updateStatistics();
-  }
-
-  private void updateStatistics() {
-    final String msg;
-    String moduleName = myModuleName;
-    if (moduleName != null) {
-      msg = CompilerBundle.message("statistics.files.classes.module", myStatistics.getFilesCount(), myStatistics.getClassesCount(), moduleName);
-    }
-    else {
-      msg = CompilerBundle.message("statistics.files.classes", myStatistics.getFilesCount(), myStatistics.getClassesCount());
-    }
-    myCompileContext.getProgressIndicator().setText2(msg);
-    //myCompileContext.getProgressIndicator().setFraction(1.0* myProcessedFilesCount /myTotalFilesToCompile);
-  }
-
-  private class ClassParsingThread implements Runnable {
-    private final BlockingQueue<FileObject> myPaths = new ArrayBlockingQueue<FileObject>(50000);
-    private CacheCorruptedException myError = null;
-    private final boolean myAddNotNullAssertions;
-    private final boolean myIsJdk16;
-    private final String myOutputDir;
-
-    private ClassParsingThread(final boolean isJdk16, String outputDir) {
-      myIsJdk16 = isJdk16;
-      myOutputDir = FileUtil.toSystemIndependentName(outputDir);
-      myAddNotNullAssertions = CompilerConfiguration.getInstance(myProject).isAddNotNullAssertions();
-    }
-
-    private volatile boolean processing;
-    public void run() {
-      processing = true;
-      try {
-        while (true) {
-          FileObject path = myPaths.take();
-
-          if (path == myStopThreadToken) {
-            break;
-          }
-          processPath(path, myProject);
-        }
-      }
-      catch (InterruptedException e) {
-        LOG.error(e);
-      }
-      catch (CacheCorruptedException e) {
-        myError = e;
-      }
-      finally {
-        processing = false;
-      }
-    }
-
-    public void addPath(FileObject path) throws CacheCorruptedException {
-      if (myError != null) {
-        throw myError;
-      }
-      myPaths.offer(path);
-    }
-
-    public void stopParsing() {
-      myPaths.offer(myStopThreadToken);
-    }
-
-    private void processPath(FileObject fileObject, Project project) throws CacheCorruptedException {
-      File file = fileObject.getFile();
-      final String path = file.getPath();
-      try {
-        if (CompilerConfiguration.MAKE_ENABLED) {
-          byte[] fileContent = fileObject.getContent();
-          // the file is assumed to exist!
-          final DependencyCache dependencyCache = myCompileContext.getDependencyCache();
-          final int newClassQName = dependencyCache.reparseClassFile(file, fileContent);
-          final Cache newClassesCache = dependencyCache.getNewClassesCache();
-          final String sourceFileName = newClassesCache.getSourceFileName(newClassQName);
-          final String qName = dependencyCache.resolve(newClassQName);
-          String relativePathToSource = "/" + MakeUtil.createRelativePathToSource(qName, sourceFileName);
-          putName(sourceFileName, newClassQName, relativePathToSource, path);
-          boolean haveToInstrument = myAddNotNullAssertions && hasNotNullAnnotations(newClassesCache, dependencyCache.getSymbolTable(), newClassQName, project);
-
-          if (haveToInstrument) {
-            try {
-              ClassReader reader = new ClassReader(fileContent, 0, fileContent.length);
-              ClassWriter writer = new PsiClassWriter(myProject, myIsJdk16);
-
-              if (NotNullVerifyingInstrumenter.processClassFile(reader, writer)) {
-                fileObject = new FileObject(file, writer.toByteArray());
-              }
-            }
-            catch (Exception ignored) {
-              LOG.info(ignored);
-            }
-          }
-
-          fileObject.save();
-        }
-        else {
-          final String _path = FileUtil.toSystemIndependentName(path);
-          final int dollarIndex = _path.indexOf('$');
-          final int tailIndex = dollarIndex >=0 ? dollarIndex : _path.length() - ".class".length();
-          final int slashIndex = _path.lastIndexOf('/');
-          final String sourceFileName = _path.substring(slashIndex + 1, tailIndex) + ".java";
-          String relativePathToSource = _path.substring(myOutputDir.length(), tailIndex) + ".java";
-          putName(sourceFileName, 0 /*doesn't matter here*/ , relativePathToSource.startsWith("/")? relativePathToSource : "/" + relativePathToSource, path);
-        }
-      }
-      catch (ClsFormatException e) {
-        final String m = e.getMessage();
-        String message = CompilerBundle.message("error.bad.class.file.format", StringUtil.isEmpty(m) ? path : m + "\n" + path);
-        myCompileContext.addMessage(CompilerMessageCategory.ERROR, message, null, -1, -1);
-        LOG.info(e);
-      }
-      catch (IOException e) {
-        myCompileContext.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
-        LOG.info(e);
-      }
-      finally {
-        myStatistics.incClassesCount();
-        updateStatistics();
-      }
-    }
-  }
-
-  private static boolean hasNotNullAnnotations(final Cache cache, final SymbolTable symbolTable, final int className, Project project) throws CacheCorruptedException {
-    final NullableNotNullManager manager = NullableNotNullManager.getInstance(project);
-    final List<String> notNulls = manager.getNotNulls();
-    for (MethodInfo methodId : cache.getMethods(className)) {
-      for (AnnotationConstantValue annotation : methodId.getRuntimeInvisibleAnnotations()) {
-        if (notNulls.contains(symbolTable.getSymbol(annotation.getAnnotationQName()))) {
-          return true;
-        }
-      }
-      final AnnotationConstantValue[][] paramAnnotations = methodId.getRuntimeInvisibleParameterAnnotations();
-      for (AnnotationConstantValue[] _singleParamAnnotations : paramAnnotations) {
-        for (AnnotationConstantValue annotation : _singleParamAnnotations) {
-          if (notNulls.contains(symbolTable.getSymbol(annotation.getAnnotationQName()))) {
-            return true;
-          }
-        }
-      }
-    }
-    return false;
-  }
-
-  private static boolean isJdk6(final Sdk jdk) {
-    return jdk != null && JavaSdk.getInstance().isOfVersionOrHigher(jdk, JavaSdkVersion.JDK_1_6);
-  }
-  
-  private static final class CompileStatistics {
-    private static final Key<CompileStatistics> KEY = Key.create("_Compile_Statistics_");
-    private int myClassesCount;
-    private int myFilesCount;
-
-    public int getClassesCount() {
-      return myClassesCount;
-    }
-
-    public int incClassesCount() {
-      return ++myClassesCount;
-    }
-
-    public int getFilesCount() {
-      return myFilesCount;
-    }
-
-    public int incFilesCount() {
-      return ++myFilesCount;
-    }
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/CompiledClass.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/CompiledClass.java
deleted file mode 100644
index 4bfa519..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/CompiledClass.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.compiler.impl.javaCompiler;
-
-/**
-* @author cdr
-*/
-final class CompiledClass {
-  public final int qName;
-  public final String relativePathToSource;
-  public final String pathToClass;
-
-  CompiledClass(final int qName, final String relativePathToSource, final String pathToClass) {
-    this.qName = qName;
-    this.relativePathToSource = relativePathToSource;
-    this.pathToClass = pathToClass;
-  }
-
-  public boolean equals(final Object o) {
-    if (this == o) return true;
-    if (o == null || getClass() != o.getClass()) return false;
-
-    final CompiledClass that = (CompiledClass)o;
-
-    if (qName != that.qName) return false;
-    if (!pathToClass.equals(that.pathToClass)) return false;
-    if (!relativePathToSource.equals(that.relativePathToSource)) return false;
-
-    return true;
-  }
-
-  public int hashCode() {
-    int result;
-    result = qName;
-    result = 31 * result + relativePathToSource.hashCode();
-    result = 31 * result + pathToClass.hashCode();
-    return result;
-  }
-
-  public String toString() {
-    return "[" + pathToClass + ";" + relativePathToSource + "]";
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/CompilerParsingThread.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/CompilerParsingThread.java
deleted file mode 100644
index 38b6b2f..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/CompilerParsingThread.java
+++ /dev/null
@@ -1,263 +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.compiler.impl.javaCompiler;
-
-import com.intellij.compiler.OutputParser;
-import com.intellij.compiler.impl.CompileDriver;
-import com.intellij.compiler.make.CacheCorruptedException;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.util.SpinAllocator;
-import com.intellij.util.StringBuilderSpinAllocator;
-import org.jetbrains.annotations.NonNls;
-
-import java.io.*;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Mar 30, 2004
- */
-public class CompilerParsingThread implements Runnable, OutputParser.Callback {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.javaCompiler.JavaCompilerParsingThread");
-  @NonNls public static final String TERMINATION_STRING = "__terminate_read__";
-  private final Reader myCompilerOutStreamReader;
-  private Process myProcess;
-  private final OutputParser myOutputParser;
-  private final boolean myTrimLines;
-  private boolean mySkipLF = false;
-  private Throwable myError = null;
-  private final boolean myIsUnitTestMode;
-  private FileObject myClassFileToProcess = null;
-  private String myLastReadLine = null;
-  private String myPushBackLine = null;
-  private volatile boolean myProcessExited = false;
-  private final CompileContext myContext;
-  
-  public CompilerParsingThread(Process process, OutputParser outputParser, final boolean readErrorStream, boolean trimLines, CompileContext context) {
-    myProcess = process;
-    myOutputParser = outputParser;
-    myTrimLines = trimLines;
-    InputStream stream = readErrorStream ? process.getErrorStream() : process.getInputStream();
-    myCompilerOutStreamReader = stream == null ? null : new BufferedReader(new InputStreamReader(stream), 16384);
-    myIsUnitTestMode = ApplicationManager.getApplication().isUnitTestMode();
-    myContext = context;
-  }
-
-  volatile boolean processing;
-  public void run() {
-    processing = true;
-    try {
-      while (true) {
-        if (!myIsUnitTestMode && myProcess == null) {
-          break;
-        }
-        if (isCanceled()) {
-          break;
-        }
-        if (!myOutputParser.processMessageLine(this)) {
-          break;
-        }
-      }
-      if (myClassFileToProcess != null) {
-        processCompiledClass(myClassFileToProcess);
-        myClassFileToProcess = null;
-      }
-    }
-    catch (Throwable e) {
-      e.printStackTrace();
-      myError = e;
-      LOG.info(e);
-    }
-    finally {
-      killProcess();
-      processing = false;
-    }
-  }
-
-  private void killProcess() {
-    if (myProcess != null) {
-      myProcess.destroy();
-      myProcess = null;
-    }
-  }
-
-  public Throwable getError() {
-    return myError;
-  }
-
-  public String getCurrentLine() {
-    return myLastReadLine;
-  }
-
-  public final String getNextLine() {
-    final String pushBack = myPushBackLine;
-    if (pushBack != null) {
-      myPushBackLine = null;
-      myLastReadLine = pushBack;
-      return pushBack;
-    }
-    final String line = readLine(myCompilerOutStreamReader);
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("LIne read: #" + line + "#");
-    }
-    if (CompileDriver.ourDebugMode) {
-      System.out.println("LIne read: #" + line + "#");
-    }
-    if (TERMINATION_STRING.equals(line)) {
-      myLastReadLine = null;
-    }
-    else {
-      myLastReadLine = line == null ? null : myTrimLines ? line.trim() : line;
-    }
-    return myLastReadLine;
-  }
-
-  @Override
-  public void pushBack(String line) {
-    myLastReadLine = null;
-    myPushBackLine = line;
-  }
-
-  public final void fileGenerated(FileObject path) {
-    // javac first logs file generated, then starts to write the file to disk,
-    // so this thread sometimes can stumble on not yet existing file,
-    // hence this complex logic
-    FileObject previousPath = myClassFileToProcess;
-    myClassFileToProcess = path;
-    if (previousPath != null) {
-      try {
-        processCompiledClass(previousPath);
-      }
-      catch (CacheCorruptedException e) {
-        if (CompileDriver.ourDebugMode) {
-          e.printStackTrace();
-        }
-        myError = e;
-        LOG.info(e);
-        killProcess();
-      }
-    }
-  }
-
-  protected boolean isCanceled() {
-    return myContext.getProgressIndicator().isCanceled();
-  }
-
-  public void setProgressText(String text) {
-    myContext.getProgressIndicator().setText(text);
-  }
-
-  public void fileProcessed(String path) {
-  }
-
-  public void message(CompilerMessageCategory category, String message, String url, int lineNum, int columnNum) {
-    myContext.addMessage(category, message, url, lineNum, columnNum);
-  }
-
-  protected void processCompiledClass(final FileObject classFileToProcess) throws CacheCorruptedException {
-  }
-
-
-  private String readLine(final Reader reader) {
-    StringBuilder buffer;
-    boolean releaseBuffer = true;
-    try {
-      buffer = StringBuilderSpinAllocator.alloc();
-    }
-    catch (SpinAllocator.AllocatorExhaustedException e) {
-      if (CompileDriver.ourDebugMode) {
-        e.printStackTrace();
-      }
-      LOG.info(e);
-      buffer = new StringBuilder();
-      releaseBuffer = false;
-    }
-
-    try {
-      boolean first = true;
-      while (true) {
-        int c = readNextByte(reader);
-        if (c == -1) break;
-        first = false;
-        if (c == '\n') {
-          if (mySkipLF) {
-            mySkipLF = false;
-            continue;
-          }
-          break;
-        }
-        else if (c == '\r') {
-          mySkipLF = true;
-          break;
-        }
-        else {
-          mySkipLF = false;
-          buffer.append((char)c);
-        }
-      }
-      if (first) {
-        return null;
-      }
-      return buffer.toString();
-    }
-    finally {
-      if (releaseBuffer) {
-        StringBuilderSpinAllocator.dispose(buffer);
-      }
-    }
-  }
-
-  private int readNextByte(final Reader reader) {
-    try {
-      while(!reader.ready()) {
-        if (isProcessTerminated()) {
-          if (reader.ready()) {
-            break;
-          }
-          return -1;
-        }
-        try {
-          Thread.sleep(1L);
-        }
-        catch (InterruptedException ignore) {
-        }
-      }
-      return reader.read();
-    }
-    catch (IOException e) {
-      if (CompileDriver.ourDebugMode) {
-        e.printStackTrace();
-      }
-      return -1; // When process terminated Process.getInputStream()'s underlying stream becomes closed on Linux.
-    }
-    catch (Throwable t) {
-      if (CompileDriver.ourDebugMode) {
-        t.printStackTrace();
-      }
-      return -1;
-    }
-  }
-
-  private boolean isProcessTerminated() {
-    return myProcessExited;
-  }
-
-  public void setProcessTerminated(final boolean procesExited) {
-    myProcessExited = procesExited;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/DummySourceGeneratingCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/DummySourceGeneratingCompiler.java
deleted file mode 100644
index 5fd91b0..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/DummySourceGeneratingCompiler.java
+++ /dev/null
@@ -1,137 +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.compiler.impl.javaCompiler;
-
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompileScope;
-import com.intellij.openapi.compiler.SourceGeneratingCompiler;
-import com.intellij.openapi.compiler.ValidityState;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.DataInput;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Oct 9, 2004
- */
-@SuppressWarnings({"HardCodedStringLiteral"})
-public class DummySourceGeneratingCompiler implements SourceGeneratingCompiler{
-  public static final String MODULE_NAME = "generated";
-  private final Project myProject;
-
-  public DummySourceGeneratingCompiler(Project project) {
-    myProject = project;
-  }
-
-  @Override
-  public VirtualFile getPresentableFile(CompileContext context, Module module, VirtualFile outputRoot, VirtualFile generatedFile) {
-    return null;
-  }
-
-  public GenerationItem[] getGenerationItems(CompileContext context) {
-    final Module module = findMyModule();
-    return new GenerationItem[] {
-      new MyGenerationItem("aaa/p1.properties", module, false),
-      new MyGenerationItem("bbb/p2.properties", module, false),
-      new MyGenerationItem("bbb/ccc/p3.properties", module, false),
-      new MyGenerationItem("aaa/p1.properties", module, true),
-      new MyGenerationItem("bbb/p2-t.properties", module, true),
-      new MyGenerationItem("bbb/ccc/p3.properties", module, true)
-    };
-  }
-
-  private Module findMyModule() {
-    return ApplicationManager.getApplication().runReadAction(new Computable<Module>() {
-      public Module compute() {
-        Module[] modules = ModuleManager.getInstance(myProject).getModules();
-        for (Module module : modules) {
-          if (MODULE_NAME.equals(module.getName())) {
-            return module;
-          }
-        }
-        return null;
-      }
-    });
-  }
-
-  public GenerationItem[] generate(CompileContext context, GenerationItem[] items, final VirtualFile outputRootDirectory) {
-    final String rootPath = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
-      public String compute() {
-        return outputRootDirectory.getPath();
-      }
-    });
-    final List<GenerationItem> success = new ArrayList<GenerationItem>();
-    for (GenerationItem item1 : items) {
-      GenerationItem item = item1;
-      File file = new File(rootPath + File.separator + item.getPath());
-      FileUtil.createIfDoesntExist(file);
-      success.add(item);
-    }
-    return success.toArray(new GenerationItem[success.size()]);
-  }
-
-  @NotNull
-  public String getDescription() {
-    return "Dummy Source Generator";
-  }
-
-  public boolean validateConfiguration(CompileScope scope) {
-    return findMyModule() != null;
-  }
-
-  public ValidityState createValidityState(DataInput in) throws IOException {
-    return null;
-  }
-
-  private static class MyGenerationItem implements GenerationItem {
-    private final String myRelPath;
-    private final Module myModule;
-    private final boolean myIsTestSource;
-
-    public MyGenerationItem(String relPath, Module module, final boolean isTestSource) {
-      myRelPath = relPath;
-      myModule = module;
-      myIsTestSource = isTestSource;
-    }
-
-    public String getPath() {
-      return myRelPath;
-    }
-
-    public ValidityState getValidityState() {
-      return null;
-    }
-
-    public Module getModule() {
-      return myModule;
-    }
-
-    public boolean isTestSource() {
-      return myIsTestSource;
-    }
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/DummyTransformingCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/DummyTransformingCompiler.java
deleted file mode 100644
index 2931190..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/DummyTransformingCompiler.java
+++ /dev/null
@@ -1,78 +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.compiler.impl.javaCompiler;
-
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompileScope;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.compiler.JavaSourceTransformingCompiler;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.ui.UIUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.*;
-
-/**          
- * @author Eugene Zhuravlev
- *         Date: Jul 10, 2004
- */
-@SuppressWarnings({"HardCodedStringLiteral"})
-public class DummyTransformingCompiler implements JavaSourceTransformingCompiler{
-  public boolean isTransformable(VirtualFile file) {
-    return "A.java".equals(file.getName());
-  }
-
-  public boolean transform(CompileContext context, final VirtualFile file, VirtualFile originalFile) {
-    System.out.println("DummyTransformingCompiler.transform");
-    final String url = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
-      public String compute() {
-        return file.getPresentableUrl();
-      }
-    });
-    context.getProgressIndicator().setText("Transforming file: " + url);
-    try {
-      OutputStream os = new BufferedOutputStream(new FileOutputStream(new File(url)));
-      DataOutput out = new DataOutputStream(os);
-      out.writeBytes("package a; ");
-      out.writeBytes("public class A { public static void main(String[] args) { System.out.println(\"Hello from modified class\");} }");
-      os.close();
-      UIUtil.invokeAndWaitIfNeeded(new Runnable() {
-        public void run() {
-          file.refresh(false, false);
-        }
-      });
-      return true;
-    }
-    catch (FileNotFoundException e) {
-      context.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
-    }
-    catch (IOException e) {
-      context.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
-    }
-    return false;
-  }
-
-  @NotNull
-  public String getDescription() {
-    return "a dummy compiler for testing";
-  }
-
-  public boolean validateConfiguration(CompileScope scope) {
-    return true;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/DummyTranslatingCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/DummyTranslatingCompiler.java
deleted file mode 100644
index 573b7e0..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/DummyTranslatingCompiler.java
+++ /dev/null
@@ -1,93 +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.compiler.impl.javaCompiler;
-
-import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.Chunk;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Dec 4, 2007
- */
-public class DummyTranslatingCompiler implements TranslatingCompiler, IntermediateOutputCompiler{
-  @NonNls private static final String DESCRIPTION = "DUMMY TRANSLATOR";
-  @NonNls private static final String FILETYPE_EXTENSION = ".dummy";
-
-  public boolean isCompilableFile(final VirtualFile file, final CompileContext context) {
-    return file.getName().endsWith(FILETYPE_EXTENSION);
-  }
-
-  public void compile(final CompileContext context, Chunk<Module> moduleChunk, final VirtualFile[] files, OutputSink sink) {
-    final List<File> filesToRefresh = new ArrayList<File>();
-    final Map<String, Collection<OutputItem>> outputs = new HashMap<String, Collection<OutputItem>>();
-    ApplicationManager.getApplication().runReadAction(new Runnable() {
-      public void run() {
-        for (final VirtualFile file : files) {
-          final Module module = context.getModuleByFile(file);
-          try {
-            final VirtualFile outputDir = context.getModuleOutputDirectory(module);
-            if (outputDir != null) {
-              final String outputDirPath = outputDir.getPath();
-              final File compiledFile = doCompile(outputDir, file);
-              filesToRefresh.add(compiledFile);
-              Collection<OutputItem> collection = outputs.get(outputDirPath);
-              if (collection == null) {
-                collection = new ArrayList<OutputItem>();
-                outputs.put(outputDirPath, collection);
-              }
-              collection.add(new OutputItemImpl(FileUtil.toSystemIndependentName(compiledFile.getPath()), file));
-            }
-          }
-          catch (IOException e) {
-            context.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, 0, 0);
-          }
-        }
-      }
-    });
-    CompilerUtil.refreshIOFiles(filesToRefresh);
-    for (Map.Entry<String, Collection<OutputItem>> entry : outputs.entrySet()) {
-      sink.add(entry.getKey(), entry.getValue(), VirtualFile.EMPTY_ARRAY);
-    }
-  }
-
-  private static File doCompile(VirtualFile out, VirtualFile src) throws IOException {
-    final String originalName = src.getName();
-    String compiledName = originalName.substring(0, originalName.length() - FILETYPE_EXTENSION.length());
-    final File destFile = new File(out.getPath(), compiledName + ".java");
-    FileUtil.copy(new File(src.getPath()), destFile);
-    return destFile;
-  }
-  
-  @NotNull
-  public String getDescription() {
-    return DESCRIPTION;
-  }
-
-  public boolean validateConfiguration(final CompileScope scope) {
-    return true;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/ExternalCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/ExternalCompiler.java
deleted file mode 100644
index 9223cbd..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/ExternalCompiler.java
+++ /dev/null
@@ -1,83 +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.compiler.impl.javaCompiler;
-
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.fileTypes.FileType;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.EnvironmentUtil;
-import com.intellij.util.StringBuilderSpinAllocator;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Set;
-
-public abstract class ExternalCompiler implements BackendCompiler {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.javaCompiler.ExternalCompiler");
-  private static final Set<FileType> COMPILABLE_TYPES = Collections.<FileType>singleton(StdFileTypes.JAVA);
-
-  @NotNull
-  public abstract String[] createStartupCommand(ModuleChunk chunk, CompileContext context, String outputPath)
-    throws IOException, IllegalArgumentException;
-
-  @NotNull
-  public Set<FileType> getCompilableFileTypes() {
-    return COMPILABLE_TYPES;
-  }
-
-  /**
-   * Checks if the compiler can compile the specified file.
-   *
-   * @param file    the file to check.
-   * @param context the context for the current compile operation.
-   * @return true if can compile the file, false otherwise. If the method returns false, <code>file</code>
-   *         will not be included in the list of files passed to {@link #compile(CompileContext, com.intellij.util.Chunk < com.intellij.openapi.module.Module >,com.intellij.openapi.vfs.VirtualFile[], com.intellij.openapi.compiler.TranslatingCompiler.OutputSink)}.
-   */
-  public boolean isCompilableFile(VirtualFile file, CompileContext context) {
-    return getCompilableFileTypes().contains(file.getFileType());
-  }
-
-  @NotNull
-  public Process launchProcess(@NotNull final ModuleChunk chunk, @NotNull final String outputDir, @NotNull final CompileContext compileContext) throws IOException {
-    final String[] commands = createStartupCommand(chunk, compileContext, outputDir);
-
-    if (LOG.isDebugEnabled()) {
-      @NonNls final StringBuilder buf = StringBuilderSpinAllocator.alloc();
-      try {
-        buf.append("\n===================================Environment:===========================\n");
-        for (String pair : EnvironmentUtil.getEnvironment()) {
-          buf.append("\t").append(pair).append("\n");
-        }
-        buf.append("=============================================================================\n");
-        buf.append("Running compiler: ");
-        for (final String command : commands) {
-          buf.append(" ").append(command);
-        }
-
-        LOG.debug(buf.toString());
-      }
-      finally {
-        StringBuilderSpinAllocator.dispose(buf);
-      }
-    }
-
-    return Runtime.getRuntime().exec(commands);
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/FileObject.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/FileObject.java
deleted file mode 100644
index 4ce53a5..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/FileObject.java
+++ /dev/null
@@ -1,73 +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.compiler.impl.javaCompiler;
-
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.util.ArrayUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-/**
- * @author cdr
- */
-public class FileObject {
-  private static final byte[] NOT_LOADED = ArrayUtil.EMPTY_BYTE_ARRAY;
-
-  private final File myFile;
-  private final byte[] myContent;
-
-  public FileObject(@NotNull File file, @NotNull byte[] content) {
-    myFile = file;
-    myContent = content;
-  }
-
-  public FileObject(File file) {
-    myFile = file;
-    myContent = NOT_LOADED;
-  }
-
-  public File getFile() {
-    return myFile;
-  }
-
-  public byte[] getContent() throws IOException {
-    if (myContent == NOT_LOADED) {
-      return FileUtil.loadFileBytes(myFile);
-    }
-    return myContent;
-  }
-
-  public void save() throws IOException {
-    if (myContent == NOT_LOADED) {
-      return; // already on disk
-    }
-    try {
-      FileUtil.writeToFile(myFile, myContent);
-    }
-    catch (FileNotFoundException e) {
-      FileUtil.createParentDirs(myFile);
-      FileUtil.writeToFile(myFile, myContent);
-    }
-  }
-
-  @Override
-  public String toString() {
-    return getFile().toString();
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/JavaCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/JavaCompiler.java
deleted file mode 100644
index 827c813..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/JavaCompiler.java
+++ /dev/null
@@ -1,94 +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: Eugene Zhuravlev
- * Date: Jan 17, 2003
- * Time: 3:22:59 PM
- */
-package com.intellij.compiler.impl.javaCompiler;
-
-import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.compiler.CompilerConfigurationImpl;
-import com.intellij.compiler.CompilerException;
-import com.intellij.compiler.impl.CompileDriver;
-import com.intellij.compiler.make.CacheCorruptedException;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.Chunk;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Arrays;
-
-public class JavaCompiler implements TranslatingCompiler {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.javaCompiler.JavaCompiler");
-  private final Project myProject;
-
-  public JavaCompiler(Project project) {
-    myProject = project;
-  }
-
-  @NotNull
-  public String getDescription() {
-    return CompilerBundle.message("java.compiler.description");
-  }
-
-  public boolean isCompilableFile(VirtualFile file, CompileContext context) {
-    final BackendCompiler backEndCompiler = getBackEndCompiler();
-    if (backEndCompiler instanceof ExternalCompiler) {
-      return ((ExternalCompiler)backEndCompiler).isCompilableFile(file, context);
-    }
-    return backEndCompiler.getCompilableFileTypes().contains(file.getFileType());
-  }
-
-  public void compile(CompileContext context, Chunk<Module> moduleChunk, VirtualFile[] files, OutputSink sink) {
-    final BackendCompiler backEndCompiler = getBackEndCompiler();
-    final BackendCompilerWrapper wrapper = new BackendCompilerWrapper(moduleChunk, myProject, Arrays.asList(files), (CompileContextEx)context, backEndCompiler, sink);
-    try {
-      if (CompileDriver.ourDebugMode) {
-        System.out.println("Starting java compiler; with backend compiler: " + backEndCompiler.getClass().getName());
-      }
-      wrapper.compile();
-    }
-    catch (CompilerException e) {
-      if (CompileDriver.ourDebugMode) {
-        e.printStackTrace();
-      }
-      context.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
-      LOG.info(e);
-    }
-    catch (CacheCorruptedException e) {
-      if (CompileDriver.ourDebugMode) {
-        e.printStackTrace();
-      }
-      LOG.info(e);
-      context.requestRebuildNextTime(e.getMessage());
-    }
-  }
-
-  public boolean validateConfiguration(CompileScope scope) {
-    return getBackEndCompiler().checkCompiler(scope);
-  }
-
-  private BackendCompiler getBackEndCompiler() {
-    CompilerConfigurationImpl configuration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject);
-    return configuration.getDefaultCompiler();
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/OutputDir.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/OutputDir.java
deleted file mode 100644
index 7d7b12d..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/OutputDir.java
+++ /dev/null
@@ -1,60 +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.compiler.impl.javaCompiler;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
-* @author cdr
-*/
-class OutputDir {
-  private final String myPath;
-  private final int myKind;
-
-  OutputDir(@NotNull String path, int kind) {
-    myPath = path;
-    myKind = kind;
-  }
-
-  @NotNull
-  public String getPath() {
-    return myPath;
-  }
-
-  public int getKind() {
-    return myKind;
-  }
-
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (!(o instanceof OutputDir)) {
-      return false;
-    }
-
-    final OutputDir outputDir = (OutputDir)o;
-
-    return myKind == outputDir.myKind && myPath.equals(outputDir.myPath);
-
-  }
-
-  public int hashCode() {
-    int result = myPath.hashCode();
-    result = 29 * result + myKind;
-    return result;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/OutputItemImpl.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/OutputItemImpl.java
deleted file mode 100644
index eb5720c..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/OutputItemImpl.java
+++ /dev/null
@@ -1,53 +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: Eugene Zhuravlev
- * Date: Apr 1, 2003
- * Time: 5:58:41 PM
- */
-package com.intellij.compiler.impl.javaCompiler;
-
-import com.intellij.openapi.compiler.TranslatingCompiler;
-import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.annotations.Nullable;
-
-public class OutputItemImpl implements TranslatingCompiler.OutputItem{
-
-  private final String myOutputPath;
-  private final VirtualFile mySourceFile;
-
-  public OutputItemImpl(VirtualFile packageInfoFile) {
-    this(null, packageInfoFile);
-  }
-
-  /**
-   * @param outputPath absolute path of the output file ('/' slashes used)
-   * @param sourceFile corresponding source file
-   */
-  public OutputItemImpl(@Nullable String outputPath, VirtualFile sourceFile) {
-    myOutputPath = outputPath;
-    mySourceFile = sourceFile;
-  }
-
-  public String getOutputPath() {
-    return myOutputPath;
-  }
-
-  public VirtualFile getSourceFile() {
-    return mySourceFile;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompAPIDriver.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompAPIDriver.java
deleted file mode 100644
index d75fe63..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompAPIDriver.java
+++ /dev/null
@@ -1,180 +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.compiler.impl.javaCompiler.api;
-
-import com.intellij.compiler.OutputParser;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.sun.source.util.JavacTask;
-import com.sun.source.util.TaskEvent;
-import com.sun.source.util.TaskListener;
-import com.sun.tools.javac.api.JavacTool;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import javax.tools.*;
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.lang.reflect.Field;
-import java.net.URI;
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-/**
- * @author cdr
- */
-@SuppressWarnings({"Since15"})
-class CompAPIDriver {
-  private final BlockingQueue<CompilationEvent> myCompilationResults = new LinkedBlockingQueue<CompilationEvent>();
-  private static final CompilationEvent GUARD = new CompilationEvent() {
-    @Override
-    protected void process(OutputParser.Callback callback) {
-    }
-
-    @Override
-    public String toString() {
-      return "FINISH";
-    }
-  };
-  private String myOutputDir;
-
-  private volatile boolean compiling;
-  private static final PrintWriter COMPILER_ERRORS = new PrintWriter(System.err);
-  @Nullable
-  private final String mySourcesEncoding;
-
-  CompAPIDriver(@Nullable String sourcesEncoding) {
-    mySourcesEncoding = sourcesEncoding;
-  }
-
-  public void compile(List<String> commandLine, List<File> paths, final String outputDir) {
-    myOutputDir = outputDir;
-    compiling = true;
-
-    assert myCompilationResults.isEmpty();
-    JavaCompiler compiler = JavacTool.create(); //use current classloader
-    StandardJavaFileManager standardFileManager = compiler.getStandardFileManager(null, null, null);
-    MyFileManager manager = new MyFileManager(this, outputDir, standardFileManager, mySourcesEncoding);
-
-    Iterable<? extends JavaFileObject> input = manager.getJavaFileObjectsFromFiles(paths);
-
-    DiagnosticListener<JavaFileObject> listener = new DiagnosticListener<JavaFileObject>() {
-      public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
-        CompilationEvent event = CompilationEvent.diagnostic(diagnostic);
-        myCompilationResults.offer(event);
-      }
-    };
-    try {
-      JavaCompiler.CompilationTask task = compiler.getTask(COMPILER_ERRORS, manager, listener, commandLine, null, input);
-      ((JavacTask)task).setTaskListener(new TaskListener() {
-        public void started(TaskEvent taskEvent) {
-          JavaFileObject sourceFile = taskEvent.getSourceFile();
-          CompilationEvent event;
-          switch (taskEvent.getKind()) {
-            case ANALYZE:
-              event = CompilationEvent.progress("Analyzing ",sourceFile);
-              break;
-            case PARSE:
-              event = CompilationEvent.progress("Parsing ", sourceFile);
-              break;
-            default:
-              event = null;
-          }
-          if (event != null) {
-            myCompilationResults.offer(event);
-          }
-        }
-        public void finished(TaskEvent taskEvent) {
-          CompilationEvent event;
-          switch (taskEvent.getKind()) {
-            case ENTER:
-              event = CompilationEvent.fileProcessed();
-              break;
-            default:
-              event = null;
-          }
-          if (event != null) {
-            myCompilationResults.offer(event);
-          }
-        }
-      });
-      task.call();
-    }
-    catch (IllegalArgumentException e) {
-      final String message = "Javac in-process compiler error: " + e.getMessage();
-      myCompilationResults.offer(new CompilationEvent() {
-        @Override
-        protected void process(OutputParser.Callback callback) {
-          callback.message(CompilerMessageCategory.ERROR, message, null, -1, -1);
-        }
-      });
-    }
-    finally {
-      compiling = false;
-      myCompilationResults.offer(GUARD);
-      try {
-        manager.close();
-      }
-      catch (IOException ignored) {
-      }
-    }
-  }
-
-  private volatile boolean processing;
-  public void processAll(@NotNull OutputParser.Callback callback) {
-    try {
-      processing =  true;
-      while (true) {
-        CompilationEvent event = myCompilationResults.take();
-        if (event == GUARD) break;
-        event.process(callback);
-      }
-    }
-    catch (InterruptedException ignored) {
-    }
-    finally {
-      processing = false;
-    }
-  }
-
-  public void finish() {
-    assert !compiling : "still compiling to "+myOutputDir;
-    assert !processing;
-    //assert myCompilationResults.isEmpty() : myCompilationResults;
-    myCompilationResults.clear();
-    cleanupInternalFields();
-  }
-
-  private static void cleanupInternalFields() {
-    try {
-      Field freelist = Class.forName("com.sun.tools.javac.util.SharedNameTable").getDeclaredField("freelist");
-      freelist.setAccessible(true);
-      freelist.set(null, com.sun.tools.javac.util.List.nil());
-    }
-    catch (Exception ignored) {
-
-    }
-  }
-
-  public void offerClassFile(URI uri, byte[] bytes) {
-    CompilationEvent event = CompilationEvent.generateClass(uri, bytes);
-    myCompilationResults.offer(event);
-  }
-
-}
-
-
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompilationEvent.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompilationEvent.java
deleted file mode 100644
index 0ca1e2b..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompilationEvent.java
+++ /dev/null
@@ -1,127 +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.compiler.impl.javaCompiler.api;
-
-import com.intellij.compiler.OutputParser;
-import com.intellij.compiler.impl.javaCompiler.FileObject;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VfsUtil;
-import org.jetbrains.annotations.NonNls;
-
-import javax.tools.*;
-import java.io.File;
-import java.net.URI;
-
-/**
- * @author cdr
- */
-abstract class CompilationEvent {
-  protected abstract void process(OutputParser.Callback callback);
-  static CompilationEvent progress(final String title, final JavaFileObject fileObject) {
-    return new CompilationEvent() {
-      @Override
-      protected void process(OutputParser.Callback callback) {
-        showProgressFor(title, fileObject.toUri(), callback);
-      }
-
-      @NonNls
-      @Override
-      public String toString() {
-        return "Progress: "+title+" "+fileObject.toUri();
-      }
-    };
-  }
-
-  private static void showProgressFor(String title, URI uri, OutputParser.Callback callback) {
-    String normalizedPath;
-    try {
-      normalizedPath = new File(uri).getPath();
-    }
-    catch (IllegalArgumentException e) {
-      normalizedPath = uri.toString();
-    }
-    callback.setProgressText(title + StringUtil.last(normalizedPath, 100, true));
-  }
-
-  static CompilationEvent generateClass(final URI uri, final byte[] bytes) {
-    return new CompilationEvent() {
-      @Override
-      protected void process(OutputParser.Callback callback) {
-        showProgressFor("Writing ", uri, callback);
-        File file = new File(uri);
-        callback.fileGenerated(new FileObject(file,bytes));
-      }
-      @NonNls
-      @Override
-      public String toString() {
-        return "Write: "+uri;
-      }
-    };
-  }
-  static CompilationEvent diagnostic(final Diagnostic<? extends JavaFileObject> diagnostic) {
-    return new CompilationEvent() {
-      @Override
-      protected void process(OutputParser.Callback callback) {
-        JavaFileObject fileObject = diagnostic.getSource();
-        String message = diagnostic.getMessage(null);
-        String url;
-        if (fileObject == null) {
-          url = null;
-        }
-        else {
-          URI uri = fileObject.toUri();
-          if (uri.getScheme().equals("file")) {
-            url = VfsUtil.pathToUrl(FileUtil.toSystemIndependentName(uri.getPath()));
-          }
-          else {
-            url = fileObject.toString();
-          }
-        }
-
-        CompilerMessageCategory category = diagnostic.getKind() == Diagnostic.Kind.ERROR
-                                           ? CompilerMessageCategory.ERROR
-                                           : diagnostic.getKind() == Diagnostic.Kind.WARNING ||
-                                             diagnostic.getKind() == Diagnostic.Kind.MANDATORY_WARNING
-                                             ? CompilerMessageCategory.WARNING
-                                             : CompilerMessageCategory.INFORMATION;
-        callback.message(category, message, url, (int)diagnostic.getLineNumber(), (int)diagnostic.getColumnNumber());
-      }
-      @NonNls
-      @Override
-      public String toString() {
-        return "Diagnostic: "+diagnostic;
-      }
-    };
-  }
-
-  public static CompilationEvent fileProcessed() {
-    return FILE_PROCESSED;
-  }
-  private static final CompilationEvent FILE_PROCESSED = new CompilationEvent() {
-    @Override
-    protected void process(OutputParser.Callback callback) {
-      callback.fileProcessed(null);
-    }
-
-    @NonNls
-    @Override
-    public String toString() {
-      return "Processed";
-    }
-  };
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompilerAPICompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompilerAPICompiler.java
deleted file mode 100644
index 19e2a0b..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompilerAPICompiler.java
+++ /dev/null
@@ -1,199 +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.compiler.impl.javaCompiler.api;
-
-import com.intellij.compiler.OutputParser;
-import com.intellij.compiler.impl.javaCompiler.BackendCompiler;
-import com.intellij.compiler.impl.javaCompiler.ModuleChunk;
-import com.intellij.compiler.impl.javaCompiler.javac.JavacCompiler;
-import com.intellij.compiler.impl.javaCompiler.javac.JavacConfigurable;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompileScope;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.fileTypes.FileType;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.options.Configurable;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.JavaSdkVersion;
-import com.intellij.openapi.util.ThrowableComputable;
-import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jps.model.java.compiler.JavaCompilers;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-
-public class CompilerAPICompiler implements BackendCompiler {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.javaCompiler.api.CompilerAPICompiler");
-  private final Project myProject;
-  private static final Set<FileType> COMPILABLE_TYPES = Collections.<FileType>singleton(StdFileTypes.JAVA);
-
-  public CompilerAPICompiler(Project project) {
-    myProject = project;
-  }
-
-  public boolean checkCompiler(final CompileScope scope) {
-    return true;
-  }
-
-  @NotNull
-  @NonNls
-  public String getId() { // used for externalization
-    return JavaCompilers.JAVAC_API_ID;
-  }
-
-  @NotNull
-  public String getPresentableName() {
-    return "Javac in-process (Java6+ only)";
-  }
-
-  @NotNull
-  public Configurable createConfigurable() {
-    return new JavacConfigurable(CompilerAPIConfiguration.getOptions(myProject, CompilerAPIConfiguration.class));
-  }
-
-  @NotNull
-  public Set<FileType> getCompilableFileTypes() {
-    return COMPILABLE_TYPES;
-  }
-
-  @Nullable
-  public OutputParser createErrorParser(@NotNull final String outputDir, final Process process) {
-    return new OutputParser() {
-      public boolean processMessageLine(Callback callback) {
-        ((MyProcess)process).myCompAPIDriver.processAll(callback);
-        return false;
-      }
-    };
-  }
-
-  @Nullable
-  public OutputParser createOutputParser(@NotNull final String outputDir) {
-    return null;
-  }
-
-  public void compileFinished() {
-  }
-
-  @NotNull
-  public Process launchProcess(@NotNull final ModuleChunk chunk, @NotNull final String outputDir, @NotNull final CompileContext compileContext) throws IOException {
-    @NonNls final List<String> commandLine =
-      ApplicationManager.getApplication().runReadAction(new ThrowableComputable<List<String>, IOException>() {
-        @Override
-        public List<String> compute() throws IOException {
-          List<String> commandLine = new ArrayList<String>();
-          final List<String> additionalOptions =
-            JavacCompiler.addAdditionalSettings(commandLine, CompilerAPIConfiguration .getOptions(myProject, CompilerAPIConfiguration.class), false,
-                                                 JavaSdkVersion.JDK_1_6, chunk, compileContext.isAnnotationProcessorsEnabled());
-
-          JavacCompiler.addCommandLineOptions(chunk, commandLine, outputDir, chunk.getJdk(), false, false, null, false, false, false);
-          commandLine.addAll(additionalOptions);
-          return commandLine;
-        }
-      });
-    return new MyProcess(commandLine, chunk, outputDir, compileContext);
-  }
-
-  private static void compile(List<String> commandLine, ModuleChunk chunk, String outputDir, CompAPIDriver myCompAPIDriver) {
-    List<VirtualFile> filesToCompile = chunk.getFilesToCompile();
-    List<File> paths = new ArrayList<File>(filesToCompile.size());
-    for (VirtualFile file : filesToCompile) {
-      paths.add(new File(file.getPresentableUrl()));
-    }
-    myCompAPIDriver.compile(commandLine, paths, outputDir);
-  }
-
-  private static class MyProcess extends Process {
-    private final List<String> myCommandLine;
-    private final ModuleChunk myChunk;
-    private final String myOutputDir;
-    private final CompileContext myCompileContext;
-    private final CompAPIDriver myCompAPIDriver;
-
-    private MyProcess(List<String> commandLine, ModuleChunk chunk, String outputDir, CompileContext compileContext) {
-      myCommandLine = commandLine;
-      myChunk = chunk;
-      myOutputDir = outputDir;
-      myCompileContext = compileContext;
-      myCompAPIDriver = new CompAPIDriver(findEncodingValue(commandLine));
-    }
-
-    private static String findEncodingValue(List<String> commandLine) {
-      boolean found = false;
-      for (String param : commandLine) {
-        if (found) {
-          return param;
-        }
-        if ("-encoding".equalsIgnoreCase(param)) {
-          found = true;
-        }
-      }
-      return null;
-    }
-
-    public OutputStream getOutputStream() {
-      throw new UnsupportedOperationException();
-    }
-
-    public InputStream getInputStream() {
-      return null;
-    }
-
-    public InputStream getErrorStream() {
-      return null;
-    }
-
-    public void destroy() {
-      myCompAPIDriver.finish();
-    }
-
-    private int myExitCode;
-    public int waitFor() {
-      try {
-        myCommandLine.remove("-verbose");
-        compile(myCommandLine, myChunk, myOutputDir, myCompAPIDriver);
-        myExitCode = 0;
-        return myExitCode;
-      }
-      catch (Exception e) {
-        myCompileContext.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
-        LOG.info(e);
-        myExitCode = -1;
-        return -1;
-      }
-    }
-
-    public int exitValue() {
-      return myExitCode;
-    }
-
-    @Override
-    public String toString() {
-      return myChunk.toString();
-    }
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompilerAPIConfiguration.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompilerAPIConfiguration.java
deleted file mode 100755
index 3a69541..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompilerAPIConfiguration.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.compiler.impl.javaCompiler.api;
-
-import com.intellij.compiler.impl.javaCompiler.javac.JavacConfiguration;
-import com.intellij.openapi.components.State;
-import com.intellij.openapi.components.Storage;
-import com.intellij.openapi.components.StoragePathMacros;
-import com.intellij.openapi.components.StorageScheme;
-import com.intellij.openapi.project.Project;
-
-@State(
-  name = "CompilerAPISettings",
-  storages = {
-    @Storage(file = StoragePathMacros.PROJECT_FILE),
-    @Storage(file = StoragePathMacros.PROJECT_CONFIG_DIR + "/compiler.xml", scheme = StorageScheme.DIRECTORY_BASED)
-  }
-)
-public class CompilerAPIConfiguration extends JavacConfiguration {
-  public CompilerAPIConfiguration(Project project) {
-    super(project);
-  }
-}
\ No newline at end of file
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompilerPerfTestAction.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompilerPerfTestAction.java
deleted file mode 100644
index ad58787..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompilerPerfTestAction.java
+++ /dev/null
@@ -1,99 +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.compiler.impl.javaCompiler.api;
-
-import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.compiler.CompilerConfigurationImpl;
-import com.intellij.compiler.impl.javaCompiler.BackendCompiler;
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompileStatusNotification;
-import com.intellij.openapi.compiler.CompilerManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.util.containers.ContainerUtil;
-
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @author cdr
- */
-public class CompilerPerfTestAction extends AnAction {
-  @Override
-  public void update(AnActionEvent e) {
-    Project project = e.getData(CommonDataKeys.PROJECT);
-    e.getPresentation().setEnabled(project != null);
-  }
-
-  public void actionPerformed(AnActionEvent e) {
-    final Project project = e.getData(CommonDataKeys.PROJECT);
-
-    final CompilerManager compilerManager = CompilerManager.getInstance(project);
-
-    final CompilerConfigurationImpl configuration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(project);
-    List<BackendCompiler> compilers = (List<BackendCompiler>)configuration.getRegisteredJavaCompilers();
-    final List<BackendCompiler> allCompilers = ContainerUtil.concat(compilers, compilers, compilers, compilers, compilers, compilers, compilers);
-    final int[] i = new int[1];
-
-    CompileStatusNotification callback = new CompileStatusNotification() {
-      volatile long start;
-      BackendCompiler compiler;
-
-      public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
-        if (compiler == null) {
-          next();
-          return;
-        }
-        final long finish = System.currentTimeMillis();
-        System.out.println("Compiled with '" +
-                           compiler.getPresentableName() + "' " +
-                           " in " +
-                           TimeUnit.MILLISECONDS.toMinutes(finish - start) + "m" +
-                           TimeUnit.MILLISECONDS.toSeconds((finish - start)%60000) + "s" +
-                           " with " +
-                           errors +
-                           " errors, " +
-                           warnings +
-                           " warnings, aborted=" +
-                           aborted+"; free memory="+Runtime.getRuntime().freeMemory()+" bytes");
-        //ProfilingUtil.forceCaptureMemorySnapshot();
-        next();
-      }
-
-      void next() {
-        if (i[0] >= allCompilers.size()) return;
-        compiler = allCompilers.get(i[0]++);
-        if (compiler.getId().equals("Jikes")|| compiler.getId().contains("Eclipse")) {
-          next();
-          return;
-        }
-        boolean success = compiler.checkCompiler(compilerManager.createProjectCompileScope(project));
-        if (!success) {
-          next();
-          return;
-        }
-        configuration.setDefaultCompiler(compiler);
-        start = System.currentTimeMillis();
-        compilerManager.rebuild(this);
-      }
-    };
-
-    callback.finished(false,0,0,null);
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/FileVirtualObject.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/FileVirtualObject.java
deleted file mode 100644
index b6866f0..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/FileVirtualObject.java
+++ /dev/null
@@ -1,70 +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.compiler.impl.javaCompiler.api;
-
-import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-
-import javax.tools.*;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URI;
-
-/**
- * @author cdr
- */
-@SuppressWarnings({"Since15"})
-public abstract class FileVirtualObject extends SimpleJavaFileObject {
-  public FileVirtualObject(URI uri, Kind kind) {
-    super(uri, kind);
-  }
-
-  protected abstract VirtualFile getVirtualFile();
-  @Override
-  public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
-    VirtualFile virtualFile = getVirtualFile();
-    if (virtualFile == null) return null;
-    return LoadTextUtil.loadText(virtualFile);
-  }
-
-  @Override
-  public InputStream openInputStream() throws IOException {
-    // in-process compiler does not work well with zipped stream
-    byte[] bytes = getVirtualFile().contentsToByteArray();
-    return new ByteArrayInputStream(bytes);
-  }
-
-  @Override
-  public OutputStream openOutputStream() throws IOException {
-    return getVirtualFile().getOutputStream(this);
-  }
-
-  @Override
-  public String toString() {
-    return toUri().toString();
-  }
-  @Override
-  public int hashCode() {
-    return toUri().hashCode();
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    return obj instanceof JavaFileObject && toUri().equals(((JavaFileObject)obj).toUri());
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/JavaIoFile.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/JavaIoFile.java
deleted file mode 100644
index 801fc75..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/JavaIoFile.java
+++ /dev/null
@@ -1,94 +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.compiler.impl.javaCompiler.api;
-
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.text.StringUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import javax.tools.JavaFileObject;
-import javax.tools.SimpleJavaFileObject;
-import java.io.*;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-/**
-* User: cdr
-*/
-@SuppressWarnings({"Since15"})
-class JavaIoFile extends SimpleJavaFileObject {
-  private final File myFile;
-  @Nullable
-  private final String myEncoding;
-
-  JavaIoFile(@NotNull File file, @NotNull Kind kind, @Nullable String encoding) {
-    super(convertToURI(file.getPath()), kind);
-    myFile = file;
-    myEncoding = encoding;
-  }
-
-  // File.toURI() asks for File.isDirectory which is too expensive
-  @NotNull
-  private static URI convertToURI(@NotNull String path) {
-    if (File.separatorChar != '/') {
-      path = path.replace(File.separatorChar, '/');
-    }
-    if (!StringUtil.startsWithChar(path, '/')) {
-      path = "/" + path;
-    }
-
-    if (path.startsWith("//")) {
-      path = "//" + path;
-    }
-    try {
-      return new URI("file", null, path, null);
-    }
-    catch (URISyntaxException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
-    return FileUtil.loadFile(myFile, myEncoding);
-  }
-
-  @Override
-  public InputStream openInputStream() throws IOException {
-    return new BufferedInputStream(new FileInputStream(myFile));
-  }
-
-  @Override
-  public OutputStream openOutputStream() throws IOException {
-    return new BufferedOutputStream(new FileOutputStream(myFile));
-  }
-
-  @Override
-  public String toString() {
-    return toUri().toString();
-  }
-
-  @Override
-  public int hashCode() {
-    return toUri().hashCode();
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    return obj instanceof JavaFileObject && toUri().equals(((JavaFileObject)obj).toUri());
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/JavaVirtualByIoFile.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/JavaVirtualByIoFile.java
deleted file mode 100644
index 6fd1065..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/JavaVirtualByIoFile.java
+++ /dev/null
@@ -1,38 +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.compiler.impl.javaCompiler.api;
-
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
-
-import java.io.File;
-
-/**
- * User: cdr
- */
-@SuppressWarnings({"Since15"})
-class JavaVirtualByIoFile extends FileVirtualObject {
-  private final File myFile;
-
-  protected JavaVirtualByIoFile(File file, Kind kind) {
-    super(file.toURI(), kind);
-    myFile = file;
-  }
-
-  protected VirtualFile getVirtualFile() {
-    return LocalFileSystem.getInstance().findFileByIoFile(myFile);
-  }
-}
\ No newline at end of file
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/JavaVirtualFile.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/JavaVirtualFile.java
deleted file mode 100644
index abe8f24..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/JavaVirtualFile.java
+++ /dev/null
@@ -1,35 +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.compiler.impl.javaCompiler.api;
-
-import com.intellij.openapi.vfs.VirtualFile;
-
-/**
-* User: cdr
-*/
-@SuppressWarnings({"Since15"})
-class JavaVirtualFile extends FileVirtualObject {
-  private final VirtualFile myFile;
-
-  JavaVirtualFile(VirtualFile file, Kind kind) {
-    super(MyFileManager.createUri(file.getUrl()), kind);
-    myFile = file;
-  }
-
-  protected VirtualFile getVirtualFile() {
-    return myFile;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/MyFileManager.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/MyFileManager.java
deleted file mode 100644
index d46d504..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/MyFileManager.java
+++ /dev/null
@@ -1,260 +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.compiler.impl.javaCompiler.api;
-
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.JarFileSystem;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.SmartList;
-import com.sun.tools.javac.util.ListBuffer;
-import gnu.trove.THashSet;
-import gnu.trove.TObjectHashingStrategy;
-
-import javax.tools.FileObject;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.util.*;
-
-/**
-* @author cdr
-*/
-class MyFileManager implements StandardJavaFileManager {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.javaCompiler.api.MyFileManager");
-
-  private final String myOutputDir;
-  private final StandardJavaFileManager myStandardFileManager;
-  private final String myEncoding;
-  private final CompAPIDriver myCompAPIDriver;
-
-  MyFileManager(CompAPIDriver compAPIDriver, String outputDir, StandardJavaFileManager standardFileManager, String encoding) {
-    myCompAPIDriver = compAPIDriver;
-    myOutputDir = outputDir;
-    myStandardFileManager = standardFileManager;
-    myEncoding = encoding;
-  }
-
-  @Override
-  public Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles(Iterable<? extends File> files) {
-    int size = ((Collection)files).size();
-    List<JavaFileObject> result = new ArrayList<JavaFileObject>(size);
-
-    for (File file : files) {
-      JavaFileObject fileObject = new JavaIoFile(file, JavaFileObject.Kind.SOURCE, myEncoding);
-      result.add(fileObject);
-    }
-
-    return result;
-  }
-
-  @Override
-  public JavaFileObject getJavaFileForOutput(Location location, String name, JavaFileObject.Kind kind, FileObject fileObject) {
-    URI uri = toURI(myOutputDir, name, kind);
-    return new Output(uri, myCompAPIDriver, kind);
-  }
-
-  static URI createUri(String url) {
-    return URI.create(url.replaceAll(" ","%20"));
-  }
-
-  private static URI toURI(String outputDir, String name, JavaFileObject.Kind kind) {
-    return createUri("file:///" + outputDir.replace('\\','/') + "/" + name.replace('.', '/') + kind.extension);
-  }
-
-
-  @Override
-  public Iterable<JavaFileObject> list(Location location, String packageName, Set<JavaFileObject.Kind> kinds, boolean recurse) throws IOException {
-    if (recurse) {
-      throw new IllegalArgumentException();
-    }
-    return findInside(location, packageName, kinds, false);
-  }
-
-  private List<JavaFileObject> findInside(Location location, String packageName, Set<JavaFileObject.Kind> kinds, boolean lookForFile)
-    throws IOException {
-    Iterable<? extends File> path = getLocation(location);
-    if (path == null) return Collections.emptyList();
-
-    String subdirectory = packageName.replace('.', '/');
-    List<JavaFileObject> results = null;
-
-    for (File directory : path) {
-      VirtualFile dir = LocalFileSystem.getInstance().findFileByIoFile(directory);
-      if (dir == null) continue;
-      if (!dir.isDirectory()) {
-        dir = JarFileSystem.getInstance().getJarRootForLocalFile(dir);
-        if (dir == null) continue;
-      }
-      VirtualFile virtualFile = StringUtil.isEmptyOrSpaces(subdirectory) ? dir : dir.findFileByRelativePath(subdirectory);
-      if (virtualFile == null) continue;
-
-      VirtualFile[] children;
-      if (lookForFile) {
-        if (!virtualFile.isDirectory()) {
-          children = new VirtualFile[]{virtualFile};
-        }
-        else continue;
-      }
-      else {
-        children = virtualFile.getChildren();
-      }
-      for (VirtualFile child : children) {
-        JavaFileObject.Kind kind = getKind("." + child.getExtension());
-        if (kinds == null || kinds.contains(kind)) {
-          if (results == null) results = new SmartList<JavaFileObject>();
-          if (kind == JavaFileObject.Kind.SOURCE && child.getFileSystem() instanceof JarFileSystem) continue;  //for some reasdon javac looks for java files inside jar
-
-          // use VFS to read content inside .jar
-          String childPath = child.getPath();
-          JavaFileObject fileObject = !childPath.contains("!/") ? new JavaIoFile(new File(childPath), kind, myEncoding) : new JavaVirtualFile(child, kind);
-          results.add(fileObject);
-        }
-      }
-    }
-
-    List<JavaFileObject> ret = results == null ? Collections.<JavaFileObject>emptyList() : results;
-
-    if (LOG.isDebugEnabled()) {
-      // for testing consistency
-      Collection c = (Collection)myStandardFileManager.list(location, packageName, kinds, false);
-      Collection<JavaFileObject> sup = new HashSet(c);
-      assert sup.size() == c.size();
-      assert new HashSet(c).equals(sup);
-
-      THashSet<JavaFileObject> s = new THashSet<JavaFileObject>(new TObjectHashingStrategy<JavaFileObject>() {
-        public int computeHashCode(JavaFileObject object) {
-          return object.getName().hashCode();
-        }
-
-        public boolean equals(JavaFileObject o1, JavaFileObject o2) {
-          return o1.getKind() == o2.getKind() && o1.toUri().equals(o2.toUri());
-        }
-      });
-      s.addAll(ret);
-
-      s.removeAll(sup);
-      if (ret.size() != sup.size()) {
-        assert false : "our implementation differs from javac'";
-      }
-    }
-
-    return ret;
-  }
-
-  private static JavaFileObject.Kind getKind(String name) {
-      if (name.endsWith(JavaFileObject.Kind.CLASS.extension))
-          return JavaFileObject.Kind.CLASS;
-      else if (name.endsWith(JavaFileObject.Kind.SOURCE.extension))
-          return JavaFileObject.Kind.SOURCE;
-      else if (name.endsWith(JavaFileObject.Kind.HTML.extension))
-          return JavaFileObject.Kind.HTML;
-      else
-          return JavaFileObject.Kind.OTHER;
-  }
-
-
-  @Override
-  public String inferBinaryName(Location location, JavaFileObject file) {
-    return FileUtil.getNameWithoutExtension(new File(file.getName()).getName());
-  }
-
-  ////////// delegates
-  @Override
-  public int isSupportedOption(String option) {
-    return myStandardFileManager.isSupportedOption(option);
-  }
-
-  @Override
-  public void close() throws IOException {
-    myStandardFileManager.close();
-  }
-
-  @Override
-  public void flush() throws IOException {
-    myStandardFileManager.flush();
-  }
-
-  @Override
-  public boolean handleOption(String current, Iterator<String> remaining) {
-    return myStandardFileManager.handleOption(current, remaining);
-  }
-
-  @Override
-  public ClassLoader getClassLoader(Location location) {
-    return myStandardFileManager.getClassLoader(location);
-  }
-
-  @Override
-  public boolean isSameFile(FileObject a, FileObject b) {
-    if (a instanceof FileVirtualObject && b instanceof FileVirtualObject || a instanceof Output && b instanceof Output) {
-      return a.equals(b);
-    }
-    return myStandardFileManager.isSameFile(a, b);
-  }
-
-  public Iterable<? extends JavaFileObject> getJavaFileObjects(File... files) {
-    return getJavaFileObjectsFromFiles(Arrays.asList(files));
-  }
-
-  public Iterable<? extends JavaFileObject> getJavaFileObjects(String... names) {
-    return getJavaFileObjectsFromStrings(Arrays.asList(names));
-  }
-  public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) {
-    ListBuffer<File> files = new ListBuffer<File>();
-    for (String name : names) {
-      files.append(new File(name));
-    }
-    return getJavaFileObjectsFromFiles(files.toList());
-  }
-
-  public JavaFileObject getJavaFileForInput(Location location, String className, JavaFileObject.Kind kind) throws IOException {
-    List<JavaFileObject> result = findInside(location, className, kind == null ? null : Collections.singleton(kind), true);
-    if (!result.isEmpty()) {
-      return result.get(0);
-    }
-    return null;
-  }
-
-  @Override
-  public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException {
-    return getJavaFileForInput(location, packageName + "/" + relativeName, getKind(relativeName));
-  }
-
-  @Override
-  public FileObject getFileForOutput(Location location, String packageName, String relativeName, FileObject sibling) throws IOException {
-    return getJavaFileForOutput(location, packageName + "/" + relativeName, getKind(relativeName), null);
-  }
-
-  @Override
-  public Iterable<? extends File> getLocation(Location location) {
-    return myStandardFileManager.getLocation(location);
-  }
-
-  @Override
-  public void setLocation(Location location, Iterable<? extends File> path) throws IOException {
-    myStandardFileManager.setLocation(location, path);
-  }
-
-  @Override
-  public boolean hasLocation(Location location) {
-    return myStandardFileManager.hasLocation(location);
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/Output.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/Output.java
deleted file mode 100644
index 8cdf09c..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/Output.java
+++ /dev/null
@@ -1,80 +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.compiler.impl.javaCompiler.api;
-
-import org.jetbrains.annotations.Nullable;
-
-import javax.tools.*;
-import java.io.*;
-import java.net.URI;
-
-/**
-* User: cdr
-*/
-@SuppressWarnings({"ALL"})
-class Output extends SimpleJavaFileObject {
-  private final CompAPIDriver myCompAPIDriver;
-  @Nullable
-  private volatile byte[] myFileBytes;
-
-  Output(URI uri, CompAPIDriver compAPIDriver, final Kind kind) {
-    super(uri, kind);
-    myCompAPIDriver = compAPIDriver;
-  }
-
-  @Override
-  public ByteArrayOutputStream openOutputStream() {
-    return new ByteArrayOutputStream() {
-      @Override
-      public void close() throws IOException {
-        super.close();
-        final byte[] bytes = toByteArray();
-        myFileBytes = bytes;
-        if (Kind.CLASS.equals(kind)) {
-          myCompAPIDriver.offerClassFile(toUri(), bytes);
-        }
-      }
-    };
-  }
-
-  @Override
-  public InputStream openInputStream() throws IOException {
-    final byte[] bytes = myFileBytes;
-    if (bytes == null) {
-      throw new FileNotFoundException(toUri().getPath());
-    }
-    return new ByteArrayInputStream(bytes);
-  }
-
-  @Override
-  public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
-    final byte[] bytes = myFileBytes;
-    if (bytes == null) {
-      throw null;
-    }
-    return new String(bytes);
-  }
-
-  @Override
-  public int hashCode() {
-    return toUri().hashCode();
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    return obj instanceof JavaFileObject && toUri().equals(((JavaFileObject)obj).toUri());
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompiler.java
index d9a7c30..874fb51 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompiler.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompiler.java
@@ -15,43 +15,24 @@
  */
 package com.intellij.compiler.impl.javaCompiler.eclipse;
 
-import com.intellij.compiler.OutputParser;
-import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.compiler.impl.javaCompiler.ExternalCompiler;
-import com.intellij.compiler.impl.javaCompiler.ModuleChunk;
-import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.compiler.impl.javaCompiler.BackendCompiler;
 import com.intellij.openapi.application.PathManager;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompileScope;
 import com.intellij.openapi.compiler.CompilerBundle;
-import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.fileTypes.StdFileTypes;
 import com.intellij.openapi.options.Configurable;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.JavaSdkType;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.projectRoots.impl.JavaAwareProjectJdkTableImpl;
-import com.intellij.openapi.ui.Messages;
-import com.intellij.openapi.util.ThrowableComputable;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.ArrayUtil;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jps.model.java.compiler.EclipseCompilerOptions;
 import org.jetbrains.jps.model.java.compiler.JavaCompilers;
 
-import java.io.*;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-                                        
-public class EclipseCompiler extends ExternalCompiler {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.javaCompiler.eclipse.EclipseCompiler");
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.Collections;
+import java.util.Set;
 
+public class EclipseCompiler implements BackendCompiler {
   private final Project myProject;
-  private final List<File> myTempFiles = new ArrayList<File>();
   private static final String COMPILER_CLASS_NAME = "org.eclipse.jdt.core.compiler.batch.BatchCompiler";
   @NonNls private static final String PATH_TO_COMPILER_JAR = findJarPah();
 
@@ -84,24 +65,6 @@
     return file.exists();
   }
 
-  public boolean checkCompiler(final CompileScope scope) {
-    if (!isInitialized()) {
-      Messages.showMessageDialog(
-        myProject,
-        CompilerBundle.message("eclipse.compiler.error.jar.not.found", PATH_TO_COMPILER_JAR),
-        CompilerBundle.message("compiler.eclipse.name"),
-        Messages.getErrorIcon()
-      );
-      return false;
-    }
-    return true;
-  }
-
-  @NonNls
-  public static String getCompilerClass() {
-    return "org.eclipse.jdt.internal.compiler.batch.Main";
-  }
-
   @NotNull
   public String getId() { // used for externalization
     return JavaCompilers.ECLIPSE_ID;
@@ -117,116 +80,9 @@
     return new EclipseCompilerConfigurable(EclipseCompilerConfiguration.getOptions(myProject, EclipseCompilerConfiguration.class));
   }
 
-  public OutputParser createErrorParser(@NotNull final String outputDir, Process process) {
-    return new EclipseCompilerErrorParser();
-  }
-
-  @Nullable
-  public OutputParser createOutputParser(@NotNull final String outputDir) {
-    return new EclipseCompilerOutputParser(outputDir);
-  }
-
   @NotNull
-  public String[] createStartupCommand(final ModuleChunk chunk, final CompileContext context, final String outputPath)
-    throws IOException {
-
-    final ArrayList<String> commandLine = new ArrayList<String>();
-    ApplicationManager.getApplication().runReadAction(new ThrowableComputable<Void, IOException>() {
-      @Override
-      public Void compute() throws IOException {
-        createStartupCommand(chunk, commandLine, outputPath, true);
-        return null;
-      }
-    });
-    return ArrayUtil.toStringArray(commandLine);
-  }
-
-  private void createStartupCommand(final ModuleChunk chunk,
-                                    @NonNls final ArrayList<String> commandLine,
-                                    final String outputPath,
-                                    final boolean useTempFile) throws IOException {
-    final EclipseCompilerOptions options = EclipseCompilerConfiguration.getOptions(myProject, EclipseCompilerConfiguration.class);
-
-    final Sdk projectJdk = JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk();
-    final String vmExePath = ((JavaSdkType)projectJdk.getSdkType()).getVMExecutablePath(projectJdk);
-    commandLine.add(vmExePath);
-    commandLine.add("-Xmx" + options.MAXIMUM_HEAP_SIZE + "m");
-
-    CompilerUtil.addLocaleOptions(commandLine, false);
-
-    commandLine.add("-classpath");
-    commandLine.add(PATH_TO_COMPILER_JAR);
-    commandLine.add(getCompilerClass());
-
-    addCommandLineOptions(commandLine, chunk, outputPath, options, useTempFile, true);
-  }
-
-  public void addCommandLineOptions(@NotNull @NonNls final List<String> commandLine,
-                                    @NotNull final ModuleChunk chunk,
-                                    @NotNull final String outputPath,
-                                    @NotNull final EclipseCompilerOptions options,
-                                    final boolean useTempFile,
-                                    boolean quoteBootClasspath) throws IOException {
-    final Sdk jdk = chunk.getJdk();
-    CompilerUtil.addSourceCommandLineSwitch(jdk, chunk.getLanguageLevel(), commandLine);
-    CompilerUtil.addTargetCommandLineSwitch(chunk, commandLine);
-
-    final String bootCp = chunk.getCompilationBootClasspath();
-
-    final String classPath = chunk.getCompilationClasspath();
-
-    if (!StringUtil.isEmpty(bootCp)) {
-      commandLine.add("-bootclasspath");
-      // important: need to quote boot classpath if path to jdk contain spaces
-      commandLine.add(quoteBootClasspath ? CompilerUtil.quotePath(bootCp) : bootCp);
-    }
-
-    if (!StringUtil.isEmpty(classPath)) {
-      commandLine.add("-classpath");
-      commandLine.add(classPath);
-    }
-
-    commandLine.add("-d");
-    commandLine.add(outputPath.replace('/', File.separatorChar));
-
-    commandLine.add("-verbose");
-    StringTokenizer tokenizer = new StringTokenizer(new EclipseSettingsBuilder(options).getOptionsString(chunk), " ");
-    while (tokenizer.hasMoreTokens()) {
-      commandLine.add(tokenizer.nextToken());
-    }
-
-    final List<VirtualFile> files = chunk.getFilesToCompile();
-
-    if (useTempFile) {
-      File sourcesFile = FileUtil.createTempFile("javac", ".tmp");
-      sourcesFile.deleteOnExit();
-      myTempFiles.add(sourcesFile);
-      final PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(sourcesFile)));
-      try {
-        for (final VirtualFile file : files) {
-          // Important: should use "/" slashes!
-          // but not for JDK 1.5 - see SCR 36673
-          final String path = file.getPath().replace('/', File.separatorChar);
-          if (LOG.isDebugEnabled()) {
-            LOG.debug("Adding path for compilation " + path);
-          }
-          writer.println(CompilerUtil.quotePath(path));
-        }
-      }
-      finally {
-        writer.close();
-      }
-      commandLine.add("@" + sourcesFile.getAbsolutePath());
-    }
-    else {
-      for (VirtualFile file : files) {
-        commandLine.add(file.getPath());
-      }
-    }
-  }
-
-  public void compileFinished() {
-    FileUtil.asyncDelete(myTempFiles);
-    myTempFiles.clear();
+  @Override
+  public Set<FileType> getCompilableFileTypes() {
+    return Collections.<FileType>singleton(StdFileTypes.JAVA);
   }
 }
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerDriver.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerDriver.java
deleted file mode 100644
index 9538c16..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerDriver.java
+++ /dev/null
@@ -1,255 +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.compiler.impl.javaCompiler.eclipse;
-
-import com.intellij.compiler.OutputParser;
-import com.intellij.compiler.impl.javaCompiler.FileObject;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompilerBundle;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.progress.ProcessCanceledException;
-import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.progress.ProgressManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.VirtualFileManager;
-import org.eclipse.jdt.core.compiler.IProblem;
-import org.eclipse.jdt.core.compiler.InvalidInputException;
-import org.eclipse.jdt.internal.compiler.*;
-import org.eclipse.jdt.internal.compiler.Compiler;
-import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
-import org.eclipse.jdt.internal.compiler.batch.CompilationUnit;
-import org.eclipse.jdt.internal.compiler.batch.FileSystem;
-import org.eclipse.jdt.internal.compiler.batch.Main;
-import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
-import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Locale;
-import java.util.Map;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;    
-
-public class EclipseCompilerDriver {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.javaCompiler.eclipse.EclipseCompilerDriver");
-
-  private String[] sourceFilePaths;
-  private Map compilerOptions;
-  private final BlockingQueue<CompilationResult> myCompilationResults = new LinkedBlockingQueue<CompilationResult>();
-  private FileSystem classPath;
-
-  private void parseCommandLine(String[] args) throws InvalidInputException {
-    StringWriter err = new StringWriter();
-    Main driver = new Main(null, new PrintWriter(err), false);
-    driver.configure(args);
-    StringBuffer buffer = err.getBuffer();
-    if (buffer.length() != 0) {
-      throw new InvalidInputException(buffer.toString());
-    }
-    sourceFilePaths = driver.filenames;
-    compilerOptions = driver.options;
-    classPath = driver.getLibraryAccess();
-  }
-
-  private CompilationUnit[] getCompilationUnits() {
-    int fileCount = sourceFilePaths.length;
-    CompilationUnit[] units = new CompilationUnit[fileCount];
-    final String defaultEncoding = null;
-
-    for (int i = 0; i < fileCount; i++) {
-      units[i] = new MyCompilationUnit(sourceFilePaths[i], defaultEncoding);
-    }
-    return units;
-  }
-
-  private ICompilerRequestor getBatchRequestor(final CompileContext compileContext) {
-    return new ICompilerRequestor() {
-      public void acceptResult(CompilationResult compilationResult) {
-        ProgressIndicator progress = compileContext.getProgressIndicator();
-        if (progress != null) {
-          progress.checkCanceled();
-        }
-        myCompilationResults.offer(compilationResult);
-      }
-    };
-  }
-
-  private static final CompilationResult END_OF_STREAM = new CompilationResult(new char[0], 0, 0, 0);
-
-  private INameEnvironment getEnvironment() {
-    return classPath;
-  }
-
-  private static IProblemFactory getProblemFactory() {
-    return new DefaultProblemFactory(Locale.getDefault());
-  }
-
-  private static IErrorHandlingPolicy getHandlingPolicy() {
-    return new IErrorHandlingPolicy() {
-      public boolean proceedOnErrors() {
-        return false; // stop if there are some errors
-      }
-
-      public boolean stopOnFirstError() {
-        return false;
-      }
-    };
-  }
-
-  private Map getCompilerOptions() {
-    return compilerOptions;
-  }
-
-
-  private void compile(final CompileContext compileContext) {
-    final INameEnvironment environment = getEnvironment();
-
-    Compiler compiler =
-      new Compiler(
-        environment,
-        getHandlingPolicy(),
-        getCompilerOptions(),
-        getBatchRequestor(compileContext),
-        getProblemFactory()){
-        protected void handleInternalException(Throwable internalException, CompilationUnitDeclaration unit, CompilationResult result) {
-          if (internalException instanceof ProcessCanceledException) throw (ProcessCanceledException)internalException;
-          super.handleInternalException(internalException, unit, result);
-        }
-      };
-    compiler.parseThreshold = 2500;
-    try {
-      compiler.compile(getCompilationUnits());
-    }
-    catch (ProcessCanceledException e) {
-      //compileContext.addMessage(CompilerMessageCategory.ERROR, "Canceled",null,-1,-1);
-    }
-    catch (Exception e) {
-      ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
-      if (indicator == null || !indicator.isCanceled()) {
-        compileContext.addMessage(CompilerMessageCategory.ERROR, "Internal Error: "+e.toString(),null,-1,-1);
-      }
-    }
-    finally {
-      myCompilationResults.offer(END_OF_STREAM);
-      environment.cleanup();
-    }
-  }
-
-  public boolean processMessageLine(final OutputParser.Callback callback, final String outputDir, Project project) {
-    ProgressManager.checkCanceled();
-    CompilationResult result;
-    try {
-      result = myCompilationResults.take();
-    }
-    catch (InterruptedException e) {
-      LOG.error(e);
-      return true;
-    }
-    if (result == END_OF_STREAM) {
-      return false;
-    }
-
-    String file = String.valueOf(result.getFileName());
-    callback.setProgressText(CompilerBundle.message("eclipse.compiler.parsing", file));
-    callback.fileProcessed(file);
-
-    ClassFile[] classFiles = result.getClassFiles();
-    for (ClassFile classFile : classFiles) {
-      String filePath = String.valueOf(classFile.fileName());
-      String relativePath = FileUtil.toSystemDependentName(filePath + ".class");
-      String path = FileUtil.toSystemDependentName(outputDir) + File.separatorChar + relativePath;
-
-      byte[] bytes = classFile.getBytes();
-      File out = new File(path);
-
-      callback.fileGenerated(new FileObject(out,bytes));
-    }
-    IProblem[] problems = result.getProblems();
-    if (problems != null) {
-      for (IProblem problem : problems) {
-        CompilerMessageCategory category = problem.isError() ? CompilerMessageCategory.ERROR
-                                           : problem.isWarning() ? CompilerMessageCategory.WARNING :
-                                             CompilerMessageCategory.INFORMATION;
-        String filePath = String.valueOf(problem.getOriginatingFileName());
-        String url = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, FileUtil.toSystemIndependentName(filePath));
-        int lineNumber = problem.getSourceLineNumber();
-        int sourceStart = problem.getSourceStart();
-        int column = getColumn(url, lineNumber, sourceStart, project);
-        callback.message(category, problem.getMessage(), url, lineNumber, column);
-      }
-    }
-    return true;
-  }
-
-  private static int getColumn(final String url, final int lineNumber, final int sourceStart, final Project project) {
-    if (sourceStart == 0) return 0;
-    return ApplicationManager.getApplication().runReadAction(new Computable<Integer>() {
-      public Integer compute() {
-        VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
-        if (file == null) return 0;
-        Document document = FileDocumentManager.getInstance().getDocument(file);
-        if (document == null) return 0;
-        int lineStartOffset = document.getLineStartOffset(lineNumber - 1);
-
-        String lineSeparator = FileDocumentManager.getInstance().getLineSeparator(file, project);
-        int offsetInVirtualFile = sourceStart - (lineNumber - 1) * (lineSeparator.length() - 1);
-        return offsetInVirtualFile - lineStartOffset + 1;
-      }
-    }).intValue();
-  }
-
-  public void parseCommandLineAndCompile(final String[] finalCmds, final CompileContext compileContext) throws Exception {
-    parseCommandLine(finalCmds);
-
-    compile(compileContext);
-  }
-
-  private static class MyCompilationUnit extends CompilationUnit {
-    private final String myDefaultEncoding;
-
-    private MyCompilationUnit(final String sourceFilePath, final String defaultEncoding) {
-      super(null, sourceFilePath, defaultEncoding);
-      myDefaultEncoding = defaultEncoding;
-    }
-
-    public char[] getContents() {
-      final String fileName = String.valueOf(getFileName());
-      try {
-        ProgressManager.checkCanceled();
-        return FileUtil.loadFileText(new File(fileName), myDefaultEncoding);
-      }
-      catch (IOException e) {
-        LOG.error(e);
-      }
-      return null;
-    }
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerErrorParser.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerErrorParser.java
deleted file mode 100644
index aa87dcb..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerErrorParser.java
+++ /dev/null
@@ -1,131 +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.compiler.impl.javaCompiler.eclipse;
-
-import com.intellij.compiler.OutputParser;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.VirtualFileManager;
-import org.jetbrains.annotations.NonNls;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class EclipseCompilerErrorParser extends OutputParser {
-
-  private final StringBuilder problemText = new StringBuilder();
-
-  public boolean processMessageLine(Callback callback) {
-    @NonNls String line = callback.getNextLine();
-    if (line == null) {
-      spitOutProblem(callback);
-      return false;
-    }
-    if (line.trim().length() == 0) {
-      return true;
-    }
-    if (line.equals("----------")) {
-      spitOutProblem(callback);
-      problemText.setLength(0);
-      return true;
-    }
-    problemText.append(line);
-    problemText.append("\n");
-    return true;
-  }
-
-  private void spitOutProblem(final Callback callback) {
-    final String problem = problemText.toString();
-    if (problem.trim().length() == 0) return;
-
-    @NonNls final String problemTemplate = "(\\d*)\\. (\\w*) in (.*)" +
-                                           "\\s*\\(at line (\\d*)\\)\n" +
-                                           "\\s*(.*)\n" +
-                                           "(\\s*)\\^+\n" +
-                                           "(.*)\\s*";
-    final Pattern PATTERN = Pattern.compile(problemTemplate, Pattern.DOTALL);
-    Matcher matcher = PATTERN.matcher(problem);
-    if (matcher.matches()) {
-      //String seqN = matcher.group(1);
-      @NonNls String problemType = matcher.group(2);
-      String path = matcher.group(3).trim();
-      String lineNum = matcher.group(4);
-      String codeSnippet = matcher.group(5);
-      String indentWhiteSpace = matcher.group(6);
-      String message = matcher.group(7).trim();
-
-      CompilerMessageCategory messageCategory;
-      if ("WARNING".equals(problemType)) {
-        messageCategory = CompilerMessageCategory.WARNING;
-      }
-      else if ("ERROR".equals(problemType)) {
-        messageCategory = CompilerMessageCategory.ERROR;
-      }
-      else {
-        messageCategory = CompilerMessageCategory.INFORMATION;
-      }
-      final String url = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, FileUtil.toSystemIndependentName(path));
-      final int line = Integer.parseInt(lineNum);
-      int col = indentWhiteSpace.length();
-      final String offendingCode = codeSnippet.substring(col-1);
-
-      // try to find similar text inside source file                   
-      int colFromFile = ApplicationManager.getApplication().runReadAction(new Computable<Integer>() {
-        public Integer compute() {
-          int index = -1;
-          VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
-          Document document = file == null ? null : FileDocumentManager.getInstance().getDocument(file);
-          if (document != null) {
-            // line is one-based
-            int docLine = line == 0 ? 0 : line-1;
-            int startOffset = document.getLineStartOffset(docLine);
-            int endOffset = document.getLineEndOffset(docLine);
-            String lineText = document.getText().substring(startOffset, endOffset);
-            index = lineText.indexOf(offendingCode);
-            if (index == -1) {
-              for (index = 0; index < lineText.length(); index++) {
-                if (!Character.isWhitespace(lineText.charAt(index))) break;
-              }
-              if (index == lineText.length()) index = -1;
-            }
-            // to one-based
-            if (index != -1) {
-              index++;
-            }
-          }
-          return index;
-        }
-      }).intValue();
-      if (colFromFile != -1) {
-        col = colFromFile;
-      }
-      callback.message(messageCategory, message, url, line, col);
-    }
-    else {
-      callback.message(CompilerMessageCategory.WARNING, problem, null, -1, -1);
-    }
-  }
-
-  public boolean isTrimLines() {
-    return false;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerOutputParser.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerOutputParser.java
deleted file mode 100644
index 12ceca3..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerOutputParser.java
+++ /dev/null
@@ -1,90 +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.compiler.impl.javaCompiler.eclipse;
-
-import com.intellij.compiler.OutputParser;
-import com.intellij.compiler.impl.javaCompiler.FileObject;
-import com.intellij.openapi.compiler.CompilerBundle;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.util.io.FileUtil;
-import org.jetbrains.annotations.NonNls;
-
-import java.io.File;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class EclipseCompilerOutputParser extends OutputParser {
-  private final String myOutputDir;
-
-  public EclipseCompilerOutputParser(final String outputDir) {
-    myOutputDir = outputDir;
-  }
-
-  @NonNls private static final Pattern PATH_PATTERN = Pattern.compile("\\s*(.*) - #.*");
-  @NonNls private static final Pattern COMPILED_PATTERN = Pattern.compile("\\[\\d* unit(s)? compiled\\]");
-  @NonNls private static final Pattern GENERATED_PATTERN = Pattern.compile("\\[\\d* \\.class file(s)? generated\\]");
-  public boolean processMessageLine(Callback callback) {
-    @NonNls String line = callback.getNextLine();
-    if (line == null) {
-      return false;
-    }
-    if (line.trim().length() == 0) {
-      return true;
-    }
-    if (line.startsWith("[parsing ")) {
-      Matcher matcher = PATH_PATTERN.matcher(line.substring("[parsing ".length()));
-      matcher.matches();
-      String path = matcher.group(1);
-      callback.setProgressText(CompilerBundle.message("eclipse.compiler.parsing", path));
-      callback.fileProcessed(path);
-      return true;
-    }
-    if (line.startsWith("[reading ")) {
-      //StringTokenizer tokenizer = new StringTokenizer(line.substring("[reading ".length()), " ]");
-      //String fqn = tokenizer.nextToken();
-      callback.setProgressText(CompilerBundle.message("eclipse.compiler.reading"));
-      return true;
-    }
-    if (line.startsWith("[analyzing ")) {
-      Matcher matcher = PATH_PATTERN.matcher(line.substring("[analyzing ".length()));
-      matcher.matches();
-      String path = matcher.group(1);
-      callback.setProgressText(CompilerBundle.message("eclipse.compiler.analyzing", path));
-      return true;
-    }
-    if (line.startsWith("[completed ")) {
-      //Matcher matcher = PATH_PATTERN.matcher(line.substring("[completed ".length()));
-      //matcher.matches();
-      //String path = matcher.group(1);
-      //callback.setProgressText(CompilerBundle.message("eclipse.compiler.completed", path));
-      return true;
-    }
-    if (line.startsWith("[writing ")) {
-      Matcher matcher = PATH_PATTERN.matcher(line.substring("[writing ".length()));
-      matcher.matches();
-      String path = matcher.group(1);
-      String absPath = FileUtil.toSystemDependentName(myOutputDir + '/' + path);
-      //callback.setProgressText(CompilerBundle.message("eclipse.compiler.writing", absPath));
-      callback.fileGenerated(new FileObject(new File(absPath)));
-      return true;
-    }
-    if (COMPILED_PATTERN.matcher(line).matches() || GENERATED_PATTERN.matcher(line).matches()) {
-      return true;
-    }
-    callback.message(CompilerMessageCategory.INFORMATION, line, null, -1, -1);
-    return true;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseEmbeddedCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseEmbeddedCompiler.java
deleted file mode 100644
index ed6c03a..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseEmbeddedCompiler.java
+++ /dev/null
@@ -1,155 +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.compiler.impl.javaCompiler.eclipse;
-
-import com.intellij.compiler.OutputParser;
-import com.intellij.compiler.impl.javaCompiler.BackendCompiler;
-import com.intellij.compiler.impl.javaCompiler.ModuleChunk;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompileScope;
-import com.intellij.openapi.compiler.CompilerBundle;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.fileTypes.FileType;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.options.Configurable;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.ThrowableComputable;
-import com.intellij.util.ArrayUtil;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jps.model.java.compiler.EclipseCompilerOptions;
-import org.jetbrains.jps.model.java.compiler.JavaCompilers;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Set;
-
-
-public class EclipseEmbeddedCompiler implements BackendCompiler {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.javaCompiler.eclipse.EclipseEmbeddedCompiler");
-
-  private final Project myProject;
-  private final EclipseCompiler myEclipseExternalCompiler;
-  private int myExitCode;
-  private final EclipseCompilerDriver myEclipseCompilerDriver;
-  private static final Set<FileType> COMPILABLE_TYPES = Collections.<FileType>singleton(StdFileTypes.JAVA);
-
-  public EclipseEmbeddedCompiler(Project project) {
-    myProject = project;
-    myEclipseExternalCompiler = new EclipseCompiler(project);
-    myEclipseCompilerDriver = new EclipseCompilerDriver();
-  }
-
-  public boolean checkCompiler(final CompileScope scope) {
-    return myEclipseCompilerDriver != null && myEclipseExternalCompiler.checkCompiler(scope);
-  }
-
-  @NotNull
-  @NonNls
-  public String getId() { // used for externalization
-    return JavaCompilers.ECLIPSE_EMBEDDED_ID;
-  }
-
-  @NotNull
-  public String getPresentableName() {
-    return CompilerBundle.message("compiler.eclipse.embedded.name");
-  }
-
-  @NotNull
-  public Configurable createConfigurable() {
-    return new EclipseCompilerConfigurable(EclipseEmbeddedCompilerConfiguration.getOptions(myProject, EclipseEmbeddedCompilerConfiguration.class));
-  }
-
-  @NotNull
-  public Set<FileType> getCompilableFileTypes() {
-    return COMPILABLE_TYPES;
-  }
-
-  @Nullable
-  public OutputParser createErrorParser(@NotNull final String outputDir, Process process) {
-    return new OutputParser() {
-      public boolean processMessageLine(Callback callback) {
-        return myEclipseCompilerDriver.processMessageLine(callback, outputDir, myProject);
-      }
-    };
-  }
-
-  @Nullable
-  public OutputParser createOutputParser(@NotNull final String outputDir) {
-    return null;
-  }
-
-  public void compileFinished() {
-  }
-
-
-  @NotNull
-  public Process launchProcess(@NotNull final ModuleChunk chunk, @NotNull final String outputDir, @NotNull final CompileContext compileContext) throws IOException {
-    @NonNls final ArrayList<String> commandLine = new ArrayList<String>();
-    ApplicationManager.getApplication().runReadAction(new ThrowableComputable<Void, IOException>() {
-      @Override
-      public Void compute() throws IOException {
-        final EclipseCompilerOptions options =
-          EclipseCompilerConfiguration.getOptions(myProject, EclipseEmbeddedCompilerConfiguration.class);
-        myEclipseExternalCompiler.addCommandLineOptions(commandLine, chunk, outputDir, options, false, false);
-        return null;
-      }
-    });
-
-    return new Process() {
-      public OutputStream getOutputStream() {
-        throw new UnsupportedOperationException();
-      }
-
-      public InputStream getInputStream() {
-        return null;
-      }
-
-      public InputStream getErrorStream() {
-        return null;
-      }
-
-      public void destroy() {
-      }
-
-      public int waitFor() {
-        try {
-          commandLine.remove("-verbose");
-          String[] finalCmds = ArrayUtil.toStringArray(commandLine);
-          myEclipseCompilerDriver.parseCommandLineAndCompile(finalCmds, compileContext);
-          myExitCode = 0;
-          return myExitCode;
-        }
-        catch (Exception e) {
-          compileContext.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
-          LOG.info(e);
-          myExitCode = -1;
-          return -1;
-        }
-      }
-
-      public int exitValue() {
-        return myExitCode;
-      }
-    };
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseEmbeddedCompilerConfiguration.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseEmbeddedCompilerConfiguration.java
deleted file mode 100755
index cb16523..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseEmbeddedCompilerConfiguration.java
+++ /dev/null
@@ -1,31 +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.compiler.impl.javaCompiler.eclipse;
-
-import com.intellij.openapi.components.State;
-import com.intellij.openapi.components.Storage;
-import com.intellij.openapi.components.StoragePathMacros;
-import com.intellij.openapi.components.StorageScheme;
-
-@State(
-  name = "EclipseEmbeddedCompilerSettings",
-  storages = {
-    @Storage(file = StoragePathMacros.PROJECT_FILE),
-    @Storage(file = StoragePathMacros.PROJECT_CONFIG_DIR + "/compiler.xml", scheme = StorageScheme.DIRECTORY_BASED)
-  }
-)
-public class EclipseEmbeddedCompilerConfiguration extends EclipseCompilerConfiguration {
-}
\ No newline at end of file
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/FilePathActionJavac.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/FilePathActionJavac.java
index fc32b08..835c4fe 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/FilePathActionJavac.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/FilePathActionJavac.java
@@ -16,14 +16,12 @@
 package com.intellij.compiler.impl.javaCompiler.javac;
 
 import com.intellij.compiler.OutputParser;
-import com.intellij.compiler.impl.javaCompiler.FileObject;
 import com.intellij.openapi.compiler.CompilerBundle;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.fileTypes.FileTypeManager;
 import com.intellij.openapi.fileTypes.StdFileTypes;
 
-import java.io.File;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -59,7 +57,7 @@
       callback.setProgressText(CompilerBundle.message("progress.parsing.file", name));
     }
     else if (StdFileTypes.CLASS.equals(fileType)) {
-      callback.fileGenerated(new FileObject(new File(filePath)));
+      callback.fileGenerated(filePath);
     }
   }
 }
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacCompiler.java
index e962a93..feb0427 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacCompiler.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacCompiler.java
@@ -15,122 +15,26 @@
  */
 package com.intellij.compiler.impl.javaCompiler.javac;
 
-import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.compiler.CompilerConfigurationImpl;
-import com.intellij.compiler.CompilerIOUtil;
-import com.intellij.compiler.OutputParser;
-import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.compiler.impl.javaCompiler.ExternalCompiler;
-import com.intellij.compiler.impl.javaCompiler.ModuleChunk;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompileScope;
+import com.intellij.compiler.impl.javaCompiler.BackendCompiler;
 import com.intellij.openapi.compiler.CompilerBundle;
-import com.intellij.openapi.compiler.CompilerPaths;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
+import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.fileTypes.StdFileTypes;
 import com.intellij.openapi.options.Configurable;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.*;
-import com.intellij.openapi.projectRoots.ex.JavaSdkUtil;
-import com.intellij.openapi.projectRoots.impl.MockJdkWrapper;
-import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.ui.Messages;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.pom.java.LanguageLevel;
-import com.intellij.rt.compiler.JavacRunner;
-import com.intellij.util.ArrayUtil;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.jps.model.java.compiler.AnnotationProcessingConfiguration;
 import org.jetbrains.jps.model.java.compiler.JavaCompilers;
-import org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions;
 
-import java.io.*;
-import java.util.*;
+import java.util.Collections;
+import java.util.Set;
 
-public class JavacCompiler extends ExternalCompiler {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.javaCompiler.javac.JavacCompiler");
+public class JavacCompiler implements BackendCompiler {
   private final Project myProject;
-  private final List<File> myTempFiles = new ArrayList<File>();
-  @NonNls private static final String JAVAC_MAIN_CLASS_OLD = "sun.tools.javac.Main";
-  @NonNls public static final String JAVAC_MAIN_CLASS = "com.sun.tools.javac.Main";
-  private boolean myAnnotationProcessorMode = false;
 
   public JavacCompiler(Project project) {
     myProject = project;
   }
 
-  public boolean isAnnotationProcessorMode() {
-    return myAnnotationProcessorMode;
-  }
-
-  /**
-   * @param annotationProcessorMode
-   * @return previous value
-   */
-  public boolean setAnnotationProcessorMode(boolean annotationProcessorMode) {
-    final boolean oldValue = myAnnotationProcessorMode;
-    myAnnotationProcessorMode = annotationProcessorMode;
-    return oldValue;
-  }
-
-  public boolean checkCompiler(final CompileScope scope) {
-    final Module[] modules = scope.getAffectedModules();
-    final Set<Sdk> checkedJdks = new HashSet<Sdk>();
-    for (final Module module : modules) {
-      final Sdk jdk  = ModuleRootManager.getInstance(module).getSdk();
-      if (jdk == null || checkedJdks.contains(jdk)) {
-        continue;
-      }
-      checkedJdks.add(jdk);
-      final SdkTypeId sdkType = jdk.getSdkType();
-      if (!(sdkType instanceof JavaSdkType)) {
-        continue;
-      }
-      final VirtualFile homeDirectory = jdk.getHomeDirectory();
-      if (homeDirectory == null) {
-        Messages.showMessageDialog(
-          myProject, CompilerBundle.jdkHomeNotFoundMessage(jdk), CompilerBundle.message("compiler.javac.name"), Messages.getErrorIcon()
-        );
-        return false;
-      }
-      final String vmExecutablePath = ((JavaSdkType)sdkType).getVMExecutablePath(jdk);
-      if (vmExecutablePath == null) {
-        Messages.showMessageDialog(
-          myProject, CompilerBundle.message("javac.error.vm.executable.missing", jdk.getName()), CompilerBundle.message("compiler.javac.name"), Messages.getErrorIcon()
-        );
-        return false;
-      }
-      final String toolsJarPath = ((JavaSdkType)sdkType).getToolsPath(jdk);
-      if (toolsJarPath == null) {
-        Messages.showMessageDialog(
-          myProject, CompilerBundle.message("javac.error.tools.jar.missing", jdk.getName()), CompilerBundle.message("compiler.javac.name"), Messages.getErrorIcon()
-        );
-        return false;
-      }
-      final String versionString = jdk.getVersionString();
-      if (versionString == null) {
-        Messages.showMessageDialog(
-          myProject, CompilerBundle.message("javac.error.unknown.jdk.version", jdk.getName()), CompilerBundle.message("compiler.javac.name"), Messages.getErrorIcon()
-        );
-        return false;
-      }
-
-      if (CompilerUtil.isOfVersion(versionString, "1.0")) {
-        Messages.showMessageDialog(
-          myProject, CompilerBundle.message("javac.error.1_0_compilation.not.supported"), CompilerBundle.message("compiler.javac.name"), Messages.getErrorIcon()
-        );
-        return false;
-      }
-    }
-
-    return true;
-  }
-
   @NotNull
   @NonNls
   public String getId() { // used for externalization
@@ -147,304 +51,8 @@
     return new JavacConfigurable(JavacConfiguration.getOptions(myProject, JavacConfiguration.class));
   }
 
-  public OutputParser createErrorParser(@NotNull final String outputDir, Process process) {
-    return new JavacOutputParser(myProject);
-  }
-
-  public OutputParser createOutputParser(@NotNull final String outputDir) {
-    return null;
-  }
-
-  private static class MyException extends RuntimeException {
-    private MyException(Throwable cause) {
-      super(cause);
-    }
-  }
-
-  @NotNull
-  public String[] createStartupCommand(final ModuleChunk chunk, final CompileContext context, final String outputPath)
-    throws IOException, IllegalArgumentException {
-
-    try {
-      return ApplicationManager.getApplication().runReadAction(new Computable<String[]>() {
-        public String[] compute() {
-          try {
-            final List<String> commandLine = new ArrayList<String>();
-            createStartupCommand(chunk, commandLine, outputPath, JavacConfiguration.getOptions(myProject, JavacConfiguration.class), context.isAnnotationProcessorsEnabled());
-            return ArrayUtil.toStringArray(commandLine);
-          }
-          catch (IOException e) {
-            throw new MyException(e);
-          }
-        }
-      });
-    }
-    catch (MyException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof IOException) {
-        throw (IOException)cause;
-      }
-      throw e;
-    }
-  }
-
-  private void createStartupCommand(final ModuleChunk chunk, @NonNls final List<String> commandLine, final String outputPath,
-                                    JpsJavaCompilerOptions javacOptions, final boolean annotationProcessorsEnabled) throws IOException {
-    final Sdk jdk = getJdkForStartupCommand(chunk);
-    final String versionString = jdk.getVersionString();
-    JavaSdkVersion version = JavaSdk.getInstance().getVersion(jdk);
-    if (versionString == null || version == null || !(jdk.getSdkType() instanceof JavaSdkType)) {
-      throw new IllegalArgumentException(CompilerBundle.message("javac.error.unknown.jdk.version", jdk.getName()));
-    }
-    final boolean isVersion1_0 = version == JavaSdkVersion.JDK_1_0;
-    final boolean isVersion1_1 = version == JavaSdkVersion.JDK_1_1;
-
-    JavaSdkType sdkType = (JavaSdkType)jdk.getSdkType();
-
-    final String toolsJarPath = sdkType.getToolsPath(jdk);
-    if (toolsJarPath == null) {
-      throw new IllegalArgumentException(CompilerBundle.message("javac.error.tools.jar.missing", jdk.getName()));
-    }
-
-    final String vmExePath = sdkType.getVMExecutablePath(jdk);
-
-    commandLine.add(vmExePath);
-
-    if (version.isAtLeast(JavaSdkVersion.JDK_1_2)) {
-      commandLine.add("-Xmx" + javacOptions.MAXIMUM_HEAP_SIZE + "m");
-    }
-    else {
-      commandLine.add("-mx" + javacOptions.MAXIMUM_HEAP_SIZE + "m");
-    }
-
-    final List<String> additionalOptions =
-      addAdditionalSettings(commandLine, javacOptions, myAnnotationProcessorMode, version, chunk, annotationProcessorsEnabled);
-
-    CompilerUtil.addLocaleOptions(commandLine, false);
-
-    commandLine.add("-classpath");
-
-    if (isVersion1_0) {
-      commandLine.add(sdkType.getToolsPath(jdk)); //  do not use JavacRunner for jdk 1.0
-    }
-    else {
-      commandLine.add(sdkType.getToolsPath(jdk) + File.pathSeparator + JavaSdkUtil.getIdeaRtJarPath());
-      commandLine.add(JavacRunner.class.getName());
-      commandLine.add("\"" + versionString + "\"");
-    }
-
-    if (version.isAtLeast(JavaSdkVersion.JDK_1_3)) {
-      commandLine.add(JAVAC_MAIN_CLASS);
-    }
-    else {
-      commandLine.add(JAVAC_MAIN_CLASS_OLD);
-    }
-
-    addCommandLineOptions(chunk, commandLine, outputPath, jdk, isVersion1_0, isVersion1_1, myTempFiles, true, true, myAnnotationProcessorMode);
-
-    commandLine.addAll(additionalOptions);
-
-    final List<VirtualFile> files = chunk.getFilesToCompile();
-
-    if (isVersion1_0) {
-      for (VirtualFile file : files) {
-        String path = file.getPath();
-        if (LOG.isDebugEnabled()) {
-          LOG.debug("Adding path for compilation " + path);
-        }
-        commandLine.add(CompilerUtil.quotePath(path));
-      }
-    }
-    else {
-      File sourcesFile = FileUtil.createTempFile("javac", ".tmp");
-      sourcesFile.deleteOnExit();
-      myTempFiles.add(sourcesFile);
-      final PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(sourcesFile)));
-      try {
-        for (final VirtualFile file : files) {
-          // Important: should use "/" slashes!
-          // but not for JDK 1.5 - see SCR 36673
-          final String path = version.isAtLeast(JavaSdkVersion.JDK_1_5) ? file.getPath().replace('/', File.separatorChar) : file.getPath();
-          if (LOG.isDebugEnabled()) {
-            LOG.debug("Adding path for compilation " + path);
-          }
-          writer.println(isVersion1_1 ? path : CompilerUtil.quotePath(path));
-        }
-      }
-      finally {
-        writer.close();
-      }
-      commandLine.add("@" + sourcesFile.getAbsolutePath());
-    }
-  }
-
-  public static List<String> addAdditionalSettings(List<String> commandLine, JpsJavaCompilerOptions javacOptions, boolean isAnnotationProcessing,
-                                                   JavaSdkVersion version, ModuleChunk chunk, boolean annotationProcessorsEnabled) {
-    final List<String> additionalOptions = new ArrayList<String>();
-    StringTokenizer tokenizer = new StringTokenizer(new JavacSettingsBuilder(javacOptions).getOptionsString(chunk), " ");
-    if (!version.isAtLeast(JavaSdkVersion.JDK_1_6)) {
-      isAnnotationProcessing = false; // makes no sense for these versions
-      annotationProcessorsEnabled = false;
-    }
-    if (isAnnotationProcessing) {
-      final AnnotationProcessingConfiguration config = CompilerConfiguration.getInstance(chunk.getProject()).getAnnotationProcessingConfiguration(chunk.getModules()[0]);
-      additionalOptions.add("-Xprefer:source");
-      additionalOptions.add("-implicit:none");
-      additionalOptions.add("-proc:only");
-      if (!config.isObtainProcessorsFromClasspath()) {
-        final String processorPath = config.getProcessorPath();
-        additionalOptions.add("-processorpath");
-        additionalOptions.add(FileUtil.toSystemDependentName(processorPath));
-      }
-      final Set<String> processors = config.getProcessors();
-      if (!processors.isEmpty()) {
-        additionalOptions.add("-processor");
-        additionalOptions.add(StringUtil.join(processors, ","));
-      }
-      for (Map.Entry<String, String> entry : config.getProcessorOptions().entrySet()) {
-        additionalOptions.add("-A" + entry.getKey() + "=" +entry.getValue());
-      }
-    }
-    else {
-      if (annotationProcessorsEnabled) {
-        // Unless explicitly specified by user, disable annotation processing by default for 'java compilation' mode
-        // This is needed to suppress unwanted side-effects from auto-discovered processors from compilation classpath
-        additionalOptions.add("-proc:none");
-      }
-    }
-
-    while (tokenizer.hasMoreTokens()) {
-      @NonNls String token = tokenizer.nextToken();
-      if (version == JavaSdkVersion.JDK_1_0 && "-deprecation".equals(token)) {
-        continue; // not supported for this version
-      }
-      if (!version.isAtLeast(JavaSdkVersion.JDK_1_5) && "-Xlint".equals(token)) {
-        continue; // not supported in these versions
-      }
-      if (isAnnotationProcessing) {
-        if (token.startsWith("-proc:")) {
-          continue;
-        }
-        if (token.startsWith("-implicit:")) {
-          continue;
-        }
-      }
-      else { // compiling java
-        if (annotationProcessorsEnabled) {
-          // in this mode we have -proc:none already added above, so user's settings should be ignored
-          if (token.startsWith("-proc:")) {
-            continue;
-          }
-        }
-      }
-      if (token.startsWith("-J-")) {
-        commandLine.add(token.substring("-J".length()));
-      }
-      else {
-        additionalOptions.add(token);
-      }
-    }
-
-    return additionalOptions;
-  }
-
-  public static void addCommandLineOptions(ModuleChunk chunk, @NonNls List<String> commandLine, String outputPath, Sdk jdk,
-                                           boolean version1_0,
-                                           boolean version1_1,
-                                           List<File> tempFiles, boolean addSourcePath, boolean useTempFile,
-                                           boolean isAnnotationProcessingMode) throws IOException {
-
-    LanguageLevel languageLevel = chunk.getLanguageLevel();
-    CompilerUtil.addSourceCommandLineSwitch(jdk, languageLevel, commandLine);
-    CompilerUtil.addTargetCommandLineSwitch(chunk, commandLine);
-
-    commandLine.add("-verbose");
-
-    final String cp = chunk.getCompilationClasspath();
-    final String bootCp = chunk.getCompilationBootClasspath();
-
-    final String classPath;
-    if (version1_0 || version1_1) {
-      classPath = bootCp + File.pathSeparator + cp;
-    }
-    else {
-      classPath = cp;
-      commandLine.add("-bootclasspath");
-      addClassPathValue(jdk, false, commandLine, bootCp, "javac_bootcp", tempFiles, useTempFile);
-    }
-
-    commandLine.add("-classpath");
-    addClassPathValue(jdk, version1_0, commandLine, classPath, "javac_cp", tempFiles, useTempFile);
-
-    if (!version1_1 && !version1_0 && addSourcePath) {
-      commandLine.add("-sourcepath");
-      // this way we tell the compiler that the sourcepath is "empty". However, javac thinks that sourcepath is 'new File("")'
-      // this may cause problems if we have java code in IDEA working directory
-      if (isAnnotationProcessingMode) {
-        final int currentSourcesMode = chunk.getSourcesFilter();
-        commandLine.add(chunk.getSourcePath(currentSourcesMode == ModuleChunk.TEST_SOURCES? ModuleChunk.ALL_SOURCES : currentSourcesMode));
-      }
-      else {
-        commandLine.add("\"\"");
-      }
-    }
-
-    if (isAnnotationProcessingMode) {
-      commandLine.add("-s");
-      commandLine.add(outputPath.replace('/', File.separatorChar));
-      final String moduleOutputPath = CompilerPaths.getModuleOutputPath(chunk.getModules()[0], false);
-      if (moduleOutputPath != null) {
-        commandLine.add("-d");
-        commandLine.add(moduleOutputPath.replace('/', File.separatorChar));
-      }
-    }
-    else {
-      commandLine.add("-d");
-      commandLine.add(outputPath.replace('/', File.separatorChar));
-    }
-  }
-
-  private static void addClassPathValue(final Sdk jdk, final boolean isVersion1_0, final List<String> commandLine, final String cpString, @NonNls final String tempFileName,
-                                        List<File> tempFiles,
-                                        boolean useTempFile) throws IOException {
-    if (!useTempFile) {
-      commandLine.add(cpString);
-      return;
-    }
-    // must include output path to classpath, otherwise javac will compile all dependent files no matter were they compiled before or not
-    if (isVersion1_0) {
-      commandLine.add(((JavaSdkType)jdk.getSdkType()).getToolsPath(jdk) + File.pathSeparator + cpString);
-    }
-    else {
-      File cpFile = FileUtil.createTempFile(tempFileName, ".tmp");
-      cpFile.deleteOnExit();
-      tempFiles.add(cpFile);
-      final DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(cpFile)));
-      try {
-        CompilerIOUtil.writeString(cpString, out);
-      }
-      finally {
-        out.close();
-      }
-      commandLine.add("@" + cpFile.getAbsolutePath());
-    }
-  }
-
-  private Sdk getJdkForStartupCommand(final ModuleChunk chunk) {
-    final Sdk jdk = chunk.getJdk();
-    if (ApplicationManager.getApplication().isUnitTestMode() && JavacConfiguration.getOptions(myProject, JavacConfiguration.class).isTestsUseExternalCompiler()) {
-      final String jdkHomePath = CompilerConfigurationImpl.getTestsExternalCompilerHome();
-      if (jdkHomePath == null) {
-        throw new IllegalArgumentException("[TEST-MODE] Cannot determine home directory for JDK to use javac from");
-      }
-      // when running under Mock JDK use VM executable from the JDK on which the tests run
-      return new MockJdkWrapper(jdkHomePath, jdk);
-    }
-    return jdk;
-  }
-
-  public void compileFinished() {
-    FileUtil.asyncDelete(myTempFiles);
-    myTempFiles.clear();
+  @NotNull 
+  public Set<FileType> getCompilableFileTypes() {
+    return Collections.<FileType>singleton(StdFileTypes.JAVA);
   }
 }
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacOutputParser.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacOutputParser.java
index ba12e69..be7db2e 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacOutputParser.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacOutputParser.java
@@ -277,7 +277,4 @@
     return Pattern.compile(regexp, Pattern.CASE_INSENSITIVE).matcher("");
   }
 
-  public boolean isTrimLines() {
-    return false;
-  }
 }
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/StatisticsActionJavac.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/StatisticsActionJavac.java
deleted file mode 100644
index d969e40..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/StatisticsActionJavac.java
+++ /dev/null
@@ -1,39 +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.compiler.impl.javaCompiler.javac;
-
-import com.intellij.compiler.OutputParser;
-import com.intellij.openapi.compiler.CompilerBundle;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.regex.Matcher;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Sep 24, 2005
- */
-public class StatisticsActionJavac extends JavacParserAction {
-  private final String myProgressMessageResourceKey;
-
-  public StatisticsActionJavac(final Matcher matcher, String progressMessageResourceKey) {
-    super(matcher);
-    myProgressMessageResourceKey = progressMessageResourceKey;
-  }
-
-  protected void doExecute(final String line, @Nullable String parsedData, final OutputParser.Callback callback) {
-    callback.setProgressText(CompilerBundle.message(myProgressMessageResourceKey));
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesCompiler.java
deleted file mode 100644
index fb0246f..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesCompiler.java
+++ /dev/null
@@ -1,231 +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.compiler.impl.javaCompiler.jikes;
-
-import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.compiler.CompilerConfigurationImpl;
-import com.intellij.compiler.OutputParser;
-import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.compiler.impl.javaCompiler.BackendCompiler;
-import com.intellij.compiler.impl.javaCompiler.ExternalCompiler;
-import com.intellij.compiler.impl.javaCompiler.ModuleChunk;
-import com.intellij.compiler.options.JavaCompilersTab;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompileScope;
-import com.intellij.openapi.compiler.CompilerBundle;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.options.Configurable;
-import com.intellij.openapi.options.ShowSettingsUtil;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.ui.Messages;
-import com.intellij.openapi.util.ThrowableComputable;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.pom.java.LanguageLevel;
-import com.intellij.util.ArrayUtil;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.StringTokenizer;
-
-public class JikesCompiler extends ExternalCompiler {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.JikesHandler");
-  private final Project myProject;
-  private File myTempFile;
-
-  public JikesCompiler(Project project) {
-    myProject = project;
-  }
-
-  public boolean checkCompiler(final CompileScope scope) {
-    String compilerPath = getCompilerPath();
-    if (StringUtil.isEmpty(compilerPath)) {
-      Messages.showMessageDialog(
-        myProject,
-        CompilerBundle.message("jikes.error.path.to.compiler.unspecified"), CompilerBundle.message("compiler.jikes.name"),
-        Messages.getErrorIcon()
-      );
-      openConfigurationDialog();
-      compilerPath = getCompilerPath(); // update path
-      if (StringUtil.isEmpty(compilerPath)) {
-        return false;
-      }
-    }
-
-    File file = new File(compilerPath);
-    if (!file.exists()) {
-      Messages.showMessageDialog(
-        myProject,
-        CompilerBundle.message("jikes.error.path.to.compiler.missing", compilerPath),
-        CompilerBundle.message("compiler.jikes.name"),
-        Messages.getErrorIcon()
-      );
-      openConfigurationDialog();
-      compilerPath = getCompilerPath(); // update path
-      if (StringUtil.isEmpty(compilerPath)) {
-        return false;
-      }
-      if (!new File(compilerPath).exists()) {
-        return false;
-      }
-    }
-
-    return true;
-  }
-
-  private void openConfigurationDialog() {
-    final CompilerConfigurationImpl configuration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject);
-    final Collection<BackendCompiler> compilers = configuration.getRegisteredJavaCompilers();
-    final BackendCompiler defaultCompiler = configuration.getDefaultCompiler();
-    final JavaCompilersTab compilersTab = new JavaCompilersTab(myProject, compilers, defaultCompiler);
-
-    ShowSettingsUtil.getInstance().editConfigurable(myProject, compilersTab);
-  }
-
-  private String getCompilerPath() {
-    return JikesConfiguration.getOptions(myProject).JIKES_PATH.replace('/', File.separatorChar);
-  }
-
-  @NotNull
-  @NonNls
-  public String getId() // used for externalization
-  {
-    return "Jikes";
-  }
-
-  @NotNull
-  public String getPresentableName() {
-    return CompilerBundle.message("compiler.jikes.name");
-  }
-
-  @NotNull
-  public Configurable createConfigurable() {
-    return new JikesConfigurable(JikesConfiguration.getOptions(myProject));
-  }
-
-  public OutputParser createErrorParser(@NotNull final String outputDir, Process process) {
-    return new JikesOutputParser(myProject);
-  }
-
-  @Nullable
-  public OutputParser createOutputParser(@NotNull final String outputDir) {
-    return null;
-  }
-
-  @NotNull
-  public String[] createStartupCommand(final ModuleChunk chunk, final CompileContext context, final String outputPath)
-    throws IOException {
-
-    final ArrayList<String> commandLine = new ArrayList<String>();
-    ApplicationManager.getApplication().runReadAction(new ThrowableComputable<Void, IOException>() {
-      @Override
-      public Void compute() throws IOException {
-        _createStartupCommand(chunk, commandLine, outputPath);
-        return null;
-      }
-    });
-    return ArrayUtil.toStringArray(commandLine);
-  }
-
-  private void _createStartupCommand(final ModuleChunk chunk, final ArrayList<String> commandLine, @NotNull final String outputPath) throws IOException {
-
-    myTempFile = FileUtil.createTempFile("jikes", ".tmp");
-    myTempFile.deleteOnExit();
-
-    final List<VirtualFile> files = chunk.getFilesToCompile();
-    PrintWriter writer = new PrintWriter(new FileWriter(myTempFile));
-    try {
-      for (VirtualFile file : files) {
-        writer.println(file.getPath());
-      }
-    }
-    finally {
-      writer.close();
-    }
-
-    String compilerPath = getCompilerPath();
-    LOG.assertTrue(compilerPath != null, "No path to compiler configured");
-
-    commandLine.add(compilerPath);
-
-    //noinspection HardCodedStringLiteral
-    commandLine.add("-verbose");
-    //noinspection HardCodedStringLiteral
-    commandLine.add("-classpath");
-
-    // must include output path to classpath, otherwise javac will compile all dependent files no matter were they compiled before or not
-    commandLine.add(chunk.getCompilationBootClasspath() + File.pathSeparator + chunk.getCompilationClasspath());
-
-    setupSourceVersion(chunk, commandLine);
-    //noinspection HardCodedStringLiteral
-    commandLine.add("-sourcepath");
-    String sourcePath = chunk.getSourcePath();
-    if (sourcePath.length() > 0) {
-      commandLine.add(sourcePath);
-    }
-    else {
-      commandLine.add("\"\"");
-    }
-
-    //noinspection HardCodedStringLiteral
-    commandLine.add("-d");
-    commandLine.add(outputPath.replace('/', File.separatorChar));
-
-    JikesSettingsBuilder jikesSettings = new JikesSettingsBuilder(JikesConfiguration.getOptions(myProject));
-    StringTokenizer tokenizer = new StringTokenizer(jikesSettings.getOptionsString(chunk), " ");
-    while (tokenizer.hasMoreTokens()) {
-      commandLine.add(tokenizer.nextToken());
-    }
-    commandLine.add("@" + myTempFile.getAbsolutePath());
-  }
-
-  @SuppressWarnings({"HardCodedStringLiteral"})
-  private static void setupSourceVersion(final ModuleChunk chunk, final ArrayList<String> commandLine) {
-    final Sdk jdk = chunk.getJdk();
-    final String versionString = jdk.getVersionString();
-
-    final LanguageLevel applicableLanguageLevel = CompilerUtil.getApplicableLanguageLevel(versionString, chunk.getLanguageLevel());
-    if (applicableLanguageLevel.equals(LanguageLevel.JDK_1_5)) {
-      commandLine.add("-source");
-      commandLine.add("1.4"); // -source 1.5 not supported yet by jikes, so use the highest possible version
-    }
-    else if (applicableLanguageLevel.equals(LanguageLevel.JDK_1_4)) {
-      commandLine.add("-source");
-      commandLine.add("1.4");
-    }
-  }
-
-
-  public void compileFinished() {
-    if (myTempFile != null) {
-      FileUtil.delete(myTempFile);
-      myTempFile = null;
-    }
-  }
-
-}
-
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesConfigurable.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesConfigurable.java
deleted file mode 100644
index 1731625..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesConfigurable.java
+++ /dev/null
@@ -1,102 +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.compiler.impl.javaCompiler.jikes;
-
-import com.intellij.compiler.options.ComparingUtils;
-import com.intellij.openapi.compiler.CompilerBundle;
-import com.intellij.openapi.fileChooser.FileChooser;
-import com.intellij.openapi.fileChooser.FileChooserDescriptor;
-import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
-import com.intellij.openapi.options.Configurable;
-import com.intellij.openapi.options.ConfigurationException;
-import com.intellij.openapi.ui.TextFieldWithBrowseButton;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.ui.RawCommandLineEditor;
-import org.jetbrains.jps.model.java.compiler.JikesCompilerOptions;
-
-import javax.swing.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Mar 30, 2004
- */
-public class JikesConfigurable implements Configurable {
-  private JPanel myPanel;
-  private JCheckBox myCbDebuggingInfo;
-  private JCheckBox myCbDeprecation;
-  private JCheckBox myCbGenerateNoWarnings;
-  private RawCommandLineEditor myAdditionalOptionsField;
-  private TextFieldWithBrowseButton myPathField;
-  private final JikesCompilerOptions myJikesSettings;
-
-  public JikesConfigurable(JikesCompilerOptions jikesSettings) {
-    myJikesSettings = jikesSettings;
-    myPathField.getButton().addActionListener(new ActionListener() {
-      public void actionPerformed(ActionEvent e) {
-        FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
-        VirtualFile file = FileChooser.chooseFile(descriptor, myPathField, null, null);
-        if (file != null) {
-          myPathField.setText(file.getPath().replace('/', File.separatorChar));
-        }
-      }
-    });
-    myAdditionalOptionsField.setDialogCaption(CompilerBundle.message("java.compiler.option.additional.command.line.parameters"));
-  }
-
-  public String getDisplayName() {
-    return null;
-  }
-
-  public String getHelpTopic() {
-    return null;
-  }
-
-  public JComponent createComponent() {
-    return myPanel;
-  }
-
-  public boolean isModified() {
-    boolean isModified = false;
-    isModified |= ComparingUtils.isModified(myPathField, myJikesSettings.JIKES_PATH.replace('/', File.separatorChar));
-    isModified |= ComparingUtils.isModified(myCbDeprecation, myJikesSettings.DEPRECATION);
-    isModified |= ComparingUtils.isModified(myCbDebuggingInfo, myJikesSettings.DEBUGGING_INFO);
-    isModified |= ComparingUtils.isModified(myCbGenerateNoWarnings, myJikesSettings.GENERATE_NO_WARNINGS);
-    isModified |= ComparingUtils.isModified(myAdditionalOptionsField, myJikesSettings.ADDITIONAL_OPTIONS_STRING);
-    return isModified;
-  }
-
-  public void apply() throws ConfigurationException {
-    myJikesSettings.JIKES_PATH = myPathField.getText().trim().replace(File.separatorChar, '/');
-    myJikesSettings.DEPRECATION = myCbDeprecation.isSelected();
-    myJikesSettings.DEBUGGING_INFO = myCbDebuggingInfo.isSelected();
-    myJikesSettings.GENERATE_NO_WARNINGS = myCbGenerateNoWarnings.isSelected();
-    myJikesSettings.ADDITIONAL_OPTIONS_STRING = myAdditionalOptionsField.getText();
-  }
-
-  public void reset() {
-    myPathField.setText(myJikesSettings.JIKES_PATH.replace('/', File.separatorChar));
-    myCbDeprecation.setSelected(myJikesSettings.DEPRECATION);
-    myCbDebuggingInfo.setSelected(myJikesSettings.DEBUGGING_INFO);
-    myCbGenerateNoWarnings.setSelected(myJikesSettings.GENERATE_NO_WARNINGS);
-    myAdditionalOptionsField.setText(myJikesSettings.ADDITIONAL_OPTIONS_STRING);
-  }
-
-  public void disposeUIResources() {
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesConfiguration.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesConfiguration.java
deleted file mode 100755
index 2899246..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesConfiguration.java
+++ /dev/null
@@ -1,46 +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.compiler.impl.javaCompiler.jikes;
-
-import com.intellij.openapi.components.*;
-import com.intellij.openapi.project.Project;
-import com.intellij.util.xmlb.XmlSerializerUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.jps.model.java.compiler.JikesCompilerOptions;
-
-@State(
-  name = "JikesSettings",
-  storages = {
-    @Storage(file = StoragePathMacros.PROJECT_FILE),
-    @Storage(file = StoragePathMacros.PROJECT_CONFIG_DIR + "/compiler.xml", scheme = StorageScheme.DIRECTORY_BASED)
-  }
-)
-public class JikesConfiguration implements PersistentStateComponent<JikesCompilerOptions> {
-  private final JikesCompilerOptions mySettings = new JikesCompilerOptions();
-
-  @NotNull
-  public JikesCompilerOptions getState() {
-    return mySettings;
-  }
-
-  public void loadState(JikesCompilerOptions state) {
-    XmlSerializerUtil.copyBean(state, mySettings);
-  }
-
-  public static JikesCompilerOptions getOptions(Project project) {
-    return ServiceManager.getService(project, JikesConfiguration.class).getState();
-  }
-}
\ No newline at end of file
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesOptionsPanel.form b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesOptionsPanel.form
deleted file mode 100644
index 23055ee..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesOptionsPanel.form
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.compiler.impl.javaCompiler.jikes.JikesConfigurable">
-  <grid id="66887" binding="myPanel" layout-manager="GridLayoutManager" row-count="6" 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="103" y="66" width="439" height="254"/>
-    </constraints>
-    <properties/>
-    <clientProperties>
-      <BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
-    </clientProperties>
-    <border type="etched" title-resource-bundle="messages/CompilerBundle" title-key="jikes.options.group.title"/>
-    <children>
-      <component id="3d38f" class="javax.swing.JCheckBox" binding="myCbDebuggingInfo">
-        <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>
-          <margin top="5" left="2" bottom="2" right="2"/>
-          <selected value="true"/>
-          <text resource-bundle="messages/CompilerBundle" key="java.compiler.option.generate.debugging.info"/>
-        </properties>
-      </component>
-      <component id="90803" class="javax.swing.JCheckBox" binding="myCbGenerateNoWarnings">
-        <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>
-          <margin top="2" left="2" bottom="2" right="3"/>
-          <selected value="true"/>
-          <text resource-bundle="messages/CompilerBundle" key="java.compiler.option.generate.no.warnings"/>
-        </properties>
-      </component>
-      <component id="8538e" class="javax.swing.JCheckBox" binding="myCbDeprecation">
-        <constraints>
-          <grid row="3" 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>
-          <margin top="2" left="2" bottom="5" right="2"/>
-          <selected value="true"/>
-          <text resource-bundle="messages/CompilerBundle" key="java.compiler.option.report.deprecated"/>
-        </properties>
-      </component>
-      <vspacer id="b6f66">
-        <constraints>
-          <grid row="5" 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>
-      <grid id="31c1" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-        <margin top="0" left="0" bottom="0" right="0"/>
-        <constraints>
-          <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="415eb" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myPathField">
-            <constraints>
-              <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-            </constraints>
-            <properties/>
-          </component>
-          <component id="327dc" class="javax.swing.JLabel">
-            <constraints>
-              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-            </constraints>
-            <properties>
-              <text resource-bundle="messages/CompilerBundle" key="jikes.option.path.to.executable"/>
-            </properties>
-          </component>
-        </children>
-      </grid>
-      <grid id="918d2" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-        <margin top="0" left="0" bottom="0" right="0"/>
-        <constraints>
-          <grid row="4" 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="f8a80" class="javax.swing.JLabel">
-            <constraints>
-              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-            </constraints>
-            <properties>
-              <text resource-bundle="messages/CompilerBundle" key="java.compiler.option.additional.command.line.parameters"/>
-            </properties>
-          </component>
-          <component id="479c2" class="com.intellij.ui.RawCommandLineEditor" binding="myAdditionalOptionsField">
-            <constraints>
-              <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
-                <preferred-size width="150" height="-1"/>
-              </grid>
-            </constraints>
-            <properties/>
-          </component>
-        </children>
-      </grid>
-    </children>
-  </grid>
-</form>
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesOutputParser.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesOutputParser.java
deleted file mode 100644
index 1d5bb00..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesOutputParser.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.compiler.impl.javaCompiler.jikes;
-
-import com.intellij.compiler.OutputParser;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFileManager;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.jps.model.java.compiler.JikesCompilerOptions;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-
-public class JikesOutputParser extends OutputParser {
-  private final JikesCompilerOptions myJikesSettings;
-  @NonNls private static final String JAVA_FILE_MSG_TAIL = ".java:";
-  @NonNls private static final String CAUTION = "Caution";
-  @NonNls private static final String WARNING = "Warning";
-  @NonNls private static final String ERROR = "Error";
-  @NonNls private static final String SEMANTIC_WARNING = "Semantic Warning";
-  @NonNls private static final String SEMANTIC_ERROR = "Semantic Error";
-  @NonNls private static final String ENTER_TO_CONTINUE_REGEXP = ".*Enter\\s+to\\s+continue.*";
-
-  public JikesOutputParser(Project project) {
-    myJikesSettings = JikesConfiguration.getOptions(project);
-    myParserActions.add(new ParserActionJikes());
-  }
-
-  public boolean processMessageLine(Callback callback) {
-    if (super.processMessageLine(callback)) {
-      return true;
-    }
-    String line = callback.getCurrentLine();
-    if (line == null) {
-      return false;
-    }
-    if (line.length() == 0) {
-      return false;
-    }
-//sae
-    if (myJikesSettings.IS_EMACS_ERRORS_MODE) {
-
-      String filePath = "";
-      final int tailIndex = line.indexOf(JAVA_FILE_MSG_TAIL);
-      if (tailIndex > 5) filePath = line.substring(0, tailIndex + 5);
-      filePath = filePath.replace(File.separatorChar, '/');
-      final String url = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, filePath);
-      if (tailIndex > 6) {
-        line = line.substring(tailIndex + 6);
-        int lineNum;
-
-//second token = start line
-        StringTokenizer tokenizer = new StringTokenizer(line, ":");
-//first token = filename
-        String token = tokenizer.nextToken();
-
-        try {
-          lineNum = Integer.parseInt(token);
-        }
-        catch (Exception e) {
-          addMessage(callback, CompilerMessageCategory.INFORMATION, line);
-          return true;
-        }
-//thrd token = start column
-        token = tokenizer.nextToken();
-        int colNum;
-        try {
-          colNum = Integer.parseInt(token);
-        }
-        catch (Exception e) {
-          addMessage(callback, CompilerMessageCategory.INFORMATION, line);
-          return true;
-        }
-//4,5 token = end line/column   tmp not used
-        tokenizer.nextToken();
-        tokenizer.nextToken();
-// 6 error type
-        CompilerMessageCategory category = CompilerMessageCategory.INFORMATION;
-        token = tokenizer.nextToken().trim();
-        if (CAUTION.equalsIgnoreCase(token)) {
-          category = CompilerMessageCategory.WARNING;
-        }
-        else if (WARNING.equalsIgnoreCase(token) || SEMANTIC_WARNING.equalsIgnoreCase(token)) { // Semantic errors/warnings were introduced in jikes 1.18
-          category = CompilerMessageCategory.WARNING;
-        }
-        else if (ERROR.equalsIgnoreCase(token) || SEMANTIC_ERROR.equalsIgnoreCase(token)) {
-          category = CompilerMessageCategory.ERROR;
-        }
-
-        String message = token;
-        message = message.concat("  ");
-        message = message.concat(tokenizer.nextToken(""));
-        ArrayList<String> messages = new ArrayList<String>();
-        messages.add(message);
-
-        if (colNum > 0 && messages.size() > 0) {
-          StringBuilder buf = new StringBuilder();
-          for (String m : messages) {
-            if (buf.length() > 0) {
-              buf.append("\n");
-            }
-            buf.append(m);
-          }
-          addMessage(callback, category, buf.toString(), url, lineNum, colNum);
-          return true;
-        }
-      }
-    }
-//--sae
-
-//Enter to continue
-    if (!line.matches(ENTER_TO_CONTINUE_REGEXP)) {
-      addMessage(callback, CompilerMessageCategory.INFORMATION, line);
-    }
-    return true;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesSettingsBuilder.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesSettingsBuilder.java
deleted file mode 100644
index 636db21..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesSettingsBuilder.java
+++ /dev/null
@@ -1,50 +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.compiler.impl.javaCompiler.jikes;
-
-import com.intellij.compiler.impl.javaCompiler.javac.JavacSettingsBuilder;
-import com.intellij.openapi.module.Module;
-import com.intellij.util.Chunk;
-import org.jetbrains.jps.model.java.compiler.JikesCompilerOptions;
-
-import java.util.Collection;
-
-public class JikesSettingsBuilder extends JavacSettingsBuilder {
-
-  public JikesSettingsBuilder(JikesCompilerOptions options) {
-    super(options);
-  }
-
-  @Override
-  public JikesCompilerOptions getOptions() {
-    return (JikesCompilerOptions)super.getOptions();
-  }
-
-  public Collection<String> getOptions(Chunk<Module> chunk) {
-    final Collection<String> options = super.getOptions(chunk);
-    if(getOptions().IS_EMACS_ERRORS_MODE) {
-      options.add("+E");
-    }
-    return options;
-  }
-
-  protected boolean acceptUserOption(String token) {
-    if (!super.acceptUserOption(token)) {
-      return false;
-    }
-    return !("++".equals(token) || "+M".equals(token) || "+F".equals(token) || "+E".equals(token));
-  }
-}
\ No newline at end of file
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/ParserActionJikes.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/ParserActionJikes.java
deleted file mode 100644
index ba1884f..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/ParserActionJikes.java
+++ /dev/null
@@ -1,88 +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.compiler.impl.javaCompiler.jikes;
-
-import com.intellij.openapi.compiler.CompilerBundle;
-import com.intellij.openapi.fileTypes.FileType;
-import com.intellij.openapi.fileTypes.FileTypeManager;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.compiler.ParserAction;
-import com.intellij.compiler.OutputParser;
-import com.intellij.compiler.impl.javaCompiler.FileObject;
-import org.jetbrains.annotations.NonNls;
-
-import java.io.File;
-
-/**
- * This class provides compatibility with older javac(english locale) and jikes versions and
- * implements parsing method from previous IDEA versions for jikes and javac compiler output.
- * Used in order not to miss some compiler output messages when jikes is configured as a preferred compiler
- * Also used in test mode in which javac is not run via JavacRunner
- *
- * @author Eugene Zhuravlev
- *         Date: Sep 24, 2005
- */
-public class ParserActionJikes extends ParserAction {
-  @NonNls private static final String JAVA_EXTENSION = ".java";
-
-  public boolean execute(@NonNls String line, final OutputParser.Callback callback) {
-    if (!StringUtil.startsWithChar(line, '[') || !StringUtil.endsWithChar(line, ']')) {
-      return false;
-    }
-    if (line.startsWith("[parsing started")){ // javac
-      String filePath = line.substring("[parsing started".length(), line.length() - 1).trim();
-      processParsingMessage(callback, filePath.replace(File.separatorChar, '/'));
-    }
-    else if (line.startsWith("[parsed") && line.contains(JAVA_EXTENSION)) { // javac version 1.2.2
-      int index = line.indexOf(JAVA_EXTENSION);
-      String filePath = line.substring("[parsed".length(), index + JAVA_EXTENSION.length()).trim();
-      processParsingMessage(callback, filePath.replace(File.separatorChar, '/'));
-    }
-    else if (line.startsWith("[read") && line.endsWith(".java]")){ // jikes
-      String filePath = line.substring("[read".length(), line.length() - 1).trim();
-      processParsingMessage(callback, filePath.replace(File.separatorChar, '/'));
-    }
-    else if (line.startsWith("[parsing completed")){
-    }
-    else if (line.startsWith("[loading") || line.startsWith("[loaded") || line.startsWith("[read")){
-      callback.setProgressText(CompilerBundle.message("progress.loading.classes"));
-    }
-    else if (line.startsWith("[checking")){
-      String className = line.substring("[checking".length(), line.length() - 1).trim();
-      callback.setProgressText(CompilerBundle.message("progress.compiling.class", className));
-    }
-    else if (line.startsWith("[wrote") || line.startsWith("[write")){
-      String filePath = line.substring("[wrote".length(), line.length() - 1).trim();
-      processParsingMessage(callback, filePath.replace(File.separatorChar, '/'));
-    }
-    return true;
-  }
-
-  private static void processParsingMessage(final OutputParser.Callback callback, @NonNls final String filePath) {
-    int index = filePath.lastIndexOf('/');
-    final String name = index >= 0 ? filePath.substring(index + 1) : filePath;
-
-    final FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(name);
-    if (StdFileTypes.JAVA.equals(fileType)) {
-      callback.fileProcessed(filePath);
-      callback.setProgressText(CompilerBundle.message("progress.parsing.file", name));
-    }
-    else if (StdFileTypes.CLASS.equals(fileType)) {
-      callback.fileGenerated(new FileObject(new File(filePath)));
-    }
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/BuildRecipeImpl.java b/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/BuildRecipeImpl.java
deleted file mode 100644
index 03e62a0..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/packagingCompiler/BuildRecipeImpl.java
+++ /dev/null
@@ -1,80 +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 cdr
- */
-package com.intellij.compiler.impl.packagingCompiler;
-
-import com.intellij.openapi.compiler.make.BuildInstruction;
-import com.intellij.openapi.compiler.make.BuildInstructionVisitor;
-import com.intellij.openapi.compiler.make.BuildRecipe;
-import com.intellij.openapi.deployment.DeploymentUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-@Deprecated
-public class BuildRecipeImpl implements BuildRecipe {
-  private final List<BuildInstruction> myInstructions = new ArrayList<BuildInstruction>();
-
-  public void addInstruction(BuildInstruction instruction) {
-    if (!contains(instruction)) {
-      myInstructions.add(instruction);
-    }
-  }
-
-  public boolean contains(final BuildInstruction instruction) {
-    return myInstructions.contains(instruction);
-  }
-
-  public boolean visitInstructions(BuildInstructionVisitor visitor, boolean reverseOrder){
-    try {
-      return visitInstructionsWithExceptions(visitor, reverseOrder);
-    }
-    catch (Exception e) {
-      if (e instanceof RuntimeException) {
-        throw (RuntimeException)e;
-      }
-      return false;
-    }
-  }
-  public boolean visitInstructionsWithExceptions(BuildInstructionVisitor visitor, boolean reverseOrder) throws Exception {
-    for (int i = reverseOrder ? myInstructions.size()-1 : 0;
-         reverseOrder ? i>=0 : i < myInstructions.size();
-         i += reverseOrder ? -1 : 1) {
-      BuildInstruction instruction = myInstructions.get(i);
-      if (!instruction.accept(visitor)) {
-        return false;
-      }
-    }
-    return true;
-  }
-
-  public void addFileCopyInstruction(@NotNull File file, boolean isDirectory, String outputRelativePath) {
-    addInstruction(new FileCopyInstructionImpl(file, isDirectory, DeploymentUtil.trimForwardSlashes(outputRelativePath)));
-  }
-
-  public String toString() {
-    String s = "Build recipe:";
-    for (BuildInstruction buildInstruction : myInstructions) {
-      s += "\n" + buildInstruction + "; ";
-    }
-    return s;
-  }
-}
\ No newline at end of file
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/resourceCompiler/ResourceCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/resourceCompiler/ResourceCompiler.java
deleted file mode 100644
index 3efbec2..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/resourceCompiler/ResourceCompiler.java
+++ /dev/null
@@ -1,236 +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: Eugene Zhuravlev
- * Date: Jan 17, 2003
- * Time: 3:48:26 PM
- */
-package com.intellij.compiler.impl.resourceCompiler;
-
-import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.compiler.CompilerConfigurationImpl;
-import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.compiler.make.MakeUtil;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.ProjectFileIndex;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.VfsUtilCore;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.VirtualFileManager;
-import com.intellij.util.Chunk;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-
-public class ResourceCompiler implements TranslatingCompiler {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.resourceCompiler.ResourceCompiler");
-  private final Project myProject;
-  private final CompilerConfiguration myConfiguration;
-  private final ResourceCompilerExtension[] myResourceCompilerExtensions = ResourceCompilerExtension.EP_NAME.getExtensions();
-
-  public ResourceCompiler(Project project, CompilerConfiguration compilerConfiguration) {
-    myProject = project;
-    myConfiguration = compilerConfiguration;
-  }
-
-  @NotNull
-  public String getDescription() {
-    return CompilerBundle.message("resource.compiler.description");
-  }
-
-  public boolean validateConfiguration(CompileScope scope) {
-    ((CompilerConfigurationImpl) CompilerConfiguration.getInstance(myProject)).convertPatterns();
-    return true;
-  }
-
-  public boolean isCompilableFile(VirtualFile file, CompileContext context) {
-    final Module module = context.getModuleByFile(file);
-    if (module != null && skipStandardResourceCompiler(module)) {
-      return false;
-    }
-    return myConfiguration.isResourceFile(file);
-  }
-
-  public void compile(final CompileContext context, Chunk<Module> moduleChunk, final VirtualFile[] files, OutputSink sink) {
-    context.getProgressIndicator().pushState();
-    context.getProgressIndicator().setText(CompilerBundle.message("progress.copying.resources"));
-
-    final Map<String, Collection<OutputItem>> processed = new HashMap<String, Collection<OutputItem>>();
-    final LinkedList<CopyCommand> copyCommands = new LinkedList<CopyCommand>();
-    final Module singleChunkModule = moduleChunk.getNodes().size() == 1? moduleChunk.getNodes().iterator().next() : null;
-    ApplicationManager.getApplication().runReadAction(new Runnable() {
-      public void run() {
-        final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
-        for (final VirtualFile file : files) {
-          if (context.getProgressIndicator().isCanceled()) {
-            break;
-          }
-          final Module module = singleChunkModule != null? singleChunkModule : context.getModuleByFile(file);
-          if (module == null) {
-            continue; // looks like file invalidated
-          }
-          final VirtualFile fileRoot = MakeUtil.getSourceRoot(context, module, file);
-          if (fileRoot == null) {
-            continue;
-          }
-          final String sourcePath = file.getPath();
-          final String relativePath = VfsUtilCore.getRelativePath(file, fileRoot, '/');
-          final boolean inTests = ((CompileContextEx)context).isInTestSourceContent(file);
-          final VirtualFile outputDir = inTests? context.getModuleOutputDirectoryForTests(module) : context.getModuleOutputDirectory(module);
-          if (outputDir == null) {
-            continue;
-          }
-          final String outputPath = outputDir.getPath();
-          
-          final String packagePrefix = fileIndex.getPackageNameByDirectory(fileRoot);
-          final String targetPath;
-          if (packagePrefix != null && packagePrefix.length() > 0) {
-            targetPath = outputPath + "/" + packagePrefix.replace('.', '/') + "/" + relativePath;
-          }
-          else {
-            targetPath = outputPath + "/" + relativePath;
-          }
-          if (sourcePath.equals(targetPath)) {
-            addToMap(processed, outputPath, new MyOutputItem(targetPath, file));
-          }
-          else {
-            copyCommands.add(new CopyCommand(outputPath, sourcePath, targetPath, file));
-          }
-        }
-      }
-    });
-
-    final List<File> filesToRefresh = new ArrayList<File>();
-    // do actual copy outside of read action to reduce the time the application is locked on it
-    while (!copyCommands.isEmpty()) {
-      final CopyCommand command = copyCommands.removeFirst();
-      if (context.getProgressIndicator().isCanceled()) {
-        break;
-      }
-      //context.getProgressIndicator().setFraction((idx++) * 1.0 / total);
-      context.getProgressIndicator().setText2("Copying " + command.getFromPath() + "...");
-      try {
-        final MyOutputItem outputItem = command.copy(filesToRefresh);
-        addToMap(processed, command.getOutputPath(), outputItem);
-      }
-      catch (IOException e) {
-        context.addMessage(
-          CompilerMessageCategory.ERROR,
-          CompilerBundle.message("error.copying", command.getFromPath(), command.getToPath(), e.getMessage()),
-          command.getSourceFileUrl(), -1, -1
-        );
-      }
-    }
-
-    if (!filesToRefresh.isEmpty()) {
-      CompilerUtil.refreshIOFiles(filesToRefresh);
-      filesToRefresh.clear();
-    }
-
-    for (Iterator<Map.Entry<String, Collection<OutputItem>>> it = processed.entrySet().iterator(); it.hasNext();) {
-      Map.Entry<String, Collection<OutputItem>> entry = it.next();
-      sink.add(entry.getKey(), entry.getValue(), VirtualFile.EMPTY_ARRAY);
-      it.remove(); // to free memory
-    }
-    context.getProgressIndicator().popState();
-  }
-
-  private boolean skipStandardResourceCompiler(final Module module) {
-    for (ResourceCompilerExtension extension : myResourceCompilerExtensions) {
-      if (extension.skipStandardResourceCompiler(module)) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  private static void addToMap(Map<String, Collection<OutputItem>> map, String outputDir, OutputItem item) {
-    Collection<OutputItem> list = map.get(outputDir);
-    if (list == null) {
-      list = new ArrayList<OutputItem>();
-      map.put(outputDir, list);
-    }
-    list.add(item);
-  }
-
-  private static class CopyCommand {
-    private final String myOutputPath;
-    private final String myFromPath;
-    private final String myToPath;
-    private final VirtualFile mySourceFile;
-
-    private CopyCommand(String outputPath, String fromPath, String toPath, VirtualFile sourceFile) {
-      myOutputPath = outputPath;
-      myFromPath = fromPath;
-      myToPath = toPath;
-      mySourceFile = sourceFile;
-    }
-
-    public MyOutputItem copy(List<File> filesToRefresh) throws IOException {
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Copying " + myFromPath + " to " + myToPath);
-      }
-      final File targetFile = new File(myToPath);
-      FileUtil.copyContent(new File(myFromPath), targetFile);
-      filesToRefresh.add(targetFile);
-      return new MyOutputItem(myToPath, mySourceFile);
-    }
-
-    public String getOutputPath() {
-      return myOutputPath;
-    }
-
-    public String getFromPath() {
-      return myFromPath;
-    }
-
-    public String getToPath() {
-      return myToPath;
-    }
-
-    public String getSourceFileUrl() {
-      // do not use mySourseFile.getUrl() directly as it requires read action
-      return VirtualFileManager.constructUrl(mySourceFile.getFileSystem().getProtocol(), myFromPath);
-    }
-  }
-
-  private static class MyOutputItem implements OutputItem {
-    private final String myTargetPath;
-    private final VirtualFile myFile;
-
-    private MyOutputItem(String targetPath, VirtualFile sourceFile) {
-      myTargetPath = targetPath;
-      myFile = sourceFile;
-    }
-
-    public String getOutputPath() {
-      return myTargetPath;
-    }
-
-    public VirtualFile getSourceFile() {
-      return myFile;
-    }
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/resourceCompiler/ResourceCompilerExtension.java b/java/compiler/impl/src/com/intellij/compiler/impl/resourceCompiler/ResourceCompilerExtension.java
deleted file mode 100644
index 47d901c..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/resourceCompiler/ResourceCompilerExtension.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.intellij.compiler.impl.resourceCompiler;
-
-import com.intellij.openapi.extensions.ExtensionPointName;
-import com.intellij.openapi.module.Module;
-import org.jetbrains.annotations.NotNull;
-
-public abstract class ResourceCompilerExtension {
-  public static final ExtensionPointName<ResourceCompilerExtension> EP_NAME =
-    ExtensionPointName.create("com.intellij.compiler.resourceCompilerExtension");
-
-  public boolean skipStandardResourceCompiler(final @NotNull Module module) {
-    return false;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/rmiCompiler/JavacOutputParserPool.java b/java/compiler/impl/src/com/intellij/compiler/impl/rmiCompiler/JavacOutputParserPool.java
deleted file mode 100644
index cc99f2d..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/rmiCompiler/JavacOutputParserPool.java
+++ /dev/null
@@ -1,117 +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.compiler.impl.rmiCompiler;
-
-import com.intellij.compiler.OutputParser;
-import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.compiler.impl.javaCompiler.CompilerParsingThread;
-import com.intellij.compiler.impl.javaCompiler.javac.JavacOutputParser;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompilerBundle;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.JavaSdkType;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.projectRoots.ex.JavaSdkUtil;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.rt.compiler.JavacResourcesReader;
-import com.intellij.util.ArrayUtil;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Oct 10, 2005
- */
-public class JavacOutputParserPool {
-  protected final Project myProject;
-  private final CompileContext myContext;
-  private final Map<Sdk, OutputParser> myProjectToParserMap = new HashMap<Sdk, OutputParser>();
-
-  protected JavacOutputParserPool(Project project, final CompileContext context) {
-    myProject = project;
-    myContext = context;
-  }
-
-  public OutputParser getJavacOutputParser(Sdk jdk) throws IOException {
-    OutputParser outputParser = myProjectToParserMap.get(jdk);
-    if (outputParser == null) {
-      outputParser = createJavacOutputParser(jdk);
-      myProjectToParserMap.put(jdk, outputParser);
-    }
-    return outputParser;
-  }
-
-  private OutputParser createJavacOutputParser(final Sdk jdk) throws IOException {
-    final JavacOutputParser outputParser = new JavacOutputParser(myProject);
-    // first, need to setup the output parser
-    final String[] setupCmdLine = ApplicationManager.getApplication().runReadAction(new Computable<String[]>() {
-      public String[] compute() {
-        return createParserSetupCommand(jdk);
-      }
-    });
-    final Process setupProcess = Runtime.getRuntime().exec(setupCmdLine);
-
-    final CompilerParsingThread setupProcessParsingThread = new CompilerParsingThread(setupProcess, outputParser, true, true,myContext);
-    final Future<?> parsingThreadFuture = ApplicationManager.getApplication().executeOnPooledThread(setupProcessParsingThread);
-    try {
-      setupProcess.waitFor();
-    }
-    catch (InterruptedException ignored) {
-    }
-    finally {
-      setupProcessParsingThread.setProcessTerminated(true);
-    }
-    try {
-      parsingThreadFuture.get();
-    }
-    catch (InterruptedException e) {
-    }
-    catch (ExecutionException e) {
-    }
-    return outputParser;
-  }
-
-  private static String[] createParserSetupCommand(final Sdk jdk) {
-
-    final VirtualFile homeDirectory = jdk.getHomeDirectory();
-    if (homeDirectory == null) {
-      throw new IllegalArgumentException(CompilerBundle.jdkHomeNotFoundMessage(jdk));
-    }
-
-    final List<String> commandLine = new ArrayList<String>();
-    commandLine.add(((JavaSdkType)jdk.getSdkType()).getVMExecutablePath(jdk));
-
-    CompilerUtil.addLocaleOptions(commandLine, false);
-
-    //noinspection HardCodedStringLiteral
-    commandLine.add("-classpath");
-    commandLine.add(((JavaSdkType)jdk.getSdkType()).getToolsPath(jdk) + File.pathSeparator + JavaSdkUtil.getIdeaRtJarPath());
-
-    commandLine.add(JavacResourcesReader.class.getName());
-
-    return ArrayUtil.toStringArray(commandLine);
-  }
-
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/rmiCompiler/RmicCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/rmiCompiler/RmicCompiler.java
deleted file mode 100644
index 142b6e6..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/rmiCompiler/RmicCompiler.java
+++ /dev/null
@@ -1,522 +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.compiler.impl.rmiCompiler;
-
-import com.intellij.compiler.OutputParser;
-import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.compiler.impl.javaCompiler.CompilerParsingThread;
-import com.intellij.compiler.impl.javaCompiler.FileObject;
-import com.intellij.compiler.make.Cache;
-import com.intellij.compiler.make.CacheCorruptedException;
-import com.intellij.compiler.make.DependencyCache;
-import com.intellij.compiler.make.MakeUtil;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.roots.OrderEnumerator;
-import com.intellij.openapi.roots.ProjectFileIndex;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VfsUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.Chunk;
-import com.intellij.util.PathsList;
-import com.intellij.util.containers.ContainerUtil;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Mar 29, 2004
- */
-
-public class RmicCompiler implements ClassPostProcessingCompiler{
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.rmiCompiler.RmicCompiler");
-  //private static final FileFilter CLASSES_AND_DIRECTORIES_FILTER = new FileFilter() {
-  //  public boolean accept(File pathname) {
-  //    return pathname.isDirectory() || pathname.getName().endsWith(".class");
-  //  }
-  //};
-  //private static final String REMOTE_INTERFACE_NAME = Remote.class.getName();
-
-  @NotNull
-  public ProcessingItem[] getProcessingItems(final CompileContext context) {
-    if (!RmicConfiguration.getOptions(context.getProject()).IS_EANABLED) {
-      return ProcessingItem.EMPTY_ARRAY;
-    }
-    final Project project = context.getProject();
-    final List<ProcessingItem> items = new ArrayList<ProcessingItem>();
-    ApplicationManager.getApplication().runReadAction(new Runnable() {
-      public void run() {
-        DependencyCache dependencyCache = ((CompileContextEx)context).getDependencyCache();
-        try {
-          final Cache cache = dependencyCache.getCache();
-          final int[] allClassNames = cache.getAllClassNames();
-          final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
-          final LocalFileSystem lfs = LocalFileSystem.getInstance();
-          for (final int className : allClassNames) {
-            final boolean isRemoteObject = cache.isRemote(className) && !MakeUtil.isInterface(cache.getFlags(className));
-            if (!isRemoteObject && !dependencyCache.wasRemote(className)) {
-              continue;
-            }
-            final String outputPath = cache.getPath(className);
-            if (outputPath == null) {
-              continue;
-            }
-            final VirtualFile outputClassFile = lfs.findFileByPath(outputPath.replace(File.separatorChar, '/'));
-            if (outputClassFile == null) {
-              continue;
-            }
-            final VirtualFile sourceFile = ((CompileContextEx)context).getSourceFileByOutputFile(outputClassFile);
-            if (sourceFile == null) {
-              continue;
-            }
-            final Module module = context.getModuleByFile(sourceFile);
-            if (module == null) {
-              continue;
-            }
-            final VirtualFile outputDir = fileIndex.isInTestSourceContent(sourceFile)
-                                          ? context.getModuleOutputDirectoryForTests(module)
-                                          : context.getModuleOutputDirectory(module);
-            if (outputDir == null) {
-              continue;
-            }
-
-            if (!VfsUtil.isAncestor(outputDir, outputClassFile, true)) {
-              LOG.error(outputClassFile.getPath() + " should be located under the output root " + outputDir.getPath());
-            }
-
-            final ProcessingItem item = createProcessingItem(module, outputClassFile, outputDir,
-                                                             isRemoteObject, dependencyCache.resolve(className));
-            items.add(item);
-          }
-        }
-        catch (CacheCorruptedException e) {
-          context.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
-          LOG.info(e);
-        }
-      }
-    });
-
-    return items.toArray(new ProcessingItem[items.size()]);
-  }
-
-  public static ProcessingItem createProcessingItem(final Module module,
-                                             final VirtualFile outputClassFile,
-                                             final VirtualFile outputDir,
-                                             final boolean remoteObject, String qName) {
-    final RmicProcessingItem item = new RmicProcessingItem(
-      module, outputClassFile, new File(outputDir.getPath()), qName
-    );
-    item.setIsRemoteObject(remoteObject);
-    return item;
-  }
-
-  public ProcessingItem[] process(CompileContext context, ProcessingItem[] items) {
-    final Project project = context.getProject();
-    if (!RmicConfiguration.getOptions(project).IS_EANABLED) {
-      return ProcessingItem.EMPTY_ARRAY;
-    }
-    final ProgressIndicator progressIndicator = context.getProgressIndicator();
-    progressIndicator.pushState();
-    try {
-      progressIndicator.setText(CompilerBundle.message("progress.generating.rmi.stubs"));
-      final Map<Pair<Module, File>, List<RmicProcessingItem>> sortedByModuleAndOutputPath = new HashMap<Pair<Module,File>, List<RmicProcessingItem>>();
-      for (ProcessingItem item1 : items) {
-        final RmicProcessingItem item = (RmicProcessingItem)item1;
-        final Pair<Module, File> moduleOutputPair = Pair.create(item.getModule(), item.getOutputDir());
-        List<RmicProcessingItem> dirItems = sortedByModuleAndOutputPath.get(moduleOutputPair);
-        if (dirItems == null) {
-          dirItems = new ArrayList<RmicProcessingItem>();
-          sortedByModuleAndOutputPath.put(moduleOutputPair, dirItems);
-        }
-        dirItems.add(item);
-      }
-      final List<ProcessingItem> processed = new ArrayList<ProcessingItem>();
-
-      final JavacOutputParserPool parserPool = new JavacOutputParserPool(project, context);
-
-      for (final Pair<Module, File> pair : sortedByModuleAndOutputPath.keySet()) {
-        if (progressIndicator.isCanceled()) {
-          break;
-        }
-        final List<RmicProcessingItem> dirItems = sortedByModuleAndOutputPath.get(pair);
-        try {
-          // should delete all previously generated files for the remote class if there are any
-          for (Iterator itemIterator = dirItems.iterator(); itemIterator.hasNext();) {
-            final RmicProcessingItem item = (RmicProcessingItem)itemIterator.next();
-            item.deleteGeneratedFiles();
-            if (!item.isRemoteObject()) {
-              itemIterator
-                .remove(); // the object was remote and currently is not, so remove it from the list and do not generate stubs for it
-            }
-          }
-          if (!dirItems.isEmpty()) {
-            final RmicProcessingItem[] successfullyProcessed = invokeRmic(context, parserPool, pair.getFirst(), dirItems, pair.getSecond());
-            ContainerUtil.addAll(processed, successfullyProcessed);
-          }
-          progressIndicator.setFraction(((double)processed.size()) / ((double)items.length));
-        }
-        catch (IOException e) {
-          context.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
-          LOG.info(e);
-        }
-      }
-      // update state so that the latest timestamps are recorded by make
-      final ProcessingItem[] processedItems = processed.toArray(new ProcessingItem[processed.size()]);
-      final List<File> filesToRefresh = new ArrayList<File>(processedItems.length * 3);
-      for (ProcessingItem processedItem : processedItems) {
-        RmicProcessingItem item = (RmicProcessingItem)processedItem;
-        item.updateState();
-        filesToRefresh.add(item.myStub);
-        filesToRefresh.add(item.mySkel);
-        filesToRefresh.add(item.myTie);
-      }
-      CompilerUtil.refreshIOFiles(filesToRefresh);
-      return processedItems;
-    }
-    finally {
-      progressIndicator.popState();
-    }
-  }
-
-  private static RmicProcessingItem[] invokeRmic(final CompileContext context,
-                                          final JavacOutputParserPool parserPool, final Module module,
-                                          final List<RmicProcessingItem> dirItems,
-                                          final File outputDir
-  ) throws IOException{
-
-    final Sdk jdk = ModuleRootManager.getInstance(module).getSdk();
-
-    final Map<String, RmicProcessingItem> pathToItemMap = new HashMap<String, RmicProcessingItem>();
-    final String[] cmdLine = ApplicationManager.getApplication().runReadAction(new Computable<String[]>() {
-      public String[] compute() {
-        for (final RmicProcessingItem item : dirItems) {
-          pathToItemMap.put(item.myStub.getPath().replace(File.separatorChar, '/'), item);
-          pathToItemMap.put(item.mySkel.getPath().replace(File.separatorChar, '/'), item);
-          pathToItemMap.put(item.myTie.getPath().replace(File.separatorChar, '/'), item);
-        }
-        return createStartupCommand(module, outputDir.getPath(), dirItems.toArray(new RmicProcessingItem[dirItems.size()]));
-      }
-    });
-
-    if (LOG.isDebugEnabled()) {
-      StringBuilder buf = new StringBuilder();
-      for (int idx = 0; idx < cmdLine.length; idx++) {
-        if (idx > 0) {
-          buf.append(" ");
-        }
-        buf.append(cmdLine[idx]);
-      }
-      LOG.debug(buf.toString());
-    }
-
-    // obtain parser before running the process because configuring parser may involve starting another process
-    final OutputParser outputParser = parserPool.getJavacOutputParser(jdk);
-
-    final Process process = Runtime.getRuntime().exec(cmdLine);
-    final Set<RmicProcessingItem> successfullyCompiledItems = new HashSet<RmicProcessingItem>();
-    final CompilerParsingThread parsingThread = new CompilerParsingThread(process, outputParser, false, true,context) {
-      protected void processCompiledClass(FileObject classFileToProcess) {
-        String key = classFileToProcess.getFile().getPath().replace(File.separatorChar, '/');
-        final RmicProcessingItem item = pathToItemMap.get(key);
-        if (item != null) {
-          successfullyCompiledItems.add(item);
-        }
-      }
-    };
-
-    final Future<?> parsingThreadFuture = ApplicationManager.getApplication().executeOnPooledThread(parsingThread);
-    try {
-      process.waitFor();
-    }
-    catch (InterruptedException ignored) {
-    }
-    finally {
-      parsingThread.setProcessTerminated(true);
-    }
-
-    try {
-      parsingThreadFuture.get();
-    }
-    catch (InterruptedException ignored) {
-    }
-    catch (ExecutionException ignored) {
-    }
-    return successfullyCompiledItems.toArray(new RmicProcessingItem[successfullyCompiledItems.size()]);
-  }
-
-  private static String[] createStartupCommand(final Module module, final String outputPath, final RmicProcessingItem[] items) {
-    final Sdk jdk = ModuleRootManager.getInstance(module).getSdk();
-
-    final VirtualFile homeDirectory = jdk.getHomeDirectory();
-    if (homeDirectory == null) {
-      throw new IllegalArgumentException(CompilerBundle.jdkHomeNotFoundMessage(jdk));
-    }
-    final String jdkPath = homeDirectory.getPath().replace('/', File.separatorChar);
-
-    @NonNls final String compilerPath = jdkPath + File.separator + "bin" + File.separator + "rmic";
-
-    @NonNls final List<String> commandLine = new ArrayList<String>();
-    commandLine.add(compilerPath);
-
-    CompilerUtil.addLocaleOptions(commandLine, true);
-
-    commandLine.add("-verbose");
-
-    final Project project = module.getProject();
-    ContainerUtil.addAll(commandLine, new RmicSettingsBuilder(RmicConfiguration.getOptions(project)).getOptions(new Chunk<Module>(module)));
-
-    commandLine.add("-classpath");
-
-    commandLine.add(getCompilationClasspath(module));
-
-    commandLine.add("-d");
-
-    commandLine.add(outputPath);
-
-    for (RmicProcessingItem item : items) {
-      commandLine.add(item.getClassQName());
-    }
-    return ArrayUtil.toStringArray(commandLine);
-  }
-
-  @NotNull
-  public String getDescription() {
-    return CompilerBundle.message("rmi.compiler.description");
-  }
-
-  public boolean validateConfiguration(CompileScope scope) {
-    return true;
-  }
-
-  /*
-  private void addAllRemoteFilesFromModuleOutput(final CompileContext context, final Module module, final List<ProcessingItem> items, final File outputDir, File fromDir, final JavaClass remoteInterface) {
-    final File[] children = fromDir.listFiles(CLASSES_AND_DIRECTORIES_FILTER);
-    for (int idx = 0; idx < children.length; idx++) {
-      final File child = children[idx];
-      if (child.isDirectory()) {
-        addAllRemoteFilesFromModuleOutput(context, module, items, outputDir, child, remoteInterface);
-      }
-      else {
-        final String path = child.getPath();
-        try {
-          final ClassParser classParser = new ClassParser(path);
-          final JavaClass javaClass = classParser.parse();
-          // important! Need this in order to resolve other classes in the project (e.g. superclasses)
-          javaClass.setRepository(BcelUtils.getActiveRepository());
-          if (isRmicCompilable(javaClass, remoteInterface)) {
-            ApplicationManager.getApplication().runReadAction(new Runnable() {
-              public void run() {
-                final VirtualFile outputClassFile = LocalFileSystem.getInstance().findFileByIoFile(child);
-                if (outputClassFile != null) {
-                  items.add(new RmicProcessingItem(module, outputClassFile, outputDir, javaClass.getClassName()));
-                }
-              }
-            });
-          }
-        }
-        catch (IOException e) {
-          context.addMessage(CompilerMessageCategory.ERROR, "Cannot parse class file " + path + ": " + e.toString(), null, -1, -1);
-        }
-        catch (ClassFormatException e) {
-          context.addMessage(CompilerMessageCategory.ERROR, "Class format exception: " + e.getMessage() + " File: " + path, null, -1, -1);
-        }
-      }
-    }
-  }
-  */
-
-  /*
-  private boolean isRmicCompilable(final JavaClass javaClass, final JavaClass remoteInterface) {
-    // stubs are needed for classes that _directly_ implement remote interfaces
-    if (javaClass.isInterface() || isGenerated(javaClass)) {
-      return false;
-    }
-    final JavaClass[] directlyImplementedInterfaces = javaClass.getInterfaces();
-    if (directlyImplementedInterfaces != null) {
-      for (int i = 0; i < directlyImplementedInterfaces.length; i++) {
-        if (directlyImplementedInterfaces[i].instanceOf(remoteInterface)) {
-          return true;
-        }
-      }
-    }
-    return false;
-  }
-  */
-
-  /*
-  private boolean isGenerated(JavaClass javaClass) {
-    final String sourceFileName = javaClass.getSourceFileName();
-    return sourceFileName == null || !sourceFileName.endsWith(".java");
-  }
-  */
-
-
-  public ValidityState createValidityState(DataInput in) throws IOException {
-    return new RemoteClassValidityState(in.readLong(), in.readLong(), in.readLong(), in.readLong());
-  }
-
-  private static String getCompilationClasspath(Module module) {
-    final OrderEnumerator enumerator = ModuleRootManager.getInstance(module).orderEntries().withoutSdk().compileOnly().recursively().exportedOnly();
-    final PathsList pathsList = enumerator.getPathsList();
-    return pathsList.getPathsString();
-  }
-
-  private static final class RemoteClassValidityState implements ValidityState {
-    private final long myRemoteClassTimestamp;
-    private final long myStubTimestamp;
-    private final long mySkelTimestamp;
-    private final long myTieTimestamp;
-
-    private RemoteClassValidityState(long remoteClassTimestamp, long stubTimestamp, long skelTimestamp, long tieTimestamp) {
-      myRemoteClassTimestamp = remoteClassTimestamp;
-      myStubTimestamp = stubTimestamp;
-      mySkelTimestamp = skelTimestamp;
-      myTieTimestamp = tieTimestamp;
-    }
-
-    public boolean equalsTo(ValidityState otherState) {
-      if (otherState instanceof RemoteClassValidityState) {
-        final RemoteClassValidityState state = (RemoteClassValidityState)otherState;
-        return myRemoteClassTimestamp == state.myRemoteClassTimestamp &&
-               myStubTimestamp == state.myStubTimestamp &&
-               mySkelTimestamp == state.mySkelTimestamp &&
-               myTieTimestamp == state.myTieTimestamp;
-      }
-      return false;
-    }
-
-    public void save(DataOutput out) throws IOException {
-      out.writeLong(myRemoteClassTimestamp);
-      out.writeLong(myStubTimestamp);
-      out.writeLong(mySkelTimestamp);
-      out.writeLong(myTieTimestamp);
-    }
-  }
-  private static final class RmicProcessingItem implements ProcessingItem {
-    private final Module myModule;
-    private final VirtualFile myOutputClassFile;
-    private final File myOutputDir;
-    private final String myQName;
-    private RemoteClassValidityState myState;
-    private final File myStub;
-    private final File mySkel;
-    private final File myTie;
-    private boolean myIsRemoteObject = false;
-
-    private RmicProcessingItem(Module module, final VirtualFile outputClassFile, File outputDir, String qName) {
-      myModule = module;
-      myOutputClassFile = outputClassFile;
-      myOutputDir = outputDir;
-      myQName = qName;
-      final String relativePath;
-      final String baseName;
-
-      final int index = qName.lastIndexOf('.');
-      if (index >= 0) {
-        relativePath = qName.substring(0, index + 1).replace('.', '/');
-        baseName = qName.substring(index + 1);
-      }
-      else {
-        relativePath = "";
-        baseName = qName;
-      }
-      final String path = outputDir.getPath().replace(File.separatorChar, '/') + "/" + relativePath;
-      //noinspection HardCodedStringLiteral
-      myStub = new File(path + "/" + baseName + "_Stub.class");
-      //noinspection HardCodedStringLiteral
-      mySkel = new File(path + "/" + baseName + "_Skel.class");
-      //noinspection HardCodedStringLiteral
-      myTie = new File(path + "/_" + baseName + "_Tie.class");
-      updateState();
-    }
-
-    public boolean isRemoteObject() {
-      return myIsRemoteObject;
-    }
-
-    public void setIsRemoteObject(boolean isRemote) {
-      myIsRemoteObject = isRemote;
-    }
-
-    @NotNull
-    public VirtualFile getFile() {
-      return myOutputClassFile;
-    }
-
-    public ValidityState getValidityState() {
-      return myState;
-    }
-
-    public void updateState() {
-      myState = new RemoteClassValidityState(
-        myOutputClassFile.getTimeStamp(),
-        getTimestamp(myStub),
-        getTimestamp(mySkel),
-        getTimestamp(myTie)
-      );
-
-    }
-
-    private static long getTimestamp(File file) {
-      long l = file.lastModified();
-      return l == 0 ? -1L : l;
-    }
-
-    public void deleteGeneratedFiles() {
-      if (FileUtil.delete(myStub)) {
-        CompilerUtil.refreshIOFile(myStub);
-      }
-      if (FileUtil.delete(mySkel)) {
-        CompilerUtil.refreshIOFile(mySkel);
-      }
-      if (FileUtil.delete(myTie)) {
-        CompilerUtil.refreshIOFile(myTie);
-      }
-    }
-
-    public String getClassQName() {
-      return myQName;
-    }
-
-    public File getOutputDir() {
-      return myOutputDir;
-    }
-
-    public Module getModule() {
-      return myModule;
-    }
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/rmiCompiler/RmicSettingsBuilder.java b/java/compiler/impl/src/com/intellij/compiler/impl/rmiCompiler/RmicSettingsBuilder.java
deleted file mode 100644
index e4b0aee..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/impl/rmiCompiler/RmicSettingsBuilder.java
+++ /dev/null
@@ -1,55 +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.compiler.impl.rmiCompiler;
-
-import com.intellij.compiler.impl.javaCompiler.javac.JavacSettingsBuilder;
-import com.intellij.openapi.module.Module;
-import com.intellij.util.Chunk;
-import org.jetbrains.jps.model.java.compiler.RmicCompilerOptions;
-
-import java.util.Collection;
-
-public class RmicSettingsBuilder extends JavacSettingsBuilder {
-
-  public RmicSettingsBuilder(final RmicCompilerOptions options) {
-    super(options);
-    getOptions().DEPRECATION = false; // in this configuration deprecation is false by default
-  }
-
-  @Override
-  public RmicCompilerOptions getOptions() {
-    return (RmicCompilerOptions)super.getOptions();
-  }
-
-  public Collection<String> getOptions(Chunk<Module> chunk) {
-    final Collection<String> options = super.getOptions(chunk);
-    if(getOptions().GENERATE_IIOP_STUBS) {
-      options.add("-iiop");
-    }
-    return options;
-  }
-
-  protected boolean acceptUserOption(String token) {
-    if (!super.acceptUserOption(token)) {
-      return false;
-    }
-    return !("-iiop".equals(token));
-  }
-
-  protected boolean acceptEncoding() {
-    return false;
-  }
-}
\ No newline at end of file
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/AnnotationTargets.java b/java/compiler/impl/src/com/intellij/compiler/make/AnnotationTargets.java
deleted file mode 100644
index 100fd4a..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/AnnotationTargets.java
+++ /dev/null
@@ -1,66 +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.compiler.make;
-
-import org.jetbrains.annotations.NonNls;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Apr 7, 2004
- */
-public interface AnnotationTargets {
-  /** Class, interface or enum declaration */
-  int TYPE = 0x1;
-
-  @NonNls String TYPE_STR = "TYPE";
-
-  /** Field declaration (includes enum constants) */
-  int FIELD = 0x2;
-
-  @NonNls String FIELD_STR = "FIELD";
-
-  /** Method declaration */
-  int METHOD = 0x4;
-
-  @NonNls String METHOD_STR = "METHOD";
-
-  /** Parameter declaration */
-  int PARAMETER = 0x8;
-
-  @NonNls String PARAMETER_STR = "PARAMETER";
-
-  /** Constructor declaration */
-  int CONSTRUCTOR = 0x10;
-
-  @NonNls String CONSTRUCTOR_STR = "CONSTRUCTOR";
-
-  /** Local variable declaration */
-  int LOCAL_VARIABLE = 0x20;
-
-  @NonNls String LOCAL_VARIABLE_STR = "LOCAL_VARIABLE";
-
-  /** Annotation type declaration */
-  int ANNOTATION_TYPE = 0x40;
-
-  @NonNls String ANNOTATION_TYPE_STR = "ANNOTATION_TYPE";
-
-  /** Package declaration */
-  int PACKAGE = 0x80;
-
-  @NonNls String PACKAGE_STR = "PACKAGE";
-
-  int ALL = TYPE | FIELD | METHOD | PARAMETER | CONSTRUCTOR | LOCAL_VARIABLE | ANNOTATION_TYPE | PACKAGE;
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/BackwardDependenciesStorage.java b/java/compiler/impl/src/com/intellij/compiler/make/BackwardDependenciesStorage.java
deleted file mode 100644
index 006debb..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/BackwardDependenciesStorage.java
+++ /dev/null
@@ -1,511 +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.compiler.make;
-
-import com.intellij.openapi.Disposable;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.Ref;
-import com.intellij.util.containers.SLRUCache;
-import com.intellij.util.io.DataExternalizer;
-import com.intellij.util.io.EnumeratorIntegerDescriptor;
-import com.intellij.util.io.PersistentHashMap;
-import gnu.trove.*;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Dec 1, 2008
- */
-public class BackwardDependenciesStorage implements Flushable, Disposable {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.make.CompilerDependencyStorage");
-  protected final PersistentHashMap<Integer, DependenciesSet> myMap;
-  protected final SLRUCache<Integer, ReferencerSetHolder> myCache;
-  private Integer myKeyToRemove;
-  private static final int FIELD = 1;
-  private static final int METHOD = 2;
-  private static final int CLASS = 3;
-
-  public BackwardDependenciesStorage(File file, final int cacheSize) throws IOException {
-    myMap = new PersistentHashMap<Integer, DependenciesSet>(file, EnumeratorIntegerDescriptor.INSTANCE, new MyDataExternalizer());
-
-    myCache = new SLRUCache<Integer, ReferencerSetHolder>(cacheSize * 2, cacheSize) {
-      @NotNull
-      public ReferencerSetHolder createValue(Integer key) {
-        return new ReferencerSetHolder(key);
-      }
-
-      protected void onDropFromCache(Integer key, final ReferencerSetHolder holder) {
-        if (key.equals(myKeyToRemove) || !holder.isDirty()) {
-          return;
-        }
-        try {
-          if (holder.isDataLoaded() || !myMap.containsMapping(key)) {
-            myMap.put(key, new DependenciesSet(holder.getData()));
-          }
-          else {
-            myMap.appendData(key, new PersistentHashMap.ValueDataAppender() {
-              public void append(final DataOutput out) throws IOException {
-                final Ref<IOException> exception = new Ref<IOException>(null);
-                // process removed
-                holder.myRemoveRequested.forEach(new TIntProcedure() {
-                  public boolean execute(int qName) {
-                    try {
-                      out.writeInt(-qName);
-                      return true;
-                    }
-                    catch (IOException e) {
-                      exception.set(e);
-                    }
-                    return false;
-                  }
-                });
-                final IOException _ex = exception.get();
-                if (_ex != null) {
-                  throw _ex;
-                }
-                // process added members
-                for (ReferencerItem item : holder.myAdded) {
-                  item.save(out);
-                }
-              }
-            });
-          }
-        }
-        catch (IOException e) {
-          LOG.error(e);
-        }
-      }
-    };
-  }
-
-  public synchronized void remove(Integer qName) throws IOException {
-    myKeyToRemove = qName;
-    try {
-      myCache.remove(qName);
-    }
-    finally {
-      myKeyToRemove = null;
-    }
-    myMap.remove(qName);
-  }
-
-  public synchronized void removeReferencer(Integer qName, int referencerQName) throws IOException {
-    if (myMap.containsMapping(qName)) {
-      final ReferencerSetHolder set = myCache.get(qName);
-      set.removeReferencer(referencerQName);
-    }
-  }
-
-  public synchronized void addClassReferencer(Integer qName, int referencerQName) {
-    myCache.get(qName).addReferencer(new ReferencerItem(referencerQName));
-  }
-
-  public synchronized void addFieldReferencer(Integer qName, int referencerQName, int fieldName) {
-    myCache.get(qName).addReferencer(new FieldReferencerItem(referencerQName, fieldName));
-  }
-
-  public synchronized void addMethodReferencer(Integer qName, int referencerQName, int methodName, int descriptor) {
-    myCache.get(qName).addReferencer(new MethodReferencerItem(referencerQName, methodName, descriptor));
-  }
-
-  public synchronized Dependency[] getDependencies(Integer classQName) throws CacheCorruptedException {
-    try {
-      if (!myMap.containsMapping(classQName)) {
-        return Dependency.EMPTY_ARRAY;
-      }
-
-      return convertToDependencies(classQName.intValue(), myCache.get(classQName).getData());
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  private static Dependency[] convertToDependencies(int classToSkip, Set<ReferencerItem> data) {
-    final TIntObjectHashMap<Dependency> dependencies = new TIntObjectHashMap<Dependency>();
-    for (ReferencerItem item : data) {
-      if (item.qName == classToSkip) {
-        continue; // skip self-dependencies
-      }
-      final Dependency dependency = addDependency(dependencies, item.qName);
-      if (item instanceof FieldReferencerItem) {
-        dependency.addField(((FieldReferencerItem)item).name);
-      }
-      else if (item instanceof MethodReferencerItem) {
-        final MethodReferencerItem methodItem = (MethodReferencerItem)item;
-        dependency.addMethod(methodItem.name, methodItem.descriptor);
-      }
-    }
-
-    final Dependency[] dependencyArray = new Dependency[dependencies.size()];
-    dependencies.forEachValue(new TObjectProcedure<Dependency>() {
-      private int index = 0;
-      public boolean execute(Dependency object) {
-        dependencyArray[index++] = object;
-        return true;
-      }
-    });
-    return dependencyArray;
-  }
-
-  private static Dependency addDependency(TIntObjectHashMap<Dependency> container, int classQName) {
-    Dependency dependency = container.get(classQName);
-    if (dependency == null) {
-      dependency = new Dependency(classQName);
-      container.put(classQName, dependency);
-    }
-    return dependency;
-  }
-
-  public synchronized void flush() throws IOException {
-    myCache.clear();
-    myMap.force();
-  }
-
-  private void flush(Integer key) {
-    myCache.remove(key); // makes changes into PersistentHashMap
-    myMap.force(); // flushes internal caches (which consume memory) and writes unsaved data to disk
-  }
-
-  public synchronized void dispose() {
-    try {
-      flush();
-    }
-    catch (IOException e) {
-      LOG.info(e);
-    }
-    try {
-      myMap.close();
-    }
-    catch (IOException e) {
-      LOG.info(e);
-    }
-  }
-
-  private static class ReferencerItem {
-    public final int qName;
-
-    private ReferencerItem(int qName) {
-      this.qName = qName;
-    }
-
-    public boolean equals(Object o) {
-      if (this == o) return true;
-      if (o == null || getClass() != o.getClass()) return false;
-
-      ReferencerItem that = (ReferencerItem)o;
-
-      if (qName != that.qName) return false;
-
-      return true;
-    }
-
-    public int hashCode() {
-      return qName;
-    }
-
-    public void save(DataOutput out) throws IOException {
-      out.writeInt(qName);
-      out.writeByte(CLASS);
-    }
-  }
-
-  private static final class MethodReferencerItem extends ReferencerItem {
-    public final int name;
-    public final int descriptor;
-
-    MethodReferencerItem(int qName, int name, int descriptor) {
-      super(qName);
-      this.name = name;
-      this.descriptor = descriptor;
-    }
-
-    public boolean equals(Object o) {
-      if (this == o) return true;
-      if (o == null || getClass() != o.getClass()) return false;
-      if (!super.equals(o)) return false;
-
-      MethodReferencerItem that = (MethodReferencerItem)o;
-
-      if (descriptor != that.descriptor) return false;
-      if (name != that.name) return false;
-
-      return true;
-    }
-
-    public int hashCode() {
-      int result = super.hashCode();
-      result = 31 * result + name;
-      result = 31 * result + descriptor;
-      return result;
-    }
-
-    public void save(DataOutput out) throws IOException {
-      out.writeInt(qName);
-      out.writeByte(METHOD);
-      out.writeInt(name);
-      out.writeInt(descriptor);
-    }
-  }
-
-  private static final class FieldReferencerItem extends ReferencerItem {
-    public final int name;
-
-    FieldReferencerItem(int qName, int name) {
-      super(qName);
-      this.name = name;
-    }
-
-    public boolean equals(Object o) {
-      if (this == o) return true;
-      if (o == null || getClass() != o.getClass()) return false;
-      if (!super.equals(o)) return false;
-
-      FieldReferencerItem that = (FieldReferencerItem)o;
-
-      if (name != that.name) return false;
-
-      return true;
-    }
-
-    public int hashCode() {
-      int result = super.hashCode();
-      result = 31 * result + name;
-      return result;
-    }
-
-    public void save(DataOutput out) throws IOException {
-      out.writeInt(qName);
-      out.writeByte(FIELD);
-      out.writeInt(name);
-    }
-  }
-
-  private class ReferencerSetHolder {
-    private final Integer myKey;
-    private TIntHashSet myRemoveRequested = new TIntHashSet();
-    private Set<ReferencerItem> myAdded = new THashSet<ReferencerItem>();
-    
-    private Set<ReferencerItem> myData = null;
-    private boolean myIsDirty = false;
-
-    public ReferencerSetHolder(Integer key) {
-      myKey = key;
-    }
-
-    public void addReferencer(ReferencerItem referencer) {
-      if (myData != null) {
-        myIsDirty |= myData.add(referencer);
-        return;
-      }
-      myAdded.add(referencer);
-    }
-
-    public void removeReferencer(int qName) {
-      if (myData != null) {
-        myIsDirty |= removeAllReferencerItems(myData, qName);
-        return;
-      }
-      myRemoveRequested.add(qName);
-      removeAllReferencerItems(myAdded, qName);
-    }
-
-    public boolean isDirty() {
-      return myData != null? myIsDirty : myRemoveRequested.size() > 0 || myAdded.size() > 0;
-    }
-
-    public boolean isDataLoaded() {
-      return myData != null;
-    }
-
-    public Set<ReferencerItem> getData() throws IOException {
-      if (myData == null) {
-        final DependenciesSet ds = myMap.get(myKey);
-        Set<ReferencerItem> set = null;
-        if (ds != null) {
-          set = ds.set;
-          myIsDirty |= ds.needsCompacting;
-        }
-        if (set == null) {
-          set = new THashSet<ReferencerItem>();
-        }
-        myIsDirty |= removeAllReferencerItems(set, myRemoveRequested);
-        myIsDirty |= set.addAll(myAdded);
-        myData = set;
-        myAdded = null;
-        myRemoveRequested = null;
-      }
-      return Collections.unmodifiableSet(myData);
-    }
-
-  }
-
-  private static class MyDataExternalizer implements DataExternalizer<DependenciesSet> {
-    public void save(@NotNull DataOutput out, DependenciesSet ds) throws IOException {
-      final TIntHashSet classes = new TIntHashSet();
-      final Map<Dependency.FieldRef, TIntHashSet> fieldsMap = new HashMap<Dependency.FieldRef, TIntHashSet>();
-      final Map<Dependency.MethodRef, TIntHashSet> methodsMap = new HashMap<Dependency.MethodRef, TIntHashSet>();
-      for (ReferencerItem item : ds.set) {
-        if (item instanceof FieldReferencerItem) {
-          final Dependency.FieldRef ref = new Dependency.FieldRef(((FieldReferencerItem)item).name);
-          TIntHashSet referencers = fieldsMap.get(ref);
-          if (referencers == null) {
-            referencers = new TIntHashSet();
-            fieldsMap.put(ref, referencers);
-          }
-          referencers.add(item.qName);
-        }
-        else if (item instanceof MethodReferencerItem) {
-          final MethodReferencerItem _item = (MethodReferencerItem)item;
-          final Dependency.MethodRef ref = new Dependency.MethodRef(_item.name, _item.descriptor);
-          TIntHashSet referencers = methodsMap.get(ref);
-          if (referencers == null) {
-            referencers = new TIntHashSet();
-            methodsMap.put(ref, referencers);
-          }
-          referencers.add(item.qName);
-        }
-        else {
-          classes.add(item.qName);
-        }
-      }
-
-      out.writeInt(classes.size());
-      for (TIntIterator it = classes.iterator(); it.hasNext();) {
-        out.writeInt(it.next());
-      }
-
-      out.writeInt(fieldsMap.size());
-      for (Map.Entry<Dependency.FieldRef, TIntHashSet> entry : fieldsMap.entrySet()) {
-        out.writeInt(entry.getKey().name);
-        final TIntHashSet referencers = entry.getValue();
-        out.writeInt(referencers.size());
-        for (TIntIterator rit = referencers.iterator(); rit.hasNext();) {
-          out.writeInt(rit.next());
-        }
-      }
-
-      out.writeInt(methodsMap.size());
-      for (Map.Entry<Dependency.MethodRef, TIntHashSet> entry : methodsMap.entrySet()) {
-        final Dependency.MethodRef ref = entry.getKey();
-        out.writeInt(ref.name);
-        out.writeInt(ref.descriptor);
-        final TIntHashSet referencers = entry.getValue();
-        out.writeInt(referencers.size());
-        for (TIntIterator rit = referencers.iterator(); rit.hasNext();) {
-          out.writeInt(rit.next());
-        }
-      }
-    }
-
-    public DependenciesSet read(@NotNull DataInput in) throws IOException {
-      final Set<ReferencerItem> set = new THashSet<ReferencerItem>();
-
-      int classesCount = in.readInt();
-      while (classesCount-- > 0) {
-        set.add(new ReferencerItem(in.readInt()));
-      }
-
-      int fieldsCount = in.readInt();
-      while (fieldsCount-- > 0) {
-        final int fieldName = in.readInt();
-        int referencersCount = in.readInt();
-        while (referencersCount-- > 0) {
-          set.add(new FieldReferencerItem(in.readInt(), fieldName));
-        }
-      }
-
-      int methodsCount = in.readInt();
-      while (methodsCount-- > 0) {
-        final int methodName = in.readInt();
-        final int methodDescriptor = in.readInt();
-        int referensersCount = in.readInt();
-        while (referensersCount-- > 0) {
-          set.add(new MethodReferencerItem(in.readInt(), methodName, methodDescriptor));
-        }
-      }
-      boolean needsCompacting = false;
-      // manage appends if exist qName, kind, {field | method}
-      final DataInputStream _in = (DataInputStream)in;
-      while (_in.available() > 0) {
-        needsCompacting = true;
-        final int qName = _in.readInt();
-        if (qName < 0) {
-          removeAllReferencerItems(set, -qName);
-        }
-        else {
-          final byte kind = _in.readByte();
-          if (kind == FIELD) {
-            set.add(new FieldReferencerItem(qName, _in.readInt()));
-          }
-          else if (kind == METHOD) {
-            final int name = _in.readInt();
-            final int descriptor = _in.readInt();
-            set.add(new MethodReferencerItem(qName, name, descriptor));
-          }
-          else if (kind == CLASS){
-            set.add(new ReferencerItem(qName));
-          }
-        }
-      }
-
-      return new DependenciesSet(set, needsCompacting);
-    }
-  }
-
-  private static final class DependenciesSet {
-    public final Set<ReferencerItem> set;
-    public final boolean needsCompacting;
-
-    public DependenciesSet(Set<ReferencerItem> set, boolean needsCompacting) {
-      this.set = set;
-      this.needsCompacting = needsCompacting;
-    }
-
-    public DependenciesSet(Set<ReferencerItem> set) {
-      this(set, false);
-    }
-  }
-
-
-  private static boolean removeAllReferencerItems(final Set<ReferencerItem> from, final TIntHashSet qNames) {
-    boolean removed = false;
-    for (Iterator<ReferencerItem> it = from.iterator(); it.hasNext();) {
-      final ReferencerItem item = it.next();
-      if (qNames.contains(item.qName)) {
-        it.remove();
-        removed = true;
-      }
-    }
-    return removed;
-  }
-
-  private static boolean removeAllReferencerItems(final Set<ReferencerItem> from, final int qNames) {
-    boolean removed = false;
-    for (Iterator<ReferencerItem> it = from.iterator(); it.hasNext();) {
-      final ReferencerItem item = it.next();
-      if (qNames == item.qName) {
-        it.remove();
-        removed = true;
-      }
-    }
-    return removed;
-  }
-
-}
\ No newline at end of file
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/BoundsParser.java b/java/compiler/impl/src/com/intellij/compiler/make/BoundsParser.java
deleted file mode 100644
index 0ab9489..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/BoundsParser.java
+++ /dev/null
@@ -1,83 +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.compiler.make;
-
-import com.intellij.compiler.classParsing.SignatureParser;
-import com.intellij.compiler.classParsing.SignatureParsingException;
-import com.intellij.util.ArrayUtil;
-
-import java.text.CharacterIterator;
-import java.text.StringCharacterIterator;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Mar 10, 2004
- */
-public class BoundsParser extends SignatureParser{
-  final List<String> myInterfaceBounds = new ArrayList<String>();
-  private int myParsingBound;
-
-  public void parseClassBound(CharacterIterator it, StringBuilder buf) throws SignatureParsingException {
-    myParsingBound += 1;
-    try {
-      super.parseClassBound(it, buf);
-    }
-    finally {
-      myParsingBound -= 1;
-    }
-  }
-
-  public void parseInterfaceBound(CharacterIterator it, StringBuilder buf) throws SignatureParsingException {
-    myParsingBound += 1;
-    try {
-      super.parseInterfaceBound(it, buf);
-    }
-    finally {
-      myParsingBound -= 1;
-    }
-  }
-
-  public void parseClassTypeSignature(CharacterIterator it, StringBuilder buf) throws SignatureParsingException {
-    if (myParsingBound > 0) {
-      final int start = buf.length();
-
-      super.parseClassTypeSignature(it, buf);
-
-      final String qName = convertToQalifiedName(buf.substring(start + 1, buf.length() - 1));
-      myInterfaceBounds.add(qName);
-    }
-    else {
-      super.parseClassTypeSignature(it, buf);
-    }
-  }
-
-  private static String convertToQalifiedName(String ifaceSignature) {
-    ifaceSignature = ifaceSignature.replaceAll("<.*>", "");
-    return ifaceSignature.replace('/', '.');
-  }
-
-  public String[] getBounds() {
-    return ArrayUtil.toStringArray(myInterfaceBounds);
-  }
-
-  public static String[] getBounds(String classSignature) throws SignatureParsingException {
-    final BoundsParser parser = new BoundsParser();
-    parser.parseClassSignature(new StringCharacterIterator(classSignature), new StringBuilder());
-    return parser.getBounds();
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/Cache.java b/java/compiler/impl/src/com/intellij/compiler/make/Cache.java
deleted file mode 100644
index f80cb8e..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/Cache.java
+++ /dev/null
@@ -1,521 +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.compiler.make;
-
-import com.intellij.compiler.SymbolTable;
-import com.intellij.compiler.classParsing.*;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.cls.ClsFormatException;
-import com.intellij.util.io.DataExternalizer;
-import com.intellij.util.io.EnumeratorIntegerDescriptor;
-import com.intellij.util.io.PersistentHashMap;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-
-/**
- * @author Eugene Zhuravlev
- * Date: Aug 8, 2003
- * Time: 7:03:56 PM
- */
-public class Cache {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.make.Cache");
-  public static final int UNKNOWN = -1;
-
-  private final PersistentHashMap<Integer, ClassInfo> myQNameToClassInfoMap;
-
-  private final BackwardDependenciesStorage myDependencies;
-  private final CompilerDependencyStorage<Integer> myQNameToReferencedClassesMap;
-  private final CompilerDependencyStorage<Integer> myQNameToSubclassesMap;
-  private final PersistentHashMap<Integer, Boolean> myRemoteQNames;
-  private final String myStorePath;
-
-  public Cache(@NonNls final String storePath, final int cacheSize) throws IOException {
-    myStorePath = storePath;
-    new File(storePath).mkdirs();
-    myQNameToClassInfoMap = new CachedPersistentHashMap<Integer, ClassInfo>(getOrCreateFile("classes"), EnumeratorIntegerDescriptor.INSTANCE, new DataExternalizer<ClassInfo>() {
-      public void save(@NotNull DataOutput out, ClassInfo value) throws IOException {
-        value.save(out);
-      }
-      public ClassInfo read(@NotNull DataInput in) throws IOException {
-        return new ClassInfo(in);
-      }
-    }, cacheSize * 2) {
-      protected boolean isValueDirty(ClassInfo classInfo) {
-        return classInfo.isDirty();
-      }
-    };
-
-    myDependencies = new BackwardDependenciesStorage(getOrCreateFile("bdeps"), cacheSize);
-    myQNameToReferencedClassesMap = new CompilerDependencyStorage<Integer>(getOrCreateFile("fdeps"), EnumeratorIntegerDescriptor.INSTANCE, cacheSize);
-    myQNameToSubclassesMap = new CompilerDependencyStorage<Integer>(getOrCreateFile("subclasses"), EnumeratorIntegerDescriptor.INSTANCE, cacheSize);
-
-    myRemoteQNames = new PersistentHashMap<Integer, Boolean>(getOrCreateFile("remote"), EnumeratorIntegerDescriptor.INSTANCE, new DataExternalizer<Boolean>() {
-      public void save(@NotNull DataOutput out, Boolean value) throws IOException {
-        out.writeBoolean(value.booleanValue());
-      }
-
-      public Boolean read(@NotNull DataInput in) throws IOException {
-        return in.readBoolean();
-      }
-    }, cacheSize);
-  }
-
-  private File getOrCreateFile(final String fileName) throws IOException {
-    final File file = new File(myStorePath, fileName);
-    FileUtil.createIfDoesntExist(file);
-    return file;
-  }
-
-  public void dispose() throws CacheCorruptedException {
-    CacheCorruptedException ex = null;
-    try {
-      myQNameToClassInfoMap.close();
-    }
-    catch (IOException e) {
-      LOG.info(e);
-      ex = new CacheCorruptedException(e);
-    }
-    try {
-      myRemoteQNames.close();
-    }
-    catch (IOException e) {
-      LOG.info(e);
-      if (ex != null) {
-        ex = new CacheCorruptedException(e);
-      }
-    }
-
-    myQNameToReferencedClassesMap.dispose();
-    myDependencies.dispose();
-    myQNameToSubclassesMap.dispose();
-
-    if (ex != null) {
-      throw ex;
-    }
-
-  }
-
-  public int[] getAllClassNames() throws CacheCorruptedException {
-    try {
-      final Collection<Integer> allKeys = myQNameToClassInfoMap.getAllKeysWithExistingMapping();
-      final int[] array = ArrayUtil.newIntArray(allKeys.size());
-      int idx = 0;
-      for (Integer id : allKeys) {
-        array[idx++] = id.intValue();
-      }
-      return array;
-    }
-    catch (IOException e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public int importClassInfo(ClassFileReader reader, SymbolTable symbolTable) throws ClsFormatException, CacheCorruptedException {
-    try {
-      final ClassInfo classInfo = new ClassInfo(reader, symbolTable);
-      myQNameToClassInfoMap.put(classInfo.getQualifiedName(), classInfo);
-      return classInfo.getQualifiedName();
-    }
-    catch (IOException e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public void importClassInfo(Cache fromCache, final int qName) throws CacheCorruptedException {
-    try {
-      final ClassInfo classInfo = fromCache.myQNameToClassInfoMap.get(qName);
-      if (classInfo != null) {
-        final ClassInfo clone = classInfo.clone();
-        clone.clearReferences();
-        myQNameToClassInfoMap.put(qName, clone);
-      }
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public AnnotationConstantValue[] getRuntimeVisibleAnnotations(int classId) throws CacheCorruptedException {
-    try {
-      final ClassInfo classInfo = myQNameToClassInfoMap.get(classId);
-      return classInfo != null? classInfo.getRuntimeVisibleAnnotations() : AnnotationConstantValue.EMPTY_ARRAY;
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public AnnotationConstantValue[] getRuntimeInvisibleAnnotations(int classId) throws CacheCorruptedException {
-    try {
-      final ClassInfo classInfo = myQNameToClassInfoMap.get(classId);
-      return classInfo != null? classInfo.getRuntimeInvisibleAnnotations() : AnnotationConstantValue.EMPTY_ARRAY;
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public int[] getSubclasses(int classId) throws CacheCorruptedException {
-    try {
-      return myQNameToSubclassesMap.getValues(classId);
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public void addSubclass(int classId, int subclassQName) throws CacheCorruptedException {
-    try {
-      myQNameToSubclassesMap.addValue(classId, subclassQName);
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public void removeSubclass(int classId, int subclassQName) throws CacheCorruptedException {
-    try {
-      myQNameToSubclassesMap.removeValue(classId, subclassQName);
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public int[] getReferencedClasses(int qName) throws CacheCorruptedException {
-    try {
-      return myQNameToReferencedClassesMap.getValues(qName);
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public void clearReferencedClasses(int qName) throws CacheCorruptedException {
-    try {
-      myQNameToReferencedClassesMap.remove(qName);
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public Collection<ReferenceInfo> getReferences(int classId) throws CacheCorruptedException {
-    try {
-      final ClassInfo classInfo = myQNameToClassInfoMap.get(classId);
-      return classInfo != null? Arrays.asList(classInfo.getReferences()) : Collections.<ReferenceInfo>emptyList();
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public String getSourceFileName(int classId) throws CacheCorruptedException {
-    try {
-      final ClassInfo classInfo = myQNameToClassInfoMap.get(classId);
-      return classInfo != null? classInfo.getSourceFileName() : "";
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public boolean isRemote(int classId) throws CacheCorruptedException {
-    try {
-      return myRemoteQNames.containsMapping(classId);
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public void setRemote(int classId, boolean remote) throws CacheCorruptedException {
-    try {
-      if (remote) {
-        myRemoteQNames.put(classId, Boolean.TRUE);
-      }
-      else {
-        myRemoteQNames.remove(classId);
-      }
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public int getSuperQualifiedName(int classId) throws CacheCorruptedException {
-    try {
-      final ClassInfo classInfo = myQNameToClassInfoMap.get(classId);
-      return classInfo != null? classInfo.getSuperQualifiedName() : UNKNOWN;
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public String getPath(int classId) throws CacheCorruptedException {
-    try {
-      final ClassInfo classInfo = myQNameToClassInfoMap.get(classId);
-      return classInfo != null? classInfo.getPath() : "";
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public void setPath(int classId, String path) throws CacheCorruptedException {
-    try {
-      final ClassInfo classInfo = myQNameToClassInfoMap.get(classId);
-      if (classInfo != null) {
-        classInfo.setPath(path);
-      }
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-  
-  public int getGenericSignature(int classId) throws CacheCorruptedException {
-    try {
-      final ClassInfo classInfo = myQNameToClassInfoMap.get(classId);
-      return classInfo != null? classInfo.getGenericSignature() : UNKNOWN;
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public boolean containsClass(int qName) throws CacheCorruptedException {
-    try {
-      return myQNameToClassInfoMap.containsMapping(qName);
-    }
-    catch (IOException e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public int[] getSuperInterfaces(int classId) throws CacheCorruptedException {
-    try {
-      final ClassInfo classInfo = myQNameToClassInfoMap.get(classId);
-      return classInfo != null? classInfo.getSuperInterfaces() : ArrayUtil.EMPTY_INT_ARRAY;
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public int getFlags(int classId) throws CacheCorruptedException {
-    try {
-      final ClassInfo classInfo = myQNameToClassInfoMap.get(classId);
-      return classInfo != null? classInfo.getFlags() : UNKNOWN;
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public FieldInfo[] getFields(int qName) throws CacheCorruptedException{
-    try {
-      final ClassInfo classInfo = myQNameToClassInfoMap.get(qName);
-      return classInfo != null? classInfo.getFields() : FieldInfo.EMPTY_ARRAY;
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  @Nullable
-  public FieldInfo findField(final int classDeclarationId, final int name, final int descriptor) throws CacheCorruptedException{
-    try {
-      for (FieldInfo fieldInfo : getFields(classDeclarationId)) {
-        if (fieldInfo.getName() == name && fieldInfo.getDescriptor() == descriptor) {
-          return fieldInfo;
-        }
-      }
-      return null;
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  @Nullable
-  public FieldInfo findFieldByName(final int classDeclarationId, final int name) throws CacheCorruptedException{
-    try {
-      for (FieldInfo fieldInfo : getFields(classDeclarationId)) {
-        if (fieldInfo.getName() == name) {
-          return fieldInfo;
-        }
-      }
-      return null;
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public MethodInfo[] getMethods(int classQName) throws CacheCorruptedException{
-    try {
-      final ClassInfo classInfo = myQNameToClassInfoMap.get(classQName);
-      return classInfo != null? classInfo.getMethods() : MethodInfo.EMPTY_ARRAY;
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  @Nullable
-  public MethodInfo findMethod(final int classQName, final int name, final int descriptor) throws CacheCorruptedException{
-    try {
-      for (MethodInfo methodInfo : getMethods(classQName)) {
-        if (methodInfo.getName() == name && methodInfo.getDescriptor() == descriptor) {
-          return methodInfo;
-        }
-      }
-      return null;
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public List<MethodInfo> findMethodsByName(final int classDeclarationId, final int name) throws CacheCorruptedException{
-    try {
-      final List<MethodInfo> methods = new ArrayList<MethodInfo>();
-      for (MethodInfo methodInfo : getMethods(classDeclarationId)) {
-        if (methodInfo.getName() == name) {
-          methods.add(methodInfo);
-        }
-      }
-      return methods;
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  @Nullable
-  public MethodInfo findMethodsBySignature(final int classDeclarationId, final String signature, SymbolTable symbolTable) throws CacheCorruptedException{
-    try {
-      for (MethodInfo methodInfo : getMethods(classDeclarationId)) {
-        if (signature.equals(CacheUtils.getMethodSignature(symbolTable.getSymbol(methodInfo.getName()), symbolTable.getSymbol(methodInfo.getDescriptor())))) {
-          return methodInfo;
-        }
-      }
-      return null;
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public void addClassReferencer(int qName, int referencerQName) throws CacheCorruptedException {
-    try {
-      if (qName == referencerQName) {
-        return; // do not log self-dependencies
-      }
-      if (myQNameToClassInfoMap.containsMapping(qName)) {
-        myDependencies.addClassReferencer(qName, referencerQName);
-        myQNameToReferencedClassesMap.addValue(referencerQName, qName);
-      }
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public void removeClassReferencer(int qName, int referencerQName) throws CacheCorruptedException {
-    try {
-      myDependencies.removeReferencer(qName, referencerQName);
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public void addFieldReferencer(int qName, int fieldName, int referencerQName) throws CacheCorruptedException {
-    try {
-      if (qName != referencerQName && myQNameToClassInfoMap.containsMapping(qName)) {
-        myDependencies.addFieldReferencer(qName, referencerQName, fieldName);
-        myQNameToReferencedClassesMap.addValue(referencerQName, qName);
-      }
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public void addMethodReferencer(int qName, int methodName, int methodDescriptor, int referencerQName) throws CacheCorruptedException {
-    try {
-      if (qName != referencerQName && myQNameToClassInfoMap.containsMapping(qName)) {
-        myDependencies.addMethodReferencer(qName, referencerQName, methodName, methodDescriptor);
-        myQNameToReferencedClassesMap.addValue(referencerQName, qName);
-      }
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  /** @NotNull */
-  public Dependency[] getBackDependencies(final int classQName) throws CacheCorruptedException{
-    return myDependencies.getDependencies(classQName);
-  }
-
-  public void wipe() {
-    try {
-      dispose();
-    }
-    catch (CacheCorruptedException ignored) {
-    }
-    finally {
-      final File[] files = new File(myStorePath).listFiles();
-      if (files != null) {
-        for (File file : files) {
-          if (!file.isDirectory()) {
-            FileUtil.delete(file);
-          }
-        }
-      }
-    }
-  }
-
-  public void removeClass(final int qName) throws CacheCorruptedException {
-    try {
-      final ClassInfo classInfo = myQNameToClassInfoMap.get(qName);
-      if (classInfo == null) {
-        return;
-      }
-      myDependencies.remove(qName);
-      myQNameToClassInfoMap.remove(qName);
-      myQNameToReferencedClassesMap.remove(qName);
-      myQNameToSubclassesMap.remove(qName);
-      myRemoteQNames.remove(qName);
-    }
-    catch (Throwable e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/CacheCorruptedException.java b/java/compiler/impl/src/com/intellij/compiler/make/CacheCorruptedException.java
deleted file mode 100644
index 916a370..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/CacheCorruptedException.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.
- */
-
-/*
- * @author: Eugene Zhuravlev
- * Date: Jul 10, 2003
- * Time: 4:51:25 PM
- */
-package com.intellij.compiler.make;
-
-import com.intellij.openapi.compiler.CompilerBundle;
-
-public class CacheCorruptedException extends Exception{
-  private static final String DEFAULT_MESSAGE = CompilerBundle.message("error.dependency.info.on.disk.corrupted");
-  public CacheCorruptedException(String message) {
-    super((message == null || message.length() == 0)? DEFAULT_MESSAGE : message);
-  }
-
-  public CacheCorruptedException(Throwable cause) {
-    super(DEFAULT_MESSAGE, cause);
-  }
-
-  public CacheCorruptedException(String message, Throwable cause) {
-    super((message == null || message.length() == 0)? DEFAULT_MESSAGE : message, cause);
-  }
-
-  public String getMessage() {
-    return super.getMessage();
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/CacheUtils.java b/java/compiler/impl/src/com/intellij/compiler/make/CacheUtils.java
deleted file mode 100644
index 51cb953..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/CacheUtils.java
+++ /dev/null
@@ -1,205 +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.compiler.make;
-
-import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.compiler.CompilerManagerImpl;
-import com.intellij.compiler.SymbolTable;
-import com.intellij.compiler.classParsing.MethodInfo;
-import com.intellij.compiler.impl.ExitException;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.CompilerBundle;
-import com.intellij.openapi.compiler.CompilerMessage;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.ThrowableComputable;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.Function;
-import com.intellij.util.StringBuilderSpinAllocator;
-import gnu.trove.TIntHashSet;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.*;
-
-/**
- * @author Eugene Zhuravlev
- * Date: Aug 18, 2003
- * Time: 6:32:32 PM
- */
-public class CacheUtils {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.make.CacheUtils");
-
-  public static String[] getParameterSignatures(MethodInfo methodDeclarationId, SymbolTable symbolTable) throws CacheCorruptedException {
-    String descriptor = symbolTable.getSymbol(methodDeclarationId.getDescriptor());
-    int endIndex = descriptor.indexOf(')');
-    if (endIndex <= 0) {
-      LOG.error("Corrupted method descriptor: " + descriptor);
-    }
-    return parseSignature(descriptor.substring(1, endIndex));
-  }
-
-  private static String[] parseSignature(String signature) {
-    final ArrayList<String> list = new ArrayList<String>();
-    String paramSignature = parseParameterSignature(signature);
-    while (paramSignature != null && !"".equals(paramSignature)) {
-      list.add(paramSignature);
-      signature = signature.substring(paramSignature.length());
-      paramSignature = parseParameterSignature(signature);
-    }
-    return ArrayUtil.toStringArray(list);
-  }
-
-  @SuppressWarnings({"HardCodedStringLiteral"})
-  private static @Nullable String parseParameterSignature(String signature) {
-    if (StringUtil.startsWithChar(signature, 'B')) {
-      return "B";
-    }
-    if (StringUtil.startsWithChar(signature, 'C')) {
-      return "C";
-    }
-    if (StringUtil.startsWithChar(signature, 'D')) {
-      return "D";
-    }
-    if (StringUtil.startsWithChar(signature, 'F')) {
-      return "F";
-    }
-    if (StringUtil.startsWithChar(signature, 'I')) {
-      return "I";
-    }
-    if (StringUtil.startsWithChar(signature, 'J')) {
-      return "J";
-    }
-    if (StringUtil.startsWithChar(signature, 'S')) {
-      return "S";
-    }
-    if (StringUtil.startsWithChar(signature, 'Z')) {
-      return "Z";
-    }
-    if (StringUtil.startsWithChar(signature, 'L')) {
-      return signature.substring(0, signature.indexOf(";") + 1);
-    }
-    if (StringUtil.startsWithChar(signature, '[')) {
-      String s = parseParameterSignature(signature.substring(1));
-      return (s != null) ? ("[" + s) : null;
-    }
-    return null;
-  }
-
-  public static String getMethodSignature(String name, String descriptor) {
-    final StringBuilder builder = StringBuilderSpinAllocator.alloc();
-    try {
-      builder.append(name);
-      builder.append(descriptor.substring(0, descriptor.indexOf(')') + 1));
-      return builder.toString();
-    }
-    finally {
-      StringBuilderSpinAllocator.dispose(builder);
-    }
-  }
-
-  public static boolean areArraysContentsEqual(int[] exceptions1, int[] exceptions2) {
-    if (exceptions1.length != exceptions2.length) {
-      return false;
-    }
-    if (exceptions1.length != 0) { // optimization
-      TIntHashSet exceptionsSet = new TIntHashSet(exceptions1);
-      for (int exception : exceptions2) {
-        if (!exceptionsSet.contains(exception)) {
-          return false;
-        }
-      }
-    }
-    return true;
-  }
-
-  public static Collection<VirtualFile> findDependentFiles(
-    final CompileContextEx context, 
-    final Set<VirtualFile> compiledWithErrors, 
-    final @Nullable Function<Pair<int[], Set<VirtualFile>>, Pair<int[], Set<VirtualFile>>> filter)
-    throws CacheCorruptedException, ExitException {
-
-    if (!CompilerConfiguration.MAKE_ENABLED) {
-      return Collections.emptyList();
-    }
-    context.getProgressIndicator().setText(CompilerBundle.message("progress.checking.dependencies"));
-
-    final DependencyCache dependencyCache = context.getDependencyCache();
-
-    final Pair<int[], Set<VirtualFile>> deps = dependencyCache.findDependentClasses(context, context.getProject(), compiledWithErrors);
-    final Pair<int[], Set<VirtualFile>> filteredDeps = filter != null ? filter.fun(deps) : deps;
-
-    final Set<VirtualFile> dependentFiles = new HashSet<VirtualFile>();
-    ApplicationManager.getApplication().runReadAction(new ThrowableComputable<Void, CacheCorruptedException>() {
-      @Override
-      public Void compute() throws CacheCorruptedException {
-        CompilerConfiguration compilerConfiguration = CompilerConfiguration.getInstance(context.getProject());
-        SourceFileFinder sourceFileFinder = new SourceFileFinder(context.getProject(), context);
-        final Cache cache = dependencyCache.getCache();
-        for (final int infoQName : filteredDeps.getFirst()) {
-          final String qualifiedName = dependencyCache.resolve(infoQName);
-          final String sourceFileName = cache.getSourceFileName(infoQName);
-          final VirtualFile file = sourceFileFinder.findSourceFile(qualifiedName, sourceFileName, true);
-          if (file != null) {
-            dependentFiles.add(file);
-            if (ApplicationManager.getApplication().isUnitTestMode()) {
-              LOG.assertTrue(file.isValid());
-              CompilerManagerImpl.addRecompiledPath(file.getPath());
-            }
-          }
-          else {
-            LOG.info("No source file for " + dependencyCache.resolve(infoQName) + " found; source file name=" + sourceFileName);
-          }
-        }
-        for (final VirtualFile file : filteredDeps.getSecond()) {
-          if (!compilerConfiguration.isExcludedFromCompilation(file)) {
-            dependentFiles.add(file);
-            if (ApplicationManager.getApplication().isUnitTestMode()) {
-              LOG.assertTrue(file.isValid());
-              CompilerManagerImpl.addRecompiledPath(file.getPath());
-            }
-          }
-        }
-        return null;
-      }
-    });
-    context.getProgressIndicator().setText(
-      dependentFiles.size() > 0 ? CompilerBundle.message("progress.found.dependent.files", dependentFiles.size()) : ""
-    );
-
-    return dependentFiles;
-  }
-
-  @NotNull
-  public static Set<VirtualFile> getFilesCompiledWithErrors(final CompileContextEx context) {
-    CompilerMessage[] messages = context.getMessages(CompilerMessageCategory.ERROR);
-    Set<VirtualFile> compiledWithErrors = Collections.emptySet();
-    if (messages.length > 0) {
-      compiledWithErrors = new HashSet<VirtualFile>(messages.length);
-      for (CompilerMessage message : messages) {
-        final VirtualFile file = message.getVirtualFile();
-        if (file != null) {
-          compiledWithErrors.add(file);
-        }
-      }
-    }
-    return compiledWithErrors;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/CachedPersistentHashMap.java b/java/compiler/impl/src/com/intellij/compiler/make/CachedPersistentHashMap.java
deleted file mode 100644
index 324a14a..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/CachedPersistentHashMap.java
+++ /dev/null
@@ -1,116 +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.compiler.make;
-
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.util.containers.SLRUMap;
-import com.intellij.util.io.DataExternalizer;
-import com.intellij.util.io.KeyDescriptor;
-import com.intellij.util.io.PersistentHashMap;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Dec 1, 2008
- */
-public class CachedPersistentHashMap<Key, Value> extends PersistentHashMap<Key, Value> {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.make.CachedPersistentHashMap");
-  protected final SLRUMap<Key, Value> myCache;
-
-  public CachedPersistentHashMap(File file, KeyDescriptor<Key> keyDescriptor, DataExternalizer<Value> valDescriptor, final int cacheSize) throws IOException {
-    super(file, keyDescriptor, valDescriptor);
-    myCache = new SLRUMap<Key,Value>(cacheSize * 2, cacheSize) {
-      protected void onDropFromCache(Key key, Value value) {
-        if (isValueDirty(value)) {
-          try {
-            CachedPersistentHashMap.super.put(key, value);
-          }
-          catch (IOException e) {
-            LOG.info(e);
-          }
-        }
-      }
-    };
-  }
-
-  protected boolean isValueDirty(Value value) {
-    return false;
-  }
-
-  @Override
-  protected void doPut(Key key, Value value) throws IOException {
-    myCache.remove(key);
-    super.doPut(key, value);
-  }
-
-  @Override
-  protected void doAppendData(Key key, @NotNull ValueDataAppender appender) throws IOException {
-    myCache.remove(key);
-    super.doAppendData(key, appender);
-  }
-
-  @Nullable
-  protected Value doGet(Key key) throws IOException {
-    Value value = myCache.get(key);
-    if (value == null) {
-      value = super.doGet(key);
-      if (value != null) {
-        myCache.put(key, value);
-      }
-    }
-    return value;
-  }
-
-  @Override
-  protected boolean doContainsMapping(Key key) throws IOException {
-    final Value value = myCache.get(key);
-    return value != null || super.doContainsMapping(key);
-  }
-
-  @Override
-  protected void doRemove(Key key) throws IOException {
-    myCache.remove(key);
-    super.doRemove(key);
-  }
-
-  @Override
-  protected void doForce() {
-    try {
-      clearCache();
-    }
-    finally {
-      super.doForce();
-    }
-  }
-
-  @Override
-  protected void doClose() throws IOException {
-    try {
-      clearCache();
-    }
-    finally {
-      super.doClose();
-    }
-  }
-
-  private void clearCache() {
-    myCache.clear();
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/CachingSearcher.java b/java/compiler/impl/src/com/intellij/compiler/make/CachingSearcher.java
deleted file mode 100644
index b232c2e..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/CachingSearcher.java
+++ /dev/null
@@ -1,57 +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.compiler.make;
-
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Pair;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiReference;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.searches.ReferencesSearch;
-import com.intellij.util.Query;
-import com.intellij.util.containers.SoftHashMap;
-
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Oct 15
- * @author 2003
- */
-public class CachingSearcher {
-  private final Project myProject;
-  private final Map<Pair<PsiElement, Boolean>, Collection<PsiReference>> myElementToReferencersMap = new SoftHashMap<Pair<PsiElement, Boolean>, Collection<PsiReference>>();
-
-  public CachingSearcher(Project project) {
-    myProject = project;
-  }
-
-  public Collection<PsiReference> findReferences(PsiElement element, final boolean ignoreAccessScope) {
-    final Pair<PsiElement, Boolean> key = Pair.create(element, ignoreAccessScope ? Boolean.TRUE : Boolean.FALSE);
-    Collection<PsiReference> psiReferences = myElementToReferencersMap.get(key);
-    if (psiReferences == null) {
-      GlobalSearchScope searchScope = GlobalSearchScope.projectScope(myProject);
-      searchScope = GlobalSearchScope.getScopeRestrictedByFileTypes(searchScope, StdFileTypes.JAVA);
-      final Query<PsiReference> query = ReferencesSearch.search(element, searchScope, ignoreAccessScope);
-      psiReferences = query.findAll();
-      myElementToReferencersMap.put(key, psiReferences);
-    }
-    return psiReferences;
-  }
-
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/ChangeDescription.java b/java/compiler/impl/src/com/intellij/compiler/make/ChangeDescription.java
deleted file mode 100644
index 1f5f8a3..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/ChangeDescription.java
+++ /dev/null
@@ -1,24 +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.compiler.make;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Apr 7, 2004
- */
-abstract class ChangeDescription {
-  public abstract boolean isChanged();
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/ChangedConstantsDependencyProcessor.java b/java/compiler/impl/src/com/intellij/compiler/make/ChangedConstantsDependencyProcessor.java
deleted file mode 100644
index ade4034..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/ChangedConstantsDependencyProcessor.java
+++ /dev/null
@@ -1,370 +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.
- */
-
-/**
- * created at Feb 24, 2002
- * @author Jeka
- */
-package com.intellij.compiler.make;
-
-import com.intellij.compiler.classParsing.FieldInfo;
-import com.intellij.compiler.impl.ExitException;
-import com.intellij.compiler.impl.ExitStatus;
-import com.intellij.lang.StdLanguages;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.progress.ProcessCanceledException;
-import com.intellij.openapi.project.DumbService;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Key;
-import com.intellij.openapi.util.Ref;
-import com.intellij.openapi.util.registry.Registry;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.*;
-import com.intellij.psi.search.*;
-import com.intellij.psi.util.PsiUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-public class ChangedConstantsDependencyProcessor {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.make.ChangedConstantsDependencyProcessor");
-  private final Project myProject;
-  private final CachingSearcher mySearcher;
-  private final DependencyCache myDependencyCache;
-  private final int myQName;
-  private final CompileContext myContext;
-  private final FieldChangeInfo[] myChangedFields;
-  private final FieldChangeInfo[] myRemovedFields;
-  private final int MAX_CONSTANT_SEARCHES = Registry.intValue("compiler.max.static.constants.searches");
-
-
-  public ChangedConstantsDependencyProcessor(Project project,
-                                             CachingSearcher searcher,
-                                             DependencyCache dependencyCache,
-                                             int qName, CompileContext context, FieldChangeInfo[] changedFields,
-                                             FieldChangeInfo[] removedFields) {
-    myProject = project;
-    mySearcher = searcher;
-    myDependencyCache = dependencyCache;
-    myQName = qName;
-    myContext = context;
-    myChangedFields = changedFields;
-    myRemovedFields = removedFields;
-  }
-
-  public void run() throws CacheCorruptedException, ExitException {
-    final Ref<CacheCorruptedException> _ex = new Ref<CacheCorruptedException>();
-    final Ref<ExitException> exitException = new Ref<ExitException>(null);
-    DumbService.getInstance(myProject).runReadActionInSmartMode(new Runnable() {
-      public void run() {
-        try {
-          final String qName = myDependencyCache.resolve(myQName);
-          PsiClass[] classes = JavaPsiFacade.getInstance(myProject).findClasses(qName.replace('$', '.'), GlobalSearchScope.allScope(myProject));
-          for (PsiClass aClass : classes) {
-            PsiField[] psiFields = aClass.getFields();
-            for (PsiField psiField : psiFields) {
-              final FieldChangeInfo changeInfo = findChangeInfo(psiField);
-              if (changeInfo != null) { // this field has been changed
-                processFieldChanged(psiField, aClass, changeInfo.isAccessibilityChange);
-              }
-            }
-            for (FieldChangeInfo removedField : myRemovedFields) {
-              processFieldRemoved(removedField.fieldInfo, aClass);
-            }
-          }
-        }
-        catch (CacheCorruptedException e) {
-          _ex.set(e);
-        }
-        catch (ExitException e) {
-          exitException.set(e);
-        }
-        catch (ProcessCanceledException e) {
-          // supressed deliberately
-        }
-      }
-    });
-    if (_ex.get() != null) {
-      throw _ex.get();
-    }
-    if (exitException.get() != null) {
-      throw exitException.get();
-    }
-  }
-
-  private void processFieldRemoved(FieldInfo info, final PsiClass aClass) throws CacheCorruptedException {
-    if (info.isPrivate()) {
-      return; // optimization: don't need to search, cause may be used only in this class
-    }
-    SearchScope searchScope = GlobalSearchScope.projectScope(myProject);
-    if (info.isPackageLocal()) {
-      final PsiFile containingFile = aClass.getContainingFile();
-      if (containingFile instanceof PsiJavaFile) {
-        final String packageName = ((PsiJavaFile)containingFile).getPackageName();
-        final PsiPackage aPackage = JavaPsiFacade.getInstance(myProject).findPackage(packageName);
-        if (aPackage != null) {
-          searchScope = PackageScope.packageScope(aPackage, false);
-          searchScope = searchScope.intersectWith(aClass.getUseScope());
-        }
-      }
-    }
-    final PsiSearchHelper psiSearchHelper = PsiSearchHelper.SERVICE.getInstance(myProject);
-
-    final Ref<CacheCorruptedException> exRef = new Ref<CacheCorruptedException>(null);
-    processIdentifiers(psiSearchHelper, new PsiElementProcessor<PsiIdentifier>() {
-      @Override
-      public synchronized boolean execute(@NotNull PsiIdentifier identifier) {
-        try {
-          final PsiElement parent = identifier.getParent();
-          if (parent instanceof PsiReferenceExpression) {
-            final PsiClass ownerClass = getOwnerClass(parent);
-            if (ownerClass != null && !ownerClass.equals(aClass)) {
-              final String _qName = ownerClass.getQualifiedName();
-              if (_qName != null) {
-                int qualifiedName = myDependencyCache.getSymbolTable().getId(_qName);
-                // should force marking of the class no matter was it compiled or not
-                // This will ensure the class was recompiled _after_ all the constants get their new values
-                if (myDependencyCache.markClass(qualifiedName, true)) {
-                  if (LOG.isDebugEnabled()) {
-                    LOG.debug("Mark dependent class " + myDependencyCache.resolve(qualifiedName) + "; reason: some constants were removed from " + myDependencyCache.resolve(myQName));
-                  }
-                }
-              }
-              else {
-                LOG.warn("Class with null qualified name was not expected here: " + ownerClass);
-              }
-            }
-          }
-          return true;
-        }
-        catch (CacheCorruptedException e) {
-          exRef.set(e);
-          return false;
-        }
-      }
-    }, myDependencyCache.resolve(info.getName()), searchScope, UsageSearchContext.IN_CODE);
-    
-    final CacheCorruptedException cacheCorruptedException = exRef.get();
-    if (cacheCorruptedException != null) {
-      throw cacheCorruptedException;
-    }
-  }
-
-  private static boolean processIdentifiers(PsiSearchHelper helper,
-                                            @NotNull final PsiElementProcessor<PsiIdentifier> processor,
-                                            @NotNull final String identifier,
-                                            @NotNull SearchScope searchScope,
-                                            short searchContext) {
-    TextOccurenceProcessor processor1 = new TextOccurenceProcessor() {
-      public boolean execute(PsiElement element, int offsetInElement) {
-        return !(element instanceof PsiIdentifier) || processor.execute((PsiIdentifier)element);
-      }
-    };
-    return helper.processElementsWithWord(processor1, searchScope, identifier, searchContext, true);
-  }
-
-  private void processFieldChanged(PsiField field, PsiClass aClass, final boolean isAccessibilityChange)
-    throws CacheCorruptedException, ExitException {
-    if (!isAccessibilityChange && field.hasModifierProperty(PsiModifier.PRIVATE)) {
-      return; // optimization: don't need to search, cause may be used only in this class
-    }
-    Set<PsiElement> usages = new HashSet<PsiElement>();
-    addUsages(field, usages, isAccessibilityChange);
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("++++++++++++++++++++++++++++++++++++++++++++++++");
-      LOG.debug("Processing changed field: " + aClass.getQualifiedName() + "." + field.getName());
-    }
-    for (final PsiElement usage : usages) {
-      PsiClass ownerClass = getOwnerClass(usage);
-      if (LOG.isDebugEnabled()) {
-        if (ownerClass != null) {
-          LOG.debug("Usage " + usage + " found in class: " + ownerClass.getQualifiedName());
-        }
-        else {
-          LOG.debug("Usage " + usage + " found in class: null");
-        }
-      }
-      if (ownerClass != null && !ownerClass.equals(aClass)) {
-        int qualifiedName = myDependencyCache.getSymbolTable().getId(ownerClass.getQualifiedName());
-        // should force marking of the class no matter was it compiled or not
-        // This will ensure the class was recompiled _after_ all the constants get their new values
-        if (LOG.isDebugEnabled()) {
-          LOG.debug("Marking class id = [" + qualifiedName + "], name=[" + myDependencyCache.resolve(qualifiedName) + "]");
-        }
-        if (myDependencyCache.markClass(qualifiedName, true)) {
-          if (LOG.isDebugEnabled()) {
-            LOG.debug("Marked dependent class " + myDependencyCache.resolve(qualifiedName) + "; reason: constants changed in " +
-                        myDependencyCache.resolve(myQName));
-          }
-        }
-      }
-      else if (ownerClass == null) {
-        final PsiFile containingFile = usage.getContainingFile();
-        if (containingFile != null) {
-          final VirtualFile file = containingFile.getVirtualFile();
-          if (file != null) {
-            myDependencyCache.markFile(file);
-          }
-        }
-      }
-    }
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("+++++++++++++++++++++++++++++++++++++++++++++++");
-    }
-  }
-
-  private void addUsages(PsiField psiField, Collection<PsiElement> usages, final boolean ignoreAccessScope) throws ExitException {
-    final int count = getConstantSearchesCount();
-    if (count > MAX_CONSTANT_SEARCHES) {
-      myContext.requestRebuildNextTime("Too many changed compile-time constants, project rebuild scheduled");
-      throw new ExitException(ExitStatus.CANCELLED);
-    }
-    Collection<PsiReference> references = mySearcher.findReferences(psiField, ignoreAccessScope)/*doFindReferences(searchHelper, psiField)*/;
-
-    incConstantSearchesCount();
-
-    for (final PsiReference ref : references) {
-      if (!(ref instanceof PsiReferenceExpression)) {
-        continue;
-      }
-      PsiElement e = ref.getElement();
-      usages.add(e);
-      PsiField ownerField = getOwnerField(e);
-      if (ownerField != null) {
-        if (ownerField.hasModifierProperty(PsiModifier.FINAL)) {
-          PsiExpression initializer = ownerField.getInitializer();
-          if (initializer != null && PsiUtil.isConstantExpression(initializer)) {
-            // if the field depends on the compile-time-constant expression and is itself final
-            addUsages(ownerField, usages, ignoreAccessScope);
-          }
-        }
-      }
-    }
-  }
-
-  /*
-  private PsiReference[] doFindReferences(final PsiSearchHelper searchHelper, final PsiField psiField) {
-    final ProgressManager progressManager = ProgressManager.getInstance();
-    final ProgressIndicator currentProgress = progressManager.getProgressIndicator();
-    final PsiReference[][] references = new PsiReference[][] {null};
-    progressManager.runProcess(new Runnable() {
-      public void run() {
-        references[0] = searchHelper.findReferences(psiField, GlobalSearchScope.projectScope(myProject), false);
-        if (ENABLE_TRACING) {
-          System.out.println("Finding referencers for " + psiField);
-        }
-      }
-    }, new NonCancellableProgressAdapter(currentProgress));
-    return references[0];
-  }
-  */
-
-  @Nullable
-  private static PsiField getOwnerField(PsiElement element) {
-    while (!(element instanceof PsiFile)) {
-      if (element instanceof PsiClass) {
-        break;
-      }
-      if (element instanceof PsiField) { // top-level class
-        return (PsiField)element;
-      }
-      element = element.getParent();
-    }
-    return null;
-  }
-
-  @Nullable
-  private FieldChangeInfo findChangeInfo(PsiField field) throws CacheCorruptedException {
-    String name = field.getName();
-    for (final FieldChangeInfo changeInfo : myChangedFields) {
-      if (name.equals(myDependencyCache.resolve(changeInfo.fieldInfo.getName()))) {
-        return changeInfo;
-      }
-    }
-    return null;
-  }
-
-  @Nullable
-  private static PsiClass getOwnerClass(PsiElement element) {
-    while (!(element instanceof PsiFile)) {
-      if (element instanceof PsiClass && element.getParent() instanceof PsiJavaFile) { // top-level class
-        final PsiClass psiClass = (PsiClass)element;
-        if (JspPsiUtil.isInJspFile(psiClass)) {
-          return null;
-        }
-        final PsiFile containingFile = psiClass.getContainingFile();
-        if (containingFile == null) {
-          return null;
-        }
-        return StdLanguages.JAVA.equals(containingFile.getLanguage())? psiClass : null;
-      }
-      element = element.getParent();
-    }
-    return null;
-  }
-
-  public static class FieldChangeInfo {
-    final FieldInfo fieldInfo;
-    final boolean isAccessibilityChange;
-
-    public FieldChangeInfo(final FieldInfo fieldId) {
-      this(fieldId, false);
-    }
-
-    public FieldChangeInfo(final FieldInfo fieldInfo, final boolean accessibilityChange) {
-      this.fieldInfo = fieldInfo;
-      isAccessibilityChange = accessibilityChange;
-    }
-
-    public boolean equals(Object o) {
-      if (this == o) return true;
-      if (o == null || getClass() != o.getClass()) return false;
-
-      final FieldChangeInfo fieldChangeInfo = (FieldChangeInfo)o;
-
-      if (isAccessibilityChange != fieldChangeInfo.isAccessibilityChange) return false;
-      if (!fieldInfo.equals(fieldChangeInfo.fieldInfo)) return false;
-
-      return true;
-    }
-
-    public int hashCode() {
-      int result;
-      result = fieldInfo.hashCode();
-      result = 29 * result + (isAccessibilityChange ? 1 : 0);
-      return result;
-    }
-  }
-
-  private static final Key<Integer> CONSTANTS_COUNTER = Key.create("_constant_searches_counter_");
-
-  private int getConstantSearchesCount() {
-    return getConstantSearchesCount(myContext);
-  }
-
-  public static int getConstantSearchesCount(CompileContext context) {
-    final Integer value = CONSTANTS_COUNTER.get(context);
-    return value != null? value.intValue() : 0;
-  }
-
-  private void incConstantSearchesCount() {
-    CONSTANTS_COUNTER.set(myContext, getConstantSearchesCount() + 1);
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/ChangedRetentionPolicyDependencyProcessor.java b/java/compiler/impl/src/com/intellij/compiler/make/ChangedRetentionPolicyDependencyProcessor.java
deleted file mode 100644
index 314fce9..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/ChangedRetentionPolicyDependencyProcessor.java
+++ /dev/null
@@ -1,107 +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.compiler.make;
-
-import com.intellij.compiler.SymbolTable;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.progress.ProcessCanceledException;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.util.cls.ClsUtil;
-
-import java.util.Collection;
-
-public class ChangedRetentionPolicyDependencyProcessor {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.make.ChangedConstantsDependencyProcessor");
-  private final Project myProject;
-  private final CachingSearcher mySearcher;
-  private final DependencyCache myDependencyCache;
-
-  public ChangedRetentionPolicyDependencyProcessor(Project project, CachingSearcher searcher, DependencyCache dependencyCache) {
-    myProject = project;
-    mySearcher = searcher;
-    myDependencyCache = dependencyCache;
-  }
-
-  public void checkAnnotationRetentionPolicyChanges(final int annotationQName) throws CacheCorruptedException {
-    final Cache oldCache = myDependencyCache.getCache();
-    if (!ClsUtil.isAnnotation(oldCache.getFlags(annotationQName))) {
-      return;
-    }
-    if (!hasRetentionPolicyChanged(annotationQName, oldCache, myDependencyCache.getNewClassesCache(), myDependencyCache.getSymbolTable())) {
-      return;
-    }
-    final CacheCorruptedException[] _ex = new CacheCorruptedException[] {null};
-    ApplicationManager.getApplication().runReadAction(new Runnable() {
-      public void run() {
-        try {
-          final String qName = myDependencyCache.resolve(annotationQName);
-          PsiClass[] classes = JavaPsiFacade.getInstance(myProject).findClasses(qName.replace('$', '.'), GlobalSearchScope.allScope(myProject));
-          for (final PsiClass aClass : classes) {
-            if (!aClass.isAnnotationType()) {
-              continue;
-            }
-            final Collection<PsiReference> references = mySearcher.findReferences(aClass, true);
-            for (PsiReference reference : references) {
-              final PsiClass ownerClass = getOwnerClass(reference.getElement());
-              if (ownerClass != null && !ownerClass.equals(aClass)) {
-                int qualifiedName = myDependencyCache.getSymbolTable().getId(ownerClass.getQualifiedName());
-                if (myDependencyCache.markClass(qualifiedName, false)) {
-                  if (LOG.isDebugEnabled()) {
-                    LOG.debug("Marked dependent class " + myDependencyCache.resolve(qualifiedName) +
-                              "; reason: annotation's retention policy changed from SOURCE to CLASS or RUNTIME " +
-                              myDependencyCache.resolve(annotationQName));
-                  }
-                }
-              }
-            }
-          }
-        }
-        catch (CacheCorruptedException e) {
-         _ex[0] = e;
-        }
-        catch (ProcessCanceledException e) {
-          // supressed deliberately
-        }
-      }
-    });
-    if (_ex[0] != null) {
-      throw _ex[0];
-    }
-  }
-
-  private boolean hasRetentionPolicyChanged(int annotationQName, final Cache oldCache, final Cache newCache, SymbolTable symbolTable) throws CacheCorruptedException {
-    // if retention policy changed from SOURCE to CLASS or RUNTIME, all sources should be recompiled to propagate changes
-    final int oldPolicy = MakeUtil.getAnnotationRetentionPolicy(annotationQName, oldCache, symbolTable);
-    final int newPolicy = MakeUtil.getAnnotationRetentionPolicy(annotationQName, newCache, symbolTable);
-    if ((oldPolicy == RetentionPolicies.SOURCE) && (newPolicy == RetentionPolicies.CLASS || newPolicy == RetentionPolicies.RUNTIME)) {
-      return true;
-    }
-    return false;
-  }
-
-  private static PsiClass getOwnerClass(PsiElement element) {
-    while (!(element instanceof PsiFile)) {
-      if (element instanceof PsiClass && element.getParent() instanceof PsiJavaFile) { // top-level class
-        return (PsiClass)element;
-      }
-      element = element.getParent();
-    }
-    return null;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/ClassInfoProcessor.java b/java/compiler/impl/src/com/intellij/compiler/make/ClassInfoProcessor.java
deleted file mode 100644
index 5298a8c..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/ClassInfoProcessor.java
+++ /dev/null
@@ -1,32 +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: Eugene Zhuravlev
- * Date: May 14, 2003
- * Time: 10:42:29 AM
- */
-package com.intellij.compiler.make;
-
-
-
-public interface ClassInfoProcessor {
-  /**
-   * @param classQName of a class info to be processed
-   * @return true if superclasses of info should be processed and false otherwise
-   */
-  boolean process(int classQName) throws CacheCorruptedException;
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/CompilerDependencyStorage.java b/java/compiler/impl/src/com/intellij/compiler/make/CompilerDependencyStorage.java
deleted file mode 100644
index 2466881..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/CompilerDependencyStorage.java
+++ /dev/null
@@ -1,257 +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.compiler.make;
-
-import com.intellij.openapi.Disposable;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.Ref;
-import com.intellij.util.containers.SLRUCache;
-import com.intellij.util.io.DataExternalizer;
-import com.intellij.util.io.KeyDescriptor;
-import com.intellij.util.io.PersistentHashMap;
-import gnu.trove.TIntHashSet;
-import gnu.trove.TIntProcedure;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.*;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Dec 1, 2008
- */
-public class CompilerDependencyStorage<Key> implements Flushable, Disposable {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.make.CompilerDependencyStorage");
-  protected final PersistentHashMap<Key, int[]> myMap;
-  protected final SLRUCache<Key, IntSet> myCache;
-  private Key myKeyToRemove;
-
-  public CompilerDependencyStorage(File file, KeyDescriptor<Key> keyDescriptor, final int cacheSize) throws IOException {
-    myMap = new PersistentHashMap<Key, int[]>(file, keyDescriptor, new DataExternalizer<int[]>() {
-      public void save(@NotNull DataOutput out, int[] array) throws IOException {
-        out.writeInt(array.length);
-        for (int value : array) {
-          out.writeInt(value);
-        }
-      }
-
-      public int[] read(@NotNull DataInput in) throws IOException {
-        final TIntHashSet set = new TIntHashSet();
-        DataInputStream stream = (DataInputStream)in;
-        while(stream.available() > 0) {
-          final int size = stream.readInt();
-          final int _size = Math.abs(size);
-          for (int idx = 0; idx < _size; idx++) {
-            if (size > 0) {
-              set.add(stream.readInt());
-            }
-            else {
-              set.remove(stream.readInt());
-            }
-          }
-        }
-        return set.toArray();
-      }
-    });
-
-    myCache = new SLRUCache<Key, IntSet>(cacheSize * 2, cacheSize) {
-      @NotNull
-      public IntSet createValue(Key key) {
-        return new IntSet(key);
-      }
-
-      protected void onDropFromCache(Key key, final IntSet set) {
-        if (key == myKeyToRemove || !set.isDirty()) {
-          return;
-        }
-        try {
-          if (set.needsCompacting()) {
-            myMap.put(key, set.getValues());
-          }
-          else {
-            myMap.appendData(key, new PersistentHashMap.ValueDataAppender() {
-              public void append(final DataOutput out) throws IOException {
-                final Ref<IOException> exception = new Ref<IOException>(null);
-                final TIntProcedure saveProc = new TIntProcedure() {
-                  public boolean execute(int value) {
-                    try {
-                      out.writeInt(value);
-                      return true;
-                    }
-                    catch (IOException e) {
-                      exception.set(e);
-                      return false;
-                    }
-                  }
-                };
-
-                out.writeInt(-set.getRemovedCount());
-                set.processRemovedValues(saveProc);
-                if (exception.get() != null) {
-                  throw exception.get();
-                }
-
-                out.writeInt(set.getAddedCount());
-                set.processAddedValues(saveProc);
-                if (exception.get() != null) {
-                  throw exception.get();
-                }
-              }
-            });
-          }
-        }
-        catch (IOException e) {
-          LOG.error(e);
-        }
-      }
-    };
-  }
-
-  public synchronized void remove(Key key) throws IOException {
-    myKeyToRemove = key;
-    try {
-      myCache.remove(key);
-    }
-    finally {
-      myKeyToRemove = null;
-    }
-    myMap.remove(key);
-  }
-
-  public synchronized void removeValue(Key key, int value) throws IOException {
-    final IntSet set = myCache.get(key);
-    set.remove(value);
-    if (set.needsFlushing()) {
-      flush(key);
-    }
-  }
-
-
-  public synchronized void addValue(Key key, int value) throws IOException {
-    final IntSet set = myCache.get(key);
-    set.add(value);
-    if (set.needsFlushing()) {
-      flush(key);
-    }
-  }
-
-  public synchronized int[] getValues(Key key) throws IOException {
-    return myCache.get(key).getValues();
-  }
-
-
-  public synchronized void flush() throws IOException {
-    myCache.clear();
-    myMap.force();
-  }
-
-  private void flush(Key key) {
-    myCache.remove(key); // makes changes into PersistentHashMap
-    myMap.force(); // flushes internal caches (which consume memory) and writes unsaved data to disk
-  }
-
-  public synchronized void dispose() {
-    try {
-      flush();
-    }
-    catch (IOException e) {
-      LOG.info(e);
-    }
-    try {
-      myMap.close();
-    }
-    catch (IOException e) {
-      LOG.info(e);
-    }
-  }
-
-  private class IntSet {
-    private final TIntHashSet myAdded = new TIntHashSet();
-    private final TIntHashSet myRemoved = new TIntHashSet();
-    private TIntHashSet myMerged = null;
-    private final Key myKey;
-
-    public IntSet(Key key) {
-      myKey = key;
-    }
-
-    public void add(int value) {
-      if (myMerged != null) {
-        myMerged.add(value);
-      }
-      if (!myRemoved.remove(value)) {
-        myAdded.add(value);
-      }
-    }
-
-    public void remove(int value) {
-      if (myMerged != null) {
-        myMerged.remove(value);
-      }
-      if (!myAdded.remove(value)) {
-        myRemoved.add(value);
-      }
-    }
-
-    public boolean isDirty() {
-      return myAdded.size() > 0 || myRemoved.size() > 0;
-    }
-
-    public boolean needsCompacting() {
-      return myMerged != null;
-    }
-
-    public boolean needsFlushing() {
-      return myAdded.size() > 3000 || myRemoved.size() > 3000;
-    }
-
-    public int getAddedCount() {
-      return myAdded.size();
-    }
-
-    public void processAddedValues(final TIntProcedure procedure) {
-      myAdded.forEach(procedure);
-    }
-
-    public int getRemovedCount() {
-      return myRemoved.size();
-    }
-
-    public void processRemovedValues(final TIntProcedure procedure) {
-      myRemoved.forEach(procedure);
-    }
-
-    public int[] getValues() throws IOException {
-      return getMerged().toArray();
-    }
-
-    private TIntHashSet getMerged() throws IOException {
-      if (myMerged == null) {
-        myMerged = new TIntHashSet();
-        final int[] fromDisk = myMap.get(myKey);
-        if (fromDisk != null) {
-          myMerged.addAll(fromDisk);
-        }
-        if (myRemoved.size() > 0) {
-          myMerged.removeAll(myRemoved.toArray());
-        }
-        if (myAdded.size() > 0) {
-          myMerged.addAll(myAdded.toArray());
-        }
-      }
-      return myMerged;
-    }
-  }
-}
\ No newline at end of file
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/Dependency.java b/java/compiler/impl/src/com/intellij/compiler/make/Dependency.java
deleted file mode 100644
index bd2c5cf..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/Dependency.java
+++ /dev/null
@@ -1,188 +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.
- */
-
-/**
- * created at Jan 4, 2002
- * @author Jeka
- */
-package com.intellij.compiler.make;
-
-import com.intellij.compiler.SymbolTable;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.util.ArrayUtil;
-import org.jetbrains.annotations.NonNls;
-
-import java.util.*;
-
-public class Dependency {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.make.Dependency");
-  public static final Dependency[] EMPTY_ARRAY = new Dependency[0];
-  private final int myClassQualifiedName;
-  private Set<FieldRef> myUsedFields;
-  private Set<MethodRef> myUsedMethods;
-
-  public static class FieldRef {
-    public final int name;
-
-    public FieldRef(int name) {
-      this.name = name;
-    }
-
-    public boolean equals(Object o) {
-      if (this == o) return true;
-      if (o == null || getClass() != o.getClass()) return false;
-
-      FieldRef fieldRef = (FieldRef)o;
-
-      if (name != fieldRef.name) return false;
-
-      return true;
-    }
-
-    public int hashCode() {
-      return name;
-    }
-  }
-
-  public static class MethodRef {
-    public final int name;
-    public final int descriptor;
-    private String[] myParameterDescriptors;
-
-    public MethodRef(int name, int descriptor) {
-      this.name = name;
-      this.descriptor = descriptor;
-    }
-
-    public boolean equals(Object o) {
-      if (this == o) return true;
-      if (o == null || getClass() != o.getClass()) return false;
-
-      MethodRef methodRef = (MethodRef)o;
-
-      if (descriptor != methodRef.descriptor) return false;
-      if (name != methodRef.name) return false;
-
-      return true;
-    }
-
-    public int hashCode() {
-      int result = name;
-      result = 31 * result + descriptor;
-      return result;
-    }
-
-    public String getDescriptor(SymbolTable symbolTable) throws CacheCorruptedException {
-      final String descriptorStr = symbolTable.getSymbol(descriptor);
-      final String nameStr = symbolTable.getSymbol(name);
-      return CacheUtils.getMethodSignature(nameStr, descriptorStr);
-    }
-
-
-    public String[] getParameterDescriptors(SymbolTable symbolTable) throws CacheCorruptedException {
-      if (myParameterDescriptors == null) {
-        String descriptorStr = symbolTable.getSymbol(descriptor);
-        int endIndex = descriptorStr.indexOf(')');
-        if (endIndex <= 0) {
-          LOG.error("Corrupted method descriptor: " + descriptorStr);
-        }
-        myParameterDescriptors = parseParameterDescriptors(descriptorStr.substring(1, endIndex));
-      }
-      return myParameterDescriptors;
-    }
-  }
-
-  public Dependency(int classQualifiedName) {
-    myClassQualifiedName = classQualifiedName;
-  }
-
-  public int getClassQualifiedName() {
-    return myClassQualifiedName;
-  }
-
-  public void addMethod(int name, int descriptor) {
-    if (myUsedMethods == null) {
-      myUsedMethods = new HashSet<MethodRef>();
-    }
-    myUsedMethods.add(new MethodRef(name, descriptor));
-  }
-
-  public void addField(int name) {
-    if (myUsedFields == null) {
-      myUsedFields = new HashSet<FieldRef>();
-    }
-    myUsedFields.add(new FieldRef(name));
-  }
-
-  public Collection<FieldRef> getFieldRefs() {
-    return myUsedFields != null? Collections.unmodifiableSet(myUsedFields) : Collections.<FieldRef>emptySet();
-  }
-
-  public Collection<MethodRef> getMethodRefs() {
-    return myUsedMethods != null? Collections.unmodifiableSet(myUsedMethods) : Collections.<MethodRef>emptySet();
-  }
-
-  private static String[] parseParameterDescriptors(String signature) {
-    ArrayList<String> list = new ArrayList<String>();
-    String paramSignature = parseFieldType(signature);
-    while (paramSignature != null && !paramSignature.isEmpty()) {
-      list.add(paramSignature);
-      signature = signature.substring(paramSignature.length());
-      paramSignature = parseFieldType(signature);
-    }
-    return ArrayUtil.toStringArray(list);
-  }
-
-  private static String parseFieldType(@NonNls String signature) {
-    if (signature.isEmpty()) {
-      return null;
-    }
-    char first = signature.charAt(0);
-    if (first == 'I') {
-      return "I";
-    }
-    if (first == 'L') {
-      return signature.substring(0, signature.indexOf(';') + 1);
-    }
-    if (first == 'B') {
-      return "B";
-    }
-    if (first == 'C') {
-      return "C";
-    }
-    if (first == 'D') {
-      return "D";
-    }
-    if (first == 'F') {
-      return "F";
-    }
-    if (first == 'J') {
-      return "J";
-    }
-    if (first == 'S') {
-      return "S";
-    }
-    if (first == 'Z') {
-      return "Z";
-    }
-    if (first == '[') {
-      String s = parseFieldType(signature.substring(1));
-      return s == null ? null : "[" + s;
-    }
-    return null;
-  }
-
-}
\ No newline at end of file
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/DependencyCache.java b/java/compiler/impl/src/com/intellij/compiler/make/DependencyCache.java
deleted file mode 100644
index 722f9fa..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/DependencyCache.java
+++ /dev/null
@@ -1,659 +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.
- */
-
-/**
- * created at Jan 7, 2002
- * @author Jeka
- */
-package com.intellij.compiler.make;
-
-import com.intellij.compiler.DependencyProcessor;
-import com.intellij.compiler.SymbolTable;
-import com.intellij.compiler.classParsing.*;
-import com.intellij.compiler.impl.ExitException;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.progress.ProcessCanceledException;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.cls.ClsFormatException;
-import com.intellij.util.cls.ClsUtil;
-import gnu.trove.TIntHashSet;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-import java.io.IOException;
-import java.rmi.Remote;
-import java.util.*;
-
-public class DependencyCache {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.make.DependencyCache");
-
-  private volatile Cache myCache;
-  private volatile Cache myNewClassesCache;
-
-  private static final String REMOTE_INTERFACE_NAME = Remote.class.getName();
-  private final TIntHashSet myToUpdate = new TIntHashSet(); // qName strings to be updated.
-  private final TIntHashSet myTraverseRoots = new TIntHashSet(); // Dependencies are calculated from these clasess
-  private final TIntHashSet myClassesWithSourceRemoved = new TIntHashSet();
-  private final TIntHashSet myPreviouslyRemoteClasses = new TIntHashSet(); // classes that were Remote, but became non-Remote for some reason
-  private final TIntHashSet myMarkedInfos = new TIntHashSet(); // classes to be recompiled
-  private final Set<VirtualFile> myMarkedFiles = new HashSet<VirtualFile>();
-  
-  private volatile DependencyCacheNavigator myCacheNavigator;
-  private volatile SymbolTable mySymbolTable;
-  private final String mySymbolTableFilePath;
-  private final String myStoreDirectoryPath;
-  @NonNls 
-  private static final String SYMBOLTABLE_FILE_NAME = "symboltable.dat";
-
-  public DependencyCache(@NonNls String storeDirectoryPath) {
-    myStoreDirectoryPath = storeDirectoryPath;
-    LOG.assertTrue(myStoreDirectoryPath != null);
-
-    mySymbolTableFilePath = myStoreDirectoryPath + "/" + SYMBOLTABLE_FILE_NAME;
-  }
-
-  public DependencyCacheNavigator getCacheNavigator() throws CacheCorruptedException {
-    if (myCacheNavigator == null) {
-      myCacheNavigator = new DependencyCacheNavigator(getCache());
-    }
-    return myCacheNavigator;
-  }
-
-  public void wipe() throws CacheCorruptedException {
-    getCache().wipe();
-    getNewClassesCache().wipe();
-  }
-
-  public Cache getCache() throws CacheCorruptedException {
-    try {
-      if (myCache == null) {
-        // base number of cached record views of each type
-        myCache = new Cache(myStoreDirectoryPath, 512);
-      }
-
-      return myCache;
-    }
-    catch (IOException e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public Cache getNewClassesCache() throws CacheCorruptedException {
-    try {
-      if (myNewClassesCache == null) {
-        myNewClassesCache = new Cache(myStoreDirectoryPath + "/tmp", 16);
-      }
-      return myNewClassesCache;
-    }
-    catch (IOException e) {
-      throw new CacheCorruptedException(e);
-    }
-  }
-
-  public void addTraverseRoot(int qName) {
-    myTraverseRoots.add(qName);
-  }
-
-  public void clearTraverseRoots() {
-    myTraverseRoots.clear();
-  }
-
-  public boolean hasUnprocessedTraverseRoots() {
-    return !myTraverseRoots.isEmpty();
-  }
-
-  public void markSourceRemoved(int qName) {
-    myClassesWithSourceRemoved.add(qName);
-  }
-
-  public void addClassToUpdate(int qName) {
-    myToUpdate.add(qName);
-  }
-
-  public int reparseClassFile(@NotNull File file, final byte[] fileContent) throws ClsFormatException, CacheCorruptedException {
-    SymbolTable symbolTable = getSymbolTable();
-
-    final int qName = getNewClassesCache().importClassInfo(new ClassFileReader(file, symbolTable, fileContent), symbolTable);
-    addClassToUpdate(qName);
-    addTraverseRoot(qName);
-    return qName;
-  }
-
-  // for profiling purposes
-  /*
-  private static void pause() {
-    System.out.println("PAUSED. ENTER A CHAR.");
-    byte[] buf = new byte[1];
-    try {
-      System.in.read(buf);
-    }
-    catch (IOException e) {
-      e.printStackTrace();
-    }
-  }
-  */
-
-  public void update() throws CacheCorruptedException {
-    if (myToUpdate.isEmpty()) {
-      return; // optimization
-    }
-
-    //pause();
-
-    final int[] namesToUpdate = myToUpdate.toArray();
-    final Cache cache = getCache();
-    final Cache newCache = getNewClassesCache();
-    final DependencyCacheNavigator navigator = getCacheNavigator();
-
-    // remove unnecesary dependencies
-    for (final int qName : namesToUpdate) {
-      // process use-dependencies
-      for (int referencedClassQName : cache.getReferencedClasses(qName)) {
-        if (!cache.containsClass(referencedClassQName)) {
-          continue;
-        }
-        cache.removeClassReferencer(referencedClassQName, qName);
-      }
-      cache.clearReferencedClasses(qName);
-      // process inheritance dependencies
-      navigator.walkSuperClasses(qName, new ClassInfoProcessor() {
-        public boolean process(int classQName) throws CacheCorruptedException {
-          cache.removeSubclass(classQName, qName);
-          return true;
-        }
-      });
-    }
-
-    // do update of classInfos
-    for (final int qName : namesToUpdate) {
-      cache.importClassInfo(newCache, qName);
-    }
-
-    // build forward-dependencies for the new infos, all new class infos must be already in the main cache!
-
-    final SymbolTable symbolTable = getSymbolTable();
-
-    for (final int qName : namesToUpdate) {
-      if (!newCache.containsClass(qName)) {
-        continue;
-      }
-      buildForwardDependencies(qName, newCache.getReferences(qName));
-      boolean isRemote = false;
-      // "remote objects" are classes that _directly_ implement remote interfaces
-      final int[] superInterfaces = cache.getSuperInterfaces(qName);
-      if (superInterfaces.length > 0) {
-        final int remoteInterfaceName = symbolTable.getId(REMOTE_INTERFACE_NAME);
-        for (int superInterface : superInterfaces) {
-          if (isRemoteInterface(cache, superInterface, remoteInterfaceName)) {
-            isRemote = true;
-            break;
-          }
-        }
-      }
-      final boolean wasRemote = cache.isRemote(qName);
-      if (wasRemote && !isRemote) {
-        synchronized (myPreviouslyRemoteClasses) {
-          myPreviouslyRemoteClasses.add(qName);
-        }
-      }
-      cache.setRemote(qName, isRemote);
-    }
-
-    // building subclass dependencies
-    for (final int qName : namesToUpdate) {
-      buildSubclassDependencies(getCache(), qName, qName);
-    }
-
-    for (final int qName : myClassesWithSourceRemoved.toArray()) {
-      cache.removeClass(qName);
-    }
-    myToUpdate.clear();
-
-    //pause();
-  }
-
-  private void buildForwardDependencies(final int classQName, final Collection<ReferenceInfo> references) throws CacheCorruptedException {
-    final Cache cache = getCache();
-
-    final int genericSignature = cache.getGenericSignature(classQName);
-    if (genericSignature != -1) {
-      final String genericClassSignature = resolve(genericSignature);
-      final int[] bounds = findBounds(genericClassSignature);
-      for (int boundClassQName : bounds) {
-        cache.addClassReferencer(boundClassQName, classQName);
-      }
-    }
-
-    buildAnnotationDependencies(classQName, cache.getRuntimeVisibleAnnotations(classQName));
-    buildAnnotationDependencies(classQName, cache.getRuntimeInvisibleAnnotations(classQName));
-
-    for (final ReferenceInfo refInfo : references) {
-      final int declaringClassName = getActualDeclaringClassForReference(refInfo);
-      if (declaringClassName == Cache.UNKNOWN) {
-        continue;
-      }
-      if (refInfo instanceof MemberReferenceInfo) {
-        final MemberInfo memberInfo = ((MemberReferenceInfo)refInfo).getMemberInfo();
-        if (memberInfo instanceof FieldInfo) {
-          cache.addFieldReferencer(declaringClassName, memberInfo.getName(), classQName);
-        }
-        else if (memberInfo instanceof MethodInfo) {
-          cache.addMethodReferencer(declaringClassName, memberInfo.getName(), memberInfo.getDescriptor(), classQName);
-        }
-        else {
-          LOG.error("Unknown member info class: " + memberInfo.getClass().getName());
-        }
-      }
-      else { // reference to class
-        cache.addClassReferencer(declaringClassName, classQName);
-      }
-    }
-    final SymbolTable symbolTable = getSymbolTable();
-
-    for (final FieldInfo fieldInfo : cache.getFields(classQName)) {
-      buildAnnotationDependencies(classQName, fieldInfo.getRuntimeVisibleAnnotations());
-      buildAnnotationDependencies(classQName, fieldInfo.getRuntimeInvisibleAnnotations());
-
-      String className = MakeUtil.parseObjectType(symbolTable.getSymbol(fieldInfo.getDescriptor()), 0);
-      if (className == null) {
-        continue;
-      }
-      final int cls = symbolTable.getId(className);
-      cache.addClassReferencer(cls, classQName);
-    }
-
-    for (final MethodInfo methodInfo : cache.getMethods(classQName)) {
-      buildAnnotationDependencies(classQName, methodInfo.getRuntimeVisibleAnnotations());
-      buildAnnotationDependencies(classQName, methodInfo.getRuntimeInvisibleAnnotations());
-      buildAnnotationDependencies(classQName, methodInfo.getRuntimeVisibleParameterAnnotations());
-      buildAnnotationDependencies(classQName, methodInfo.getRuntimeInvisibleParameterAnnotations());
-
-      if (methodInfo.isConstructor()) {
-        continue;
-      }
-
-      final String returnTypeClassName = MakeUtil.parseObjectType(methodInfo.getReturnTypeDescriptor(symbolTable), 0);
-      if (returnTypeClassName != null) {
-        final int returnTypeClassQName = symbolTable.getId(returnTypeClassName);
-        cache.addClassReferencer(returnTypeClassQName, classQName);
-      }
-
-      String[] parameterSignatures = CacheUtils.getParameterSignatures(methodInfo, symbolTable);
-      for (String parameterSignature : parameterSignatures) {
-        String paramClassName = MakeUtil.parseObjectType(parameterSignature, 0);
-        if (paramClassName != null) {
-          final int paramClassId = symbolTable.getId(paramClassName);
-          cache.addClassReferencer(paramClassId, classQName);
-        }
-      }
-    }
-  }
-
-  private static boolean isRemoteInterface(Cache cache, int ifaceName, final int remoteInterfaceName) throws CacheCorruptedException {
-    if (ifaceName == remoteInterfaceName) {
-      return true;
-    }
-    for (int superInterfaceName : cache.getSuperInterfaces(ifaceName)) {
-      if (isRemoteInterface(cache, superInterfaceName, remoteInterfaceName)) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-
-  private void buildAnnotationDependencies(int classQName, AnnotationConstantValue[][] annotations) throws CacheCorruptedException {
-    if (annotations == null || annotations.length == 0) {
-      return;
-    }
-    for (AnnotationConstantValue[] annotation : annotations) {
-      buildAnnotationDependencies(classQName, annotation);
-    }
-  }
-
-  private void buildAnnotationDependencies(int classQName, AnnotationConstantValue[] annotations) throws CacheCorruptedException {
-    if (annotations == null || annotations.length == 0) {
-      return;
-    }
-    final Cache cache = getCache();
-    for (AnnotationConstantValue annotation : annotations) {
-      final int annotationQName = annotation.getAnnotationQName();
-
-      cache.addClassReferencer(annotationQName, classQName);
-
-      final AnnotationNameValuePair[] memberValues = annotation.getMemberValues();
-      for (final AnnotationNameValuePair nameValuePair : memberValues) {
-        for (MethodInfo annotationMember : cache.findMethodsByName(annotationQName, nameValuePair.getName())) {
-          cache.addMethodReferencer(annotationQName, annotationMember.getName(), annotationMember.getDescriptor(), classQName);
-        }
-      }
-    }
-  }
-
-  private int[] findBounds(final String genericClassSignature) throws CacheCorruptedException{
-    try {
-      final String[] boundInterfaces = BoundsParser.getBounds(genericClassSignature);
-      int[] ids = ArrayUtil.newIntArray(boundInterfaces.length);
-      for (int i = 0; i < boundInterfaces.length; i++) {
-        ids[i] = getSymbolTable().getId(boundInterfaces[i]);
-      }
-      return ids;
-    }
-    catch (SignatureParsingException e) {
-      return ArrayUtil.EMPTY_INT_ARRAY;
-    }
-  }
-
-  // fixes JDK 1.4 javac bug that generates references in the constant pool
-  // to the subclass even if the field was declared in a superclass
-  private int getActualDeclaringClassForReference(final ReferenceInfo refInfo) throws CacheCorruptedException {
-    if (!(refInfo instanceof MemberReferenceInfo)) {
-      return refInfo.getClassName();
-    }
-    final int declaringClassName = refInfo.getClassName();
-    final Cache cache = getCache();
-    final MemberInfo memberInfo = ((MemberReferenceInfo)refInfo).getMemberInfo();
-    if (memberInfo instanceof FieldInfo) {
-      if (cache.findFieldByName(declaringClassName, memberInfo.getName()) != null) {
-        return declaringClassName;
-      }
-    }
-    else if (memberInfo instanceof MethodInfo) {
-      if (cache.findMethod(declaringClassName, memberInfo.getName(), memberInfo.getDescriptor()) != null) {
-        return declaringClassName;
-      }
-    }
-    final DeclaringClassFinder finder = new DeclaringClassFinder(memberInfo);
-    getCacheNavigator().walkSuperClasses(declaringClassName, finder);
-    return finder.getDeclaringClassName();
-  }
-
-  /**
-   * @return qualified names of the classes that should be additionally recompiled
-   */
-  public Pair<int[], Set<VirtualFile>> findDependentClasses(CompileContext context, Project project, Set<VirtualFile> compiledWithErrors)
-    throws CacheCorruptedException, ExitException {
-
-    markDependencies(context, project, compiledWithErrors);
-    return Pair.create(myMarkedInfos.toArray(), Collections.unmodifiableSet(myMarkedFiles));
-  }
-
-  private void markDependencies(CompileContext context, Project project, final Set<VirtualFile> compiledWithErrors)
-    throws CacheCorruptedException, ExitException {
-    try {
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("====================Marking dependent files=====================");
-      }
-      // myToUpdate can be modified during the mark procedure, so use toArray() to iterate it
-      final int[] traverseRoots = myTraverseRoots.toArray();
-      final SourceFileFinder sourceFileFinder = new SourceFileFinder(project, context);
-      final CachingSearcher searcher = new CachingSearcher(project);
-      final ChangedRetentionPolicyDependencyProcessor changedRetentionPolicyDependencyProcessor = new ChangedRetentionPolicyDependencyProcessor(project, searcher, this);
-      for (final int qName : traverseRoots) {
-        if (!getCache().containsClass(qName)) {
-          continue;
-        }
-        if (getNewClassesCache().containsClass(qName)) { // there is a new class file created
-          new JavaDependencyProcessor(project, this, qName).run();
-          ArrayList<ChangedConstantsDependencyProcessor.FieldChangeInfo> changed =
-            new ArrayList<ChangedConstantsDependencyProcessor.FieldChangeInfo>();
-          ArrayList<ChangedConstantsDependencyProcessor.FieldChangeInfo> removed =
-            new ArrayList<ChangedConstantsDependencyProcessor.FieldChangeInfo>();
-          findModifiedConstants(qName, changed, removed);
-          if (!changed.isEmpty() || !removed.isEmpty()) {
-            new ChangedConstantsDependencyProcessor(
-              project, searcher, this, qName, context,
-              changed.toArray(new ChangedConstantsDependencyProcessor.FieldChangeInfo[changed.size()]),
-              removed.toArray(new ChangedConstantsDependencyProcessor.FieldChangeInfo[removed.size()])
-            ).run();
-          }
-          changedRetentionPolicyDependencyProcessor.checkAnnotationRetentionPolicyChanges(qName);
-          for (DependencyProcessor additionalProcessor : DependencyProcessor.EXTENSION_POINT_NAME.getExtensions()) {
-            additionalProcessor.processDependencies(context, qName, searcher);
-          }
-        }
-        else {
-          boolean isSourceDeleted = false;
-          if (myClassesWithSourceRemoved.contains(qName)) { // no recompiled class file, check whether the classfile exists
-            isSourceDeleted = true;
-          }
-          else if (!new File(getCache().getPath(qName)).exists()) {
-            final String qualifiedName = resolve(qName);
-            final String sourceFileName = getCache().getSourceFileName(qName);
-            final boolean markAsRemovedSource = ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
-              public Boolean compute() {
-                VirtualFile sourceFile = sourceFileFinder.findSourceFile(qualifiedName, sourceFileName, false);
-                return sourceFile == null || !compiledWithErrors.contains(sourceFile) ? Boolean.TRUE : Boolean.FALSE;
-              }
-            }).booleanValue();
-            if (markAsRemovedSource) {
-              // for Inner classes: sourceFile may exist, but the inner class declaration inside it may not,
-              // thus the source for the class info should be considered removed
-              isSourceDeleted = true;
-              markSourceRemoved(qName);
-              myMarkedInfos.remove(qName); // if the info has been marked already, the mark should be removed
-            }
-          }
-          if (isSourceDeleted) {
-            Dependency[] backDependencies = getCache().getBackDependencies(qName);
-            for (Dependency backDependency : backDependencies) {
-              if (markTargetClassInfo(backDependency)) {
-                if (LOG.isDebugEnabled()) {
-                  LOG.debug(
-                    "Mark dependent class " + backDependency.getClassQualifiedName() + "; reason: no class file found for " + qName);
-                }
-              }
-            }
-          }
-        }
-      }
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("================================================================");
-      }
-    }
-    catch (ProcessCanceledException ignored) {
-      // deliberately suppressed
-    }
-  }
-
-  private void findModifiedConstants(
-    final int qName,
-    Collection<ChangedConstantsDependencyProcessor.FieldChangeInfo> changedConstants,
-    Collection<ChangedConstantsDependencyProcessor.FieldChangeInfo> removedConstants) throws CacheCorruptedException {
-
-    final Cache cache = getCache();
-    for (final FieldInfo field : cache.getFields(qName)) {
-      final int oldFlags = field.getFlags();
-      if (ClsUtil.isStatic(oldFlags) && ClsUtil.isFinal(oldFlags)) {
-        final Cache newClassesCache = getNewClassesCache();
-        FieldInfo newField = newClassesCache.findFieldByName(qName, field.getName());
-        if (newField == null) {
-          if (!ConstantValue.EMPTY_CONSTANT_VALUE.equals(field.getConstantValue())) {
-            // if the field was really compile time constant
-            removedConstants.add(new ChangedConstantsDependencyProcessor.FieldChangeInfo(field));
-          }
-        }
-        else {
-          final boolean visibilityRestricted = MakeUtil.isMoreAccessible(oldFlags, newField.getFlags());
-          if (!field.getConstantValue().equals(newField.getConstantValue()) || visibilityRestricted) {
-            changedConstants.add(new ChangedConstantsDependencyProcessor.FieldChangeInfo(field, visibilityRestricted));
-          }
-        }
-      }
-    }
-  }
-
-  private static void buildSubclassDependencies(Cache cache, final int qName, int targetClassId) throws CacheCorruptedException {
-    final int superQName = cache.getSuperQualifiedName(targetClassId);
-    if (superQName != Cache.UNKNOWN) {
-      cache.addSubclass(superQName, qName);
-      buildSubclassDependencies(cache, qName, superQName);
-    }
-
-    int[] interfaces = cache.getSuperInterfaces(targetClassId);
-    for (final int interfaceName : interfaces) {
-      cache.addSubclass(interfaceName, qName);
-      buildSubclassDependencies(cache, qName, interfaceName);
-    }
-  }
-
-
-  /**
-   * Marks ClassInfo targeted by the dependency
-   * @return true if really added, false otherwise
-   */
-  public boolean markTargetClassInfo(Dependency dependency) throws CacheCorruptedException {
-    return markClassInfo(dependency.getClassQualifiedName(), false);
-  }
-
-  /**
-   * Marks ClassInfo that corresponds to the specified qualified name
-   * If class info is already recompiled, it is not marked
-   * @return true if really added, false otherwise
-   */
-  public boolean markClass(int qualifiedName) throws CacheCorruptedException {
-    return markClass(qualifiedName, false);
-  }
-
-  /**
-   * Marks ClassInfo that corresponds to the specified qualified name
-   * If class info is already recompiled, it is not marked unless force parameter is true
-   * @return true if really added, false otherwise
-   */
-  public boolean markClass(int qualifiedName, boolean force) throws CacheCorruptedException {
-    return markClassInfo(qualifiedName, force);
-  }
-
-  public boolean isTargetClassInfoMarked(Dependency dependency) {
-    return isClassInfoMarked(dependency.getClassQualifiedName());
-  }
-
-  public boolean isClassInfoMarked(int qName) {
-    return myMarkedInfos.contains(qName);
-  }
-  
-  public void markFile(VirtualFile file) {
-    myMarkedFiles.add(file);
-  }
-
-  /**
-   * @return true if really marked, false otherwise
-   */
-  private boolean markClassInfo(int qName, boolean force) throws CacheCorruptedException {
-    if (!getCache().containsClass(qName)) {
-      return false;
-    }
-    if (myClassesWithSourceRemoved.contains(qName)) {
-      return false; // no need to recompile since source has been removed
-    }
-    if (!force) {
-      if (getNewClassesCache().containsClass(qName)) { // already recompiled
-        return false;
-      }
-    }
-    return myMarkedInfos.add(qName);
-  }
-
-  public void resetState() {
-    myClassesWithSourceRemoved.clear();
-    myMarkedFiles.clear();
-    myMarkedInfos.clear();
-    myToUpdate.clear();
-    myTraverseRoots.clear();
-    if (myNewClassesCache != null) {
-      myNewClassesCache.wipe();
-      myNewClassesCache = null;
-    }
-    myCacheNavigator = null;
-    try {
-      if (myCache != null) {
-        myCache.dispose();
-        myCache = null;
-      }
-    }
-    catch (CacheCorruptedException e) {
-      LOG.info(e);
-    }
-    try {
-      if (mySymbolTable != null) {
-        mySymbolTable.dispose();
-        mySymbolTable = null;
-      }
-    }
-    catch (CacheCorruptedException e) {
-      LOG.info(e);
-    }
-  }
-
-
-  public SymbolTable getSymbolTable() throws CacheCorruptedException {
-    if (mySymbolTable == null) {
-      mySymbolTable = new SymbolTable(new File(mySymbolTableFilePath));
-    }
-    return mySymbolTable;
-  }
-
-  public String resolve(int id) throws CacheCorruptedException {
-    return getSymbolTable().getSymbol(id);
-  }
-
-  public boolean wasRemote(int qName) {
-    return myPreviouslyRemoteClasses.contains(qName);
-  }
-
-  private class DeclaringClassFinder implements ClassInfoProcessor {
-    private final int myMemberName;
-    private final int myMemberDescriptor;
-    private int myDeclaringClass = Cache.UNKNOWN;
-    private final boolean myIsField;
-
-    private DeclaringClassFinder(MemberInfo memberInfo) {
-      myMemberName = memberInfo.getName();
-      myMemberDescriptor = memberInfo.getDescriptor();
-      myIsField = memberInfo instanceof FieldInfo;
-    }
-
-    public int getDeclaringClassName() {
-      return myDeclaringClass;
-    }
-
-    public boolean process(int classQName) throws CacheCorruptedException {
-      final Cache cache = getCache();
-      if (myIsField) {
-        final FieldInfo fieldId = cache.findField(classQName, myMemberName, myMemberDescriptor);
-        if (fieldId != null) {
-          myDeclaringClass = classQName;
-          return false;
-        }
-      }
-      else {
-        final MethodInfo methodId = cache.findMethod(classQName, myMemberName, myMemberDescriptor);
-        if (methodId != null) {
-          myDeclaringClass = classQName;
-          return false;
-        }
-      }
-      return true;
-    }
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/DependencyCacheNavigator.java b/java/compiler/impl/src/com/intellij/compiler/make/DependencyCacheNavigator.java
deleted file mode 100644
index a93caa2..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/DependencyCacheNavigator.java
+++ /dev/null
@@ -1,84 +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: Eugene Zhuravlev
- * Date: May 26, 2003
- * Time: 8:13:56 PM
- */
-package com.intellij.compiler.make;
-
-import com.intellij.openapi.diagnostic.Logger;
-
-public class DependencyCacheNavigator {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.make.DependencyCacheNavigator");
-
-  private final Cache myCache;
-
-  public DependencyCacheNavigator(Cache cache) {
-    myCache = cache;
-  }
-
-  public void walkSuperClasses(int classQName, ClassInfoProcessor processor) throws CacheCorruptedException {
-    if (classQName == Cache.UNKNOWN) {
-      return;
-    }
-    int superQName = myCache.getSuperQualifiedName(classQName);
-
-    if (classQName == superQName) {
-      LOG.error("Superclass qualified name is the same as class' name: " + classQName);
-      return;
-    }
-
-    if (superQName != Cache.UNKNOWN) {
-      if (processor.process(superQName)) {
-        walkSuperClasses(superQName, processor);
-      }
-    }
-    for (int superInterfaceQName : myCache.getSuperInterfaces(classQName)) {
-      if (processor.process(superInterfaceQName)) {
-        walkSuperClasses(superInterfaceQName, processor);
-      }
-    }
-  }
-
-  public void walkSuperInterfaces(int classQName, ClassInfoProcessor processor) throws CacheCorruptedException {
-    if (classQName == Cache.UNKNOWN) {
-      return;
-    }
-
-    for (int superInterfaceQName : myCache.getSuperInterfaces(classQName)) {
-      if (processor.process(superInterfaceQName)) {
-        walkSuperInterfaces(superInterfaceQName, processor);
-      }
-    }
-  }
-
-  public void walkSubClasses(int fromClassQName, ClassInfoProcessor processor) throws CacheCorruptedException {
-    for (int subQName : myCache.getSubclasses(fromClassQName)) {
-      if (fromClassQName == subQName) {
-        LOG.error("Subclass qualified name is the same as class' name: " + fromClassQName);
-        return;
-      }
-      if (subQName != Cache.UNKNOWN) {
-        if (!processor.process(subQName)) {
-          break;
-        }
-      }
-    }
-  }
-
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/FieldChangeDescription.java b/java/compiler/impl/src/com/intellij/compiler/make/FieldChangeDescription.java
deleted file mode 100644
index 9d0ef47..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/FieldChangeDescription.java
+++ /dev/null
@@ -1,38 +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.compiler.make;
-
-import com.intellij.compiler.classParsing.FieldInfo;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Apr 7, 2004
- */
-class FieldChangeDescription extends ChangeDescription {
-  public final boolean flagsChanged;
-  public final boolean descriptorChanged;
-  public final boolean genericSignatureChanged;
-
-  public FieldChangeDescription(final FieldInfo oldField, final FieldInfo newField) {
-    descriptorChanged = oldField.getDescriptor() != newField.getDescriptor();
-    flagsChanged = oldField.getFlags() != newField.getFlags();
-    genericSignatureChanged = oldField.getGenericSignature() != newField.getGenericSignature();
-  }
-
-  public boolean isChanged() {
-    return flagsChanged || descriptorChanged || genericSignatureChanged;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/JavaDependencyProcessor.java b/java/compiler/impl/src/com/intellij/compiler/make/JavaDependencyProcessor.java
deleted file mode 100644
index b00d886..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/JavaDependencyProcessor.java
+++ /dev/null
@@ -1,1322 +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.
- */
-
-/**
- * created at Feb 19, 2002
- * @author Jeka
- */
-package com.intellij.compiler.make;
-
-import com.intellij.compiler.SymbolTable;
-import com.intellij.compiler.classParsing.*;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Computable;
-import com.intellij.pom.java.LanguageLevel;
-import com.intellij.psi.*;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.cls.ClsUtil;
-import gnu.trove.TIntHashSet;
-import gnu.trove.TIntObjectHashMap;
-import gnu.trove.TIntObjectIterator;
-import gnu.trove.TIntObjectProcedure;
-import org.jetbrains.annotations.NonNls;
-
-import java.util.*;
-
-class JavaDependencyProcessor {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.make.JavaDependencyProcessor");
-  private final DependencyCache myDependencyCache;
-  private final int myQName;
-  private final Map<Dependency.MethodRef, MethodInfo> myRefToMethodMap = new HashMap<Dependency.MethodRef, MethodInfo>();
-  private final Map<Dependency.FieldRef, FieldInfo> myRefToFieldMap = new HashMap<Dependency.FieldRef, FieldInfo>();
-  private final Set<MemberInfo> myAddedMembers = new HashSet<MemberInfo>();
-  private final Set<MemberInfo> myRemovedMembers = new HashSet<MemberInfo>();
-  private final Set<MemberInfo> myChangedMembers = new HashSet<MemberInfo>();
-  private final Map<MemberInfo, ChangeDescription> myChangeDescriptions = new HashMap<MemberInfo, ChangeDescription>();
-  private Dependency[] myBackDependencies;
-  private final boolean myMembersChanged;
-  private final boolean mySuperInterfaceAdded;
-  private final boolean mySuperInterfaceRemoved;
-  private final boolean mySuperClassChanged;
-  private final boolean mySuperlistGenericSignatureChanged;
-  private final boolean mySuperClassAdded;
-  private final Project myProject;
-  private final boolean myIsAnnotation;
-  private final boolean myIsRemoteInterface;
-  private final boolean myWereAnnotationTargetsRemoved;
-  private final boolean myRetentionPolicyChanged;
-  private final boolean myAnnotationSemanticsChanged;
-
-  public JavaDependencyProcessor(Project project, DependencyCache dependencyCache, int qName) throws CacheCorruptedException {
-    myProject = project;
-    myDependencyCache = dependencyCache;
-    myQName = qName;
-    final Cache cache = dependencyCache.getCache();
-    final Cache newClassesCache = dependencyCache.getNewClassesCache();
-
-    final MethodInfo[] oldMethods = cache.getMethods(qName);
-    for (MethodInfo method : oldMethods) {
-      myRefToMethodMap.put(new Dependency.MethodRef(method.getName(), method.getDescriptor()), method);
-    }
-    final TIntObjectHashMap<FieldInfo> oldFieldsMap = getFieldInfos(cache, qName);
-    oldFieldsMap.forEachEntry(new TIntObjectProcedure<FieldInfo>() {
-      public boolean execute(int fieldName, FieldInfo fieldInfo) {
-        myRefToFieldMap.put(new Dependency.FieldRef(fieldName), fieldInfo);
-        return true;
-      }
-    });
-    final Map<String, MethodInfoContainer> oldMethodsMap = getMethodInfos(oldMethods);
-    final Map<String, MethodInfoContainer> newMethodsMap = getMethodInfos(newClassesCache.getMethods(qName));
-    final TIntObjectHashMap<FieldInfo> newFieldsMap = getFieldInfos(newClassesCache, qName);
-    addAddedMembers(oldFieldsMap, oldMethodsMap, newFieldsMap, newMethodsMap, myAddedMembers);
-    addRemovedMembers(oldFieldsMap, oldMethodsMap, newFieldsMap, newMethodsMap, myRemovedMembers);
-    addChangedMembers(oldFieldsMap, oldMethodsMap, newFieldsMap, newMethodsMap, myChangedMembers);
-
-    myMembersChanged = !myAddedMembers.isEmpty() || !myRemovedMembers.isEmpty() || !myChangedMembers.isEmpty();
-    // track changes in super list
-
-    myIsRemoteInterface = MakeUtil.isInterface(cache.getFlags(myQName)) && cache.isRemote(qName);
-    myIsAnnotation = ClsUtil.isAnnotation(cache.getFlags(qName));
-    myWereAnnotationTargetsRemoved = myIsAnnotation && wereAnnotationTargesRemoved(cache, newClassesCache);
-    myRetentionPolicyChanged = myIsAnnotation && hasRetentionPolicyChanged(cache, newClassesCache);
-    myAnnotationSemanticsChanged = myIsAnnotation && hasAnnotationSemanticsChanged(cache, newClassesCache);
-
-    int[] oldInterfaces = cache.getSuperInterfaces(qName);
-    int[] newInterfaces = newClassesCache.getSuperInterfaces(qName);
-    mySuperInterfaceRemoved = wereInterfacesRemoved(oldInterfaces, newInterfaces);
-    mySuperInterfaceAdded = wereInterfacesRemoved(newInterfaces, oldInterfaces);
-
-    mySuperlistGenericSignatureChanged = isSuperlistGenericSignatureChanged(cache.getGenericSignature(qName), newClassesCache.getGenericSignature(qName));
-
-    boolean superclassesDiffer = cache.getSuperQualifiedName(qName) != newClassesCache.getSuperQualifiedName(qName);
-    boolean wasDerivedFromObject = CommonClassNames.JAVA_LANG_OBJECT.equals(dependencyCache.resolve(cache.getSuperQualifiedName(qName)));
-    mySuperClassChanged = !wasDerivedFromObject && superclassesDiffer;
-    mySuperClassAdded = wasDerivedFromObject && superclassesDiffer;
-  }
-
-  private static boolean hasMembersWithoutDefaults(Set<MemberInfo> addedMembers) {
-    for (final Object addedMember : addedMembers) {
-      MemberInfo memberInfo = (MemberInfo)addedMember;
-      if (memberInfo instanceof MethodInfo) {
-        final ConstantValue annotationDefault = ((MethodInfo)memberInfo).getAnnotationDefault();
-        if (annotationDefault == null || ConstantValue.EMPTY_CONSTANT_VALUE.equals(annotationDefault)) {
-          return true;
-        }
-      }
-    }
-    return false;
-  }
-
-  private boolean wereAnnotationDefaultsRemoved() {
-    for (final MemberInfo memberInfo : myChangeDescriptions.keySet()) {
-      if (memberInfo instanceof MethodInfo) {
-        MethodChangeDescription description = (MethodChangeDescription)myChangeDescriptions.get(memberInfo);
-        if (description.removedAnnotationDefault) {
-          return true;
-        }
-      }
-    }
-    return false;
-  }
-
-  private boolean isSuperlistGenericSignatureChanged(int oldGenericSignature, int newGenericSignature) throws CacheCorruptedException {
-    if (oldGenericSignature == newGenericSignature) {
-      return false;
-    }
-    if (oldGenericSignature != -1 && newGenericSignature != -1) {
-      final SymbolTable symbolTable = myDependencyCache.getSymbolTable();
-      final String _oldGenericMethodSignature = cutFormalParams(symbolTable.getSymbol(oldGenericSignature));
-      final String _newGenericMethodSignature = cutFormalParams(symbolTable.getSymbol(newGenericSignature));
-      return !_oldGenericMethodSignature.equals(_newGenericMethodSignature);
-    }
-    return true;
-  }
-
-  private static String cutFormalParams(String genericClassSignature) {
-    if (genericClassSignature.charAt(0) == '<') {
-      int idx = genericClassSignature.indexOf('>');
-      return genericClassSignature.substring(idx + 1);
-    }
-    return genericClassSignature;
-  }
-
-  public void run() throws CacheCorruptedException {
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("Checking dependencies for " + myDependencyCache.resolve(myQName));
-    }
-    final boolean superListChanged = mySuperClassChanged || mySuperClassAdded || mySuperInterfaceAdded || mySuperInterfaceRemoved || mySuperlistGenericSignatureChanged;
-    final Cache oldCache = myDependencyCache.getCache();
-    final Cache newCache = myDependencyCache.getNewClassesCache();
-
-    if (!myMembersChanged &&
-        oldCache.getFlags(myQName) == newCache.getFlags(myQName) &&
-        !superListChanged && !myWereAnnotationTargetsRemoved && !myRetentionPolicyChanged && !myAnnotationSemanticsChanged) {
-      return; // nothing to do
-    }
-
-    if (myIsAnnotation) {
-      if (myAnnotationSemanticsChanged) {
-        final TIntHashSet visited = new TIntHashSet();
-        visited.add(myQName);
-        markAnnotationDependenciesRecursively(getBackDependencies(), LOG.isDebugEnabled()? "; reason: semantics changed for " + myDependencyCache.resolve(myQName) : "", visited);
-        return;
-      }
-      if (hasMembersWithoutDefaults(myAddedMembers)) {
-        markAll(getBackDependencies(), LOG.isDebugEnabled()? "; reason: added annotation type member without default " + myDependencyCache.resolve(myQName) : "");
-        return;
-      }
-      if (!myRemovedMembers.isEmpty()) {
-        markAll(getBackDependencies(), LOG.isDebugEnabled()? "; reason: removed annotation type member " + myDependencyCache.resolve(myQName) : "");
-        return;
-      }
-      if (!myChangedMembers.isEmpty()) { // for annotations "changed" means return type changed
-        markAll(getBackDependencies(), LOG.isDebugEnabled()? "; reason: changed annotation member's type " + myDependencyCache.resolve(myQName) : "");
-        return;
-      }
-      if (wereAnnotationDefaultsRemoved()) {
-        markAll(getBackDependencies(), LOG.isDebugEnabled()? "; reason: removed annotation member's default value " + myDependencyCache.resolve(myQName): "");
-        return;
-      }
-      if (myWereAnnotationTargetsRemoved) {
-        markAll(getBackDependencies(), LOG.isDebugEnabled()? "; reason: removed annotation's targets " + myDependencyCache.resolve(myQName) : "");
-        return;
-      }
-      if (myRetentionPolicyChanged) {
-        markAll(getBackDependencies(), LOG.isDebugEnabled()? "; reason: retention policy changed for " + myDependencyCache.resolve(myQName) : "");
-        return;
-      }
-    }
-
-    final DependencyCacheNavigator cacheNavigator = myDependencyCache.getCacheNavigator();
-
-    if (mySuperClassChanged || mySuperInterfaceRemoved || mySuperlistGenericSignatureChanged) {
-      // superclass changed == old removed and possibly new added
-      // if anything (class or interface) in the superlist was removed, should recompile all subclasses (both direct and indirect)
-      // and all back-dependencies of this class and its subclasses
-      markAll(getBackDependencies(), LOG.isDebugEnabled()? "; reason: deleted items from the superlist or changed superlist generic signature of " + myDependencyCache.resolve(myQName) : "");
-      cacheNavigator.walkSubClasses(myQName, new ClassInfoProcessor() {
-        public boolean process(int classQName) throws CacheCorruptedException {
-          markAll(oldCache.getBackDependencies(classQName), LOG.isDebugEnabled()? "; reason: deleted items from the superlist or changed superlist generic signature of " + myDependencyCache.resolve(myQName) : "");
-          return true;
-        }
-      });
-      return;
-    }
-
-    final boolean isKindChanged =
-      (MakeUtil.isInterface(oldCache.getFlags(myQName)) && !MakeUtil.isInterface(newCache.getFlags(myQName))) ||
-      (!MakeUtil.isInterface(oldCache.getFlags(myQName)) && MakeUtil.isInterface(newCache.getFlags(myQName)));
-    if (isKindChanged) {
-      markAll(getBackDependencies(), LOG.isDebugEnabled()? "; reason: class kind changed (class/interface) " + myDependencyCache.resolve(myQName) : "");
-      cacheNavigator.walkSubClasses(myQName, new ClassInfoProcessor() {
-        public boolean process(int classQName) throws CacheCorruptedException {
-          markAll(oldCache.getBackDependencies(classQName), LOG.isDebugEnabled()? "; reason: class kind changed (class/interface) " + myDependencyCache.resolve(myQName) : "");
-          return true;
-        }
-      });
-      return;
-    }
-
-    boolean becameFinal = !ClsUtil.isFinal(oldCache.getFlags(myQName)) && ClsUtil.isFinal(newCache.getFlags(myQName));
-    if (becameFinal) {
-      markAll(getBackDependencies(), LOG.isDebugEnabled()? "; reason: class became final: " + myDependencyCache.resolve(myQName) : "");
-    }
-    else {
-      boolean becameAbstract = !ClsUtil.isAbstract(oldCache.getFlags(myQName)) && ClsUtil.isAbstract(newCache.getFlags(myQName));
-      boolean accessRestricted = MakeUtil.isMoreAccessible(oldCache.getFlags(myQName), newCache.getFlags(myQName));
-      Set<MethodInfo> removedMethods = null;
-      Set<MethodInfo> addedMethods = null;
-      for (Dependency backDependency : getBackDependencies()) {
-        if (myDependencyCache.isTargetClassInfoMarked(backDependency)) continue;
-
-        if (accessRestricted) {
-          if (myDependencyCache.markTargetClassInfo(backDependency)) {
-            if (LOG.isDebugEnabled()) {
-              LOG.debug("Mark dependent class " + myDependencyCache.resolve(backDependency.getClassQualifiedName()) + "; reason: " +
-                        myDependencyCache.resolve(myQName) + " made less accessible");
-            }
-          }
-          continue;
-        }
-        if (becameAbstract) {
-          if (processClassBecameAbstract(backDependency)) {
-            continue;
-          }
-        }
-        if (isDependentOnRemovedMembers(backDependency)) {
-          if (myDependencyCache.markTargetClassInfo(backDependency)) {
-            if (LOG.isDebugEnabled()) {
-              LOG.debug("Mark dependent class " + myDependencyCache.resolve(backDependency.getClassQualifiedName()) +
-                        "; reason: the class uses removed members of " + myDependencyCache.resolve(myQName));
-            }
-          }
-          continue;
-        }
-        if (isDependentOnChangedMembers(backDependency)) {
-          if (myDependencyCache.markTargetClassInfo(backDependency)) {
-            if (LOG.isDebugEnabled()) {
-              LOG.debug("Mark dependent class " + myDependencyCache.resolve(backDependency.getClassQualifiedName()) +
-                        "; reason: the class uses changed members of " + myDependencyCache.resolve(myQName));
-            }
-          }
-          continue;
-        }
-        final Collection<Dependency.MethodRef> usedMethods = backDependency.getMethodRefs();
-        if (removedMethods == null) {
-          removedMethods = extractMethods(myRemovedMembers, true);
-        }
-        if (isDependentOnEquivalentMethods(usedMethods, removedMethods)) {
-          if (myDependencyCache.markTargetClassInfo(backDependency)) {
-            if (LOG.isDebugEnabled()) {
-              LOG.debug("Mark dependent class " + myDependencyCache.resolve(backDependency.getClassQualifiedName()) +
-                        "; reason: some overloaded methods of " + myDependencyCache.resolve(myQName) + " were removed");
-            }
-          }
-          continue;
-        }
-        if (addedMethods == null) {
-          addedMethods = extractMethods(myAddedMembers, true);
-        }
-        if (isDependentOnEquivalentMethods(usedMethods, addedMethods)) {
-          if (myDependencyCache.markTargetClassInfo(backDependency)) {
-            if (LOG.isDebugEnabled()) {
-              LOG.debug("Mark dependent class " + myDependencyCache.resolve(backDependency.getClassQualifiedName()) +
-                        "; reason: some overloaded methods of " + myDependencyCache.resolve(myQName) + " were added");
-            }
-          }
-        }
-      }
-    }
-
-    final Set<MethodInfo> methodsToCheck = new HashSet<MethodInfo>();
-    extractMethods(myRemovedMembers, methodsToCheck, false);
-    
-    processInheritanceDependencies(methodsToCheck);
-
-    extractMethods(myAddedMembers, methodsToCheck, false);
-
-    if (!MakeUtil.isAnonymous(myDependencyCache.resolve(myQName))) {
-      // these checks make no sense for anonymous classes
-      
-      final TIntHashSet fieldNames = new TIntHashSet();
-      extractFieldNames(myAddedMembers, fieldNames);
-      int addedFieldsCount = fieldNames.size();
-      extractFieldNames(myRemovedMembers, fieldNames);
-      
-      if (!fieldNames.isEmpty()) {
-        cacheNavigator.walkSuperClasses(myQName, new ClassInfoProcessor() {
-          public boolean process(final int classQName) throws CacheCorruptedException {
-            markUseDependenciesOnFields(classQName, fieldNames);
-            return true;
-          }
-        });
-      }
-      
-      if (addedFieldsCount > 0 && MakeUtil.isInterface(oldCache.getFlags(myQName))) {
-        final TIntHashSet visitedClasses = new TIntHashSet();
-        visitedClasses.add(myQName);
-        cacheNavigator.walkSubClasses(myQName, new ClassInfoProcessor() {
-          public boolean process(int subclassQName) throws CacheCorruptedException {
-            markUseDependenciesOnFields(subclassQName, fieldNames);
-            visitedClasses.add(subclassQName);
-            cacheNavigator.walkSuperClasses(subclassQName, new ClassInfoProcessor() {
-              public boolean process(int superclassQName) throws CacheCorruptedException {
-                if (visitedClasses.contains(superclassQName)) {
-                  return false;
-                }
-                markUseDependenciesOnFields(superclassQName, fieldNames);
-                visitedClasses.add(superclassQName);
-                return true;
-              }
-            });
-            return true;
-          }
-        });
-      }
-
-      if (!methodsToCheck.isEmpty()) {
-        cacheNavigator.walkSuperClasses(myQName, new ClassInfoProcessor() {
-          public boolean process(int classQName) throws CacheCorruptedException {
-            markUseDependenciesOnEquivalentMethods(classQName, methodsToCheck, myQName);
-            return true;
-          }
-        });
-
-        cacheNavigator.walkSubClasses(myQName, new ClassInfoProcessor() {
-          public boolean process(int classQName) throws CacheCorruptedException {
-            markUseDependenciesOnEquivalentMethods(classQName, methodsToCheck, myQName);
-            return true;
-          }
-        });
-      }
-      // check referencing members in subclasses
-      
-      final TIntHashSet addedOrRemovedFields = new TIntHashSet();
-      final TIntHashSet addedOrRemovedMethods = new TIntHashSet();
-      for (Set<MemberInfo> infos : Arrays.asList(myAddedMembers, myRemovedMembers)) {
-        for (MemberInfo member : infos) {
-          if (!member.isPrivate()) {
-            if (member instanceof FieldInfo) {
-              addedOrRemovedFields.add(member.getName());
-            }
-            else if (member instanceof MethodInfo){
-              addedOrRemovedMethods.add(member.getName());
-            }
-          }
-        }
-        
-      }
-      if (!addedOrRemovedFields.isEmpty() || !addedOrRemovedMethods.isEmpty()) {
-        cacheNavigator.walkSubClasses(myQName, new ClassInfoProcessor() {
-          public boolean process(final int subclassQName) throws CacheCorruptedException {
-            if (!myDependencyCache.isClassInfoMarked(subclassQName)) {
-              if (referencesMembersWithNames(oldCache, subclassQName, addedOrRemovedFields, addedOrRemovedMethods)) {
-                final boolean marked = myDependencyCache.markClass(subclassQName);
-                if (marked && LOG.isDebugEnabled()) {
-                  LOG.debug("Mark dependent class " + myDependencyCache.resolve(subclassQName) + "; Reason: members were added/removed in superclass with names, that may clash with the names of members of another classes that this class references");
-                }
-              }
-            }
-            return true;
-          }
-        });
-      }
-    }
-  }
-  
-  private static boolean referencesMembersWithNames(Cache cache, final int qName, TIntHashSet fieldNames, TIntHashSet methodNames) throws CacheCorruptedException {
-    for (final int referencedClass : cache.getReferencedClasses(qName)) {
-      for (Dependency dependency : cache.getBackDependencies(referencedClass)) {
-        if (dependency.getClassQualifiedName() == qName) {
-          for (Dependency.FieldRef ref : dependency.getFieldRefs()) {
-            if (fieldNames.contains(ref.name)) {
-              return true;
-            }
-          }
-          for (Dependency.MethodRef ref : dependency.getMethodRefs()) {
-            if (methodNames.contains(ref.name)) {
-              return true;
-            }
-          }
-        }
-      }
-    }
-    return false;
-  }
-
-  private void markAnnotationDependenciesRecursively(final Dependency[] dependencies, final @NonNls String reason, final TIntHashSet visitedAnnotations)
-      throws CacheCorruptedException {
-    final Cache oldCache = myDependencyCache.getCache();
-    for (Dependency dependency : dependencies) {
-      if (myDependencyCache.markTargetClassInfo(dependency)) {
-        if (LOG.isDebugEnabled()) {
-          LOG.debug("Mark dependent class " + myDependencyCache.resolve(dependency.getClassQualifiedName()) + reason);
-        }
-      }
-      final int depQName = dependency.getClassQualifiedName();
-      if (ClsUtil.isAnnotation(oldCache.getFlags(depQName))) {
-        if (!visitedAnnotations.contains(depQName)) {
-          visitedAnnotations.add(depQName);
-          markAnnotationDependenciesRecursively(oldCache.getBackDependencies(depQName), LOG.isDebugEnabled()? "; reason: cascade semantics change for " + myDependencyCache.resolve(depQName) : "", visitedAnnotations);
-        }
-      }
-    }
-  }
-
-  private static final int[] ALL_TARGETS = {
-    AnnotationTargets.ANNOTATION_TYPE,
-    AnnotationTargets.CONSTRUCTOR,
-    AnnotationTargets.FIELD,
-    AnnotationTargets.LOCAL_VARIABLE,
-    AnnotationTargets.METHOD,
-    AnnotationTargets.PACKAGE,
-    AnnotationTargets.PARAMETER,
-    AnnotationTargets.TYPE
-  };
-  private boolean wereAnnotationTargesRemoved(final Cache oldCache, final Cache newCache) throws CacheCorruptedException {
-    final int oldAnnotationTargets = MakeUtil.getAnnotationTargets(oldCache, myQName, myDependencyCache.getSymbolTable());
-    final int newAnnotationTargets = MakeUtil.getAnnotationTargets(newCache, myQName, myDependencyCache.getSymbolTable());
-    if (oldAnnotationTargets == newAnnotationTargets) {
-      return false;
-    }
-    for (final int target : ALL_TARGETS) {
-      if ((oldAnnotationTargets & target) != 0 && (newAnnotationTargets & target) == 0) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  private boolean hasRetentionPolicyChanged(final Cache oldCache, final Cache newCache) throws CacheCorruptedException {
-    // if retention policy changed from SOURCE to CLASS or RUNTIME, all sources should be recompiled to propagate changes
-    final int oldPolicy = MakeUtil.getAnnotationRetentionPolicy(myQName, oldCache, myDependencyCache.getSymbolTable());
-    final int newPolicy = MakeUtil.getAnnotationRetentionPolicy(myQName, newCache, myDependencyCache.getSymbolTable());
-    if (oldPolicy == RetentionPolicies.SOURCE && (newPolicy == RetentionPolicies.CLASS || newPolicy == RetentionPolicies.RUNTIME)) {
-      return true;
-    }
-    return oldPolicy == RetentionPolicies.CLASS && newPolicy == RetentionPolicies.RUNTIME;
-  }
-
-  private boolean hasAnnotationSemanticsChanged(final Cache oldCache, final Cache newCache) throws CacheCorruptedException {
-    final TIntObjectHashMap<AnnotationConstantValue> oldAnnotations = fetchAllAnnotations(oldCache);
-    final TIntObjectHashMap<AnnotationConstantValue> newAnnotations = fetchAllAnnotations(newCache);
-    // filter certain known annotation which are processed separately
-    final int retentionAnnotation = myDependencyCache.getSymbolTable().getId("java.lang.annotation.Retention");
-    final int targetAnnotation = myDependencyCache.getSymbolTable().getId("java.lang.annotation.Target");
-    oldAnnotations.remove(retentionAnnotation);
-    oldAnnotations.remove(targetAnnotation);
-    newAnnotations.remove(retentionAnnotation);
-    newAnnotations.remove(targetAnnotation);
-
-    if (oldAnnotations.size() != newAnnotations.size()) {
-      return true; // number of annotation has changed
-    }
-    for (int annotName : oldAnnotations.keys()) {
-      if (!newAnnotations.contains(annotName)) {
-        return true;
-      }
-      final AnnotationNameValuePair[] oldValues = oldAnnotations.get(annotName).getMemberValues();
-      final AnnotationNameValuePair[] newValues = newAnnotations.get(annotName).getMemberValues();
-      if (annotationValuesDiffer(oldValues, newValues)) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  private boolean annotationValuesDiffer(final AnnotationNameValuePair[] oldValues, final AnnotationNameValuePair[] newValues) {
-    if (oldValues.length != newValues.length) {
-      return true;
-    }
-    final TIntObjectHashMap<ConstantValue> names = new TIntObjectHashMap<ConstantValue>();
-    for (AnnotationNameValuePair value : oldValues) {
-      names.put(value.getName(), value.getValue());
-    }
-    for (AnnotationNameValuePair value : newValues) {
-      if (!names.containsKey(value.getName())) {
-        return true;
-      }
-      if (!value.getValue().equals(names.get(value.getName()))) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-
-  private TIntObjectHashMap<AnnotationConstantValue> fetchAllAnnotations(final Cache cache) throws CacheCorruptedException {
-    final int classId = myQName;
-    TIntObjectHashMap<AnnotationConstantValue> oldAnnotations = new TIntObjectHashMap<AnnotationConstantValue>();
-    for (AnnotationConstantValue annot : cache.getRuntimeVisibleAnnotations(classId)) {
-      oldAnnotations.put(annot.getAnnotationQName(), annot);
-    }
-    for (AnnotationConstantValue annot : cache.getRuntimeInvisibleAnnotations(classId)) {
-      oldAnnotations.put(annot.getAnnotationQName(), annot);
-    }
-    return oldAnnotations;
-  }
-
-  private void markAll(Dependency[] backDependencies, @NonNls String reason) throws CacheCorruptedException {
-    for (Dependency backDependency : backDependencies) {
-      if (myDependencyCache.markTargetClassInfo(backDependency)) {
-        if (LOG.isDebugEnabled()) {
-          LOG.debug("Mark dependent class " + myDependencyCache.resolve(backDependency.getClassQualifiedName()) + reason);
-        }
-      }
-    }
-  }
-
-  private static void extractFieldNames(Collection<MemberInfo> fromCollection, TIntHashSet toCollection) {
-    for (final Object aFromCollection : fromCollection) {
-      MemberInfo memberInfo = (MemberInfo)aFromCollection;
-      if (memberInfo instanceof FieldInfo) {
-        toCollection.add(memberInfo.getName());
-      }
-    }
-  }
-
-  private static Set<MethodInfo> extractMethods(Collection<MemberInfo> fromCollection, boolean includeConstructors) {
-    final Set<MethodInfo> methods = new HashSet<MethodInfo>();
-    extractMethods(fromCollection, methods, includeConstructors);
-    return methods;
-  }
-  
-  private static void extractMethods(Collection<MemberInfo> fromCollection, Collection<MethodInfo> toCollection, boolean includeConstructors) {
-    for (final MemberInfo memberInfo : fromCollection) {
-      if (memberInfo instanceof MethodInfo) {
-        final MethodInfo methodInfo = (MethodInfo)memberInfo;
-        if (includeConstructors) {
-          toCollection.add(methodInfo);
-        }
-        else {
-          if (!methodInfo.isConstructor()) {
-            toCollection.add(methodInfo);
-          }
-        }
-      }
-    }
-  }
-
-  private boolean processClassBecameAbstract(Dependency dependency) throws CacheCorruptedException {
-    for (Dependency.MethodRef ref : dependency.getMethodRefs()) {
-      final MethodInfo usedMethod = myRefToMethodMap.get(ref);
-      if (usedMethod == null) {
-        continue;
-      }
-      if (usedMethod.isConstructor()) {
-        if (myDependencyCache.markTargetClassInfo(dependency)) {
-          if (LOG.isDebugEnabled()) {
-            LOG.debug("Mark dependent class " + myDependencyCache.resolve(dependency.getClassQualifiedName()) + "; reason: " +
-                      myDependencyCache.resolve(myQName) + " made abstract");
-          }
-        }
-        return true;
-      }
-    }
-    return false;
-  }
-
-  private boolean isDependentOnRemovedMembers(Dependency dependency) {
-    for (Dependency.MethodRef ref : dependency.getMethodRefs()) {
-      if (myRemovedMembers.contains(myRefToMethodMap.get(ref))) {
-        return true;
-      }
-    }
-    for (Dependency.FieldRef ref : dependency.getFieldRefs()) {
-      if (myRemovedMembers.contains(myRefToFieldMap.get(ref))) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  private boolean isDependentOnChangedMembers(Dependency dependency) {
-    for (Dependency.FieldRef ref : dependency.getFieldRefs()) {
-      final FieldInfo fieldInfo = myRefToFieldMap.get(ref);
-      if (myChangedMembers.contains(fieldInfo)) {
-        return true;
-      }
-    }
-
-    for (Dependency.MethodRef ref : dependency.getMethodRefs()) {
-      final MethodInfo methodInfo = myRefToMethodMap.get(ref);
-      if (myChangedMembers.contains(methodInfo)) {
-        final MethodChangeDescription changeDescription = (MethodChangeDescription)myChangeDescriptions.get(methodInfo);
-        if (changeDescription.returnTypeDescriptorChanged ||
-            changeDescription.returnTypeGenericSignatureChanged ||
-            changeDescription.paramsGenericSignatureChanged ||
-            changeDescription.throwsListChanged ||
-            changeDescription.staticPropertyChanged ||
-            changeDescription.accessRestricted) {
-          return true;
-        }
-      }
-    }
-
-    return false;
-  }
-
-  private boolean isDependentOnEquivalentMethods(Collection<Dependency.MethodRef> checkedMembers, Set<MethodInfo> members) throws CacheCorruptedException {
-    // check if 'members' contains method with the same name and the same numbers of parameters, but with different types
-    if (checkedMembers.isEmpty() || members.isEmpty()) {
-      return false; // optimization
-    }
-    for (Dependency.MethodRef checkedMethod : checkedMembers) {
-      if (hasEquivalentMethod(members, checkedMethod)) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  private void markUseDependenciesOnEquivalentMethods(final int checkedInfoQName, Set<MethodInfo> methodsToCheck, int methodsClassName) throws CacheCorruptedException {
-    final Dependency[] backDependencies = myDependencyCache.getCache().getBackDependencies(checkedInfoQName);
-    for (Dependency dependency : backDependencies) {
-      if (myDependencyCache.isTargetClassInfoMarked(dependency)) {
-        continue;
-      }
-      if (isDependentOnEquivalentMethods(dependency.getMethodRefs(), methodsToCheck)) {
-        if (myDependencyCache.markTargetClassInfo(dependency)) {
-          if (LOG.isDebugEnabled()) {
-            LOG.debug("Mark dependent class " + myDependencyCache.resolve(dependency.getClassQualifiedName()) +
-                      "; reason: more specific methods added to " + myDependencyCache.resolve(methodsClassName));
-          }
-        }
-        myDependencyCache.addClassToUpdate(checkedInfoQName);
-      }
-    }
-  }
-
-  private void markUseDependenciesOnFields(final int classQName, TIntHashSet fieldNames) throws CacheCorruptedException {
-    final Cache oldCache = myDependencyCache.getCache();
-    for (Dependency useDependency : oldCache.getBackDependencies(classQName)) {
-      if (!myDependencyCache.isTargetClassInfoMarked(useDependency)) {
-        for (Dependency.FieldRef field : useDependency.getFieldRefs()) {
-          if (fieldNames.contains(field.name)) {
-            if (myDependencyCache.markTargetClassInfo(useDependency)) {
-              if (LOG.isDebugEnabled()) {
-                LOG.debug("Mark dependent class " + myDependencyCache.resolve(useDependency.getClassQualifiedName()) +
-                          "; reason: conflicting fields were added to the hierarchy of the class " + myDependencyCache.resolve(classQName));
-              }
-            }
-            myDependencyCache.addClassToUpdate(classQName);
-            break; // stop iterating fields
-          }
-        }
-      }
-    }
-  }
-  
-  private void processInheritanceDependencies(final Set<MethodInfo> removedMethods) throws CacheCorruptedException {
-    final Cache oldCache = myDependencyCache.getCache();
-    final Cache newCache = myDependencyCache.getNewClassesCache();
-
-    final boolean becameFinal = !ClsUtil.isFinal(oldCache.getFlags(myQName)) && ClsUtil.isFinal(newCache.getFlags(myQName));
-    final SymbolTable symbolTable = myDependencyCache.getSymbolTable();
-
-    final Set<MemberInfo> removedConcreteMethods = fetchNonAbstractMethods(myRemovedMembers);
-    final Set<MethodInfo> removedOverridableMethods;
-    if (!removedMethods.isEmpty()) {
-      removedOverridableMethods = new HashSet<MethodInfo>(removedMethods);
-      for (Iterator<MethodInfo> it = removedOverridableMethods.iterator(); it.hasNext();) {
-        final MethodInfo method = it.next();
-        if (method.isFinal() || method.isStatic() || method.isPrivate() || method.isConstructor()) {
-          it.remove();
-        }
-      }
-    }
-    else {
-      removedOverridableMethods = Collections.emptySet();
-    }
-    myDependencyCache.getCacheNavigator().walkSubClasses(myQName, new ClassInfoProcessor() {
-      public boolean process(final int subclassQName) throws CacheCorruptedException {
-        if (myDependencyCache.isClassInfoMarked(subclassQName)) {
-          return true;
-        }
-
-        if (!oldCache.containsClass(subclassQName)) {
-          return true;
-        }
-
-        if (!removedMethods.isEmpty() && myIsRemoteInterface && !MakeUtil.isInterface(oldCache.getFlags(subclassQName))) {
-          if (myDependencyCache.markClass(subclassQName)) {
-            if (LOG.isDebugEnabled()) {
-              LOG.debug("Mark dependent class " + myDependencyCache.resolve(subclassQName) +
-                        "; reason: methods were removed from remote interface: " + myDependencyCache.resolve(myQName));
-            }
-          }
-          return true;
-        }
-
-        if (mySuperClassAdded || mySuperInterfaceAdded) {
-          if (myDependencyCache.markClass(subclassQName)) {
-            if (LOG.isDebugEnabled()) {
-              LOG.debug("Mark dependent class " + myDependencyCache.resolve(subclassQName) + "; reason: the superlist of " +
-                        myDependencyCache.resolve(myQName) + " is changed");
-            }
-          }
-          return true;
-        }
-
-        // if info became final, mark direct inheritors
-        if (becameFinal) {
-          if (myQName == oldCache.getSuperQualifiedName(subclassQName)) {
-            if (myDependencyCache.markClass(subclassQName)) {
-              if (LOG.isDebugEnabled()) {
-                LOG.debug("Mark dependent class " + myDependencyCache.resolve(subclassQName) + "; reason: the class " +
-                          myDependencyCache.resolve(myQName) + " was made final");
-              }
-            }
-            return true;
-          }
-        }
-
-        // process added members
-        for (final MemberInfo member : myAddedMembers) {
-          if (member instanceof MethodInfo) {
-            final MethodInfo method = (MethodInfo)member;
-            if (method.isAbstract()) {
-              // all derived classes should be marked in case an abstract method was added
-              if (myDependencyCache.markClass(subclassQName)) {
-                if (LOG.isDebugEnabled()) {
-                  LOG.debug("Mark dependent class " + myDependencyCache.resolve(subclassQName) + "; reason: added abstract method to " +
-                            myDependencyCache.resolve(myQName));
-                }
-              }
-              return true;
-            }
-            if (!method.isPrivate()) {
-              final MethodInfo derivedMethod = oldCache.findMethodsBySignature(subclassQName, method.getDescriptor(symbolTable), symbolTable);
-              if (derivedMethod != null) {
-                if (!method.getReturnTypeDescriptor(symbolTable).equals(derivedMethod.getReturnTypeDescriptor(symbolTable))) {
-                  if (myDependencyCache.markClass(subclassQName)) {
-                    if (LOG.isDebugEnabled()) {
-                      LOG.debug("Mark dependent class " + myDependencyCache.resolve(subclassQName) + "; reason: return types of method " +
-                                method + " in base and derived classes are different");
-                    }
-                  }
-                  return true;
-                }
-                if (MakeUtil.isMoreAccessible(method.getFlags(), derivedMethod.getFlags())) {
-                  if (myDependencyCache.markClass(subclassQName)) {
-                    if (LOG.isDebugEnabled()) {
-                      LOG.debug("Mark dependent class " + myDependencyCache.resolve(subclassQName) + "; reason: the method " + method +
-                                " in derived class is less accessible than in base class");
-                    }
-                  }
-                  return true;
-                }
-                if (!method.isStatic() && derivedMethod.isStatic()) {
-                  if (myDependencyCache.markClass(subclassQName)) {
-                    if (LOG.isDebugEnabled()) {
-                      LOG.debug("Mark dependent class " + myDependencyCache.resolve(subclassQName) + "; reason: the method " + method +
-                                " in derived class is static, but added method in the base class is not");
-                    }
-                  }
-                  return true;
-                }
-                if (method.isFinal() && !derivedMethod.isFinal()) {
-                  if (myDependencyCache.markClass(subclassQName)) {
-                    if (LOG.isDebugEnabled()) {
-                      LOG.debug("Mark dependent class " + myDependencyCache.resolve(subclassQName) + "; reason: the method " + method +
-                                " in base class is final, but in derived class is not");
-                    }
-                  }
-                  return true;
-                }
-                if (!CacheUtils.areArraysContentsEqual(method.getThrownExceptions(), derivedMethod.getThrownExceptions())) {
-                  if (myDependencyCache.markClass(subclassQName)) {
-                    if (LOG.isDebugEnabled()) {
-                      LOG.debug("Mark dependent class " + myDependencyCache.resolve(subclassQName) + "; reason: exception lists of " +
-                                method + " in base and derived classes are different");
-                    }
-                  }
-                  return true;
-                }
-              }
-              if (hasGenericsNameClashes(method, oldCache, subclassQName)) {
-                if (myDependencyCache.markClass(subclassQName)) {
-                  if (LOG.isDebugEnabled()) {
-                    LOG.debug("Mark dependent class " + myDependencyCache.resolve(subclassQName) +
-                              "; reason: found method with the same name, different generic signature, but the same erasure as " + method);
-                  }
-                }
-                return true;
-              }
-            }
-          }
-          else if (member instanceof FieldInfo) {
-            if (oldCache.findFieldByName(subclassQName, member.getName()) != null) {
-              if (myDependencyCache.markClass(subclassQName)) {
-                if (LOG.isDebugEnabled()) {
-                  LOG.debug("Mark dependent class " + myDependencyCache.resolve(subclassQName) + "; reason: added field " + member +
-                            " to base class");
-                }
-              }
-              return true;
-            }
-          }
-        }
-
-        // process changed members
-        for (final MemberInfo changedMember : myChangedMembers) {
-          if (changedMember instanceof MethodInfo) {
-            final MethodInfo oldMethod = (MethodInfo)changedMember;
-            MethodChangeDescription changeDescription = (MethodChangeDescription)myChangeDescriptions.get(oldMethod);
-            if (changeDescription.becameAbstract) {
-              if (!ClsUtil.isAbstract(oldCache.getFlags(subclassQName))) { // if the subclass was not abstract
-                if (myDependencyCache.markClass(subclassQName)) {
-                  if (LOG.isDebugEnabled()) {
-                    LOG.debug(
-                      "Mark dependent class " + myDependencyCache.resolve(subclassQName) + "; reason: changed base method " + oldMethod);
-                  }
-                }
-                return true;
-              }
-            }
-            
-            final String oldMethodDescriptor = oldMethod.getDescriptor(symbolTable);
-            
-            final MethodInfo derivedMethod = oldCache.findMethodsBySignature(subclassQName, oldMethodDescriptor, symbolTable);
-            if (derivedMethod != null) {
-              if (myDependencyCache.markClass(subclassQName)) {
-                if (LOG.isDebugEnabled()) {
-                  LOG.debug("Mark dependent class " + myDependencyCache.resolve(subclassQName) + "; reason: changed base method " + oldMethod);
-                }
-              }
-              return true;
-            }
-            // now check if the changed method is compatible with methods declared in implemented interfaces of subclasses
-            myDependencyCache.getCacheNavigator().walkSuperInterfaces(subclassQName, new ClassInfoProcessor() {
-              boolean found = false;
-              public boolean process(final int ifaceQName) throws CacheCorruptedException {
-                if (found) {
-                  return false;
-                }
-                final MethodInfo implementee = oldCache.findMethodsBySignature(ifaceQName, oldMethodDescriptor, symbolTable);
-                if (implementee != null) {
-                  found = true;
-                  if (myDependencyCache.markClass(subclassQName)) {
-                    if (LOG.isDebugEnabled()) {
-                      LOG.debug("Mark dependent class " + myDependencyCache.resolve(subclassQName) + "; reason: changed base method, implementing corresponding method inherited from an interface" + oldMethod);
-                    }
-                  }
-                }
-                return !found;
-              }
-            });
-            if (myDependencyCache.isClassInfoMarked(subclassQName)) {
-              return true;
-            }
-          }
-        }
-
-        if (!ClsUtil.isAbstract(oldCache.getFlags(subclassQName))) {
-          if (hasUnimplementedAbstractMethods(subclassQName, new HashSet<MemberInfo>(removedConcreteMethods))) {
-            if (myDependencyCache.markClass(subclassQName)) {
-              if (LOG.isDebugEnabled()) {
-                LOG.debug("Mark dependent class " + myDependencyCache.resolve(subclassQName) + "; reason: the class should be declared abstract because abstract method implementation was removed from its superclass: " +
-                          myDependencyCache.resolve(myQName));
-              }
-            }
-            return true;
-          }
-        }
-
-        if (!removedOverridableMethods.isEmpty() && !myDependencyCache.isClassInfoMarked(subclassQName) && !myDependencyCache.getNewClassesCache().containsClass(subclassQName) /*not compiled in this session*/) {
-          final Cache cache = myDependencyCache.getCache();
-          for (MethodInfo subclassMethod : cache.getMethods(subclassQName)) {
-            if (!subclassMethod.isConstructor()) {
-              for (MethodInfo removedMethod : removedOverridableMethods) {
-                if (removedMethod.getName() == subclassMethod.getName() /*todo: check param signatures here for better accuracy*/) {
-                  // got it
-                  if (myDependencyCache.markClass(subclassQName)) {
-                    if (LOG.isDebugEnabled()) {
-                      LOG.debug("Mark dependent subclass " + myDependencyCache.resolve(subclassQName) + "; reason: the class has methods annotated with @Override and some methods were changed or removed in a base class" +
-                                myDependencyCache.resolve(myQName));
-                    }
-                  }
-                  return true;
-                }
-              }
-            }
-          }
-        }
-        // end of subclass processor
-        return true;
-      }
-    });
-  }
-
-  private static boolean hasGenericsNameClashes(final MethodInfo baseMethod, final Cache oldCache, final int subclassQName) throws CacheCorruptedException {
-    // it is illegal if 2 methods in a hierarchy have 1) same name 2) different signatures 3) same erasure
-    final List<MethodInfo> methods = oldCache.findMethodsByName(subclassQName, baseMethod.getName());
-    if (methods.size() > 0) {
-      for (final MethodInfo methodInSubclass : methods) {
-        if (ClsUtil.isBridge(methodInSubclass.getFlags())) {
-          continue;
-        }
-        if (baseMethod.getDescriptor() == methodInSubclass.getDescriptor() && baseMethod.getGenericSignature() != methodInSubclass.getGenericSignature()) {
-          return true;
-        }
-      }
-    }
-    return false;
-  }
-
-  private static Set<MemberInfo> fetchNonAbstractMethods(Set<MemberInfo> membersToCheck) {
-    final Set<MemberInfo> methodsToCheck = new HashSet<MemberInfo>();
-    for (final Object aMembersToCheck : membersToCheck) {
-      final MemberInfo memberInfo = (MemberInfo)aMembersToCheck;
-      if (memberInfo instanceof MethodInfo) {
-        final MethodInfo methodInfo = (MethodInfo)memberInfo;
-        if (!methodInfo.isAbstract() && !methodInfo.isConstructor()) {
-          methodsToCheck.add(memberInfo);
-        }
-      }
-    }
-    return methodsToCheck;
-  }
-
-  private boolean hasUnimplementedAbstractMethods(int superQName, final Set methodsToCheck) throws CacheCorruptedException {
-    if (myDependencyCache.getCache().containsClass(superQName)) {
-      return hasBaseAbstractMethods(superQName, methodsToCheck) ||
-             hasBaseAbstractMethodsInHierarchy(superQName, methodsToCheck);
-    }
-    else {
-      final String qName = myDependencyCache.resolve(superQName);
-      if (!CommonClassNames.JAVA_LANG_OBJECT.equals(qName)) {
-        if (hasBaseAbstractMethods2(qName, methodsToCheck)) {
-          return true;
-        }
-      }
-    }
-    return false;
-  }
-
-  private boolean hasBaseAbstractMethodsInHierarchy(int fromClassQName, final Set methodsToCheck) throws CacheCorruptedException {
-    if (fromClassQName == Cache.UNKNOWN || methodsToCheck.isEmpty()) {
-      return false;
-    }
-    final Cache cache = myDependencyCache.getCache();
-    int superName = cache.getSuperQualifiedName(fromClassQName);
-    if (superName != Cache.UNKNOWN) {
-      if (hasUnimplementedAbstractMethods(superName, methodsToCheck)) {
-        return true;
-      }
-    }
-    if (methodsToCheck.isEmpty()) {
-      return false;
-    }
-    int[] superInterfaces = cache.getSuperInterfaces(fromClassQName);
-    for (int superInterface : superInterfaces) {
-      if (hasUnimplementedAbstractMethods(superInterface, methodsToCheck)) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  private boolean hasBaseAbstractMethods(int qName, Set methodsToCheck) throws CacheCorruptedException {
-    final SymbolTable symbolTable = myDependencyCache.getSymbolTable();
-    final Cache oldCache = myDependencyCache.getCache();
-    final Cache newCache = myDependencyCache.getNewClassesCache();
-    final Cache cache = newCache.containsClass(qName)? newCache : oldCache; // use recompiled version (if any) for searching methods
-    for (Iterator it = methodsToCheck.iterator(); it.hasNext();) {
-      final MethodInfo methodInfo = (MethodInfo)it.next();
-      final MethodInfo superMethod = cache.findMethodsBySignature(qName, methodInfo.getDescriptor(symbolTable), symbolTable);
-      if (superMethod != null) {
-        if (ClsUtil.isAbstract(superMethod.getFlags())) {
-          return true;
-        }
-        it.remove();
-      }
-    }
-    return false;
-  }
-
-  // search using PSI
-  private boolean hasBaseAbstractMethods2(final String qName, final Set methodsToCheck) throws CacheCorruptedException {
-    final boolean[] found = {false};
-    final CacheCorruptedException ex = ApplicationManager.getApplication().runReadAction(new Computable<CacheCorruptedException>() {
-      public CacheCorruptedException compute() {
-        try {
-          final PsiManager psiManager = PsiManager.getInstance(myProject);
-          final PsiClass aClass = JavaPsiFacade.getInstance(psiManager.getProject()).findClass(qName, GlobalSearchScope.allScope(myProject));
-          if (aClass == null) {
-            return null;
-          }
-          final PsiElementFactory factory = JavaPsiFacade.getInstance(psiManager.getProject()).getElementFactory();
-          final PsiNameHelper nameHelper = JavaPsiFacade.getInstance(myProject).getNameHelper();
-          for (Iterator it = methodsToCheck.iterator(); it.hasNext();) {
-            final MethodInfo methodInfo = (MethodInfo)it.next();
-            if (!nameHelper.isIdentifier(myDependencyCache.resolve(methodInfo.getName()), LanguageLevel.JDK_1_3)) { // fix for SCR 16068
-              continue;
-            }
-            // language level 1.3 will prevent exceptions from PSI if there are methods named "assert"
-            final PsiMethod methodPattern = factory.createMethodFromText(getMethodText(methodInfo), null, LanguageLevel.JDK_1_3);
-            final PsiMethod superMethod = aClass.findMethodBySignature(methodPattern, true);
-            if (superMethod != null) {
-              if (superMethod.hasModifierProperty(PsiModifier.ABSTRACT)) {
-                found[0] = true;
-                return null;
-              }
-              it.remove();
-            }
-          }
-        }
-        catch (IncorrectOperationException e) {
-          LOG.error(e);
-        }
-        catch (CacheCorruptedException e) {
-          return e;
-        }
-        return null;
-      }
-    });
-    if (ex != null) {
-      throw ex;
-    }
-    return found[0];
-  }
-
-  @SuppressWarnings({"HardCodedStringLiteral"})
-  private @NonNls String getMethodText(MethodInfo methodInfo) throws CacheCorruptedException {
-    final SymbolTable symbolTable = myDependencyCache.getSymbolTable();
-    StringBuilder text = new StringBuilder(16);
-    final String returnType = signatureToSourceTypeName(methodInfo.getReturnTypeDescriptor(symbolTable));
-    text.append(returnType);
-    text.append(" ");
-    text.append(myDependencyCache.resolve(methodInfo.getName()));
-    text.append("(");
-    final String[] parameterSignatures = methodInfo.getParameterDescriptors(symbolTable);
-    for (int idx = 0; idx < parameterSignatures.length; idx++) {
-      String parameterSignature = parameterSignatures[idx];
-      if (idx > 0) {
-        text.append(",");
-      }
-      text.append(signatureToSourceTypeName(parameterSignature));
-      text.append(" arg");
-      text.append(idx);
-    }
-    text.append(")");
-    return text.toString();
-  }
-
-  private static boolean wereInterfacesRemoved(int[] oldInterfaces, int[] newInterfaces) {
-    for (int oldInterface : oldInterfaces) {
-      boolean found = false;
-      for (int newInterface : newInterfaces) {
-        found = oldInterface == newInterface;
-        if (found) {
-          break;
-        }
-      }
-      if (!found) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  /** @return a map [fieldName->FieldInfo]*/
-  private static TIntObjectHashMap<FieldInfo> getFieldInfos(Cache cache, int qName) throws CacheCorruptedException {
-    final TIntObjectHashMap<FieldInfo> map = new TIntObjectHashMap<FieldInfo>();
-    for (FieldInfo fieldInfo : cache.getFields(qName)) {
-      map.put(fieldInfo.getName(), fieldInfo);
-    }
-    return map;
-  }
-
-  /** @return a map [methodSignature->MethodInfo]*/
-  private Map<String, MethodInfoContainer> getMethodInfos(final MethodInfo[] methods) throws CacheCorruptedException {
-    final Map<String, MethodInfoContainer> map = new HashMap<String, MethodInfoContainer>();
-    final SymbolTable symbolTable = myDependencyCache.getSymbolTable();
-    for (MethodInfo methodInfo : methods) {
-      final String signature = methodInfo.getDescriptor(symbolTable);
-      final MethodInfoContainer currentValue = map.get(signature);
-      // covariant methods have the same signature, so there might be several MethodInfos for one key
-      if (currentValue == null) {
-        map.put(signature, new MethodInfoContainer(methodInfo));
-      }
-      else {
-        currentValue.add(methodInfo);
-      }
-    }
-    return map;
-  }
-
-  private static void addAddedMembers(TIntObjectHashMap<FieldInfo> oldFields, Map<String, MethodInfoContainer> oldMethods,
-                               TIntObjectHashMap<FieldInfo> newFields, Map<String, MethodInfoContainer> newMethods,
-                               Collection<MemberInfo> members) {
-
-    for (final TIntObjectIterator<FieldInfo> it = newFields.iterator(); it.hasNext();) {
-      it.advance();
-      final int fieldName = it.key();
-      final FieldInfo fieldInfo = it.value();
-      if (!oldFields.containsKey(fieldName)) {
-        members.add(fieldInfo);
-      }
-    }
-    for (final String signature : newMethods.keySet()) {
-      if (!oldMethods.containsKey(signature)) {
-        members.addAll(newMethods.get(signature).getMethods());
-      }
-    }
-  }
-
-  private static void addRemovedMembers(TIntObjectHashMap<FieldInfo> oldFields, Map<String, MethodInfoContainer> oldMethods,
-                               TIntObjectHashMap<FieldInfo> newFields, Map<String, MethodInfoContainer> newMethods,
-                               Collection<MemberInfo> members)  {
-    addAddedMembers(newFields, newMethods, oldFields, oldMethods, members);
-  }
-
-  private void addChangedMembers(TIntObjectHashMap<FieldInfo> oldFields, Map<String, MethodInfoContainer> oldMethods,
-                               TIntObjectHashMap<FieldInfo> newFields, Map<String, MethodInfoContainer> newMethods,
-                               Collection<MemberInfo> members) throws CacheCorruptedException {
-    for (final TIntObjectIterator<FieldInfo> it = oldFields.iterator(); it.hasNext();) {
-      it.advance();
-      final int fieldName = it.key();
-      final FieldInfo oldInfo = it.value();
-      final FieldInfo newInfo = newFields.get(fieldName);
-      if (newInfo != null) {
-        final FieldChangeDescription changeDescription = new FieldChangeDescription(oldInfo, newInfo);
-        if (changeDescription.isChanged()) {
-          members.add(oldInfo);
-          myChangeDescriptions.put(oldInfo, changeDescription);
-        }
-      }
-    }
-
-    if (!oldMethods.isEmpty()) {
-      final SymbolTable symbolTable = myDependencyCache.getSymbolTable();
-      final Set<MethodInfo> processed = new HashSet<MethodInfo>();
-      for (final String signature : oldMethods.keySet()) {
-        final MethodInfoContainer oldMethodsContainer = oldMethods.get(signature);
-        final MethodInfoContainer newMethodsContainer = newMethods.get(signature);
-        if (newMethodsContainer != null) {
-          processed.clear();
-          if (oldMethodsContainer.size() == newMethodsContainer.size()) {
-            // first, process all corresponding method infos
-            for (MethodInfo oldInfo : oldMethodsContainer.getMethods()) {
-              MethodInfo _newInfo = null;
-              for (MethodInfo newInfo : newMethodsContainer.getMethods()) {
-                if (oldInfo.equals(newInfo)) {
-                  _newInfo = newInfo;
-                  break;
-                }
-              }
-              if (_newInfo != null) {
-                processed.add(oldInfo);
-                processed.add(_newInfo);
-                final MethodChangeDescription changeDescription = new MethodChangeDescription(oldInfo, _newInfo, symbolTable);
-                if (changeDescription.isChanged()) {
-                  members.add(oldInfo);
-                  myChangeDescriptions.put(oldInfo, changeDescription);
-                }
-              }
-            }
-          }
-          // processing the rest of infos, each pair
-          for (MethodInfo oldInfo : oldMethodsContainer.getMethods()) {
-            if (processed.contains(oldInfo)) {
-              continue;
-            }
-            for (MethodInfo newInfo : newMethodsContainer.getMethods()) {
-              if (processed.contains(newInfo)) {
-                continue;
-              }
-              final MethodChangeDescription changeDescription = new MethodChangeDescription(oldInfo, newInfo, symbolTable);
-              if (changeDescription.isChanged()) {
-                members.add(oldInfo);
-                myChangeDescriptions.put(oldInfo, changeDescription);
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-
-  private boolean hasEquivalentMethod(Collection<MethodInfo> members, Dependency.MethodRef modelMethod) throws CacheCorruptedException {
-    final String[] modelSignature = modelMethod.getParameterDescriptors(myDependencyCache.getSymbolTable());
-    for (final MethodInfo method : members) {
-      if (modelMethod.name != method.getName()) {
-        continue;
-      }
-      final String[] methodSignature = method.getParameterDescriptors(myDependencyCache.getSymbolTable());
-      if (modelSignature.length != methodSignature.length) {
-        continue;
-      }
-
-      for (int i = 0; i < methodSignature.length; i++) {
-        if (!methodSignature[i].equals(modelSignature[i])) {
-          if (LOG.isDebugEnabled()) {
-            LOG.debug("Equivalent: " + modelMethod.getDescriptor(myDependencyCache.getSymbolTable()) + " <=> " +
-                      method.getDescriptor(myDependencyCache.getSymbolTable()));
-          }
-          return true;
-        }
-      }
-    }
-    return false;
-  }
-
-  private static @NonNls
-  String signatureToSourceTypeName(String signature)
-  {
-    try {
-      switch(signature.charAt(0)) {
-      case 'B' : return "byte";
-      case 'C' : return "char";
-      case 'D' : return "double";
-      case 'F' : return "float";
-      case 'I' : return "int";
-      case 'J' : return "long";
-
-      case 'L' : { // Full class name
-	int    index = signature.indexOf(';'); // Look for closing `;'
-
-	if(index < 0)
-	  throw new RuntimeException("Invalid signature: " + signature);
-
-        return signature.substring(1, index).replace('/', '.');
-      }
-
-      case 'S' : return "short";
-      case 'Z' : return "boolean";
-
-      case '[' : { // Array declaration
-	int          n;
-	StringBuffer brackets;
-	String       type;
-
-	brackets = new StringBuffer(); // Accumulate []'s
-
-	// Count opening brackets and look for optional size argument
-	for(n=0; signature.charAt(n) == '['; n++)
-	  brackets.append("[]");
-
-
-	// The rest of the string denotes a `<field_type>'
-	type = signatureToSourceTypeName(signature.substring(n));
-
-	return type + brackets.toString();
-      }
-
-      case 'V' : return "void";
-
-      default  : throw new RuntimeException("Invalid signature: `" +
-					    signature + "'");
-      }
-    } catch(StringIndexOutOfBoundsException e) { // Should never occur
-      throw new RuntimeException("Invalid signature: " + e + ":" + signature);
-    }
-  }
-
-  private Dependency[] getBackDependencies() throws CacheCorruptedException {
-    if (myBackDependencies == null) {
-      myBackDependencies = myDependencyCache.getCache().getBackDependencies(myQName);
-    }
-    return myBackDependencies;
-  }
-
-  private static class MethodInfoContainer {
-    private List<MethodInfo> myInfos = null;
-
-    protected MethodInfoContainer(MethodInfo info) {
-      myInfos = Collections.singletonList(info);
-    }
-
-    public List<MethodInfo> getMethods() {
-      return myInfos;
-    }
-
-    public int size() {
-      return myInfos.size();
-    }
-
-    public void add(MethodInfo info) {
-      if (myInfos.size() == 1) {
-        myInfos = new ArrayList<MethodInfo>(myInfos);
-      }
-      myInfos.add(info);
-    }
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/MakeUtil.java b/java/compiler/impl/src/com/intellij/compiler/make/MakeUtil.java
deleted file mode 100644
index 52f347f..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/MakeUtil.java
+++ /dev/null
@@ -1,300 +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.
- */
-
-/**
- * created at Jan 17, 2002
- * @author Jeka
- */
-package com.intellij.compiler.make;
-
-import com.intellij.compiler.SymbolTable;
-import com.intellij.compiler.classParsing.*;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.roots.CompilerModuleExtension;
-import com.intellij.openapi.roots.ProjectFileIndex;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.SystemInfo;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VfsUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.StringBuilderSpinAllocator;
-import com.intellij.util.cls.ClsUtil;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.Nullable;
-
-public class MakeUtil {
-
-  private MakeUtil() {
-  }
-
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.make.MakeUtil");
-
-
-  public static VirtualFile getSourceRoot(CompileContext context, Module module, VirtualFile file) {
-    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(module.getProject()).getFileIndex();
-    final VirtualFile root = fileIndex.getSourceRootForFile(file);
-    if (root != null) {
-      return root;
-    }
-    // try to find among roots of generated files.
-    final VirtualFile[] sourceRoots = context.getSourceRoots(module);
-    for (final VirtualFile sourceRoot : sourceRoots) {
-      if (fileIndex.isInSourceContent(sourceRoot)) {
-        continue; // skip content source roots, need only roots for generated files
-      }
-      if (VfsUtil.isAncestor(sourceRoot, file, false)) {
-        return sourceRoot;
-      }
-    }
-    return null;
-  }
-
-  /**
-   * cuts inner or anonymous class' parts and translates package names to lower case
-   */
-  private static String normalizeClassName(String qName) {
-    int index = qName.indexOf('$');
-    if (index >= 0) {
-      qName = qName.substring(0, index);
-    }
-    if (SystemInfo.isFileSystemCaseSensitive) {
-      return qName;
-    }
-    // the name of a dir should be lowercased because javac seem to allow difference in case
-    // between the physical directory and package name.
-    final int dotIndex = qName.lastIndexOf('.');
-    final StringBuilder builder = StringBuilderSpinAllocator.alloc();
-    try {
-      builder.append(qName);
-      for (int idx = 0; idx < dotIndex; idx++) {
-        builder.setCharAt(idx, Character.toLowerCase(builder.charAt(idx)));
-      }
-      return builder.toString();
-    }
-    finally {
-      StringBuilderSpinAllocator.dispose(builder);
-    }
-  }
-
-  public static boolean isAnonymous(String name) {
-    int index = name.lastIndexOf('$');
-    if (index >= 0) {
-      index++;
-      if (index < name.length()) {
-        try {
-          Integer.parseInt(name.substring(index));
-          return true;
-        }
-        catch (NumberFormatException e) {
-        }
-      }
-    }
-    return false;
-  }
-
-  /*
-     not needed currently
-  public static String getEnclosingClassName(String anonymousQName) {
-    return anonymousQName.substring(0, anonymousQName.lastIndexOf('$'));
-  }
-  */
-
-  /*
-   not needed currently
-  public static boolean isNative(int flags) {
-    return (ClsUtil.ACC_NATIVE & flags) != 0;
-  }
-  */
-
-  /**
-   * tests if the accessibility, denoted by flags1 is less restricted than the accessibility denoted by flags2
-   * @return true means flags1 is less restricted than flags2 <br>
-   *         false means flags1 define more restricted access than flags2 or they have equal accessibility
-   */
-  public static boolean isMoreAccessible(int flags1, int flags2) {
-    if (ClsUtil.isPrivate(flags2)) {
-      return ClsUtil.isPackageLocal(flags1) || ClsUtil.isProtected(flags1) || ClsUtil.isPublic(flags1);
-    }
-    if (ClsUtil.isPackageLocal(flags2)) {
-      return ClsUtil.isProtected(flags1) || ClsUtil.isPublic(flags1);
-    }
-    if (ClsUtil.isProtected(flags2)) {
-      return ClsUtil.isPublic(flags1);
-    }
-    return false;
-  }
-
-  @Nullable
-  @SuppressWarnings({"HardCodedStringLiteral"})
-  public static String relativeClassPathToQName(String relativePath, char separator) {
-    if (!relativePath.endsWith(".class")) {
-      return null;
-    }
-    int start = 0;
-    int end = relativePath.length() - ".class".length();
-    if (relativePath.startsWith(String.valueOf(separator))) {
-      start += 1;
-    }
-    return (start <= end)? relativePath.substring(start, end).replace(separator, '.') : null;
-  }
-
-  public static @NonNls String parseObjectType(final String descriptor, int fromIndex) {
-    int semicolonIndex = descriptor.indexOf(';', fromIndex);
-    if (descriptor.charAt(fromIndex) == 'L' && semicolonIndex > fromIndex) { // isObjectType
-      return descriptor.substring(fromIndex + 1, semicolonIndex).replace('/', '.');
-    }
-    if (descriptor.charAt(fromIndex) == '[' && (descriptor.length() - fromIndex) > 0) { // isArrayType
-      return parseObjectType(descriptor, fromIndex + 1);
-    }
-    return null;
-  }
-
-  @SuppressWarnings({"HardCodedStringLiteral"})
-  public static boolean isPrimitiveType(String descriptor) {
-    return
-      "V".equals(descriptor) ||
-      "B".equals(descriptor) ||
-      "C".equals(descriptor) ||
-      "D".equals(descriptor) ||
-      "F".equals(descriptor) ||
-      "I".equals(descriptor) ||
-      "J".equals(descriptor) ||
-      "S".equals(descriptor) ||
-      "Z".equals(descriptor);
-  }
-
-  public static boolean isArrayType(String descriptor) {
-    return StringUtil.startsWithChar(descriptor, '[');
-  }
-
-  public static String getComponentType(String descriptor) {
-    if (!isArrayType(descriptor)) {
-      return null;
-    }
-    return descriptor.substring(1);
-  }
-
-
-  /**
-   * @return a normalized path to source relative to a source root by class qualified name and sourcefile short name.
-   *  The path uses forward slashes "/".
-   */
-  public static String createRelativePathToSource(String qualifiedName, String srcName) {
-    qualifiedName = normalizeClassName(qualifiedName);
-    int index = qualifiedName.lastIndexOf('.');
-    if (index >= 0) {
-      srcName = qualifiedName.substring(0, index).replace('.', '/') + "/" + srcName;
-    }
-    return srcName;
-  }
-
-  public static boolean isInterface(int flags) {
-    return (ClsUtil.ACC_INTERFACE & flags) != 0;
-  }
-
-  public static int getAnnotationTargets(final Cache cache, final int annotationQName, final SymbolTable symbolTable) throws CacheCorruptedException {
-    final AnnotationConstantValue targetAnnotation = findAnnotation(
-      "java.lang.annotation.Target",
-      cache.getRuntimeVisibleAnnotations(annotationQName), symbolTable);
-    if (targetAnnotation == null) {
-      return AnnotationTargets.ALL; // all program elements are annotation targets by default
-    }
-    final AnnotationNameValuePair[] memberValues = targetAnnotation.getMemberValues();
-    ConstantValueArray value = (ConstantValueArray)memberValues[0].getValue();
-    final ConstantValue[] targets = value.getValue();
-    int annotationTargets = 0;
-    for (final ConstantValue target : targets) {
-      if (target instanceof EnumConstantValue) {
-        final String constantName = symbolTable.getSymbol(((EnumConstantValue)target).getConstantName());
-        if (AnnotationTargets.TYPE_STR.equals(constantName)) {
-          annotationTargets |= AnnotationTargets.TYPE;
-        }
-        if (AnnotationTargets.FIELD_STR.equals(constantName)) {
-          annotationTargets |= AnnotationTargets.FIELD;
-        }
-        if (AnnotationTargets.METHOD_STR.equals(constantName)) {
-          annotationTargets |= AnnotationTargets.METHOD;
-        }
-        if (AnnotationTargets.PARAMETER_STR.equals(constantName)) {
-          annotationTargets |= AnnotationTargets.PARAMETER;
-        }
-        if (AnnotationTargets.CONSTRUCTOR_STR.equals(constantName)) {
-          annotationTargets |= AnnotationTargets.CONSTRUCTOR;
-        }
-        if (AnnotationTargets.LOCAL_VARIABLE_STR.equals(constantName)) {
-          annotationTargets |= AnnotationTargets.LOCAL_VARIABLE;
-        }
-        if (AnnotationTargets.ANNOTATION_TYPE_STR.equals(constantName)) {
-          annotationTargets |= AnnotationTargets.ANNOTATION_TYPE;
-        }
-        if (AnnotationTargets.PACKAGE_STR.equals(constantName)) {
-          annotationTargets |= AnnotationTargets.PACKAGE;
-        }
-      }
-    }
-    return annotationTargets;
-  }
-
-  public static int getAnnotationRetentionPolicy(final int annotationQName, final Cache cache, final SymbolTable symbolTable) throws CacheCorruptedException {
-    final AnnotationConstantValue retentionPolicyAnnotation = findAnnotation(
-      "java.lang.annotation.Retention",
-      cache.getRuntimeVisibleAnnotations(annotationQName), symbolTable
-    );
-    if (retentionPolicyAnnotation == null) {
-      return RetentionPolicies.CLASS; // default retention policy
-    }
-    final AnnotationNameValuePair[] memberValues = retentionPolicyAnnotation.getMemberValues();
-    final EnumConstantValue value = (EnumConstantValue)memberValues[0].getValue();
-    final String constantName = symbolTable.getSymbol(value.getConstantName());
-    if (RetentionPolicies.SOURCE_STR.equals(constantName)) {
-      return RetentionPolicies.SOURCE;
-    }
-    if (RetentionPolicies.CLASS_STR.equals(constantName)) {
-      return RetentionPolicies.CLASS;
-    }
-    if (RetentionPolicies.RUNTIME_STR.equals(constantName)) {
-      return RetentionPolicies.RUNTIME;
-    }
-    LOG.error("Unknown retention policy: " + constantName);
-    return -1;
-  }
-
-  public static AnnotationConstantValue findAnnotation(@NonNls final String annotationQName,
-                                                       AnnotationConstantValue[] annotations, final SymbolTable symbolTable) throws CacheCorruptedException {
-    for (final AnnotationConstantValue annotation : annotations) {
-      if (annotationQName.equals(symbolTable.getSymbol(annotation.getAnnotationQName()))) {
-        return annotation;
-      }
-    }
-    return null;
-  }
-
-  public static String getModuleOutputDirPath(final Module module) {
-    return ApplicationManager.getApplication().runReadAction(new Computable<String>() {
-      public String compute() {
-        final String url = CompilerModuleExtension.getInstance(module).getCompilerOutputUrl();
-        if (url == null) {
-          return null;
-        }
-        return VfsUtil.urlToPath(url);
-      }
-    });
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/MethodChangeDescription.java b/java/compiler/impl/src/com/intellij/compiler/make/MethodChangeDescription.java
deleted file mode 100644
index 2465703..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/MethodChangeDescription.java
+++ /dev/null
@@ -1,90 +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.compiler.make;
-
-import com.intellij.compiler.SymbolTable;
-import com.intellij.compiler.classParsing.ConstantValue;
-import com.intellij.compiler.classParsing.GenericMethodSignature;
-import com.intellij.compiler.classParsing.MethodInfo;
-import com.intellij.compiler.classParsing.SignatureParsingException;
-import com.intellij.util.cls.ClsUtil;
-
-import java.util.Arrays;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Apr 7, 2004
- */
-class MethodChangeDescription extends ChangeDescription {
-  public final boolean returnTypeDescriptorChanged;
-  public final boolean returnTypeGenericSignatureChanged;
-  public final boolean paramsGenericSignatureChanged;
-  public final boolean throwsListChanged;
-  public final boolean flagsChanged;
-  public final boolean staticPropertyChanged;
-  public final boolean accessRestricted;
-  public final boolean becameAbstract;
-  public final boolean removedAnnotationDefault;
-
-  public MethodChangeDescription(final MethodInfo oldMethod, final MethodInfo newMethod, SymbolTable symbolTable) throws CacheCorruptedException {
-    final String oldRtDescriptor = oldMethod.getReturnTypeDescriptor(symbolTable);
-    final String newRtDescriptor = newMethod.getReturnTypeDescriptor(symbolTable);
-    returnTypeDescriptorChanged = !oldRtDescriptor.equals(newRtDescriptor);
-
-    final int oldGenericSignature = oldMethod.getGenericSignature();
-    final int newGenericSignature = newMethod.getGenericSignature();
-    if (oldGenericSignature == newGenericSignature) {
-      returnTypeGenericSignatureChanged = false;
-      paramsGenericSignatureChanged = false;
-    }
-    else {
-      if (oldGenericSignature != -1 && newGenericSignature != -1) {
-        try {
-          final GenericMethodSignature _oldGenericMethodSignature = GenericMethodSignature.parse(symbolTable.getSymbol(oldGenericSignature));
-          final GenericMethodSignature _newGenericMethodSignature = GenericMethodSignature.parse(symbolTable.getSymbol(newGenericSignature));
-          returnTypeGenericSignatureChanged = !_oldGenericMethodSignature.getReturnTypeSignature().equals(_newGenericMethodSignature.getReturnTypeSignature());
-          paramsGenericSignatureChanged = !_oldGenericMethodSignature.getFormalTypeParams().equals(_newGenericMethodSignature.getFormalTypeParams()) ||
-                                          !Arrays.equals(_oldGenericMethodSignature.getParamSignatures(), _newGenericMethodSignature.getParamSignatures());
-        }
-        catch (SignatureParsingException e) {
-          throw new CacheCorruptedException(e);
-        }
-      }
-      else {
-        returnTypeGenericSignatureChanged = true;
-        paramsGenericSignatureChanged = true;
-      }
-    }
-
-    throwsListChanged = !CacheUtils.areArraysContentsEqual(oldMethod.getThrownExceptions(), newMethod.getThrownExceptions());
-
-    final int oldFlags = oldMethod.getFlags();
-    final int newFlags = newMethod.getFlags();
-    flagsChanged = oldFlags != newFlags;
-
-    staticPropertyChanged = (ClsUtil.isStatic(oldFlags) && !ClsUtil.isStatic(newFlags)) ||  (!ClsUtil.isStatic(oldFlags) && ClsUtil.isStatic(newFlags)); // was not static and became static or was static and became not static
-    accessRestricted = MakeUtil.isMoreAccessible(oldFlags, newFlags);
-    becameAbstract = !ClsUtil.isAbstract(oldFlags) && ClsUtil.isAbstract(newFlags);
-
-    final ConstantValue oldDefault = oldMethod.getAnnotationDefault();
-    final ConstantValue newDefault = newMethod.getAnnotationDefault();
-    removedAnnotationDefault = (oldDefault != null && !ConstantValue.EMPTY_CONSTANT_VALUE.equals(oldDefault)) && (newDefault == null || ConstantValue.EMPTY_CONSTANT_VALUE.equals(newDefault));
-  }
-
-  public boolean isChanged() {
-    return returnTypeDescriptorChanged || throwsListChanged || flagsChanged || returnTypeGenericSignatureChanged || paramsGenericSignatureChanged || removedAnnotationDefault;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/RetentionPolicies.java b/java/compiler/impl/src/com/intellij/compiler/make/RetentionPolicies.java
deleted file mode 100644
index 13cfaa5..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/RetentionPolicies.java
+++ /dev/null
@@ -1,50 +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.compiler.make;
-
-import org.jetbrains.annotations.NonNls;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: Apr 7, 2004
- */
-public interface RetentionPolicies {
-  /**
-   * Annotations are to be discarded by the compiler.
-   */
-  int SOURCE = 0x1;
-
-  @NonNls String SOURCE_STR = "SOURCE";
-
-  /**
-   * Annotations are to be recorded in the class file by the compiler
-   * but need not be retained by the VM at run time.  This is the default
-   * behavior.
-   */
-  int CLASS = 0x2;
-
-  @NonNls String CLASS_STR = "CLASS";
-
-  /**
-   * Annotations are to be recorded in the class file by the compiler and
-   * retained by the VM at run time, so they may be read reflectively.
-   */
-  int RUNTIME = 0x4;
-
-  @NonNls String RUNTIME_STR = "RUNTIME";
-
-  int ALL = SOURCE | CLASS | RUNTIME;
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/SourceFileFinder.java b/java/compiler/impl/src/com/intellij/compiler/make/SourceFileFinder.java
deleted file mode 100644
index 1e17b86..0000000
--- a/java/compiler/impl/src/com/intellij/compiler/make/SourceFileFinder.java
+++ /dev/null
@@ -1,122 +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.compiler.make;
-
-import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.ProjectFileIndex;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.JavaPsiFacade;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.util.containers.HashMap;
-
-import java.util.Map;
-
-/**
- * Assumes that source roots in the project has not changed and caches the snapshot of source roots for effective searching
- * User: JEKA
- * Date: Jul 17, 2003
- * Time: 9:52:26 PM
- */
-public class SourceFileFinder {
-  private final Project myProject;
-  private final CompileContext myCompileContext;
-  private Map<VirtualFile, String> myProjectSourceRoots = null;
-  private final CompilerConfiguration myCompilerConfiguration;
-
-  public SourceFileFinder(Project project, CompileContext compileContext) {
-    myProject = project;
-    myCompileContext = compileContext;
-    myCompilerConfiguration = CompilerConfiguration.getInstance(project);
-  }
-
-  public VirtualFile findSourceFile(String qualifiedName, final String srcName, boolean checkIfExcludedFromMake) {
-    // optimization
-    final int dollar = qualifiedName.indexOf('$');
-    final String outerQName = (dollar >= 0)? qualifiedName.substring(0, dollar) : qualifiedName;
-    final PsiClass[] classes = JavaPsiFacade.getInstance(myProject).findClasses(outerQName, GlobalSearchScope.projectScope(myProject));
-    for (PsiClass aClass : classes) {
-      final PsiFile file = aClass.getContainingFile();
-      if (srcName.equals(file.getName())) {
-        final VirtualFile vFile = file.getVirtualFile();
-        if (vFile != null && (!checkIfExcludedFromMake || !myCompilerConfiguration.isExcludedFromCompilation(vFile))) {
-          return vFile;
-        }
-      }
-    }
-
-    String relativePath = MakeUtil.createRelativePathToSource(qualifiedName, srcName);
-    Map<VirtualFile, String> dirs = getAllSourceRoots();
-    if (!StringUtil.startsWithChar(relativePath, '/')) {
-      relativePath = "/" + relativePath;
-    }
-    LocalFileSystem fs = LocalFileSystem.getInstance();
-    for (final VirtualFile virtualFile : dirs.keySet()) {
-      final String prefix = dirs.get(virtualFile);
-      String path;
-      if (prefix.length() > 0) {
-        if (FileUtil.startsWith(relativePath, prefix)) {
-          // if there is package prefix assigned to the root, the relative path should be corrected
-          path = virtualFile.getPath() + relativePath.substring(prefix.length() - 1);
-        }
-        else {
-          // if there is package prefix, but the relative path does not match it, skip the root
-          continue;
-        }
-      }
-      else {
-        path = virtualFile.getPath() + relativePath;
-      }
-      VirtualFile file = fs.findFileByPath(path);
-      if (file != null && (!checkIfExcludedFromMake || !myCompilerConfiguration.isExcludedFromCompilation(virtualFile))) {
-        return file;
-      }
-    }
-    return null;
-  }
-
-  private Map<VirtualFile, String> getAllSourceRoots() {
-    if (myProjectSourceRoots == null) {
-      myProjectSourceRoots = new HashMap<VirtualFile, String>();
-      ApplicationManager.getApplication().runReadAction(new Runnable() {
-        public void run() {
-          final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
-          final Module[] allModules = ModuleManager.getInstance(myProject).getModules();
-          for (Module allModule : allModules) {
-            final VirtualFile[] sourceRoots = myCompileContext.getSourceRoots(allModule);
-            for (final VirtualFile sourceRoot : sourceRoots) {
-              String packageName = fileIndex.getPackageNameByDirectory(sourceRoot);
-              myProjectSourceRoots
-                .put(sourceRoot, packageName == null || packageName.length() == 0 ? "" : "/" + packageName.replace('.', '/') + "/");
-            }
-          }
-        }
-      });
-    }
-    return myProjectSourceRoots;
-  }
-
-}
diff --git a/java/compiler/impl/src/com/intellij/compiler/options/JavaCompilersTab.java b/java/compiler/impl/src/com/intellij/compiler/options/JavaCompilersTab.java
index 09adaba..6d2d5fd 100644
--- a/java/compiler/impl/src/com/intellij/compiler/options/JavaCompilersTab.java
+++ b/java/compiler/impl/src/com/intellij/compiler/options/JavaCompilersTab.java
@@ -46,7 +46,6 @@
   private JPanel myTargetOptionsPanel;
   private final CardLayout myCardLayout;
 
-  private final Project myProject;
   private final BackendCompiler myDefaultCompiler;
   private BackendCompiler mySelectedCompiler;
   private final CompilerConfigurationImpl myCompilerConfiguration;
@@ -59,7 +58,6 @@
   }
 
   public JavaCompilersTab(final Project project, Collection<BackendCompiler> compilers, BackendCompiler defaultCompiler) {
-    myProject = project;
     myDefaultCompiler = defaultCompiler;
     myCompilerConfiguration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(project);
     myConfigurables = new ArrayList<Configurable>(compilers.size());
diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
index 50227a7..cb01abb 100644
--- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
+++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
@@ -91,7 +91,6 @@
 import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
-import org.jetbrains.annotations.TestOnly;
 import org.jetbrains.ide.PooledThreadExecutor;
 import org.jetbrains.io.ChannelRegistrar;
 import org.jetbrains.io.NettyUtil;
@@ -101,7 +100,8 @@
 import org.jetbrains.jps.incremental.Utils;
 import org.jetbrains.jps.model.serialization.JpsGlobalLoader;
 
-import javax.tools.*;
+import javax.tools.JavaCompiler;
+import javax.tools.ToolProvider;
 import java.awt.*;
 import java.io.File;
 import java.io.IOException;
@@ -382,12 +382,8 @@
     scheduleAutoMake();
   }
 
-  public boolean rescanRequired(Project project) {
-    final String projectPath = getProjectPath(project);
-    synchronized (myProjectDataMap) {
-      final ProjectData data = myProjectDataMap.get(projectPath);
-      return data == null || data.myNeedRescan;
-    }
+  public boolean isProjectWatched(Project project) {
+    return myProjectDataMap.containsKey(getProjectPath(project));
   }
 
   @Nullable
@@ -457,7 +453,7 @@
       return false;
     }
     final CompilerWorkspaceConfiguration config = CompilerWorkspaceConfiguration.getInstance(project);
-    if (!config.useOutOfProcessBuild() || !config.MAKE_PROJECT_ON_SAVE) {
+    if (!config.MAKE_PROJECT_ON_SAVE) {
       return false;
     }
     if (!config.allowAutoMakeWhileRunningApplication() && hasRunningProcess(project)) {
@@ -914,6 +910,7 @@
     cmdLine.addParameter("-D" + GlobalOptions.LOG_DIR_OPTION + "=" + FileUtil.toSystemIndependentName(getBuildLogDirectory().getAbsolutePath()));
 
     final File workDirectory = getBuildSystemDirectory();
+    //noinspection ResultOfMethodCallIgnored
     workDirectory.mkdirs();
     cmdLine.addParameter("-Djava.io.tmpdir=" + FileUtil.toSystemIndependentName(workDirectory.getPath()) + "/" + TEMP_DIR_NAME);
 
@@ -1033,11 +1030,6 @@
     return ((InetSocketAddress)serverChannel.localAddress()).getPort();
   }
 
-  @TestOnly
-  public void stopWatchingProject(Project project) {
-    myProjectDataMap.remove(getProjectPath(project));
-  }
-
   private static String classpathToString(List<String> cp) {
     StringBuilder builder = new StringBuilder();
     for (String file : cp) {
diff --git a/java/compiler/impl/src/com/intellij/openapi/compiler/ex/CompileContextEx.java b/java/compiler/impl/src/com/intellij/openapi/compiler/ex/CompileContextEx.java
index 8f8f4e3..6251b56 100644
--- a/java/compiler/impl/src/com/intellij/openapi/compiler/ex/CompileContextEx.java
+++ b/java/compiler/impl/src/com/intellij/openapi/compiler/ex/CompileContextEx.java
@@ -15,29 +15,16 @@
  */
 package com.intellij.openapi.compiler.ex;
 
-import com.intellij.compiler.make.DependencyCache;
 import com.intellij.openapi.compiler.CompileContext;
 import com.intellij.openapi.compiler.CompileScope;
 import com.intellij.openapi.compiler.CompilerMessage;
-import com.intellij.openapi.module.Module;
 import com.intellij.openapi.vfs.VirtualFile;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collection;
-import java.util.Set;
 
 public interface CompileContextEx extends CompileContext {
-  DependencyCache getDependencyCache();
-
-  @Nullable
-  VirtualFile getSourceFileByOutputFile(VirtualFile outputFile);
 
   void addMessage(CompilerMessage message);
 
-  @NotNull
-  Set<VirtualFile> getTestOutputDirectories();
-  
   /**
    * the same as FileIndex.isInTestSourceContent(), but takes into account generated output dirs
    */
@@ -47,13 +34,4 @@
 
   void addScope(CompileScope additionalScope);
 
-  long getStartCompilationStamp();
-
-  void recalculateOutputDirs();
-
-  void markGenerated(Collection<VirtualFile> files);
-
-  boolean isGenerated(VirtualFile file);
-
-  void assignModule(@NotNull VirtualFile root, @NotNull Module module, boolean isTestSource, @Nullable com.intellij.openapi.compiler.Compiler compiler);
 }
diff --git a/java/compiler/impl/src/com/intellij/openapi/compiler/generic/GenericCompiler.java b/java/compiler/impl/src/com/intellij/openapi/compiler/generic/GenericCompiler.java
index 8713628..3a81718 100644
--- a/java/compiler/impl/src/com/intellij/openapi/compiler/generic/GenericCompiler.java
+++ b/java/compiler/impl/src/com/intellij/openapi/compiler/generic/GenericCompiler.java
@@ -69,7 +69,7 @@
     return myOrderPlace;
   }
 
-  public static enum CompileOrderPlace {
+  public enum CompileOrderPlace {
     CLASS_INSTRUMENTING, CLASS_POST_PROCESSING, PACKAGING, VALIDATING
   }
 
diff --git a/java/compiler/impl/src/com/intellij/openapi/deployment/DeploymentUtilImpl.java b/java/compiler/impl/src/com/intellij/openapi/deployment/DeploymentUtilImpl.java
index d36d28f..773493c 100644
--- a/java/compiler/impl/src/com/intellij/openapi/deployment/DeploymentUtilImpl.java
+++ b/java/compiler/impl/src/com/intellij/openapi/deployment/DeploymentUtilImpl.java
@@ -15,11 +15,9 @@
  */
 package com.intellij.openapi.deployment;
 
-import com.intellij.compiler.impl.packagingCompiler.BuildRecipeImpl;
 import com.intellij.openapi.compiler.CompileContext;
 import com.intellij.openapi.compiler.CompilerBundle;
 import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.compiler.make.BuildRecipe;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleType;
@@ -119,14 +117,6 @@
                               FileUtil.toSystemDependentName(toFile.getPath()));
   }
 
-  public final boolean addItemsRecursively(@NotNull BuildRecipe items, @NotNull File root, String outputRelativePath) {
-    if (outputRelativePath == null) outputRelativePath = "";
-    outputRelativePath = trimForwardSlashes(outputRelativePath);
-
-    items.addFileCopyInstruction(root, true, outputRelativePath);
-    return true;
-  }
-
   public void reportDeploymentDescriptorDoesNotExists(ConfigFile descriptor, CompileContext context, Module module) {
     final String description = ModuleType.get(module).getName() + " '" + module.getName() + '\'';
     String descriptorPath = VfsUtil.urlToPath(descriptor.getUrl());
@@ -150,10 +140,6 @@
     }
   }
 
-  public BuildRecipe createBuildRecipe() {
-    return new BuildRecipeImpl();
-  }
-
   @Nullable
   public String getConfigFileErrorMessage(final ConfigFile configFile) {
     if (configFile.getVirtualFile() == null) {
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactAdditionalCompileScopeProvider.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactAdditionalCompileScopeProvider.java
deleted file mode 100644
index ceb8bb4..0000000
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactAdditionalCompileScopeProvider.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.packaging.impl.compiler;
-
-import com.intellij.compiler.impl.AdditionalCompileScopeProvider;
-import com.intellij.openapi.application.ReadAction;
-import com.intellij.openapi.application.Result;
-import com.intellij.openapi.compiler.CompileScope;
-import com.intellij.openapi.compiler.CompilerFilter;
-import com.intellij.openapi.project.Project;
-import com.intellij.packaging.artifacts.Artifact;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Set;
-
-/**
- * @author nik
- */
-public class ArtifactAdditionalCompileScopeProvider extends AdditionalCompileScopeProvider {
-  @Override
-  public CompileScope getAdditionalScope(@NotNull final CompileScope baseScope, @NotNull CompilerFilter filter, @NotNull final Project project) {
-    if (ArtifactCompileScope.getArtifacts(baseScope) != null) {
-      return null;
-    }
-    final ArtifactsCompiler compiler = ArtifactsCompiler.getInstance(project);
-    if (compiler == null || !filter.acceptCompiler(compiler)) {
-      return null;
-    }
-    return new ReadAction<CompileScope>() {
-      protected void run(final Result<CompileScope> result) {
-        final Set<Artifact> artifacts = ArtifactCompileScope.getArtifactsToBuild(project, baseScope, false);
-        result.setResult(ArtifactCompileScope.createScopeForModulesInArtifacts(project, artifacts));
-      } 
-    }.execute().getResultObject();
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactsCompiler.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactsCompiler.java
index 9875816..8cb3d19 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactsCompiler.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactsCompiler.java
@@ -16,16 +16,12 @@
 package com.intellij.packaging.impl.compiler;
 
 import com.intellij.openapi.compiler.CompileContext;
+import com.intellij.openapi.compiler.CompileScope;
+import com.intellij.openapi.compiler.Compiler;
 import com.intellij.openapi.compiler.CompilerManager;
-import com.intellij.openapi.compiler.generic.CompileItem;
-import com.intellij.openapi.compiler.generic.GenericCompiler;
-import com.intellij.openapi.compiler.generic.GenericCompilerInstance;
-import com.intellij.openapi.compiler.generic.VirtualFilePersistentState;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Key;
 import com.intellij.packaging.artifacts.Artifact;
-import com.intellij.util.io.DataExternalizer;
-import com.intellij.util.io.KeyDescriptor;
 import gnu.trove.THashSet;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -35,12 +31,15 @@
 /**
  * @author nik
  */
-public class ArtifactsCompiler extends GenericCompiler<String, VirtualFilePersistentState, ArtifactPackagingItemOutputState> {
+public class ArtifactsCompiler implements Compiler {
   private static final Key<Set<String>> WRITTEN_PATHS_KEY = Key.create("artifacts_written_paths");
   private static final Key<Set<Artifact>> CHANGED_ARTIFACTS = Key.create("affected_artifacts");
 
   public ArtifactsCompiler() {
-    super("artifacts_compiler", 0, GenericCompiler.CompileOrderPlace.PACKAGING);
+  }
+
+  public boolean validateConfiguration(CompileScope scope) {
+    return false;
   }
 
   @Nullable
@@ -68,31 +67,6 @@
   }
 
   @NotNull
-  @Override
-  public KeyDescriptor<String> getItemKeyDescriptor() {
-    return STRING_KEY_DESCRIPTOR;
-  }
-
-  @NotNull
-  @Override
-  public DataExternalizer<VirtualFilePersistentState> getSourceStateExternalizer() {
-    return VirtualFilePersistentState.EXTERNALIZER;
-  }
-
-  @NotNull
-  @Override
-  public DataExternalizer<ArtifactPackagingItemOutputState> getOutputStateExternalizer() {
-    return new ArtifactPackagingItemExternalizer();
-  }
-
-  @NotNull
-  @Override
-  public GenericCompilerInstance<ArtifactBuildTarget, ? extends CompileItem<String, VirtualFilePersistentState, ArtifactPackagingItemOutputState>, String, VirtualFilePersistentState, ArtifactPackagingItemOutputState> createInstance(
-    @NotNull CompileContext context) {
-    return new ArtifactsCompilerInstance(context);
-  }
-
-  @NotNull
   public String getDescription() {
     return "Artifacts Packaging Compiler";
   }
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactsCompilerInstance.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactsCompilerInstance.java
deleted file mode 100644
index d0c7c23..0000000
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactsCompilerInstance.java
+++ /dev/null
@@ -1,425 +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.packaging.impl.compiler;
-
-import com.intellij.compiler.CompilerManagerImpl;
-import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.compiler.impl.packagingCompiler.*;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.application.ReadAction;
-import com.intellij.openapi.application.Result;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompilerBundle;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.compiler.generic.GenericCompilerCacheState;
-import com.intellij.openapi.compiler.generic.GenericCompilerInstance;
-import com.intellij.openapi.compiler.generic.GenericCompilerProcessingItem;
-import com.intellij.openapi.compiler.generic.VirtualFilePersistentState;
-import com.intellij.openapi.compiler.make.BuildParticipant;
-import com.intellij.openapi.compiler.make.BuildParticipantProvider;
-import com.intellij.openapi.deployment.DeploymentUtil;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.progress.ProcessCanceledException;
-import com.intellij.openapi.project.DumbService;
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.Ref;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.*;
-import com.intellij.packaging.artifacts.Artifact;
-import com.intellij.packaging.artifacts.ArtifactManager;
-import com.intellij.packaging.artifacts.ArtifactProperties;
-import com.intellij.packaging.artifacts.ArtifactPropertiesProvider;
-import com.intellij.packaging.elements.CompositePackagingElement;
-import com.intellij.packaging.elements.PackagingElementResolvingContext;
-import com.intellij.packaging.impl.artifacts.ArtifactSortingUtil;
-import com.intellij.util.ThrowableRunnable;
-import com.intellij.util.containers.ContainerUtil;
-import gnu.trove.THashSet;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * @author nik
- */
-public class ArtifactsCompilerInstance extends GenericCompilerInstance<ArtifactBuildTarget, ArtifactCompilerCompileItem,
-  String, VirtualFilePersistentState, ArtifactPackagingItemOutputState> {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.packaging.impl.compiler.ArtifactsCompilerInstance");
-  public static final Logger FULL_LOG = Logger.getInstance("#com.intellij.full-artifacts-compiler-log");
-  private ArtifactsProcessingItemsBuilderContext myBuilderContext;
-
-  public ArtifactsCompilerInstance(CompileContext context) {
-    super(context);
-  }
-
-  @NotNull
-  @Override
-  public List<ArtifactBuildTarget> getAllTargets() {
-    return getArtifactTargets(false);
-  }
-
-  @NotNull
-  @Override
-  public List<ArtifactBuildTarget> getSelectedTargets() {
-    return getArtifactTargets(true);
-  }
-
-  private List<ArtifactBuildTarget> getArtifactTargets(final boolean selectedOnly) {
-    final List<ArtifactBuildTarget> targets = new ArrayList<ArtifactBuildTarget>();
-    new ReadAction() {
-      protected void run(final Result result) {
-        final Set<Artifact> artifacts;
-        if (selectedOnly) {
-          artifacts = ArtifactCompileScope.getArtifactsToBuild(getProject(), myContext.getCompileScope(), true);
-        }
-        else {
-          artifacts = new HashSet<Artifact>(Arrays.asList(ArtifactManager.getInstance(getProject()).getArtifacts()));
-        }
-
-        Map<String, Artifact> artifactsMap = new HashMap<String, Artifact>();
-        for (Artifact artifact : artifacts) {
-          artifactsMap.put(artifact.getName(), artifact);
-        }
-        for (String name : ArtifactSortingUtil.getInstance(getProject()).getArtifactsSortedByInclusion()) {
-          Artifact artifact = artifactsMap.get(name);
-          if (artifact != null) {
-            targets.add(new ArtifactBuildTarget(artifact));
-          }
-        }
-
-        for (BuildParticipantProvider provider : BuildParticipantProvider.EXTENSION_POINT_NAME.getExtensions()) {
-          for (Module module : ModuleManager.getInstance(getProject()).getModules()) {
-            final Collection<? extends BuildParticipant> participants = provider.getParticipants(module);
-            for (BuildParticipant participant : participants) {
-              Artifact artifact = participant.createArtifact(myContext);
-              if (artifact != null) {
-                LOG.debug("additional artifact to build: " + artifact);
-                targets.add(new ArtifactBuildTarget(artifact));
-              }
-            }
-          }
-        }
-      }
-    }.execute();
-    return targets;
-  }
-
-  @Override
-  public void processObsoleteTarget(@NotNull String targetId,
-                                    @NotNull List<GenericCompilerCacheState<String, VirtualFilePersistentState, ArtifactPackagingItemOutputState>> obsoleteItems) {
-    deleteFiles(obsoleteItems, Collections.<GenericCompilerProcessingItem<ArtifactCompilerCompileItem, VirtualFilePersistentState, ArtifactPackagingItemOutputState>>emptyList());
-  }
-
-  @NotNull
-  @Override
-  public List<ArtifactCompilerCompileItem> getItems(@NotNull ArtifactBuildTarget target) {
-    myBuilderContext = new ArtifactsProcessingItemsBuilderContext(myContext);
-    final Artifact artifact = target.getArtifact();
-
-    final Map<String, String> selfIncludingArtifacts = new ReadAction<Map<String, String>>() {
-      protected void run(final Result<Map<String, String>> result) {
-        result.setResult(ArtifactSortingUtil.getInstance(getProject()).getArtifactToSelfIncludingNameMap());
-      }
-    }.execute().getResultObject();
-    final String selfIncludingName = selfIncludingArtifacts.get(artifact.getName());
-    if (selfIncludingName != null) {
-      String name = selfIncludingName.equals(artifact.getName()) ? "it" : "'" + selfIncludingName + "' artifact";
-      myContext.addMessage(CompilerMessageCategory.ERROR, "Cannot build '" + artifact.getName() + "' artifact: " + name + " includes itself in the output layout", null, -1, -1);
-      return Collections.emptyList();
-    }
-
-    final String outputPath = artifact.getOutputPath();
-    if (outputPath == null || outputPath.length() == 0) {
-      myContext.addMessage(CompilerMessageCategory.ERROR, "Cannot build '" + artifact.getName() + "' artifact: output path is not specified",
-                      null, -1, -1);
-      return Collections.emptyList();
-    }
-
-    DumbService.getInstance(getProject()).runReadActionInSmartMode(new Runnable() {
-      @Override
-      public void run() {
-        collectItems(artifact, outputPath);
-      }
-    });
-    return new ArrayList<ArtifactCompilerCompileItem>(myBuilderContext.getProcessingItems());
-  }
-
-  private void collectItems(@NotNull Artifact artifact, @NotNull String outputPath) {
-    final CompositePackagingElement<?> rootElement = artifact.getRootElement();
-    final VirtualFile outputFile = LocalFileSystem.getInstance().findFileByPath(outputPath);
-    final CopyToDirectoryInstructionCreator instructionCreator = new CopyToDirectoryInstructionCreator(myBuilderContext, outputPath, outputFile);
-    final PackagingElementResolvingContext resolvingContext = ArtifactManager.getInstance(getProject()).getResolvingContext();
-    FULL_LOG.debug("Collecting items for " + artifact.getName());
-    rootElement.computeIncrementalCompilerInstructions(instructionCreator, resolvingContext, myBuilderContext, artifact.getArtifactType());
-  }
-
-  private boolean doBuild(@NotNull Artifact artifact,
-                          final List<GenericCompilerProcessingItem<ArtifactCompilerCompileItem, VirtualFilePersistentState, ArtifactPackagingItemOutputState>> changedItems,
-                          final Set<ArtifactCompilerCompileItem> processedItems,
-                          final @NotNull Set<String> writtenPaths,
-                          final Set<String> deletedJars) {
-    FULL_LOG.debug("Building " + artifact.getName());
-    final boolean testMode = ApplicationManager.getApplication().isUnitTestMode();
-
-    final DeploymentUtil deploymentUtil = DeploymentUtil.getInstance();
-    final FileFilter fileFilter = new IgnoredFileFilter();
-    final Set<JarInfo> changedJars = new THashSet<JarInfo>();
-    for (String deletedJar : deletedJars) {
-      ContainerUtil.addIfNotNull(myBuilderContext.getJarInfo(deletedJar), changedJars);
-    }
-
-    try {
-      onBuildStartedOrFinished(artifact, false);
-      if (myContext.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
-        return false;
-      }
-
-      int i = 0;
-      for (final GenericCompilerProcessingItem<ArtifactCompilerCompileItem, VirtualFilePersistentState, ArtifactPackagingItemOutputState> item : changedItems) {
-        final ArtifactCompilerCompileItem sourceItem = item.getItem();
-        myContext.getProgressIndicator().checkCanceled();
-
-        final Ref<IOException> exception = Ref.create(null);
-        new ReadAction() {
-          protected void run(final Result result) {
-            final VirtualFile sourceFile = sourceItem.getFile();
-            for (DestinationInfo destination : sourceItem.getDestinations()) {
-              if (destination instanceof ExplodedDestinationInfo) {
-                final ExplodedDestinationInfo explodedDestination = (ExplodedDestinationInfo)destination;
-                File toFile = new File(FileUtil.toSystemDependentName(explodedDestination.getOutputPath()));
-                try {
-                  if (sourceFile.isInLocalFileSystem()) {
-                    final File ioFromFile = VfsUtilCore.virtualToIoFile(sourceFile);
-                    if (ioFromFile.exists()) {
-                      deploymentUtil.copyFile(ioFromFile, toFile, myContext, writtenPaths, fileFilter);
-                    }
-                    else {
-                      LOG.debug("Cannot copy " + ioFromFile.getAbsolutePath() + ": file doesn't exist");
-                    }
-                  }
-                  else {
-                    extractFile(sourceFile, toFile, writtenPaths, fileFilter);
-                  }
-                }
-                catch (IOException e) {
-                  exception.set(e);
-                  return;
-                }
-              }
-              else {
-                changedJars.add(((JarDestinationInfo)destination).getJarInfo());
-              }
-            }
-          }
-        }.execute();
-        if (exception.get() != null) {
-          throw exception.get();
-        }
-
-        myContext.getProgressIndicator().setFraction(++i * 1.0 / changedItems.size());
-        processedItems.add(sourceItem);
-        if (testMode) {
-          CompilerManagerImpl.addRecompiledPath(FileUtil.toSystemDependentName(sourceItem.getFile().getPath()));
-        }
-      }
-
-      JarsBuilder builder = new JarsBuilder(changedJars, fileFilter, myContext);
-      final boolean processed = builder.buildJars(writtenPaths);
-      if (!processed) {
-        return false;
-      }
-
-      Set<VirtualFile> recompiledSources = new HashSet<VirtualFile>();
-      for (JarInfo info : builder.getJarsToBuild()) {
-        for (Pair<String, VirtualFile> pair : info.getPackedFiles()) {
-          recompiledSources.add(pair.getSecond());
-        }
-      }
-      for (VirtualFile source : recompiledSources) {
-        ArtifactCompilerCompileItem item = myBuilderContext.getItemBySource(source);
-        LOG.assertTrue(item != null, source);
-        processedItems.add(item);
-        if (testMode) {
-          CompilerManagerImpl.addRecompiledPath(FileUtil.toSystemDependentName(item.getFile().getPath()));
-        }
-      }
-
-      onBuildStartedOrFinished(artifact, true);
-    }
-    catch (ProcessCanceledException e) {
-      throw e;
-    }
-    catch (Exception e) {
-      LOG.info(e);
-      myContext.addMessage(CompilerMessageCategory.ERROR, e.getLocalizedMessage(), null, -1, -1);
-      return false;
-    }
-    return true;
-  }
-
-  private void extractFile(VirtualFile sourceFile, File toFile, Set<String> writtenPaths, FileFilter fileFilter) throws IOException {
-    if (!writtenPaths.add(toFile.getPath())) {
-      return;
-    }
-
-    if (!FileUtil.createParentDirs(toFile)) {
-      myContext.addMessage(CompilerMessageCategory.ERROR, "Cannot create directory for '" + toFile.getAbsolutePath() + "' file", null, -1, -1);
-      return;
-    }
-
-    final BufferedInputStream input = ArtifactCompilerUtil.getJarEntryInputStream(sourceFile, myContext);
-    if (input == null) return;
-    final BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(toFile));
-    try {
-      FileUtil.copy(input, output);
-    }
-    finally {
-      input.close();
-      output.close();
-    }
-  }
-
-  private void onBuildStartedOrFinished(@NotNull Artifact artifact, final boolean finished) throws Exception {
-    for (ArtifactPropertiesProvider provider : artifact.getPropertiesProviders()) {
-      final ArtifactProperties<?> properties = artifact.getProperties(provider);
-      if (finished) {
-        properties.onBuildFinished(artifact, myContext);
-      }
-      else {
-        properties.onBuildStarted(artifact, myContext);
-      }
-    }
-  }
-
-  private static THashSet<String> createPathsHashSet() {
-    return new THashSet<String>(FileUtil.PATH_HASHING_STRATEGY);
-  }
-
-  @Override
-  public void processItems(@NotNull final ArtifactBuildTarget target,
-                           @NotNull final List<GenericCompilerProcessingItem<ArtifactCompilerCompileItem,VirtualFilePersistentState,ArtifactPackagingItemOutputState>> changedItems,
-                           @NotNull List<GenericCompilerCacheState<String, VirtualFilePersistentState, ArtifactPackagingItemOutputState>> obsoleteItems,
-                           @NotNull OutputConsumer<ArtifactCompilerCompileItem> consumer) {
-
-    final THashSet<String> deletedJars = deleteFiles(obsoleteItems, changedItems);
-
-    final Set<String> writtenPaths = createPathsHashSet();
-    final Ref<Boolean> built = Ref.create(false);
-    final Set<ArtifactCompilerCompileItem> processedItems = new HashSet<ArtifactCompilerCompileItem>();
-    CompilerUtil.runInContext(myContext, "Copying files", new ThrowableRunnable<RuntimeException>() {
-      public void run() throws RuntimeException {
-        built.set(doBuild(target.getArtifact(), changedItems, processedItems, writtenPaths, deletedJars));
-      }
-    });
-    if (!built.get()) {
-      return;
-    }
-
-    myContext.getProgressIndicator().setText(CompilerBundle.message("packaging.compiler.message.updating.caches"));
-    myContext.getProgressIndicator().setText2("");
-    for (String path : writtenPaths) {
-      consumer.addFileToRefresh(new File(path));
-    }
-    for (ArtifactCompilerCompileItem item : processedItems) {
-      consumer.addProcessedItem(item);
-    }
-    ArtifactsCompiler.addWrittenPaths(myContext, writtenPaths);
-    ArtifactsCompiler.addChangedArtifact(myContext, target.getArtifact());
-  }
-
-  private THashSet<String> deleteFiles(List<GenericCompilerCacheState<String, VirtualFilePersistentState, ArtifactPackagingItemOutputState>> obsoleteItems,
-                                       List<GenericCompilerProcessingItem<ArtifactCompilerCompileItem, VirtualFilePersistentState, ArtifactPackagingItemOutputState>> changedItems) {
-    myContext.getProgressIndicator().setText(CompilerBundle.message("packaging.compiler.message.deleting.outdated.files"));
-
-    final boolean testMode = ApplicationManager.getApplication().isUnitTestMode();
-    final THashSet<String> deletedJars = new THashSet<String>();
-    final THashSet<String> notDeletedJars = new THashSet<String>();
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("Deleting outdated files...");
-    }
-
-    Set<String> pathToDelete = new THashSet<String>();
-    for (GenericCompilerProcessingItem<ArtifactCompilerCompileItem, VirtualFilePersistentState, ArtifactPackagingItemOutputState> item : changedItems) {
-      final ArtifactPackagingItemOutputState cached = item.getCachedOutputState();
-      if (cached != null) {
-        for (Pair<String, Long> destination : cached.myDestinations) {
-          pathToDelete.add(destination.getFirst());
-        }
-      }
-    }
-    for (GenericCompilerProcessingItem<ArtifactCompilerCompileItem, VirtualFilePersistentState, ArtifactPackagingItemOutputState> item : changedItems) {
-      for (DestinationInfo destination : item.getItem().getDestinations()) {
-        pathToDelete.remove(destination.getOutputPath());
-      }
-    }
-    for (GenericCompilerCacheState<String, VirtualFilePersistentState, ArtifactPackagingItemOutputState> item : obsoleteItems) {
-      for (Pair<String, Long> destination : item.getOutputState().myDestinations) {
-        pathToDelete.add(destination.getFirst());
-      }
-    }
-
-    int notDeletedFilesCount = 0;
-    List<File> filesToRefresh = new ArrayList<File>();
-
-    for (String fullPath : pathToDelete) {
-      int end = fullPath.indexOf(JarFileSystem.JAR_SEPARATOR);
-      boolean isJar = end != -1;
-      String filePath = isJar ? fullPath.substring(0, end) : fullPath;
-      boolean deleted = false;
-      if (isJar) {
-      if (notDeletedJars.contains(filePath)) {
-        continue;
-      }
-      deleted = deletedJars.contains(filePath);
-    }
-
-      File file = new File(FileUtil.toSystemDependentName(filePath));
-      if (!deleted) {
-      filesToRefresh.add(file);
-      deleted = FileUtil.delete(file);
-    }
-
-      if (deleted) {
-      if (isJar) {
-        deletedJars.add(filePath);
-      }
-      if (testMode) {
-        CompilerManagerImpl.addDeletedPath(file.getAbsolutePath());
-      }
-    }
-    else {
-      if (isJar) {
-        notDeletedJars.add(filePath);
-      }
-      if (notDeletedFilesCount++ > 50) {
-        myContext.addMessage(CompilerMessageCategory.WARNING, "Deletion of outdated files stopped because too many files cannot be deleted", null, -1, -1);
-        break;
-      }
-      myContext.addMessage(CompilerMessageCategory.WARNING, "Cannot delete file '" + filePath + "'", null, -1, -1);
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Cannot delete file " + file);
-      }
-    }
-    }
-
-    CompilerUtil.refreshIOFiles(filesToRefresh);
-    return deletedJars;
-  }
-
-}
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactsProcessingItemsBuilderContext.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactsProcessingItemsBuilderContext.java
deleted file mode 100644
index a96663c..0000000
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactsProcessingItemsBuilderContext.java
+++ /dev/null
@@ -1,112 +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.packaging.impl.compiler;
-
-import com.intellij.compiler.impl.packagingCompiler.DestinationInfo;
-import com.intellij.compiler.impl.packagingCompiler.ExplodedDestinationInfo;
-import com.intellij.compiler.impl.packagingCompiler.JarInfo;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.packaging.elements.ArtifactIncrementalCompilerContext;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author nik
- */
-public class ArtifactsProcessingItemsBuilderContext implements ArtifactIncrementalCompilerContext {
-  protected final Map<VirtualFile, ArtifactCompilerCompileItem> myItemsBySource;
-  private final Map<String, VirtualFile> mySourceByOutput;
-  private final Map<String, JarInfo> myJarByPath;
-  private final CompileContext myCompileContext;
-  private final boolean myPrintToLog;
-
-  public ArtifactsProcessingItemsBuilderContext(CompileContext compileContext) {
-    myCompileContext = compileContext;
-    myItemsBySource = new HashMap<VirtualFile, ArtifactCompilerCompileItem>();
-    mySourceByOutput = new HashMap<String, VirtualFile>();
-    myJarByPath = new HashMap<String, JarInfo>();
-    myPrintToLog = ArtifactsCompilerInstance.FULL_LOG.isDebugEnabled();
-  }
-
-  public boolean addDestination(@NotNull VirtualFile sourceFile, @NotNull DestinationInfo destinationInfo) {
-    if (destinationInfo instanceof ExplodedDestinationInfo && sourceFile.equals(destinationInfo.getOutputFile())) {
-      return false;
-    }
-
-    if (checkOutputPath(destinationInfo.getOutputPath(), sourceFile)) {
-      if (myPrintToLog) {
-        ArtifactsCompilerInstance.FULL_LOG.debug("  " + sourceFile.getPath() + " -> " + destinationInfo);
-      }
-      getOrCreateProcessingItem(sourceFile).addDestination(destinationInfo);
-      return true;
-    }
-    return false;
-  }
-
-  public Collection<ArtifactCompilerCompileItem> getProcessingItems() {
-    return myItemsBySource.values();
-  }
-
-  public boolean checkOutputPath(final String outputPath, final VirtualFile sourceFile) {
-    VirtualFile old = mySourceByOutput.get(outputPath);
-    if (old == null) {
-      mySourceByOutput.put(outputPath, sourceFile);
-      return true;
-    }
-    //todo[nik] show warning?
-    return false;
-  }
-
-  public ArtifactCompilerCompileItem getItemBySource(VirtualFile source) {
-    return myItemsBySource.get(source);
-  }
-
-  public boolean registerJarFile(@NotNull JarInfo jarInfo, @NotNull String outputPath) {
-    if (mySourceByOutput.containsKey(outputPath) || myJarByPath.containsKey(outputPath)) {
-      return false;
-    }
-    myJarByPath.put(outputPath, jarInfo);
-    return true;
-  }
-
-  @Nullable
-  public JarInfo getJarInfo(String outputPath) {
-    return myJarByPath.get(outputPath);
-  }
-
-  @Nullable
-  public VirtualFile getSourceByOutput(String outputPath) {
-    return mySourceByOutput.get(outputPath);
-  }
-
-  public CompileContext getCompileContext() {
-    return myCompileContext;
-  }
-
-  public ArtifactCompilerCompileItem getOrCreateProcessingItem(VirtualFile sourceFile) {
-    ArtifactCompilerCompileItem item = myItemsBySource.get(sourceFile);
-    if (item == null) {
-      item = new ArtifactCompilerCompileItem(sourceFile);
-      myItemsBySource.put(sourceFile, item);
-    }
-    return item;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/CopyToDirectoryInstructionCreator.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/CopyToDirectoryInstructionCreator.java
deleted file mode 100644
index 3043468..0000000
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/CopyToDirectoryInstructionCreator.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.packaging.impl.compiler;
-
-import com.intellij.compiler.impl.packagingCompiler.ExplodedDestinationInfo;
-import com.intellij.compiler.impl.packagingCompiler.JarInfo;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.packaging.elements.IncrementalCompilerInstructionCreator;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author nik
- */
-public class CopyToDirectoryInstructionCreator extends IncrementalCompilerInstructionCreatorBase {
-  private final String myOutputPath;
-  private final @Nullable VirtualFile myOutputFile;
-
-  public CopyToDirectoryInstructionCreator(ArtifactsProcessingItemsBuilderContext context, String outputPath,
-                                           @Nullable VirtualFile outputFile) {
-    super(context);
-    myOutputPath = outputPath;
-    myOutputFile = outputFile;
-  }
-
-  public void addFileCopyInstruction(@NotNull VirtualFile file, @NotNull String outputFileName) {
-    myContext.addDestination(file, new ExplodedDestinationInfo(myOutputPath + "/" + outputFileName, outputChild(outputFileName)));
-  }
-
-  public CopyToDirectoryInstructionCreator subFolder(@NotNull String directoryName) {
-    return new CopyToDirectoryInstructionCreator(myContext, myOutputPath + "/" + directoryName, outputChild(directoryName));
-  }
-
-  public IncrementalCompilerInstructionCreator archive(@NotNull String archiveFileName) {
-    String jarOutputPath = myOutputPath + "/" + archiveFileName;
-    final JarInfo jarInfo = new JarInfo();
-    if (!myContext.registerJarFile(jarInfo, jarOutputPath)) {
-      return new SkipAllInstructionCreator(myContext);
-    }
-    VirtualFile outputFile = outputChild(archiveFileName);
-    final ExplodedDestinationInfo destination = new ExplodedDestinationInfo(jarOutputPath, outputFile);
-    jarInfo.addDestination(destination);
-    return new PackIntoArchiveInstructionCreator(myContext, jarInfo, "", destination);
-  }
-
-  @Nullable
-  private VirtualFile outputChild(String name) {
-    return myOutputFile != null ? myOutputFile.findChild(name) : null;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/IncrementalCompilerInstructionCreatorBase.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/IncrementalCompilerInstructionCreatorBase.java
deleted file mode 100644
index 9837b9f..0000000
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/IncrementalCompilerInstructionCreatorBase.java
+++ /dev/null
@@ -1,98 +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.packaging.impl.compiler;
-
-import com.intellij.openapi.fileTypes.FileTypeManager;
-import com.intellij.openapi.roots.ProjectFileIndex;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VfsUtilCore;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.VirtualFileVisitor;
-import com.intellij.packaging.elements.IncrementalCompilerInstructionCreator;
-import com.intellij.packaging.elements.PackagingFileFilter;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.List;
-
-/**
- * @author nik
- */
-public abstract class IncrementalCompilerInstructionCreatorBase implements IncrementalCompilerInstructionCreator {
-  protected final ArtifactsProcessingItemsBuilderContext myContext;
-
-  public IncrementalCompilerInstructionCreatorBase(ArtifactsProcessingItemsBuilderContext context) {
-    myContext = context;
-  }
-
-  public void addDirectoryCopyInstructions(@NotNull VirtualFile directory) {
-    addDirectoryCopyInstructions(directory, null);
-  }
-
-  public void addDirectoryCopyInstructions(@NotNull VirtualFile directory, @Nullable PackagingFileFilter filter) {
-    final ProjectFileIndex index = ProjectRootManager.getInstance(myContext.getCompileContext().getProject()).getFileIndex();
-    final boolean copyExcluded = index.isIgnored(directory);
-    collectInstructionsRecursively(directory, this, filter, index, copyExcluded);
-  }
-
-  private static void collectInstructionsRecursively(VirtualFile directory,
-                                                     final IncrementalCompilerInstructionCreatorBase creator,
-                                                     @Nullable final PackagingFileFilter filter,
-                                                     final ProjectFileIndex index,
-                                                     final boolean copyExcluded) {
-    final FileTypeManager fileTypeManager = FileTypeManager.getInstance();
-    VfsUtilCore.visitChildrenRecursively(directory, new VirtualFileVisitor<IncrementalCompilerInstructionCreatorBase>(VirtualFileVisitor.SKIP_ROOT) {
-      { setValueForChildren(creator); }
-
-      @Override
-      public boolean visitFile(@NotNull VirtualFile child) {
-        if (copyExcluded) {
-          if (fileTypeManager.isFileIgnored(child)) return false;
-        }
-        else {
-          if (index.isIgnored(child)) return false;
-        }
-
-        final IncrementalCompilerInstructionCreatorBase creator = getCurrentValue();
-        if (filter != null && !filter.accept(child, creator.myContext.getCompileContext())) {
-          return false;
-        }
-
-        if (!child.isDirectory()) {
-          creator.addFileCopyInstruction(child, child.getName());
-        }
-        else {
-          setValueForChildren(creator.subFolder(child.getName()));
-        }
-
-        return true;
-      }
-    });
-  }
-
-  @Override
-  public abstract IncrementalCompilerInstructionCreatorBase subFolder(@NotNull String directoryName);
-
-  public IncrementalCompilerInstructionCreator subFolderByRelativePath(@NotNull String relativeDirectoryPath) {
-    final List<String> folders = StringUtil.split(relativeDirectoryPath, "/");
-    IncrementalCompilerInstructionCreator current = this;
-    for (String folder : folders) {
-      current = current.subFolder(folder);
-    }
-    return current;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/PackIntoArchiveInstructionCreator.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/PackIntoArchiveInstructionCreator.java
deleted file mode 100644
index c51b8e7..0000000
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/PackIntoArchiveInstructionCreator.java
+++ /dev/null
@@ -1,66 +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.packaging.impl.compiler;
-
-import com.intellij.compiler.impl.packagingCompiler.DestinationInfo;
-import com.intellij.compiler.impl.packagingCompiler.JarDestinationInfo;
-import com.intellij.compiler.impl.packagingCompiler.JarInfo;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.packaging.elements.IncrementalCompilerInstructionCreator;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author nik
- */
-public class PackIntoArchiveInstructionCreator extends IncrementalCompilerInstructionCreatorBase {
-  private final DestinationInfo myJarDestination;
-  private final JarInfo myJarInfo;
-  private final String myPathInJar;
-
-  public PackIntoArchiveInstructionCreator(ArtifactsProcessingItemsBuilderContext context, JarInfo jarInfo,
-                                           String pathInJar, DestinationInfo jarDestination) {
-    super(context);
-    myJarInfo = jarInfo;
-    myPathInJar = pathInJar;
-    myJarDestination = jarDestination;
-  }
-
-  public void addFileCopyInstruction(@NotNull VirtualFile file, @NotNull String outputFileName) {
-    final String pathInJar = childPathInJar(outputFileName);
-    if (myContext.addDestination(file, new JarDestinationInfo(pathInJar, myJarInfo, myJarDestination))) {
-      myJarInfo.addContent(pathInJar, file);
-    }
-  }
-
-  private String childPathInJar(String fileName) {
-    return myPathInJar.length() == 0 ? fileName : myPathInJar + "/" + fileName;
-  }
-
-  public PackIntoArchiveInstructionCreator subFolder(@NotNull String directoryName) {
-    return new PackIntoArchiveInstructionCreator(myContext, myJarInfo, childPathInJar(directoryName), myJarDestination);
-  }
-
-  public IncrementalCompilerInstructionCreator archive(@NotNull String archiveFileName) {
-    final JarInfo jarInfo = new JarInfo();
-    final String outputPath = myJarDestination.getOutputPath() + "/" + archiveFileName;
-    if (!myContext.registerJarFile(jarInfo, outputPath)) {
-      return new SkipAllInstructionCreator(myContext);
-    }
-    final JarDestinationInfo destination = new JarDestinationInfo(childPathInJar(archiveFileName), myJarInfo, myJarDestination);
-    jarInfo.addDestination(destination);
-    return new PackIntoArchiveInstructionCreator(myContext, jarInfo, "", destination);
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/SkipAllInstructionCreator.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/SkipAllInstructionCreator.java
deleted file mode 100644
index b7d409f..0000000
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/SkipAllInstructionCreator.java
+++ /dev/null
@@ -1,40 +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.packaging.impl.compiler;
-
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.packaging.elements.IncrementalCompilerInstructionCreator;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author nik
- */
-public class SkipAllInstructionCreator extends IncrementalCompilerInstructionCreatorBase {
-  public SkipAllInstructionCreator(ArtifactsProcessingItemsBuilderContext context) {
-    super(context);
-  }
-
-  public void addFileCopyInstruction(@NotNull VirtualFile file, @NotNull String outputFileName) {
-  }
-
-  public SkipAllInstructionCreator subFolder(@NotNull String directoryName) {
-    return this;
-  }
-
-  public IncrementalCompilerInstructionCreator archive(@NotNull String archiveFileName) {
-    return this;
-  }
-}
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArchivePackagingElement.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArchivePackagingElement.java
index 0064ee2..0127900 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArchivePackagingElement.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArchivePackagingElement.java
@@ -22,7 +22,10 @@
 import com.intellij.compiler.ant.taskdefs.Jar;
 import com.intellij.compiler.ant.taskdefs.Zip;
 import com.intellij.packaging.artifacts.ArtifactType;
-import com.intellij.packaging.elements.*;
+import com.intellij.packaging.elements.AntCopyInstructionCreator;
+import com.intellij.packaging.elements.ArtifactAntGenerationContext;
+import com.intellij.packaging.elements.PackagingElement;
+import com.intellij.packaging.elements.PackagingElementResolvingContext;
 import com.intellij.packaging.impl.ui.ArchiveElementPresentation;
 import com.intellij.packaging.ui.ArtifactEditorContext;
 import com.intellij.packaging.ui.PackagingElementPresentation;
@@ -74,13 +77,6 @@
     return Collections.singletonList(creator.createFileCopyInstruction(jarPath, myArchiveFileName));
   }
 
-  @Override
-  public void computeIncrementalCompilerInstructions(@NotNull IncrementalCompilerInstructionCreator creator,
-                                                     @NotNull PackagingElementResolvingContext resolvingContext,
-                                                     @NotNull ArtifactIncrementalCompilerContext compilerContext, @NotNull ArtifactType artifactType) {
-    computeChildrenInstructions(creator.archive(myArchiveFileName), resolvingContext, compilerContext, artifactType);
-  }
-
   @Attribute(NAME_ATTRIBUTE)
   public String getArchiveFileName() {
     return myArchiveFileName;
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactPackagingElement.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactPackagingElement.java
index 7d507b6..87deabf 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactPackagingElement.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactPackagingElement.java
@@ -19,8 +19,6 @@
 import com.intellij.compiler.ant.Generator;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.packaging.artifacts.Artifact;
 import com.intellij.packaging.artifacts.ArtifactPointer;
 import com.intellij.packaging.artifacts.ArtifactPointerManager;
@@ -95,47 +93,6 @@
     return Collections.emptyList();
   }
 
-  @Override
-  public void computeIncrementalCompilerInstructions(@NotNull IncrementalCompilerInstructionCreator creator,
-                                                     @NotNull PackagingElementResolvingContext resolvingContext,
-                                                     @NotNull ArtifactIncrementalCompilerContext compilerContext,
-                                                     @NotNull ArtifactType artifactType) {
-    Artifact artifact = findArtifact(resolvingContext);
-    if (artifact == null) return;
-
-    if (StringUtil.isEmpty(artifact.getOutputPath())
-        || artifact.getArtifactType().getSubstitution(artifact, resolvingContext, artifactType) != null) {
-      super.computeIncrementalCompilerInstructions(creator, resolvingContext, compilerContext, artifactType);
-      return;
-    }
-
-    VirtualFile outputFile = artifact.getOutputFile();
-    if (outputFile == null) {
-      LOG.debug("Output file for " + artifact + " not found");
-      return;
-    }
-    if (!outputFile.isValid()) {
-      LOG.debug("Output file for " + artifact + "(" + outputFile + ") is not valid");
-      return;
-    }
-
-    if (outputFile.isDirectory()) {
-      creator.addDirectoryCopyInstructions(outputFile);
-    }
-    else {
-      creator.addFileCopyInstruction(outputFile, outputFile.getName());
-    }
-  }
-
-  @Override
-  protected ArtifactType getArtifactTypeForSubstitutedElements(PackagingElementResolvingContext resolvingContext, ArtifactType artifactType) {
-    final Artifact artifact = findArtifact(resolvingContext);
-    if (artifact != null) {
-      return artifact.getArtifactType();
-    }
-    return artifactType;
-  }
-
   public PackagingElementPresentation createPresentation(@NotNull ArtifactEditorContext context) {
     return new DelegatedPackagingElementPresentation(new ArtifactElementPresentation(myArtifactPointer, context));
   }
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactRootElementImpl.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactRootElementImpl.java
index 5fcba6f..d3e806f 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactRootElementImpl.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactRootElementImpl.java
@@ -20,7 +20,10 @@
 import com.intellij.ide.projectView.PresentationData;
 import com.intellij.openapi.compiler.CompilerBundle;
 import com.intellij.packaging.artifacts.ArtifactType;
-import com.intellij.packaging.elements.*;
+import com.intellij.packaging.elements.AntCopyInstructionCreator;
+import com.intellij.packaging.elements.ArtifactAntGenerationContext;
+import com.intellij.packaging.elements.ArtifactRootElement;
+import com.intellij.packaging.elements.PackagingElementResolvingContext;
 import com.intellij.packaging.ui.ArtifactEditorContext;
 import com.intellij.packaging.ui.PackagingElementPresentation;
 import com.intellij.ui.SimpleTextAttributes;
@@ -78,13 +81,6 @@
     return computeChildrenGenerators(resolvingContext, creator, generationContext, artifactType);
   }
 
-  @Override
-  public void computeIncrementalCompilerInstructions(@NotNull IncrementalCompilerInstructionCreator creator,
-                                                     @NotNull PackagingElementResolvingContext resolvingContext,
-                                                     @NotNull ArtifactIncrementalCompilerContext compilerContext, @NotNull ArtifactType artifactType) {
-    computeChildrenInstructions(creator, resolvingContext, compilerContext, artifactType);
-  }
-
   public String getName() {
     return "";
   }
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryCopyPackagingElement.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryCopyPackagingElement.java
index c5c10dc..e9f1fc1 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryCopyPackagingElement.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryCopyPackagingElement.java
@@ -16,9 +16,10 @@
 package com.intellij.packaging.impl.elements;
 
 import com.intellij.compiler.ant.Generator;
-import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.packaging.artifacts.ArtifactType;
-import com.intellij.packaging.elements.*;
+import com.intellij.packaging.elements.AntCopyInstructionCreator;
+import com.intellij.packaging.elements.ArtifactAntGenerationContext;
+import com.intellij.packaging.elements.PackagingElementResolvingContext;
 import com.intellij.packaging.impl.ui.DirectoryCopyPresentation;
 import com.intellij.packaging.ui.ArtifactEditorContext;
 import com.intellij.packaging.ui.PackagingElementPresentation;
@@ -54,17 +55,6 @@
     return Collections.singletonList(creator.createDirectoryContentCopyInstruction(path));
   }
 
-  @Override
-  public void computeIncrementalCompilerInstructions(@NotNull IncrementalCompilerInstructionCreator creator,
-                                                     @NotNull PackagingElementResolvingContext resolvingContext,
-                                                     @NotNull ArtifactIncrementalCompilerContext compilerContext,
-                                                     @NotNull ArtifactType artifactType) {
-    final VirtualFile file = findFile();
-    if (file != null && file.isValid() && file.isDirectory()) {
-      creator.addDirectoryCopyInstructions(file);
-    }
-  }
-
   public DirectoryCopyPackagingElement getState() {
     return this;
   }
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryPackagingElement.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryPackagingElement.java
index 0fd3a34..815d0c2 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryPackagingElement.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryPackagingElement.java
@@ -16,15 +16,18 @@
 package com.intellij.packaging.impl.elements;
 
 import com.intellij.compiler.ant.Generator;
-import com.intellij.packaging.elements.*;
-import com.intellij.packaging.impl.ui.DirectoryElementPresentation;
-import com.intellij.packaging.ui.PackagingElementPresentation;
-import com.intellij.packaging.ui.ArtifactEditorContext;
 import com.intellij.packaging.artifacts.ArtifactType;
-import com.intellij.util.xmlb.annotations.Attribute;
+import com.intellij.packaging.elements.AntCopyInstructionCreator;
+import com.intellij.packaging.elements.ArtifactAntGenerationContext;
+import com.intellij.packaging.elements.PackagingElement;
+import com.intellij.packaging.elements.PackagingElementResolvingContext;
+import com.intellij.packaging.impl.ui.DirectoryElementPresentation;
+import com.intellij.packaging.ui.ArtifactEditorContext;
+import com.intellij.packaging.ui.PackagingElementPresentation;
 import com.intellij.util.xmlb.XmlSerializerUtil;
-import org.jetbrains.annotations.NotNull;
+import com.intellij.util.xmlb.annotations.Attribute;
 import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -65,13 +68,6 @@
     return children;
   }
 
-  @Override
-  public void computeIncrementalCompilerInstructions(@NotNull IncrementalCompilerInstructionCreator creator,
-                                                     @NotNull PackagingElementResolvingContext resolvingContext,
-                                                     @NotNull ArtifactIncrementalCompilerContext compilerContext, @NotNull ArtifactType artifactType) {
-    computeChildrenInstructions(creator.subFolder(myDirectoryName), resolvingContext, compilerContext, artifactType);
-  }
-
   public DirectoryPackagingElement getState() {
     return this;
   }
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ExtractedDirectoryPackagingElement.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ExtractedDirectoryPackagingElement.java
index a0b4dda..38a58d1 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ExtractedDirectoryPackagingElement.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ExtractedDirectoryPackagingElement.java
@@ -26,7 +26,10 @@
 import com.intellij.openapi.vfs.JarFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.packaging.artifacts.ArtifactType;
-import com.intellij.packaging.elements.*;
+import com.intellij.packaging.elements.AntCopyInstructionCreator;
+import com.intellij.packaging.elements.ArtifactAntGenerationContext;
+import com.intellij.packaging.elements.PackagingElement;
+import com.intellij.packaging.elements.PackagingElementResolvingContext;
 import com.intellij.packaging.impl.ui.ExtractedDirectoryPresentation;
 import com.intellij.packaging.ui.ArtifactEditorContext;
 import com.intellij.packaging.ui.PackagingElementPresentation;
@@ -105,17 +108,6 @@
 
 
   @Override
-  public void computeIncrementalCompilerInstructions(@NotNull IncrementalCompilerInstructionCreator creator,
-                                                     @NotNull PackagingElementResolvingContext resolvingContext,
-                                                     @NotNull ArtifactIncrementalCompilerContext compilerContext,
-                                                     @NotNull ArtifactType artifactType) {
-    final VirtualFile file = findFile();
-    if (file != null && file.isValid() && file.isDirectory()) {
-      creator.addDirectoryCopyInstructions(file);
-    }
-  }
-
-  @Override
   public boolean isEqualTo(@NotNull PackagingElement<?> element) {
     return element instanceof ExtractedDirectoryPackagingElement && super.isEqualTo(element)
            && Comparing.equal(myPathInJar, ((ExtractedDirectoryPackagingElement)element).getPathInJar());
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/FileCopyPackagingElement.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/FileCopyPackagingElement.java
index 6513c76..b3bf1a9 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/FileCopyPackagingElement.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/FileCopyPackagingElement.java
@@ -76,16 +76,6 @@
     return myRenamedOutputFileName != null ? myRenamedOutputFileName : PathUtil.getFileName(myFilePath);
   }
 
-  @Override
-  public void computeIncrementalCompilerInstructions(@NotNull IncrementalCompilerInstructionCreator creator,
-                                                     @NotNull PackagingElementResolvingContext resolvingContext,
-                                                     @NotNull ArtifactIncrementalCompilerContext compilerContext, @NotNull ArtifactType artifactType) {
-    final VirtualFile file = findFile();
-    if (file != null && file.isValid() && !file.isDirectory()) {
-      creator.addFileCopyInstruction(file, getOutputFileName());
-    }
-  }
-
   @NonNls @Override
   public String toString() {
     return "file:" + myFilePath + (myRenamedOutputFileName != null ? ",rename to:" + myRenamedOutputFileName : "");
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ModuleOutputPackagingElementBase.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ModuleOutputPackagingElementBase.java
index 084cf6e..231a379 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ModuleOutputPackagingElementBase.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ModuleOutputPackagingElementBase.java
@@ -68,22 +68,6 @@
 
   protected abstract String getModuleOutputAntProperty(ArtifactAntGenerationContext generationContext);
 
-  @Override
-  public void computeIncrementalCompilerInstructions(@NotNull IncrementalCompilerInstructionCreator creator,
-                                                     @NotNull PackagingElementResolvingContext resolvingContext,
-                                                     @NotNull ArtifactIncrementalCompilerContext compilerContext, @NotNull ArtifactType artifactType) {
-    final Module module = findModule(resolvingContext);
-    if (module != null) {
-      final CompilerModuleExtension extension = CompilerModuleExtension.getInstance(module);
-      if (extension != null) {
-        final VirtualFile output = getModuleOutputPath(extension);
-        if (output != null) {
-          creator.addDirectoryCopyInstructions(output, null);
-        }
-      }
-    }
-  }
-
   @Nullable
   protected abstract VirtualFile getModuleOutputPath(CompilerModuleExtension extension);
 
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/run/BuildArtifactsBeforeRunTaskProvider.java b/java/compiler/impl/src/com/intellij/packaging/impl/run/BuildArtifactsBeforeRunTaskProvider.java
index a9ea9c3..a111eaa 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/run/BuildArtifactsBeforeRunTaskProvider.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/run/BuildArtifactsBeforeRunTaskProvider.java
@@ -15,6 +15,7 @@
  */
 package com.intellij.packaging.impl.run;
 
+import com.intellij.compiler.impl.CompileScopeUtil;
 import com.intellij.execution.BeforeRunTask;
 import com.intellij.execution.BeforeRunTaskProvider;
 import com.intellij.execution.RunManagerEx;
@@ -30,25 +31,24 @@
 import com.intellij.openapi.application.ReadAction;
 import com.intellij.openapi.application.Result;
 import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.compiler.Compiler;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.DialogBuilder;
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.util.Key;
 import com.intellij.openapi.util.Ref;
 import com.intellij.packaging.artifacts.*;
-import com.intellij.packaging.impl.compiler.ArtifactAwareCompiler;
 import com.intellij.packaging.impl.compiler.ArtifactCompileScope;
-import com.intellij.packaging.impl.compiler.ArtifactsCompiler;
 import com.intellij.util.concurrency.Semaphore;
 import com.intellij.util.containers.ContainerUtil;
 import gnu.trove.THashSet;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.jps.api.CmdlineRemoteProto;
 
 import javax.swing.*;
 import java.awt.*;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 
@@ -185,20 +185,15 @@
         finished.up();
       }
     };
-    final CompilerFilter compilerFilter = new CompilerFilter() {
-      public boolean acceptCompiler(Compiler compiler) {
-        return compiler instanceof ArtifactsCompiler
-               || compiler instanceof ArtifactAwareCompiler && ((ArtifactAwareCompiler)compiler).shouldRun(artifacts);
-      }
-    };
 
     ApplicationManager.getApplication().invokeAndWait(new Runnable() {
       public void run() {
         final CompilerManager manager = CompilerManager.getInstance(myProject);
         finished.down();
         final CompileScope scope = ArtifactCompileScope.createArtifactsScope(myProject, artifacts);
+        CompileScopeUtil.setBaseScopeForExternalBuild(scope, Collections.<CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope>emptyList());
         ExecutionManagerImpl.EXECUTION_SESSION_ID_KEY.set(scope, ExecutionManagerImpl.EXECUTION_SESSION_ID_KEY.get(env));
-        manager.make(scope, compilerFilter, callback);
+        manager.make(scope, CompilerFilter.ALL, callback);
       }
     }, ModalityState.NON_MODAL);
 
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/ui/actions/PackageFileAction.java b/java/compiler/impl/src/com/intellij/packaging/impl/ui/actions/PackageFileAction.java
index 5cbfdfb..cd3092f 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/ui/actions/PackageFileAction.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/ui/actions/PackageFileAction.java
@@ -6,7 +6,6 @@
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.compiler.CompilerBundle;
 import com.intellij.openapi.compiler.CompilerManager;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
@@ -16,6 +15,7 @@
 import com.intellij.openapi.util.Clock;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.wm.StatusBar;
 import com.intellij.openapi.wm.WindowManager;
 import com.intellij.packaging.artifacts.Artifact;
 import com.intellij.packaging.artifacts.ArtifactManager;
@@ -100,7 +100,10 @@
       }
       String time = TIME_FORMAT.format(Clock.getTime());
       final String statusText = CompilerBundle.message("status.text.file.has.been.packaged", files.size(), fileNames, time);
-      WindowManager.getInstance().getStatusBar(project).setInfo(statusText);
+      final StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
+      if (statusBar != null) {
+        statusBar.setInfo(statusText);
+      }
     }
   }
 }
diff --git a/java/compiler/impl/testSrc/com/intellij/compiler/BaseCompilerTestCase.java b/java/compiler/impl/testSrc/com/intellij/compiler/BaseCompilerTestCase.java
index ee88a67..5ca8ff6 100644
--- a/java/compiler/impl/testSrc/com/intellij/compiler/BaseCompilerTestCase.java
+++ b/java/compiler/impl/testSrc/com/intellij/compiler/BaseCompilerTestCase.java
@@ -46,9 +46,6 @@
  * @author nik
  */
 public abstract class BaseCompilerTestCase extends ModuleTestCase {
-  protected boolean useExternalCompiler() {
-    return false;
-  }
 
   @Override
   protected void setUpModule() {
@@ -57,19 +54,14 @@
   @Override
   protected void setUp() throws Exception {
     super.setUp();
-    if (useExternalCompiler()) {
-      myProject.getMessageBus().connect(myTestRootDisposable).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
-        @Override
-        public void rootsChanged(ModuleRootEvent event) {
-          //todo[nik] projectOpened isn't called in tests so we need to add this listener manually
-          forceFSRescan();
-        }
-      });
-      CompilerTestUtil.enableExternalCompiler(myProject);
-    }
-    else {
-      CompilerTestUtil.disableExternalCompiler(myProject);
-    }
+    myProject.getMessageBus().connect(myTestRootDisposable).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
+      @Override
+      public void rootsChanged(ModuleRootEvent event) {
+        //todo[nik] projectOpened isn't called in tests so we need to add this listener manually
+        forceFSRescan();
+      }
+    });
+    CompilerTestUtil.enableExternalCompiler();
   }
 
   protected void forceFSRescan() {
@@ -78,10 +70,7 @@
 
   @Override
   protected Sdk getTestProjectJdk() {
-    if (useExternalCompiler()) {
-      return JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk();
-    }
-    return super.getTestProjectJdk();
+    return JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk();
   }
 
   @Override
@@ -92,9 +81,7 @@
         FileUtil.delete(new File(FileUtil.toSystemDependentName(outputPath)));
       }
     }
-    if (useExternalCompiler()) {
-      CompilerTestUtil.disableExternalCompiler(myProject);
-    }
+    CompilerTestUtil.disableExternalCompiler(getProject());
 
     super.tearDown();
   }
@@ -259,7 +246,6 @@
       @Override
       public void run() {
 
-        CompilerManagerImpl.testSetup();
         final CompileStatusNotification callback = new CompileStatusNotification() {
           @Override
           public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
@@ -269,7 +255,6 @@
               }
               ExitStatus status = CompileDriver.getExternalBuildExitStatus(compileContext);
               result.set(new CompilationLog(status == ExitStatus.UP_TO_DATE,
-                                            CompilerManagerImpl.getPathsToRecompile(), CompilerManagerImpl.getPathsToDelete(),
                                             generatedFilePaths,
                                             compileContext.getMessages(CompilerMessageCategory.ERROR),
                                             compileContext.getMessages(CompilerMessageCategory.WARNING)));
@@ -279,11 +264,9 @@
             }
           }
         };
-        if (useExternalCompiler()) {
-          myProject.save();
-          CompilerTestUtil.saveApplicationSettings();
-          CompilerTestUtil.scanSourceRootsToRecompile(myProject);
-        }
+        myProject.save();
+        CompilerTestUtil.saveApplicationSettings();
+        CompilerTestUtil.scanSourceRootsToRecompile(myProject);
         action.run(callback);
       }
     });
@@ -353,31 +336,26 @@
   @Override
   protected File getIprFile() throws IOException {
     File iprFile = super.getIprFile();
-    if (useExternalCompiler()) {
-      FileUtil.delete(iprFile);
-    }
+    FileUtil.delete(iprFile);
     return iprFile;
   }
 
   @Override
   protected Module doCreateRealModule(String moduleName) {
-    if (useExternalCompiler()) {
-      //todo[nik] reuse code from PlatformTestCase
-      final VirtualFile baseDir = myProject.getBaseDir();
-      Assert.assertNotNull(baseDir);
-      final File moduleFile = new File(baseDir.getPath().replace('/', File.separatorChar), moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION);
-      PlatformTestCase.myFilesToDelete.add(moduleFile);
-      return new WriteAction<Module>() {
-        @Override
-        protected void run(Result<Module> result) throws Throwable {
-          Module module = ModuleManager.getInstance(myProject)
-            .newModule(FileUtil.toSystemIndependentName(moduleFile.getAbsolutePath()), getModuleType().getId());
-          module.getModuleFile();
-          result.setResult(module);
-        }
-      }.execute().getResultObject();
-    }
-    return super.doCreateRealModule(moduleName);
+    //todo[nik] reuse code from PlatformTestCase
+    final VirtualFile baseDir = myProject.getBaseDir();
+    Assert.assertNotNull(baseDir);
+    final File moduleFile = new File(baseDir.getPath().replace('/', File.separatorChar), moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION);
+    PlatformTestCase.myFilesToDelete.add(moduleFile);
+    return new WriteAction<Module>() {
+      @Override
+      protected void run(Result<Module> result) throws Throwable {
+        Module module = ModuleManager.getInstance(myProject)
+          .newModule(FileUtil.toSystemIndependentName(moduleFile.getAbsolutePath()), getModuleType().getId());
+        module.getModuleFile();
+        result.setResult(module);
+      }
+    }.execute().getResultObject();
   }
 
   @Override
@@ -433,62 +411,27 @@
   }
 
   protected class CompilationLog {
-    private final Set<String> myRecompiledPaths;
-    private final Set<String> myDeletedPaths;
     private final Set<String> myGeneratedPaths;
     private final boolean myExternalBuildUpToDate;
     private final CompilerMessage[] myErrors;
     private final CompilerMessage[] myWarnings;
 
-    public CompilationLog(boolean externalBuildUpToDate, String[] recompiledPaths, String[] deletedPaths, List<String> generatedFilePaths,
-                          CompilerMessage[] errors, CompilerMessage[] warnings) {
+    public CompilationLog(boolean externalBuildUpToDate, List<String> generatedFilePaths, CompilerMessage[] errors,
+                          CompilerMessage[] warnings) {
       myExternalBuildUpToDate = externalBuildUpToDate;
       myErrors = errors;
       myWarnings = warnings;
-      myRecompiledPaths = getRelativePaths(recompiledPaths);
-      myDeletedPaths = getRelativePaths(deletedPaths);
       myGeneratedPaths = new THashSet<String>(generatedFilePaths, FileUtil.PATH_HASHING_STRATEGY);
     }
 
     public void assertUpToDate() {
-      if (useExternalCompiler()) {
-        assertTrue(myExternalBuildUpToDate);
-      }
-      else {
-        checkRecompiled();
-        checkDeleted();
-      }
-    }
-
-    public void assertRecompiled(String... expected) {
-      checkRecompiled(expected);
-      checkDeleted();
+      assertTrue(myExternalBuildUpToDate);
     }
 
     public void assertGenerated(String... expected) {
       assertSet("generated", myGeneratedPaths, expected);
     }
 
-    public void assertDeleted(String... expected) {
-      checkRecompiled();
-      checkDeleted(expected);
-    }
-
-    public void assertRecompiledAndDeleted(String[] recompiled, String... deleted) {
-      checkRecompiled(recompiled);
-      checkDeleted(deleted);
-    }
-
-    private void checkRecompiled(String... expected) {
-      if (useExternalCompiler()) return;
-      assertSet("recompiled", myRecompiledPaths, expected);
-    }
-
-    private void checkDeleted(String... expected) {
-      if (useExternalCompiler()) return;
-      assertSet("deleted", myDeletedPaths, expected);
-    }
-
     public CompilerMessage[] getErrors() {
       return myErrors;
     }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/CompilerWorkspaceConfiguration.java b/java/compiler/openapi/src/com/intellij/compiler/CompilerWorkspaceConfiguration.java
index 79f66c5..40db69f 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/CompilerWorkspaceConfiguration.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/CompilerWorkspaceConfiguration.java
@@ -44,7 +44,6 @@
   public boolean DISPLAY_NOTIFICATION_POPUP = true;
   @Deprecated public boolean CLOSE_MESSAGE_VIEW_IF_SUCCESS = true;
   public boolean CLEAR_OUTPUT_DIRECTORY = true;
-  public boolean USE_OUT_OF_PROCESS_BUILD = true;
   public boolean MAKE_PROJECT_ON_SAVE = false; // until we fix problems with several open projects (IDEA-104064), daemon slowness (IDEA-104666)
   public boolean PARALLEL_COMPILATION = false;
   public int COMPILER_PROCESS_HEAP_SIZE = DEFAULT_COMPILE_PROCESS_HEAP_SIZE;
@@ -63,10 +62,6 @@
     XmlSerializerUtil.copyBean(state, this);
   }
 
-  public boolean useOutOfProcessBuild() {
-    return USE_OUT_OF_PROCESS_BUILD;
-  }
-
   public boolean allowAutoMakeWhileRunningApplication() {
     return false;/*ALLOW_AUTOMAKE_WHILE_RUNNING_APPLICATION*/
   }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ModuleCompilerUtil.java b/java/compiler/openapi/src/com/intellij/compiler/ModuleCompilerUtil.java
index 5b25dac..bffe5a5 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ModuleCompilerUtil.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ModuleCompilerUtil.java
@@ -159,7 +159,7 @@
       for (Chunk<ModifiableRootModel> chunk : nodesAfter) {
         if (chunk.containsNode(toDependOnModel) && chunk.containsNode(currentModel)) {
           Iterator<ModifiableRootModel> nodes = chunk.getNodes().iterator();
-          return Couple.newOne(nodes.next().getModule(), nodes.next().getModule());
+          return Couple.of(nodes.next().getModule(), nodes.next().getModule());
         }
       }
     }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/BuildTargetsFactory.java b/java/compiler/openapi/src/com/intellij/compiler/ant/BuildTargetsFactory.java
index 65a7587..339923f 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/BuildTargetsFactory.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/BuildTargetsFactory.java
@@ -20,12 +20,8 @@
  */
 package com.intellij.compiler.ant;
 
-import com.intellij.compiler.ant.taskdefs.Target;
-import com.intellij.openapi.compiler.make.BuildRecipe;
 import com.intellij.openapi.components.ServiceManager;
 import com.intellij.openapi.project.Project;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.Nullable;
 
 public abstract class BuildTargetsFactory {
   public static BuildTargetsFactory getInstance() {
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/Tag.java b/java/compiler/openapi/src/com/intellij/compiler/ant/Tag.java
index b3b88a5..05f12dd 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/Tag.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/Tag.java
@@ -83,6 +83,6 @@
     if (v2 == null) {
       return null;
     }
-    return Couple.newOne(v1, v2);
+    return Couple.of(v1, v2);
   }
 }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/AntCall.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/AntCall.java
index 46f1c75..21a7ba6 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/AntCall.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/AntCall.java
@@ -27,6 +27,6 @@
 public class AntCall extends Tag{
 
   public AntCall(final String target) {
-    super("antcall", Couple.newOne("target", target));
+    super("antcall", Couple.of("target", target));
   }
 }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/AntProject.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/AntProject.java
index 0dae459..7fa9689 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/AntProject.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/AntProject.java
@@ -27,6 +27,6 @@
 public class AntProject extends Tag {
   public AntProject(@NonNls String name, @NonNls String defaultTarget) {
     //noinspection HardCodedStringLiteral
-    super("project", Couple.newOne("name", name), Couple.newOne("default", defaultTarget));
+    super("project", Couple.of("name", name), Couple.of("default", defaultTarget));
   }
 }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Attribute.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Attribute.java
index 821ced4..c09c137 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Attribute.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Attribute.java
@@ -27,6 +27,6 @@
 public class Attribute extends Tag{
   public Attribute(@NonNls String name, String value) {
     //noinspection HardCodedStringLiteral
-    super("attribute", Couple.newOne("name", name), Couple.newOne("value", value));
+    super("attribute", Couple.of("name", name), Couple.of("value", value));
   }
 }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Copy.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Copy.java
index d7f0b5b..3c8deb4 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Copy.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Copy.java
@@ -27,10 +27,10 @@
 public class Copy extends Tag {
   public Copy(@NonNls String toDir) {
     //noinspection HardCodedStringLiteral
-    super("copy", Couple.newOne("todir", toDir));
+    super("copy", Couple.of("todir", toDir));
   }
   public Copy(@NonNls String file, @NonNls String toFile) {
     //noinspection HardCodedStringLiteral
-    super("copy", Couple.newOne("file", file), Couple.newOne("tofile", toFile));
+    super("copy", Couple.of("file", file), Couple.of("tofile", toFile));
   }
 }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Delete.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Delete.java
index 14b96cc..f7406f4 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Delete.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Delete.java
@@ -27,6 +27,6 @@
 public class Delete extends Tag{
   public Delete(@NonNls String dir) {
     //noinspection HardCodedStringLiteral
-    super("delete", Couple.newOne("dir", dir));
+    super("delete", Couple.of("dir", dir));
   }
 }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/DirSet.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/DirSet.java
index ab56f17..b426fa2 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/DirSet.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/DirSet.java
@@ -28,6 +28,6 @@
 
   public DirSet(@NonNls final String dir) {
     //noinspection HardCodedStringLiteral
-    super("dirset", Couple.newOne("dir", dir));
+    super("dirset", Couple.of("dir", dir));
   }
 }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Dirname.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Dirname.java
index e68b07d..99f0d66 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Dirname.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Dirname.java
@@ -27,6 +27,6 @@
 public class Dirname extends Tag{
   public Dirname(@NonNls String property, @NonNls String file) {
     //noinspection HardCodedStringLiteral
-    super("dirname", Couple.newOne("property", property), Couple.newOne("file", file));
+    super("dirname", Couple.of("property", property), Couple.of("file", file));
   }
 }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Exclude.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Exclude.java
index 7b00eac..d256c50 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Exclude.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Exclude.java
@@ -28,7 +28,7 @@
 
   public Exclude(@NonNls final String name) {
     //noinspection HardCodedStringLiteral
-    super("exclude", Couple.newOne("name", name));
+    super("exclude", Couple.of("name", name));
   }
 
 }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Import.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Import.java
index 111e608..4adc77c 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Import.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Import.java
@@ -27,11 +27,11 @@
 public class Import extends Tag{
   public Import(@NonNls String file, boolean optional) {
     //noinspection HardCodedStringLiteral
-    super("import", Couple.newOne("file", file), Couple.newOne("optional", optional ? "true" : "false"));
+    super("import", Couple.of("file", file), Couple.of("optional", optional ? "true" : "false"));
   }
 
   public Import(@NonNls String file) {
     //noinspection HardCodedStringLiteral
-    super("import", Couple.newOne("file", file));
+    super("import", Couple.of("file", file));
   }
 }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Mkdir.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Mkdir.java
index db18fb7..83b7c92 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Mkdir.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Mkdir.java
@@ -27,6 +27,6 @@
 public class Mkdir extends Tag {
   public Mkdir(@NonNls String directory) {
     //noinspection HardCodedStringLiteral
-    super("mkdir", Couple.newOne("dir", directory));
+    super("mkdir", Couple.of("dir", directory));
   }
 }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Param.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Param.java
index 305a956..d632bc0 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Param.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Param.java
@@ -27,7 +27,7 @@
 public class Param extends Tag {
   public Param(@NonNls final String name, final String value) {
     //noinspection HardCodedStringLiteral
-    super("param", Couple.newOne("name", name), Couple.newOne("value", value));
+    super("param", Couple.of("name", name), Couple.of("value", value));
   }
 
 }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PatternSetRef.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PatternSetRef.java
index 0bd2e0c..361c785 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PatternSetRef.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PatternSetRef.java
@@ -27,6 +27,6 @@
 public class PatternSetRef extends Tag{
   public PatternSetRef(@NonNls final String refid) {
     //noinspection HardCodedStringLiteral
-    super("patternset", Couple.newOne("refid", refid));
+    super("patternset", Couple.of("refid", refid));
   }
 }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Property.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Property.java
index b666e1e..f86ff18 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Property.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Property.java
@@ -28,12 +28,12 @@
 
   public Property(@NonNls final String name, final String value) {
     //noinspection HardCodedStringLiteral
-    super("property", Couple.newOne("name", name), Couple.newOne("value", value));
+    super("property", Couple.of("name", name), Couple.of("value", value));
   }
 
   public Property(@NonNls final String filePath) {
     //noinspection HardCodedStringLiteral
-    super("property", Couple.newOne("file", filePath));
+    super("property", Couple.of("file", filePath));
   }
 
 }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Target.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Target.java
index eb12c38..13b6d35 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Target.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Target.java
@@ -42,7 +42,7 @@
   @SuppressWarnings({"HardCodedStringLiteral"})
   private static Pair[] getOptions(@NonNls String... names) {
     final List<Pair> options = new ArrayList<Pair>();
-    options.add(Couple.newOne("name", names[0]));
+    options.add(Couple.of("name", names[0]));
     appendIfNonEmpty(options, "depends", names[1]);
     appendIfNonEmpty(options, "description", names[2]);
     appendIfNonEmpty(options, "unless", names[3]);
@@ -54,7 +54,7 @@
 
   private static void appendIfNonEmpty(List<Pair> options, final String paramName, String value) {
     if (!StringUtil.isEmptyOrSpaces(value)) {
-      options.add(Couple.newOne(paramName, value));
+      options.add(Couple.of(paramName, value));
     }
   }
 }
diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Zip.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Zip.java
index 33cfede..adf7bb8 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Zip.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Zip.java
@@ -27,6 +27,6 @@
 public class Zip extends Tag {
   public Zip(@NonNls final String destFile) {
     //noinspection HardCodedStringLiteral
-    super("zip", Couple.newOne("destfile", destFile));
+    super("zip", Couple.of("destfile", destFile));
   }
 }
\ No newline at end of file
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompileContext.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompileContext.java
index 7fa4a5f..6046c28 100644
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompileContext.java
+++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompileContext.java
@@ -122,13 +122,6 @@
   VirtualFile[] getSourceRoots(Module module);
 
   /**
-   * Returns the list of all output directories.
-   *
-   * @return a list of all configured output directories from all modules (including output directories for tests)
-   */
-  VirtualFile[] getAllOutputDirectories();
-
-  /**
    * Returns the output directory for the specified module.
    *
    * @param module the module to check.
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerFilter.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerFilter.java
index c7a9f7f..36b2e5f 100644
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerFilter.java
+++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerFilter.java
@@ -16,8 +16,9 @@
 package com.intellij.openapi.compiler;
 
 /**
- * @author Eugene Zhuravlev
- *         Date: Jul 9, 2009
+ * @deprecated this interface is a part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
+ * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
+ * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
  */
 public interface CompilerFilter {
   CompilerFilter ALL = new CompilerFilter() {
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerManager.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerManager.java
index 1f0106c..58e5405 100644
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerManager.java
+++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerManager.java
@@ -56,7 +56,7 @@
    * @param compiler the compiler to register.
    */
   public abstract void addCompiler(@NotNull Compiler compiler);
-
+  
   /**
    * Registers a custom translating compiler. Input and output filetype sets allow compiler manager
    * to sort translating compilers so that output of one compiler will be used as input for another one
@@ -71,12 +71,6 @@
    */
   public abstract void addTranslatingCompiler(@NotNull TranslatingCompiler compiler, Set<FileType> inputTypes, Set<FileType> outputTypes);
 
-  @NotNull
-  public abstract Set<FileType> getRegisteredInputTypes(@NotNull TranslatingCompiler compiler);
-  
-  @NotNull
-  public abstract Set<FileType> getRegisteredOutputTypes(@NotNull TranslatingCompiler compiler);
-  
   /**
    * Unregisters a custom compiler.
    *
@@ -276,9 +270,6 @@
    */
   public abstract boolean isExcludedFromCompilation(@NotNull VirtualFile file);
 
-  @NotNull
-  public abstract OutputToSourceMapping getJavaCompilerOutputMapping();
-
   /*
    * Convetience methods for creating frequently-used compile scopes
    */
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerPaths.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerPaths.java
index 15c1933..fd749d1 100644
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerPaths.java
+++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerPaths.java
@@ -30,7 +30,6 @@
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.VirtualFileManager;
 import com.intellij.util.PathUtil;
-import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.jps.model.java.compiler.AnnotationProcessingConfiguration;
 
@@ -198,12 +197,5 @@
     }
     return StringUtil.isEmpty(sourceDirName)? path : path + "/" + sourceDirName;
   }
-  
-  @NonNls
-  public static String getGenerationOutputPath(IntermediateOutputCompiler compiler, Module module, final boolean forTestSources) {
-    final String generatedCompilerDirectoryPath = getGeneratedDataDirectory(module.getProject(), compiler).getPath();
-    //noinspection HardCodedStringLiteral
-    final String moduleDir = module.getName().replaceAll("\\s+", "_") + "." + Integer.toHexString(module.getModuleFilePath().hashCode());
-    return generatedCompilerDirectoryPath.replace(File.separatorChar, '/') + "/" + moduleDir + "/" + (forTestSources? "test" : "production");
-  }
+
 }
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/DummyCompileContext.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/DummyCompileContext.java
index 297f293..af4752e 100644
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/DummyCompileContext.java
+++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/DummyCompileContext.java
@@ -97,10 +97,6 @@
     return VirtualFile.EMPTY_ARRAY;
   }
 
-  public VirtualFile[] getAllOutputDirectories() {
-    return VirtualFile.EMPTY_ARRAY;
-  }
-
   public VirtualFile getModuleOutputDirectory(final Module module) {
     return ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile>() {
       public VirtualFile compute() {
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/IntermediateOutputCompiler.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/IntermediateOutputCompiler.java
index a289393..a55136e 100644
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/IntermediateOutputCompiler.java
+++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/IntermediateOutputCompiler.java
@@ -18,6 +18,10 @@
 /**
  * A tag interface denoting that compiler's output should go into 'intermediate' directory 
  * and can be used as input to another compiler 
+ *
+ * @deprecated this interface is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
+ * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
+ * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
  */
 public interface IntermediateOutputCompiler extends Compiler{
 }
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/SourceProcessingCompiler.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/SourceProcessingCompiler.java
index 8392fdc..64d287a 100644
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/SourceProcessingCompiler.java
+++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/SourceProcessingCompiler.java
@@ -15,5 +15,10 @@
  */
 package com.intellij.openapi.compiler;
 
+/**
+ * @deprecated this interface is part of the obsolete build system which runs as part of the IDE process. Since IDEA 12 plugins need to
+ * integrate into 'external build system' instead (http://confluence.jetbrains.com/display/IDEADEV/External+Builder+API+and+Plugins).
+ * Since IDEA 13 users cannot switch to the old build system via UI and it will be completely removed in IDEA 14.
+ */
 public interface SourceProcessingCompiler extends FileProcessingCompiler, IntermediateOutputCompiler {
 }
\ No newline at end of file
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/ex/CompilerPathsEx.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/ex/CompilerPathsEx.java
index 0f40216..8235094 100644
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/ex/CompilerPathsEx.java
+++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/ex/CompilerPathsEx.java
@@ -19,10 +19,7 @@
 import com.intellij.openapi.compiler.CompilerPaths;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.progress.ProgressManager;
-import com.intellij.openapi.project.Project;
 import com.intellij.openapi.roots.CompilerModuleExtension;
-import com.intellij.openapi.util.Key;
-import com.intellij.openapi.vfs.VfsUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.VirtualFileManager;
 import com.intellij.util.ArrayUtil;
@@ -34,16 +31,6 @@
 import java.util.Set;
 
 public class CompilerPathsEx extends CompilerPaths {
-  public static final Key<Boolean> CLEAR_ALL_OUTPUTS_KEY = Key.create("_should_clear_all_outputs_");
-
-  public static File getZippedOutputPath(Project project, String outputDirectoryPath) {
-    final File outputDir = new File(outputDirectoryPath);
-    return new File(getZipStoreDirectory(project), "_" + outputDir.getName() + Integer.toHexString(outputDirectoryPath.hashCode()) + ".zip");
-  }
-
-  public static File getZipStoreDirectory(Project project) {
-    return new File(getCompilerSystemDirectory(project), ".zip");
-  }
 
   public static class FileVisitor {
     protected void accept(final VirtualFile file, final String fileRoot, final String filePath) {
@@ -107,19 +94,4 @@
     }
     return ArrayUtil.toStringArray(outputPaths);
   }
-
-  public static VirtualFile[] getOutputDirectories(final Module[] modules) {
-    final Set<VirtualFile> dirs = new OrderedSet<VirtualFile>();
-    for (Module module : modules) {
-      final VirtualFile outputDir = getModuleOutputDirectory(module, false);
-      if (outputDir != null) {
-        dirs.add(outputDir);
-      }
-      VirtualFile testsOutputDir = getModuleOutputDirectory(module, true);
-      if (testsOutputDir != null) {
-        dirs.add(testsOutputDir);
-      }
-    }
-    return VfsUtil.toVirtualFileArray(dirs);
-  }
 }
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildRecipe.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildRecipe.java
deleted file mode 100644
index ad30291..0000000
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/make/BuildRecipe.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.openapi.compiler.make;
-
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-
-@Deprecated
-public interface BuildRecipe {
-  void addInstruction(BuildInstruction instruction);
-
-  boolean visitInstructions(BuildInstructionVisitor visitor, boolean reverseOrder);
-  boolean visitInstructionsWithExceptions(BuildInstructionVisitor visitor, boolean reverseOrder) throws Exception;
-
-  void addFileCopyInstruction(@NotNull File file, boolean isDirectory, String outputRelativePath);
-}
\ No newline at end of file
diff --git a/java/compiler/openapi/src/com/intellij/openapi/deployment/DeploymentUtil.java b/java/compiler/openapi/src/com/intellij/openapi/deployment/DeploymentUtil.java
index dc1ff57..4919789 100644
--- a/java/compiler/openapi/src/com/intellij/openapi/deployment/DeploymentUtil.java
+++ b/java/compiler/openapi/src/com/intellij/openapi/deployment/DeploymentUtil.java
@@ -16,7 +16,6 @@
 package com.intellij.openapi.deployment;
 
 import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.make.BuildRecipe;
 import com.intellij.openapi.components.ServiceManager;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.util.text.StringUtil;
@@ -41,9 +40,6 @@
                                 @Nullable Set<String> writtenPaths,
                                 @Nullable FileFilter fileFilter) throws IOException;
 
-  @Deprecated
-  public abstract boolean addItemsRecursively(@NotNull BuildRecipe items, @NotNull File root, String outputRelativePath);
-
   public static String trimForwardSlashes(@NotNull String path) {
     while (path.length() != 0 && (path.charAt(0) == '/' || path.charAt(0) == File.separatorChar)) {
       path = path.substring(1);
@@ -83,9 +79,6 @@
     return basePath + tail;
   }
 
-  @Deprecated
-  public abstract BuildRecipe createBuildRecipe();
-
   @Nullable
   public abstract String getConfigFileErrorMessage(ConfigFile configFile);
 
diff --git a/java/compiler/openapi/src/com/intellij/packaging/elements/ComplexPackagingElement.java b/java/compiler/openapi/src/com/intellij/packaging/elements/ComplexPackagingElement.java
index 5a09569..e30af39 100644
--- a/java/compiler/openapi/src/com/intellij/packaging/elements/ComplexPackagingElement.java
+++ b/java/compiler/openapi/src/com/intellij/packaging/elements/ComplexPackagingElement.java
@@ -20,9 +20,9 @@
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.util.List;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.List;
 
 /**
  * @author nik
@@ -48,23 +48,6 @@
     return fileSets;
   }
 
-  @Override
-  public void computeIncrementalCompilerInstructions(@NotNull IncrementalCompilerInstructionCreator creator,
-                                                     @NotNull PackagingElementResolvingContext resolvingContext,
-                                                     @NotNull ArtifactIncrementalCompilerContext compilerContext, @NotNull ArtifactType artifactType) {
-    final List<? extends PackagingElement<?>> substitution = getSubstitution(resolvingContext, artifactType);
-    if (substitution == null) return;
-
-    for (PackagingElement<?> element : substitution) {
-      element.computeIncrementalCompilerInstructions(creator, resolvingContext, compilerContext,
-                                                     getArtifactTypeForSubstitutedElements(resolvingContext, artifactType));
-    }
-  }
-
-  protected ArtifactType getArtifactTypeForSubstitutedElements(PackagingElementResolvingContext resolvingContext, ArtifactType artifactType) {
-    return artifactType;
-  }
-
 
   @Nullable
   public abstract List<? extends PackagingElement<?>> getSubstitution(@NotNull PackagingElementResolvingContext context, @NotNull ArtifactType artifactType);
diff --git a/java/compiler/openapi/src/com/intellij/packaging/elements/CompositePackagingElement.java b/java/compiler/openapi/src/com/intellij/packaging/elements/CompositePackagingElement.java
index fbfa5e0..c0f3ff0 100644
--- a/java/compiler/openapi/src/com/intellij/packaging/elements/CompositePackagingElement.java
+++ b/java/compiler/openapi/src/com/intellij/packaging/elements/CompositePackagingElement.java
@@ -116,14 +116,6 @@
     return generators;
   }
 
-  protected void computeChildrenInstructions(@NotNull IncrementalCompilerInstructionCreator creator,
-                                             @NotNull PackagingElementResolvingContext resolvingContext,
-                                             @NotNull ArtifactIncrementalCompilerContext compilerContext, ArtifactType artifactType) {
-    for (PackagingElement<?> child : myChildren) {
-      child.computeIncrementalCompilerInstructions(creator, resolvingContext, compilerContext, artifactType);
-    }
-  }
-
   public void removeAllChildren() {
     myChildren.clear();
   }
diff --git a/java/compiler/openapi/src/com/intellij/packaging/elements/IncrementalCompilerInstructionCreator.java b/java/compiler/openapi/src/com/intellij/packaging/elements/IncrementalCompilerInstructionCreator.java
deleted file mode 100644
index 7c1f1d0..0000000
--- a/java/compiler/openapi/src/com/intellij/packaging/elements/IncrementalCompilerInstructionCreator.java
+++ /dev/null
@@ -1,38 +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.packaging.elements;
-
-import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author nik
- */
-public interface IncrementalCompilerInstructionCreator {
-
-  void addFileCopyInstruction(@NotNull VirtualFile file, @NotNull String outputFileName);
-
-  void addDirectoryCopyInstructions(@NotNull VirtualFile directory);
-
-  void addDirectoryCopyInstructions(@NotNull VirtualFile directory, @Nullable PackagingFileFilter filter);
-
-  IncrementalCompilerInstructionCreator subFolder(@NotNull String directoryName);
-
-  IncrementalCompilerInstructionCreator archive(@NotNull String archiveFileName);
-
-  IncrementalCompilerInstructionCreator subFolderByRelativePath(@NotNull String relativeDirectoryPath);
-}
diff --git a/java/compiler/openapi/src/com/intellij/packaging/elements/PackagingElement.java b/java/compiler/openapi/src/com/intellij/packaging/elements/PackagingElement.java
index 377616b..5c54f50 100644
--- a/java/compiler/openapi/src/com/intellij/packaging/elements/PackagingElement.java
+++ b/java/compiler/openapi/src/com/intellij/packaging/elements/PackagingElement.java
@@ -44,10 +44,6 @@
                                                                    @NotNull ArtifactAntGenerationContext generationContext,
                                                                    @NotNull ArtifactType artifactType);
 
-  public abstract void computeIncrementalCompilerInstructions(@NotNull IncrementalCompilerInstructionCreator creator, @NotNull PackagingElementResolvingContext resolvingContext,
-                                                              @NotNull ArtifactIncrementalCompilerContext compilerContext,
-                                                              @NotNull ArtifactType artifactType);
-
   public abstract boolean isEqualTo(@NotNull PackagingElement<?> element);
 
   @NotNull
diff --git a/java/debugger/impl/src/com/intellij/debugger/DefaultDebugEnvironment.java b/java/debugger/impl/src/com/intellij/debugger/DefaultDebugEnvironment.java
index 5a842e4..76515d8 100644
--- a/java/debugger/impl/src/com/intellij/debugger/DefaultDebugEnvironment.java
+++ b/java/debugger/impl/src/com/intellij/debugger/DefaultDebugEnvironment.java
@@ -19,10 +19,7 @@
 import com.intellij.execution.ExecutionResult;
 import com.intellij.execution.Executor;
 import com.intellij.execution.configurations.*;
-import com.intellij.execution.filters.ExceptionFilters;
-import com.intellij.execution.filters.TextConsoleBuilder;
 import com.intellij.execution.runners.ProgramRunner;
-import com.intellij.execution.runners.RunContentBuilder;
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.search.GlobalSearchScope;
 
@@ -54,17 +51,11 @@
     myRemoteConnection = remoteConnection;
     myPollConnection = pollConnection;
 
-    mySearchScope = RunContentBuilder.createSearchScope(project, runProfile);
+    mySearchScope = SearchScopeProvider.createSearchScope(project, runProfile);
   }
 
   @Override
   public ExecutionResult createExecutionResult() throws ExecutionException {
-    if (myState instanceof CommandLineState) {
-      final TextConsoleBuilder consoleBuilder = ((CommandLineState)myState).getConsoleBuilder();
-      if (consoleBuilder != null) {
-        consoleBuilder.filters(ExceptionFilters.getFilters(mySearchScope));
-      }
-    }
     return myState.execute(myExecutor, myRunner);
   }
 
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/JavaValueModifier.java b/java/debugger/impl/src/com/intellij/debugger/actions/JavaValueModifier.java
deleted file mode 100644
index 89235a1..0000000
--- a/java/debugger/impl/src/com/intellij/debugger/actions/JavaValueModifier.java
+++ /dev/null
@@ -1,578 +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.debugger.actions;
-
-import com.intellij.debugger.DebuggerBundle;
-import com.intellij.debugger.DebuggerInvocationUtil;
-import com.intellij.debugger.DebuggerManagerEx;
-import com.intellij.debugger.engine.ContextUtil;
-import com.intellij.debugger.engine.JavaValue;
-import com.intellij.debugger.engine.evaluation.*;
-import com.intellij.debugger.engine.evaluation.expression.*;
-import com.intellij.debugger.engine.events.DebuggerContextCommandImpl;
-import com.intellij.debugger.engine.events.SuspendContextCommandImpl;
-import com.intellij.debugger.impl.*;
-import com.intellij.debugger.jdi.LocalVariableProxyImpl;
-import com.intellij.debugger.jdi.VirtualMachineProxyImpl;
-import com.intellij.debugger.ui.DebuggerExpressionComboBox;
-import com.intellij.debugger.ui.EditorEvaluationCommand;
-import com.intellij.debugger.ui.impl.DebuggerTreeRenderer;
-import com.intellij.debugger.ui.impl.watch.*;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.progress.ProcessCanceledException;
-import com.intellij.openapi.progress.util.ProgressIndicatorListenerAdapter;
-import com.intellij.openapi.progress.util.ProgressWindowWithNotification;
-import com.intellij.openapi.ui.Messages;
-import com.intellij.psi.PsiDocumentManager;
-import com.intellij.psi.PsiFile;
-import com.intellij.ui.SimpleColoredComponent;
-import com.intellij.util.IJSwingUtilities;
-import com.intellij.xdebugger.frame.XValueModifier;
-import com.sun.jdi.*;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-
-/*
- * Class SetValueAction
- * @author Jeka
- */
-public class JavaValueModifier extends XValueModifier {
-  private final JavaValue myJavaValue;
-
-  public JavaValueModifier(JavaValue javaValue) {
-    myJavaValue = javaValue;
-  }
-
-  //public void update(AnActionEvent e) {
-  //  boolean enable = false;
-  //  DebuggerTreeNodeImpl node = getSelectedNode(e.getDataContext());
-  //  if (node != null) {
-  //    NodeDescriptorImpl descriptor = node.getDescriptor();
-  //    if(descriptor instanceof ValueDescriptorImpl){
-  //      ValueDescriptorImpl valueDescriptor = ((ValueDescriptorImpl)descriptor);
-  //      enable = valueDescriptor.canSetValue();
-  //    }
-  //  }
-  //  e.getPresentation().setVisible(enable);
-  //}
-  //
-  private void update(final DebuggerContextImpl context) {
-    DebuggerInvocationUtil.swingInvokeLater(context.getProject(), new Runnable() {
-      public void run() {
-        final DebuggerSession session = context.getDebuggerSession();
-        if (session != null) {
-          session.refresh(false);
-        }
-      }
-    });
-    //node.setState(context);
-  }
-
-  @Override
-  public void setValue(@NotNull String expression, @NotNull XModificationCallback callback) {
-    final NodeDescriptorImpl descriptor = myJavaValue.getDescriptor();
-    if (!(descriptor instanceof ValueDescriptorImpl)) {
-      return;
-    }
-    if(!((ValueDescriptorImpl)descriptor).canSetValue()) {
-      return;
-    }
-
-    //final DebuggerTree tree = getTree(event.getDataContext());
-    //final DebuggerContextImpl debuggerContext = getDebuggerContext(event.getDataContext());
-    final DebuggerContextImpl debuggerContext = DebuggerManagerEx.getInstanceEx(myJavaValue.getProject()).getContext();
-    //tree.saveState(node);
-
-    if (descriptor instanceof FieldDescriptorImpl) {
-      FieldDescriptorImpl fieldDescriptor = (FieldDescriptorImpl)descriptor;
-      final Field field = fieldDescriptor.getField();
-      if (!field.isStatic()) {
-        final ObjectReference object = fieldDescriptor.getObject();
-        if (object != null) {
-          set(expression, callback, debuggerContext, new SetValueRunnable() {
-            public void setValue(EvaluationContextImpl evaluationContext, Value newValue)
-              throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
-              object.setValue(field, preprocessValue(evaluationContext, newValue, field.type()));
-              update(debuggerContext);
-            }
-
-            public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws
-                                                                                                      InvocationException,
-                                                                                                      ClassNotLoadedException,
-                                                                                                      IncompatibleThreadStateException,
-                                                                                                      InvalidTypeException,
-                                                                                                      EvaluateException {
-              return evaluationContext.getDebugProcess().loadClass(evaluationContext, className, field.declaringType().classLoader());
-            }
-          });
-        }
-      }
-      else {
-        // field is static
-        ReferenceType refType = field.declaringType();
-        if (refType instanceof ClassType) {
-          final ClassType classType = (ClassType)refType;
-          set(expression, callback, debuggerContext, new SetValueRunnable() {
-            public void setValue(EvaluationContextImpl evaluationContext, Value newValue)
-              throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
-              classType.setValue(field, preprocessValue(evaluationContext, newValue, field.type()));
-              update(debuggerContext);
-            }
-
-            public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws
-                                                                                                      InvocationException,
-                                                                                                      ClassNotLoadedException,
-                                                                                                      IncompatibleThreadStateException,
-                                                                                                      InvalidTypeException,
-                                                                                                      EvaluateException {
-              return evaluationContext.getDebugProcess().loadClass(evaluationContext, className,
-                                                                   field.declaringType().classLoader());
-            }
-          });
-        }
-      }
-    }
-    else if (descriptor instanceof LocalVariableDescriptorImpl) {
-      LocalVariableDescriptorImpl localDescriptor = (LocalVariableDescriptorImpl)descriptor;
-      final LocalVariableProxyImpl local = localDescriptor.getLocalVariable();
-      if (local != null) {
-        set(expression, callback, debuggerContext, new SetValueRunnable() {
-          public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException,
-                                                                                               InvalidTypeException,
-                                                                                               EvaluateException {
-            debuggerContext.getFrameProxy().setValue(local, preprocessValue(evaluationContext, newValue, local.getType()));
-            update(debuggerContext);
-          }
-
-          public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException,
-                                                                                                           ClassNotLoadedException,
-                                                                                                           IncompatibleThreadStateException,
-                                                                                                           InvalidTypeException,
-                                                                                                           EvaluateException {
-            return evaluationContext.getDebugProcess().loadClass(evaluationContext, className,
-                                                                 evaluationContext.getClassLoader());
-          }
-        });
-      }
-    }
-    else if (descriptor instanceof ArrayElementDescriptorImpl) {
-      final ArrayElementDescriptorImpl elementDescriptor = (ArrayElementDescriptorImpl)descriptor;
-      final ArrayReference array = elementDescriptor.getArray();
-      if (array != null) {
-        if (VirtualMachineProxyImpl.isCollected(array)) {
-          // will only be the case if debugger does not use ObjectReference.disableCollection() because of Patches.IBM_JDK_DISABLE_COLLECTION_BUG
-          Messages.showWarningDialog(myJavaValue.getProject(), DebuggerBundle.message("evaluation.error.array.collected") + "\n"+ DebuggerBundle.message("warning.recalculate"), DebuggerBundle.message("title.set.value"));
-          //node.getParent().calcValue();
-          return;
-        }
-        final ArrayType arrType = (ArrayType)array.referenceType();
-        set(expression, callback, debuggerContext, new SetValueRunnable() {
-          public void setValue(EvaluationContextImpl evaluationContext, Value newValue)
-            throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
-            array.setValue(elementDescriptor.getIndex(), preprocessValue(evaluationContext, newValue, arrType.componentType()));
-            update(debuggerContext);
-          }
-
-          public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException,
-                                                                                                           ClassNotLoadedException,
-                                                                                                           IncompatibleThreadStateException,
-                                                                                                           InvalidTypeException,
-                                                                                                           EvaluateException {
-            return evaluationContext.getDebugProcess().loadClass(evaluationContext, className, arrType.classLoader());
-          }
-        });
-      }
-    }
-    else if (descriptor instanceof EvaluationDescriptor) {
-      final EvaluationDescriptor evaluationDescriptor = (EvaluationDescriptor)descriptor;
-      if (evaluationDescriptor.canSetValue()) {
-        set(expression, callback, debuggerContext, new SetValueRunnable() {
-          public void setValue(EvaluationContextImpl evaluationContext, Value newValue)
-            throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
-            final Modifier modifier = evaluationDescriptor.getModifier();
-            modifier.setValue(preprocessValue(evaluationContext, newValue, modifier.getExpectedType()));
-            update(debuggerContext);
-          }
-
-          public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException,
-                                                                                                           ClassNotLoadedException,
-                                                                                                           IncompatibleThreadStateException,
-                                                                                                           InvalidTypeException,
-                                                                                                           EvaluateException {
-            return evaluationContext.getDebugProcess().loadClass(evaluationContext, className,
-                                                                 evaluationContext.getClassLoader());
-          }
-        });
-      }
-    }
-  }
-
-  private Value preprocessValue(EvaluationContextImpl context, Value value, Type varType) throws EvaluateException {
-    if (value != null && "java.lang.String".equals(varType.name()) && !(value instanceof StringReference)) {
-      String v = DebuggerUtilsEx.getValueAsString(context, value);
-      if (v != null) {
-        value = context.getSuspendContext().getDebugProcess().getVirtualMachineProxy().mirrorOf(v);
-      }
-    }
-    if(value instanceof DoubleValue) {
-      double dValue = ((DoubleValue) value).doubleValue();
-      if(varType instanceof FloatType && Float.MIN_VALUE <= dValue && dValue <= Float.MAX_VALUE){
-        value = context.getSuspendContext().getDebugProcess().getVirtualMachineProxy().mirrorOf((float)dValue);
-      }
-    }
-    if (value != null) {
-      if (varType instanceof PrimitiveType) {
-        if (!(value instanceof PrimitiveValue)) {
-          value = (Value)new UnBoxingEvaluator(new IdentityEvaluator(value)).evaluate(context);
-        }
-      }
-      else if (UnBoxingEvaluator.isTypeUnboxable(varType.name())) {
-        // variable is not primitive and boxing/unboxing is applicable
-        if (value instanceof PrimitiveValue) {
-          value = (Value)new BoxingEvaluator(new IdentityEvaluator(value)).evaluate(context);
-        }
-      }
-    }
-    return value;
-  }
-
-  private static interface SetValueRunnable {
-    void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException,
-                                                                                          InvalidTypeException,
-                                                                                          EvaluateException,
-                                                                                          IncompatibleThreadStateException;
-    ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws EvaluateException,
-                                                                                            InvocationException,
-                                                                                            ClassNotLoadedException,
-                                                                                            IncompatibleThreadStateException,
-                                                                                            InvalidTypeException;
-  }
-
-  private static void setValue(String expressionToShow, ExpressionEvaluator evaluator, EvaluationContextImpl evaluationContext, SetValueRunnable setValueRunnable) throws EvaluateException {
-    Value value;
-    try {
-      value = evaluator.evaluate(evaluationContext);
-
-      setValueRunnable.setValue(evaluationContext, value);
-    }
-    catch (IllegalArgumentException ex) {
-      throw EvaluateExceptionUtil.createEvaluateException(ex.getMessage());
-    }
-    catch (InvalidTypeException ex) {
-      throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.type.mismatch"));
-    }
-    catch (IncompatibleThreadStateException e) {
-      throw EvaluateExceptionUtil.createEvaluateException(e);
-    }
-    catch (ClassNotLoadedException ex) {
-      if (!evaluationContext.isAutoLoadClasses()) {
-        throw EvaluateExceptionUtil.createEvaluateException(ex);
-      }
-      final ReferenceType refType;
-      try {
-        refType = setValueRunnable.loadClass(evaluationContext, ex.className());
-        if (refType != null) {
-          //try again
-          setValue(expressionToShow, evaluator, evaluationContext, setValueRunnable);
-        }
-      }
-      catch (InvocationException e) {
-        throw EvaluateExceptionUtil.createEvaluateException(e);
-      }
-      catch (ClassNotLoadedException e) {
-        throw EvaluateExceptionUtil.createEvaluateException(e);
-      }
-      catch (IncompatibleThreadStateException e) {
-        throw EvaluateExceptionUtil.createEvaluateException(e);
-      }
-      catch (InvalidTypeException e) {
-        throw EvaluateExceptionUtil.createEvaluateException(e);
-      }
-      catch (ObjectCollectedException e) {
-        throw EvaluateExceptionUtil.OBJECT_WAS_COLLECTED;
-      }
-    }
-  }
-
-  private void set(@NotNull final String expression, final XModificationCallback callback, final DebuggerContextImpl debuggerContext, final SetValueRunnable setValueRunnable) {
-    final ProgressWindowWithNotification progressWindow = new ProgressWindowWithNotification(true, debuggerContext.getProject());
-    final EvaluationContextImpl evaluationContext = myJavaValue.getEvaluationContext();
-
-    SuspendContextCommandImpl askSetAction = new DebuggerContextCommandImpl(debuggerContext) {
-      public Priority getPriority() {
-        return Priority.HIGH;
-      }
-
-      public void threadAction() {
-        ExpressionEvaluator evaluator = null;
-        try {
-          evaluator = DebuggerInvocationUtil
-            .commitAndRunReadAction(evaluationContext.getProject(), new com.intellij.debugger.EvaluatingComputable<ExpressionEvaluator>() {
-              public ExpressionEvaluator compute() throws EvaluateException {
-                return EvaluatorBuilderImpl
-                  .build(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, expression), ContextUtil.getContextElement(evaluationContext),
-                         ContextUtil.getSourcePosition(evaluationContext));
-              }
-            });
-
-
-          setValue(expression, evaluator, evaluationContext, new SetValueRunnable() {
-            public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException,
-                                                                                                 InvalidTypeException,
-                                                                                                 EvaluateException,
-                                                                                                 IncompatibleThreadStateException {
-              if (!progressWindow.isCanceled()) {
-                setValueRunnable.setValue(evaluationContext, newValue);
-                //node.calcValue();
-              }
-            }
-
-            public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws
-                                                                                                      InvocationException,
-                                                                                                      ClassNotLoadedException,
-                                                                                                      EvaluateException,
-                                                                                                      IncompatibleThreadStateException,
-                                                                                                      InvalidTypeException {
-              return setValueRunnable.loadClass(evaluationContext, className);
-            }
-          });
-          callback.valueModified();
-        } catch (EvaluateException e) {
-          callback.errorOccurred(e.getMessage());
-        }
-        //String initialString = "";
-        //if (descriptor instanceof ValueDescriptorImpl) {
-        //  Value currentValue = ((ValueDescriptorImpl) descriptor).getValue();
-        //  if (currentValue instanceof StringReference) {
-        //    initialString = DebuggerUtilsEx.getValueOrErrorAsString(debuggerContext.createEvaluationContext(), currentValue);
-        //    initialString = initialString == null ? "" : "\"" + DebuggerUtilsEx.translateStringValue(initialString) + "\"";
-        //  }
-        //  else if (currentValue instanceof PrimitiveValue) {
-        //    ValueLabelRenderer renderer = ((ValueDescriptorImpl) descriptor).getRenderer(debuggerContext.getDebugProcess());
-        //    initialString = getDisplayableString((PrimitiveValue) currentValue, renderer instanceof NodeRenderer && HexRenderer.UNIQUE_ID.equals(renderer.getUniqueId()));
-        //  }
-        //
-        //  final String initialString1 = initialString;
-        //  final Project project = debuggerContext.getProject();
-        //  DebuggerInvocationUtil.swingInvokeLater(project, new Runnable() {
-        //    public void run() {
-        //      showEditor(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, initialString1), node, debuggerContext, setValueRunnable);
-        //    }
-        //  });
-        //}
-      }
-    };
-
-    progressWindow.setTitle(DebuggerBundle.message("title.evaluating"));
-    debuggerContext.getDebugProcess().getManagerThread().startProgress(askSetAction, progressWindow);
-  }
-
-  private void showEditor(final TextWithImports initialString,
-                          final DebuggerTreeNodeImpl node,
-                          final DebuggerContextImpl debuggerContext,
-                          final SetValueRunnable setValueRunnable) {
-    final JPanel editorPanel = new JPanel();
-    editorPanel.setLayout(new BoxLayout(editorPanel, BoxLayout.X_AXIS));
-    SimpleColoredComponent label = new SimpleColoredComponent();
-    label.setIcon(node.getIcon());
-    DebuggerTreeRenderer.getDescriptorTitle(debuggerContext, node.getDescriptor()).appendToComponent(label);
-    editorPanel.add(label);
-
-    final DebuggerExpressionComboBox comboBox = new DebuggerExpressionComboBox(
-      debuggerContext.getProject(),
-      PositionUtil.getContextElement(debuggerContext),
-      "setValue", DefaultCodeFragmentFactory.getInstance());
-    comboBox.setText(initialString);
-    comboBox.selectAll();
-    editorPanel.add(comboBox);
-
-    final DebuggerTreeInplaceEditor editor = new DebuggerTreeInplaceEditor(node) {
-      public JComponent createInplaceEditorComponent() {
-        return editorPanel;
-      }
-
-      public JComponent getPreferredFocusedComponent() {
-        return comboBox;
-      }
-
-      public Editor getEditor() {
-        return comboBox.getEditor();
-      }
-
-      public JComponent getEditorComponent() {
-        return comboBox.getEditorComponent();
-      }
-
-      private void flushValue() {
-        if (comboBox.isPopupVisible()) {
-          comboBox.selectPopupValue();
-        }
-
-        Editor editor = getEditor();
-        if(editor == null) {
-          return;
-        }
-
-        final TextWithImports text = comboBox.getText();
-
-        PsiFile psiFile = PsiDocumentManager.getInstance(debuggerContext.getProject()).getPsiFile(editor.getDocument());
-
-        final ProgressWindowWithNotification progressWindow = new ProgressWindowWithNotification(true, getProject());
-        EditorEvaluationCommand evaluationCommand = new EditorEvaluationCommand(getEditor(), psiFile, debuggerContext, progressWindow) {
-          public void threadAction() {
-            try {
-              evaluate();
-            }
-            catch(EvaluateException e) {
-              progressWindow.cancel();
-            }
-            catch(ProcessCanceledException e) {
-              progressWindow.cancel();
-            }
-            finally{
-              if (!progressWindow.isCanceled()) {
-                DebuggerInvocationUtil.swingInvokeLater(debuggerContext.getProject(), new Runnable() {
-                  public void run() {
-                    comboBox.addRecent(text);
-                    cancelEditing();
-                  }
-                });
-              }
-            }
-          }
-
-          protected Object evaluate(final EvaluationContextImpl evaluationContext) throws EvaluateException {
-            ExpressionEvaluator evaluator = DebuggerInvocationUtil.commitAndRunReadAction(evaluationContext.getProject(), new com.intellij.debugger.EvaluatingComputable<ExpressionEvaluator>() {
-              public ExpressionEvaluator compute() throws EvaluateException {
-                return EvaluatorBuilderImpl.build(text, ContextUtil.getContextElement(evaluationContext), ContextUtil.getSourcePosition(evaluationContext));
-              }
-            });
-
-            setValue(text.getText(), evaluator, evaluationContext, new SetValueRunnable() {
-              public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException,
-                                                                                                   InvalidTypeException,
-                                                                                                   EvaluateException,
-                                                                                                   IncompatibleThreadStateException {
-                if (!progressWindow.isCanceled()) {
-                  setValueRunnable.setValue(evaluationContext, newValue);
-                  node.calcValue();
-                }
-              }
-
-              public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws
-                                                                                                        InvocationException,
-                                                                                                        ClassNotLoadedException,
-                                                                                                        EvaluateException,
-                                                                                                        IncompatibleThreadStateException,
-                                                                                                        InvalidTypeException {
-                return setValueRunnable.loadClass(evaluationContext, className);
-              }
-            });
-
-            return null;
-          }
-        };
-
-        progressWindow.addListener(new ProgressIndicatorListenerAdapter() {
-          //should return whether to stop processing
-          public void stopped() {
-            if(!progressWindow.isCanceled()) {
-              IJSwingUtilities.invoke(new Runnable() {
-                public void run() {
-                  cancelEditing();
-                }
-              });
-            }
-          }
-
-
-        });
-
-        progressWindow.setTitle(DebuggerBundle.message("progress.set.value"));
-        debuggerContext.getDebugProcess().getManagerThread().startProgress(evaluationCommand, progressWindow);
-      }
-
-      public void cancelEditing() {
-        try {
-          super.cancelEditing();
-        }
-        finally {
-          comboBox.dispose();
-        }
-      }
-
-      public void doOKAction() {
-        try {
-          flushValue();
-        }
-        finally {
-          comboBox.dispose();
-        }
-      }
-
-    };
-
-    final DebuggerStateManager stateManager = DebuggerManagerEx.getInstanceEx(debuggerContext.getProject()).getContextManager();
-
-    stateManager.addListener(new DebuggerContextListener() {
-      public void changeEvent(DebuggerContextImpl newContext, int event) {
-        if (event != DebuggerSession.EVENT_THREADS_REFRESH) {
-          stateManager.removeListener(this);
-          editor.cancelEditing();
-        }
-      }
-    });
-
-    node.getTree().hideTooltip();
-
-    editor.show();
-  }
-
-  @SuppressWarnings({"HardCodedStringLiteral"})
-  private static String getDisplayableString(PrimitiveValue value, boolean showAsHex) {
-    if (value instanceof CharValue) {
-      long longValue = value.longValue();
-      return showAsHex ? "0x" + Long.toHexString(longValue).toUpperCase() : Long.toString(longValue);
-    }
-    if (value instanceof ByteValue) {
-      byte val = value.byteValue();
-      String strValue = Integer.toHexString(val).toUpperCase();
-      if (strValue.length() > 2) {
-        strValue = strValue.substring(strValue.length() - 2);
-      }
-      return showAsHex ? "0x" + strValue : value.toString();
-    }
-    if (value instanceof ShortValue) {
-      short val = value.shortValue();
-      String strValue = Integer.toHexString(val).toUpperCase();
-      if (strValue.length() > 4) {
-        strValue = strValue.substring(strValue.length() - 4);
-      }
-      return showAsHex ? "0x" + strValue : value.toString();
-    }
-    if (value instanceof IntegerValue) {
-      int val = value.intValue();
-      return showAsHex ? "0x" + Integer.toHexString(val).toUpperCase() : value.toString();
-    }
-    if (value instanceof LongValue) {
-      long val = value.longValue();
-      return showAsHex ? "0x" + Long.toHexString(val).toUpperCase() + "L" : value.toString() + "L";
-    }
-    return DebuggerUtilsEx.translateStringValue(value.toString());
-  }
-
-}
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java b/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java
index c890d14..127765a 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java
@@ -63,6 +63,9 @@
       catch (Exception e) {
         LOG.error(e);
       }
+      catch (AssertionError e) {
+        LOG.error(e);
+      }
     }
     return null;
   }
@@ -79,6 +82,9 @@
       catch (Exception e) {
         LOG.error(e);
       }
+      catch (AssertionError e) {
+        LOG.error(e);
+      }
     }
     return Collections.emptyList();
   }
@@ -95,6 +101,9 @@
       catch (Exception e) {
         LOG.error(e);
       }
+      catch (AssertionError e) {
+        LOG.error(e);
+      }
     }
     return Collections.emptyList();
   }
@@ -110,6 +119,9 @@
       catch (Exception e) {
         LOG.error(e);
       }
+      catch (AssertionError e) {
+        LOG.error(e);
+      }
     }
 
     return null;
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaBreakpointHandler.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaBreakpointHandler.java
index 3496894..1050c99 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaBreakpointHandler.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaBreakpointHandler.java
@@ -36,18 +36,23 @@
 
   @Nullable
   protected Breakpoint createJavaBreakpoint(@NotNull XBreakpoint xBreakpoint) {
-    return BreakpointManager.getJavaBreakpoint(xBreakpoint);
+    return null;
   }
 
   @Override
   public void registerBreakpoint(@NotNull XBreakpoint breakpoint) {
-    final Breakpoint javaBreakpoint = createJavaBreakpoint(breakpoint);
+    Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint(breakpoint);
+    if (javaBreakpoint == null) {
+      javaBreakpoint = createJavaBreakpoint(breakpoint);
+      breakpoint.putUserData(Breakpoint.DATA_KEY, javaBreakpoint);
+    }
     if (javaBreakpoint != null) {
-      BreakpointManager.addBreakpointInt(javaBreakpoint);
+      final Breakpoint bpt = javaBreakpoint;
+      BreakpointManager.addBreakpoint(bpt);
       myProcess.getManagerThread().invoke(new DebuggerCommandImpl() {
         @Override
         protected void action() throws Exception {
-          javaBreakpoint.createRequest(myProcess);
+          bpt.createRequest(myProcess);
         }
       });
     }
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java
index 60077d0..166ec95 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java
@@ -16,7 +16,6 @@
 package com.intellij.debugger.engine;
 
 import com.intellij.debugger.DebuggerBundle;
-import com.intellij.debugger.DebuggerInvocationUtil;
 import com.intellij.debugger.actions.DebuggerActions;
 import com.intellij.debugger.engine.evaluation.EvaluationContext;
 import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
@@ -35,12 +34,11 @@
 import com.intellij.debugger.ui.tree.render.DescriptorLabelListener;
 import com.intellij.execution.process.ProcessHandler;
 import com.intellij.execution.ui.ExecutionConsole;
+import com.intellij.execution.ui.ExecutionConsoleEx;
 import com.intellij.execution.ui.RunnerLayoutUi;
 import com.intellij.execution.ui.layout.PlaceInGrid;
 import com.intellij.icons.AllIcons;
-import com.intellij.idea.ActionsBundle;
 import com.intellij.openapi.actionSystem.*;
-import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
@@ -98,28 +96,33 @@
     myJavaSession.getContextManager().addListener(new DebuggerContextListener() {
       @Override
       public void changeEvent(final DebuggerContextImpl newContext, int event) {
-        if (event == DebuggerSession.EVENT_PAUSE && myJavaSession.isPaused()) {
-          process.getManagerThread().schedule(new DebuggerContextCommandImpl(newContext) {
-            @Override
-            public void threadAction() {
-              SuspendContextImpl context = newContext.getSuspendContext();
-              if (context != null) {
-                context.initExecutionStacks(newContext.getThreadProxy());
+        if (event == DebuggerSession.EVENT_PAUSE
+            || event == DebuggerSession.EVENT_CONTEXT
+            || event == DebuggerSession.EVENT_REFRESH
+               && myJavaSession.isPaused()) {
+          if (getSession().getSuspendContext() != newContext.getSuspendContext()) {
+            process.getManagerThread().schedule(new DebuggerContextCommandImpl(newContext) {
+              @Override
+              public void threadAction() {
+                SuspendContextImpl context = newContext.getSuspendContext();
+                if (context != null) {
+                  context.initExecutionStacks(newContext.getThreadProxy());
 
-                List<Pair<Breakpoint, Event>> descriptors =
-                  DebuggerUtilsEx.getEventDescriptors(context);
-                if (!descriptors.isEmpty()) {
-                  Breakpoint breakpoint = descriptors.get(0).getFirst();
-                  XBreakpoint xBreakpoint = breakpoint.getXBreakpoint();
-                  if (xBreakpoint != null) {
-                    getSession().breakpointReached(xBreakpoint, null, context);
-                    return;
+                  List<Pair<Breakpoint, Event>> descriptors =
+                    DebuggerUtilsEx.getEventDescriptors(context);
+                  if (!descriptors.isEmpty()) {
+                    Breakpoint breakpoint = descriptors.get(0).getFirst();
+                    XBreakpoint xBreakpoint = breakpoint.getXBreakpoint();
+                    if (xBreakpoint != null) {
+                      getSession().breakpointReached(xBreakpoint, null, context);
+                      return;
+                    }
                   }
+                  getSession().positionReached(context);
                 }
-                getSession().positionReached(context);
               }
-            }
-          });
+            });
+          }
         }
       }
     });
@@ -137,6 +140,11 @@
       public DebuggerTreeNodeImpl createMessageNode(MessageDescriptor descriptor) {
         return new DebuggerTreeNodeImpl(null, descriptor);
       }
+
+      @Override
+      public DebuggerTreeNodeImpl createMessageNode(String message) {
+        return new DebuggerTreeNodeImpl(null, new MessageDescriptor(message));
+      }
     };
     session.addSessionListener(new XDebugSessionAdapter() {
       @Override
@@ -160,18 +168,6 @@
           DebuggerContextUtil.setStackFrame(javaSession.getContextManager(), ((JavaStackFrame)frame).getStackFrameProxy());
         }
       }
-
-      @Override
-      public void sessionStopped() {
-        if (DebuggerSettings.getInstance().UNMUTE_ON_STOP) {
-          ApplicationManager.getApplication().runReadAction(new Runnable() {
-            @Override
-            public void run() {
-              session.setBreakpointMuted(false);
-            }
-          });
-        }
-      }
     });
   }
 
@@ -286,6 +282,20 @@
           }
         }, threadsContent);
       }
+
+      @NotNull
+      @Override
+      public Content registerConsoleContent(@NotNull RunnerLayoutUi ui, @NotNull ExecutionConsole console) {
+        Content content = null;
+        if (console instanceof ExecutionConsoleEx) {
+          ((ExecutionConsoleEx)console).buildUi(ui);
+          content = ui.findContent(DebuggerContentInfo.CONSOLE_CONTENT);
+        }
+        if (content == null) {
+          content = super.registerConsoleContent(ui, console);
+        }
+        return content;
+      }
     };
   }
 
@@ -297,25 +307,16 @@
     leftToolbar.add(ActionManager.getInstance().getAction(DebuggerActions.DUMP_THREADS), beforeRunner);
     leftToolbar.add(Separator.getInstance(), beforeRunner);
 
-    final DefaultActionGroup settings = new DefaultActionGroup("DebuggerSettings", true) {
-      @Override
-      public void update(AnActionEvent e) {
-        e.getPresentation().setText(ActionsBundle.message("group.XDebugger.settings.text"));
-        e.getPresentation().setIcon(AllIcons.General.SecondaryGroup);
+    for (AnAction action : leftToolbar.getChildren(null)) {
+      //TODO: maybe introduce API for extra settings?
+      if (action instanceof DefaultActionGroup && "DebuggerSettings".equals(action.getTemplatePresentation().getText())) {
+        DefaultActionGroup settings = (DefaultActionGroup)action;
+        addActionToGroup(settings, XDebuggerActions.AUTO_TOOLTIP);
+        settings.addAction(new AutoVarsSwitchAction(), Constraints.FIRST);
+        settings.addAction(new WatchLastMethodReturnValueAction(), Constraints.FIRST);
+        break;
       }
-
-      @Override
-      public boolean isDumbAware() {
-        return true;
-      }
-    };
-    settings.add(new WatchLastMethodReturnValueAction());
-    settings.add(new AutoVarsSwitchAction());
-    settings.add(new UnmuteOnStopAction());
-    settings.addSeparator();
-    addActionToGroup(settings, XDebuggerActions.AUTO_TOOLTIP);
-
-    leftToolbar.add(settings, new Constraints(Anchor.AFTER, "Runner.Layout"));
+    }
   }
 
   private static class AutoVarsSwitchAction extends ToggleAction {
@@ -410,7 +411,7 @@
 
   private static void addActionToGroup(final DefaultActionGroup group, final String actionId) {
     AnAction action = ActionManager.getInstance().getAction(actionId);
-    if (action != null) group.add(action);
+    if (action != null) group.addAction(action, Constraints.FIRST);
   }
 
   public NodeManagerImpl getNodeManager() {
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebuggerEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebuggerEvaluator.java
index 835fece..4104000 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebuggerEvaluator.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebuggerEvaluator.java
@@ -69,8 +69,6 @@
           callback.errorOccurred("Context is not available");
           return;
         }
-        descriptor.setContext(evalContext);
-        descriptor.updateRepresentation(evalContext, DescriptorLabelListener.DUMMY_LISTENER);
         JavaDebugProcess process = myDebugProcess.getXdebugProcess();
         if (process != null) {
           callback.evaluated(JavaValue.create(descriptor, evalContext, process.getNodeManager()));
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java
index 305418d..5d8f50c 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java
@@ -30,6 +30,7 @@
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import javax.swing.*;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -44,7 +45,7 @@
   private final MethodsTracker myTracker = new MethodsTracker();
 
   public JavaExecutionStack(@NotNull ThreadReferenceProxyImpl threadProxy, @NotNull DebugProcessImpl debugProcess, boolean current) {
-    super(calcRepresentation(threadProxy), current ? AllIcons.Debugger.ThreadCurrent : AllIcons.Debugger.ThreadSuspended);
+    super(calcRepresentation(threadProxy), calcIcon(threadProxy, current));
     myThreadProxy = threadProxy;
     myDebugProcess = debugProcess;
     if (current) {
@@ -52,6 +53,21 @@
     }
   }
 
+  private static Icon calcIcon(ThreadReferenceProxyImpl threadProxy, boolean current) {
+    if (current) {
+      return AllIcons.Debugger.ThreadCurrent;
+    }
+    else if (threadProxy.getThreadReference().isAtBreakpoint()) {
+      return AllIcons.Debugger.ThreadAtBreakpoint;
+    }
+    else if (threadProxy.isSuspended()) {
+      return AllIcons.Debugger.ThreadSuspended;
+    }
+    else {
+      return AllIcons.Debugger.ThreadRunning;
+    }
+  }
+
   @NotNull
   public ThreadReferenceProxyImpl getThreadProxy() {
     return myThreadProxy;
@@ -148,4 +164,21 @@
     }
     return DebuggerBundle.message("label.thread.node", name, thread.uniqueID(), threadStatusText);
   }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+    if (o == null || getClass() != o.getClass()) return false;
+
+    JavaExecutionStack stack = (JavaExecutionStack)o;
+
+    if (!myThreadProxy.equals(stack.myThreadProxy)) return false;
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return myThreadProxy.hashCode();
+  }
 }
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java
index d6e7d2c..316c492 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java
@@ -163,9 +163,10 @@
     DebuggerManagerThreadImpl.assertIsManagerThread();
     DebuggerContextImpl context = myDebugProcess.getDebuggerContext();
     if (context.getFrameProxy() != getStackFrameProxy()) {
+      SuspendContextImpl threadSuspendContext = SuspendManagerUtil.getSuspendContextForThread(context.getSuspendContext(), getStackFrameProxy().threadProxy());
       context = DebuggerContextImpl.createDebuggerContext(
         myDebugProcess.mySession,
-        context.getSuspendContext(),
+        threadSuspendContext,
         getStackFrameProxy().threadProxy(),
         getStackFrameProxy());
       context.setPositionCache(mySourcePosition);
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java
index b48d580..d146196 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java
@@ -17,7 +17,6 @@
 
 import com.intellij.debugger.DebuggerInvocationUtil;
 import com.intellij.debugger.SourcePosition;
-import com.intellij.debugger.actions.JavaValueModifier;
 import com.intellij.debugger.actions.JumpToObjectAction;
 import com.intellij.debugger.engine.evaluation.EvaluateException;
 import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
@@ -27,13 +26,13 @@
 import com.intellij.debugger.engine.events.SuspendContextCommandImpl;
 import com.intellij.debugger.impl.DebuggerContextImpl;
 import com.intellij.debugger.impl.DebuggerUtilsEx;
+import com.intellij.debugger.ui.impl.DebuggerTreeRenderer;
 import com.intellij.debugger.ui.impl.watch.*;
 import com.intellij.debugger.ui.tree.*;
 import com.intellij.debugger.ui.tree.render.ArrayRenderer;
 import com.intellij.debugger.ui.tree.render.ChildrenBuilder;
 import com.intellij.debugger.ui.tree.render.DescriptorLabelListener;
 import com.intellij.debugger.ui.tree.render.NodeRenderer;
-import com.intellij.icons.AllIcons;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
@@ -41,7 +40,6 @@
 import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.PsiExpression;
-import com.intellij.util.PlatformIcons;
 import com.intellij.xdebugger.frame.*;
 import com.intellij.xdebugger.frame.presentation.XRegularValuePresentation;
 import com.intellij.xdebugger.frame.presentation.XStringValuePresentation;
@@ -103,31 +101,14 @@
     myEvaluationContext.getDebugProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(getDebuggerContext()) {
       @Override
       public void threadAction() {
-        Icon nodeIcon;
-        if (myValueDescriptor instanceof FieldDescriptorImpl && ((FieldDescriptorImpl)myValueDescriptor).isStatic()) {
-          nodeIcon = PlatformIcons.FIELD_ICON;
-        }
-        else if (myValueDescriptor.isArray()) {
-          nodeIcon = AllIcons.Debugger.Db_array;
-        }
-        else if (myValueDescriptor.isPrimitive()) {
-          nodeIcon = AllIcons.Debugger.Db_primitive;
-        }
-        else {
-          if (myValueDescriptor instanceof WatchItemDescriptor) {
-            nodeIcon = AllIcons.Debugger.Watch;
-          }
-          else {
-            Icon icon = myValueDescriptor.getValueIcon();
-            nodeIcon = icon != null ? icon : AllIcons.Debugger.Value;
-          }
-        }
+        Icon nodeIcon = DebuggerTreeRenderer.getValueIcon(myValueDescriptor);
         final String[] strings = splitValue(myValueDescriptor.getValueLabel());
-        XValuePresentation presentation = new XRegularValuePresentation(strings[1], strings[0]);
+        String value = StringUtil.notNullize(strings[1]);
+        XValuePresentation presentation = new XRegularValuePresentation(value, strings[0]);
         if (myValueDescriptor.isString()) {
-          presentation = new TypedStringValuePresentation(StringUtil.unquoteString(strings[1]), strings[0]);
+          presentation = new TypedStringValuePresentation(StringUtil.unquoteString(value), strings[0]);
         }
-        if (strings[1].length() > XValueNode.MAX_VALUE_LENGTH) {
+        if (value.length() > XValueNode.MAX_VALUE_LENGTH) {
           node.setFullValueEvaluator(new XFullValueEvaluator() {
             @Override
             public void startEvaluation(@NotNull final XFullValueEvaluationCallback callback) {
@@ -151,6 +132,10 @@
     });
   }
 
+  String getValueString() {
+    return splitValue(myValueDescriptor.getValueLabel())[1];
+  }
+
   private static class TypedStringValuePresentation extends XStringValuePresentation {
     private final String myType;
 
@@ -170,7 +155,7 @@
     if (StringUtil.startsWithChar(value, '{')) {
       int end = value.indexOf('}');
       if (end > 0) {
-        return new String[]{value.substring(1, end-1), value.substring(end+1)};
+        return new String[]{value.substring(1, end), value.substring(end+1)};
       }
     }
     return new String[]{null, value};
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaValueMarker.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaValueMarker.java
index 1791c24..be1b8fa 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaValueMarker.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaValueMarker.java
@@ -23,7 +23,7 @@
 /**
  * @author egor
  */
-public class JavaValueMarker extends XValueMarkerProvider<JavaValue, Long> {
+public class JavaValueMarker extends XValueMarkerProvider<JavaValue, ObjectReference> {
   public JavaValueMarker() {
     super(JavaValue.class);
   }
@@ -35,10 +35,10 @@
   }
 
   @Override
-  public Long getMarker(@NotNull JavaValue value) {
+  public ObjectReference getMarker(@NotNull JavaValue value) {
     Value obj = value.getDescriptor().getValue();
     if (obj instanceof ObjectReference) {
-      return ((ObjectReference)obj).uniqueID();
+      return ((ObjectReference)obj);
     }
     return null;
   }
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaValueModifier.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaValueModifier.java
new file mode 100644
index 0000000..713b4c9
--- /dev/null
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaValueModifier.java
@@ -0,0 +1,587 @@
+/*
+ * 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.debugger.engine;
+
+import com.intellij.debugger.DebuggerBundle;
+import com.intellij.debugger.DebuggerInvocationUtil;
+import com.intellij.debugger.DebuggerManagerEx;
+import com.intellij.debugger.engine.evaluation.*;
+import com.intellij.debugger.engine.evaluation.expression.*;
+import com.intellij.debugger.engine.events.DebuggerContextCommandImpl;
+import com.intellij.debugger.engine.events.SuspendContextCommandImpl;
+import com.intellij.debugger.impl.*;
+import com.intellij.debugger.jdi.LocalVariableProxyImpl;
+import com.intellij.debugger.jdi.VirtualMachineProxyImpl;
+import com.intellij.debugger.ui.DebuggerExpressionComboBox;
+import com.intellij.debugger.ui.EditorEvaluationCommand;
+import com.intellij.debugger.ui.impl.DebuggerTreeRenderer;
+import com.intellij.debugger.ui.impl.watch.*;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.progress.ProcessCanceledException;
+import com.intellij.openapi.progress.util.ProgressIndicatorListenerAdapter;
+import com.intellij.openapi.progress.util.ProgressWindowWithNotification;
+import com.intellij.openapi.ui.Messages;
+import com.intellij.psi.PsiDocumentManager;
+import com.intellij.psi.PsiFile;
+import com.intellij.ui.SimpleColoredComponent;
+import com.intellij.util.IJSwingUtilities;
+import com.intellij.xdebugger.frame.XValueModifier;
+import com.sun.jdi.*;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+
+/*
+ * Class SetValueAction
+ * @author Jeka
+ */
+public class JavaValueModifier extends XValueModifier {
+  private final JavaValue myJavaValue;
+
+  public JavaValueModifier(JavaValue javaValue) {
+    myJavaValue = javaValue;
+  }
+
+  @Nullable
+  @Override
+  public String getInitialValueEditorText() {
+    Value value = myJavaValue.getDescriptor().getValue();
+    if (value instanceof PrimitiveValue || value instanceof StringReference) {
+      return myJavaValue.getValueString();
+    }
+    return null;
+  }
+
+  //public void update(AnActionEvent e) {
+  //  boolean enable = false;
+  //  DebuggerTreeNodeImpl node = getSelectedNode(e.getDataContext());
+  //  if (node != null) {
+  //    NodeDescriptorImpl descriptor = node.getDescriptor();
+  //    if(descriptor instanceof ValueDescriptorImpl){
+  //      ValueDescriptorImpl valueDescriptor = ((ValueDescriptorImpl)descriptor);
+  //      enable = valueDescriptor.canSetValue();
+  //    }
+  //  }
+  //  e.getPresentation().setVisible(enable);
+  //}
+  //
+  private void update(final DebuggerContextImpl context) {
+    DebuggerInvocationUtil.swingInvokeLater(context.getProject(), new Runnable() {
+      public void run() {
+        final DebuggerSession session = context.getDebuggerSession();
+        if (session != null) {
+          session.refresh(false);
+        }
+      }
+    });
+    //node.setState(context);
+  }
+
+  @Override
+  public void setValue(@NotNull String expression, @NotNull XModificationCallback callback) {
+    final NodeDescriptorImpl descriptor = myJavaValue.getDescriptor();
+    if (!(descriptor instanceof ValueDescriptorImpl)) {
+      return;
+    }
+    if(!((ValueDescriptorImpl)descriptor).canSetValue()) {
+      return;
+    }
+
+    //final DebuggerTree tree = getTree(event.getDataContext());
+    //final DebuggerContextImpl debuggerContext = getDebuggerContext(event.getDataContext());
+    final DebuggerContextImpl debuggerContext = DebuggerManagerEx.getInstanceEx(myJavaValue.getProject()).getContext();
+    //tree.saveState(node);
+
+    if (descriptor instanceof FieldDescriptorImpl) {
+      FieldDescriptorImpl fieldDescriptor = (FieldDescriptorImpl)descriptor;
+      final Field field = fieldDescriptor.getField();
+      if (!field.isStatic()) {
+        final ObjectReference object = fieldDescriptor.getObject();
+        if (object != null) {
+          set(expression, callback, debuggerContext, new SetValueRunnable() {
+            public void setValue(EvaluationContextImpl evaluationContext, Value newValue)
+              throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
+              object.setValue(field, preprocessValue(evaluationContext, newValue, field.type()));
+              update(debuggerContext);
+            }
+
+            public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws
+                                                                                                      InvocationException,
+                                                                                                      ClassNotLoadedException,
+                                                                                                      IncompatibleThreadStateException,
+                                                                                                      InvalidTypeException,
+                                                                                                      EvaluateException {
+              return evaluationContext.getDebugProcess().loadClass(evaluationContext, className, field.declaringType().classLoader());
+            }
+          });
+        }
+      }
+      else {
+        // field is static
+        ReferenceType refType = field.declaringType();
+        if (refType instanceof ClassType) {
+          final ClassType classType = (ClassType)refType;
+          set(expression, callback, debuggerContext, new SetValueRunnable() {
+            public void setValue(EvaluationContextImpl evaluationContext, Value newValue)
+              throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
+              classType.setValue(field, preprocessValue(evaluationContext, newValue, field.type()));
+              update(debuggerContext);
+            }
+
+            public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws
+                                                                                                      InvocationException,
+                                                                                                      ClassNotLoadedException,
+                                                                                                      IncompatibleThreadStateException,
+                                                                                                      InvalidTypeException,
+                                                                                                      EvaluateException {
+              return evaluationContext.getDebugProcess().loadClass(evaluationContext, className,
+                                                                   field.declaringType().classLoader());
+            }
+          });
+        }
+      }
+    }
+    else if (descriptor instanceof LocalVariableDescriptorImpl) {
+      LocalVariableDescriptorImpl localDescriptor = (LocalVariableDescriptorImpl)descriptor;
+      final LocalVariableProxyImpl local = localDescriptor.getLocalVariable();
+      if (local != null) {
+        set(expression, callback, debuggerContext, new SetValueRunnable() {
+          public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException,
+                                                                                               InvalidTypeException,
+                                                                                               EvaluateException {
+            debuggerContext.getFrameProxy().setValue(local, preprocessValue(evaluationContext, newValue, local.getType()));
+            update(debuggerContext);
+          }
+
+          public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException,
+                                                                                                           ClassNotLoadedException,
+                                                                                                           IncompatibleThreadStateException,
+                                                                                                           InvalidTypeException,
+                                                                                                           EvaluateException {
+            return evaluationContext.getDebugProcess().loadClass(evaluationContext, className,
+                                                                 evaluationContext.getClassLoader());
+          }
+        });
+      }
+    }
+    else if (descriptor instanceof ArrayElementDescriptorImpl) {
+      final ArrayElementDescriptorImpl elementDescriptor = (ArrayElementDescriptorImpl)descriptor;
+      final ArrayReference array = elementDescriptor.getArray();
+      if (array != null) {
+        if (VirtualMachineProxyImpl.isCollected(array)) {
+          // will only be the case if debugger does not use ObjectReference.disableCollection() because of Patches.IBM_JDK_DISABLE_COLLECTION_BUG
+          Messages.showWarningDialog(myJavaValue.getProject(), DebuggerBundle.message("evaluation.error.array.collected") + "\n"+ DebuggerBundle.message("warning.recalculate"), DebuggerBundle.message("title.set.value"));
+          //node.getParent().calcValue();
+          return;
+        }
+        final ArrayType arrType = (ArrayType)array.referenceType();
+        set(expression, callback, debuggerContext, new SetValueRunnable() {
+          public void setValue(EvaluationContextImpl evaluationContext, Value newValue)
+            throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
+            array.setValue(elementDescriptor.getIndex(), preprocessValue(evaluationContext, newValue, arrType.componentType()));
+            update(debuggerContext);
+          }
+
+          public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException,
+                                                                                                           ClassNotLoadedException,
+                                                                                                           IncompatibleThreadStateException,
+                                                                                                           InvalidTypeException,
+                                                                                                           EvaluateException {
+            return evaluationContext.getDebugProcess().loadClass(evaluationContext, className, arrType.classLoader());
+          }
+        });
+      }
+    }
+    else if (descriptor instanceof EvaluationDescriptor) {
+      final EvaluationDescriptor evaluationDescriptor = (EvaluationDescriptor)descriptor;
+      if (evaluationDescriptor.canSetValue()) {
+        set(expression, callback, debuggerContext, new SetValueRunnable() {
+          public void setValue(EvaluationContextImpl evaluationContext, Value newValue)
+            throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
+            final Modifier modifier = evaluationDescriptor.getModifier();
+            modifier.setValue(preprocessValue(evaluationContext, newValue, modifier.getExpectedType()));
+            update(debuggerContext);
+          }
+
+          public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException,
+                                                                                                           ClassNotLoadedException,
+                                                                                                           IncompatibleThreadStateException,
+                                                                                                           InvalidTypeException,
+                                                                                                           EvaluateException {
+            return evaluationContext.getDebugProcess().loadClass(evaluationContext, className,
+                                                                 evaluationContext.getClassLoader());
+          }
+        });
+      }
+    }
+  }
+
+  private Value preprocessValue(EvaluationContextImpl context, Value value, Type varType) throws EvaluateException {
+    if (value != null && "java.lang.String".equals(varType.name()) && !(value instanceof StringReference)) {
+      String v = DebuggerUtilsEx.getValueAsString(context, value);
+      if (v != null) {
+        value = context.getSuspendContext().getDebugProcess().getVirtualMachineProxy().mirrorOf(v);
+      }
+    }
+    if(value instanceof DoubleValue) {
+      double dValue = ((DoubleValue) value).doubleValue();
+      if(varType instanceof FloatType && Float.MIN_VALUE <= dValue && dValue <= Float.MAX_VALUE){
+        value = context.getSuspendContext().getDebugProcess().getVirtualMachineProxy().mirrorOf((float)dValue);
+      }
+    }
+    if (value != null) {
+      if (varType instanceof PrimitiveType) {
+        if (!(value instanceof PrimitiveValue)) {
+          value = (Value)new UnBoxingEvaluator(new IdentityEvaluator(value)).evaluate(context);
+        }
+      }
+      else if (UnBoxingEvaluator.isTypeUnboxable(varType.name())) {
+        // variable is not primitive and boxing/unboxing is applicable
+        if (value instanceof PrimitiveValue) {
+          value = (Value)new BoxingEvaluator(new IdentityEvaluator(value)).evaluate(context);
+        }
+      }
+    }
+    return value;
+  }
+
+  private static interface SetValueRunnable {
+    void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException,
+                                                                                          InvalidTypeException,
+                                                                                          EvaluateException,
+                                                                                          IncompatibleThreadStateException;
+    ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws EvaluateException,
+                                                                                            InvocationException,
+                                                                                            ClassNotLoadedException,
+                                                                                            IncompatibleThreadStateException,
+                                                                                            InvalidTypeException;
+  }
+
+  private static void setValue(String expressionToShow, ExpressionEvaluator evaluator, EvaluationContextImpl evaluationContext, SetValueRunnable setValueRunnable) throws EvaluateException {
+    Value value;
+    try {
+      value = evaluator.evaluate(evaluationContext);
+
+      setValueRunnable.setValue(evaluationContext, value);
+    }
+    catch (IllegalArgumentException ex) {
+      throw EvaluateExceptionUtil.createEvaluateException(ex.getMessage());
+    }
+    catch (InvalidTypeException ex) {
+      throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.type.mismatch"));
+    }
+    catch (IncompatibleThreadStateException e) {
+      throw EvaluateExceptionUtil.createEvaluateException(e);
+    }
+    catch (ClassNotLoadedException ex) {
+      if (!evaluationContext.isAutoLoadClasses()) {
+        throw EvaluateExceptionUtil.createEvaluateException(ex);
+      }
+      final ReferenceType refType;
+      try {
+        refType = setValueRunnable.loadClass(evaluationContext, ex.className());
+        if (refType != null) {
+          //try again
+          setValue(expressionToShow, evaluator, evaluationContext, setValueRunnable);
+        }
+      }
+      catch (InvocationException e) {
+        throw EvaluateExceptionUtil.createEvaluateException(e);
+      }
+      catch (ClassNotLoadedException e) {
+        throw EvaluateExceptionUtil.createEvaluateException(e);
+      }
+      catch (IncompatibleThreadStateException e) {
+        throw EvaluateExceptionUtil.createEvaluateException(e);
+      }
+      catch (InvalidTypeException e) {
+        throw EvaluateExceptionUtil.createEvaluateException(e);
+      }
+      catch (ObjectCollectedException e) {
+        throw EvaluateExceptionUtil.OBJECT_WAS_COLLECTED;
+      }
+    }
+  }
+
+  private void set(@NotNull final String expression, final XModificationCallback callback, final DebuggerContextImpl debuggerContext, final SetValueRunnable setValueRunnable) {
+    final ProgressWindowWithNotification progressWindow = new ProgressWindowWithNotification(true, debuggerContext.getProject());
+    final EvaluationContextImpl evaluationContext = myJavaValue.getEvaluationContext();
+
+    SuspendContextCommandImpl askSetAction = new DebuggerContextCommandImpl(debuggerContext) {
+      public Priority getPriority() {
+        return Priority.HIGH;
+      }
+
+      public void threadAction() {
+        ExpressionEvaluator evaluator = null;
+        try {
+          evaluator = DebuggerInvocationUtil
+            .commitAndRunReadAction(evaluationContext.getProject(), new com.intellij.debugger.EvaluatingComputable<ExpressionEvaluator>() {
+              public ExpressionEvaluator compute() throws EvaluateException {
+                return EvaluatorBuilderImpl
+                  .build(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, expression), ContextUtil.getContextElement(evaluationContext),
+                         ContextUtil.getSourcePosition(evaluationContext));
+              }
+            });
+
+
+          setValue(expression, evaluator, evaluationContext, new SetValueRunnable() {
+            public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException,
+                                                                                                 InvalidTypeException,
+                                                                                                 EvaluateException,
+                                                                                                 IncompatibleThreadStateException {
+              if (!progressWindow.isCanceled()) {
+                setValueRunnable.setValue(evaluationContext, newValue);
+                //node.calcValue();
+              }
+            }
+
+            public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws
+                                                                                                      InvocationException,
+                                                                                                      ClassNotLoadedException,
+                                                                                                      EvaluateException,
+                                                                                                      IncompatibleThreadStateException,
+                                                                                                      InvalidTypeException {
+              return setValueRunnable.loadClass(evaluationContext, className);
+            }
+          });
+          callback.valueModified();
+        } catch (EvaluateException e) {
+          callback.errorOccurred(e.getMessage());
+        }
+        //String initialString = "";
+        //if (descriptor instanceof ValueDescriptorImpl) {
+        //  Value currentValue = ((ValueDescriptorImpl) descriptor).getValue();
+        //  if (currentValue instanceof StringReference) {
+        //    initialString = DebuggerUtilsEx.getValueOrErrorAsString(debuggerContext.createEvaluationContext(), currentValue);
+        //    initialString = initialString == null ? "" : "\"" + DebuggerUtilsEx.translateStringValue(initialString) + "\"";
+        //  }
+        //  else if (currentValue instanceof PrimitiveValue) {
+        //    ValueLabelRenderer renderer = ((ValueDescriptorImpl) descriptor).getRenderer(debuggerContext.getDebugProcess());
+        //    initialString = getDisplayableString((PrimitiveValue) currentValue, renderer instanceof NodeRenderer && HexRenderer.UNIQUE_ID.equals(renderer.getUniqueId()));
+        //  }
+        //
+        //  final String initialString1 = initialString;
+        //  final Project project = debuggerContext.getProject();
+        //  DebuggerInvocationUtil.swingInvokeLater(project, new Runnable() {
+        //    public void run() {
+        //      showEditor(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, initialString1), node, debuggerContext, setValueRunnable);
+        //    }
+        //  });
+        //}
+      }
+    };
+
+    progressWindow.setTitle(DebuggerBundle.message("title.evaluating"));
+    debuggerContext.getDebugProcess().getManagerThread().startProgress(askSetAction, progressWindow);
+  }
+
+  private void showEditor(final TextWithImports initialString,
+                          final DebuggerTreeNodeImpl node,
+                          final DebuggerContextImpl debuggerContext,
+                          final SetValueRunnable setValueRunnable) {
+    final JPanel editorPanel = new JPanel();
+    editorPanel.setLayout(new BoxLayout(editorPanel, BoxLayout.X_AXIS));
+    SimpleColoredComponent label = new SimpleColoredComponent();
+    label.setIcon(node.getIcon());
+    DebuggerTreeRenderer.getDescriptorTitle(debuggerContext, node.getDescriptor()).appendToComponent(label);
+    editorPanel.add(label);
+
+    final DebuggerExpressionComboBox comboBox = new DebuggerExpressionComboBox(
+      debuggerContext.getProject(),
+      PositionUtil.getContextElement(debuggerContext),
+      "setValue", DefaultCodeFragmentFactory.getInstance());
+    comboBox.setText(initialString);
+    comboBox.selectAll();
+    editorPanel.add(comboBox);
+
+    final DebuggerTreeInplaceEditor editor = new DebuggerTreeInplaceEditor(node) {
+      public JComponent createInplaceEditorComponent() {
+        return editorPanel;
+      }
+
+      public JComponent getPreferredFocusedComponent() {
+        return comboBox;
+      }
+
+      public Editor getEditor() {
+        return comboBox.getEditor();
+      }
+
+      public JComponent getEditorComponent() {
+        return comboBox.getEditorComponent();
+      }
+
+      private void flushValue() {
+        if (comboBox.isPopupVisible()) {
+          comboBox.selectPopupValue();
+        }
+
+        Editor editor = getEditor();
+        if(editor == null) {
+          return;
+        }
+
+        final TextWithImports text = comboBox.getText();
+
+        PsiFile psiFile = PsiDocumentManager.getInstance(debuggerContext.getProject()).getPsiFile(editor.getDocument());
+
+        final ProgressWindowWithNotification progressWindow = new ProgressWindowWithNotification(true, getProject());
+        EditorEvaluationCommand evaluationCommand = new EditorEvaluationCommand(getEditor(), psiFile, debuggerContext, progressWindow) {
+          public void threadAction() {
+            try {
+              evaluate();
+            }
+            catch(EvaluateException e) {
+              progressWindow.cancel();
+            }
+            catch(ProcessCanceledException e) {
+              progressWindow.cancel();
+            }
+            finally{
+              if (!progressWindow.isCanceled()) {
+                DebuggerInvocationUtil.swingInvokeLater(debuggerContext.getProject(), new Runnable() {
+                  public void run() {
+                    comboBox.addRecent(text);
+                    cancelEditing();
+                  }
+                });
+              }
+            }
+          }
+
+          protected Object evaluate(final EvaluationContextImpl evaluationContext) throws EvaluateException {
+            ExpressionEvaluator evaluator = DebuggerInvocationUtil.commitAndRunReadAction(evaluationContext.getProject(), new com.intellij.debugger.EvaluatingComputable<ExpressionEvaluator>() {
+              public ExpressionEvaluator compute() throws EvaluateException {
+                return EvaluatorBuilderImpl.build(text, ContextUtil.getContextElement(evaluationContext), ContextUtil.getSourcePosition(evaluationContext));
+              }
+            });
+
+            setValue(text.getText(), evaluator, evaluationContext, new SetValueRunnable() {
+              public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException,
+                                                                                                   InvalidTypeException,
+                                                                                                   EvaluateException,
+                                                                                                   IncompatibleThreadStateException {
+                if (!progressWindow.isCanceled()) {
+                  setValueRunnable.setValue(evaluationContext, newValue);
+                  node.calcValue();
+                }
+              }
+
+              public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws
+                                                                                                        InvocationException,
+                                                                                                        ClassNotLoadedException,
+                                                                                                        EvaluateException,
+                                                                                                        IncompatibleThreadStateException,
+                                                                                                        InvalidTypeException {
+                return setValueRunnable.loadClass(evaluationContext, className);
+              }
+            });
+
+            return null;
+          }
+        };
+
+        progressWindow.addListener(new ProgressIndicatorListenerAdapter() {
+          //should return whether to stop processing
+          public void stopped() {
+            if(!progressWindow.isCanceled()) {
+              IJSwingUtilities.invoke(new Runnable() {
+                public void run() {
+                  cancelEditing();
+                }
+              });
+            }
+          }
+
+
+        });
+
+        progressWindow.setTitle(DebuggerBundle.message("progress.set.value"));
+        debuggerContext.getDebugProcess().getManagerThread().startProgress(evaluationCommand, progressWindow);
+      }
+
+      public void cancelEditing() {
+        try {
+          super.cancelEditing();
+        }
+        finally {
+          comboBox.dispose();
+        }
+      }
+
+      public void doOKAction() {
+        try {
+          flushValue();
+        }
+        finally {
+          comboBox.dispose();
+        }
+      }
+
+    };
+
+    final DebuggerStateManager stateManager = DebuggerManagerEx.getInstanceEx(debuggerContext.getProject()).getContextManager();
+
+    stateManager.addListener(new DebuggerContextListener() {
+      public void changeEvent(DebuggerContextImpl newContext, int event) {
+        if (event != DebuggerSession.EVENT_THREADS_REFRESH) {
+          stateManager.removeListener(this);
+          editor.cancelEditing();
+        }
+      }
+    });
+
+    node.getTree().hideTooltip();
+
+    editor.show();
+  }
+
+  @SuppressWarnings({"HardCodedStringLiteral"})
+  private static String getDisplayableString(PrimitiveValue value, boolean showAsHex) {
+    if (value instanceof CharValue) {
+      long longValue = value.longValue();
+      return showAsHex ? "0x" + Long.toHexString(longValue).toUpperCase() : Long.toString(longValue);
+    }
+    if (value instanceof ByteValue) {
+      byte val = value.byteValue();
+      String strValue = Integer.toHexString(val).toUpperCase();
+      if (strValue.length() > 2) {
+        strValue = strValue.substring(strValue.length() - 2);
+      }
+      return showAsHex ? "0x" + strValue : value.toString();
+    }
+    if (value instanceof ShortValue) {
+      short val = value.shortValue();
+      String strValue = Integer.toHexString(val).toUpperCase();
+      if (strValue.length() > 4) {
+        strValue = strValue.substring(strValue.length() - 4);
+      }
+      return showAsHex ? "0x" + strValue : value.toString();
+    }
+    if (value instanceof IntegerValue) {
+      int val = value.intValue();
+      return showAsHex ? "0x" + Integer.toHexString(val).toUpperCase() : value.toString();
+    }
+    if (value instanceof LongValue) {
+      long val = value.longValue();
+      return showAsHex ? "0x" + Long.toHexString(val).toUpperCase() + "L" : value.toString() + "L";
+    }
+    return DebuggerUtilsEx.translateStringValue(value.toString());
+  }
+
+}
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java
index 2da1246..0e37ff3 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java
@@ -177,7 +177,16 @@
       return null;
     }
 
-    PsiClass psiClass = DebuggerUtils.findClass(refType.name(), project, myDebugProcess.getSearchScope());
+    final String originalQName = refType.name();
+    final GlobalSearchScope searchScope = myDebugProcess.getSearchScope();
+    PsiClass psiClass = DebuggerUtils.findClass(originalQName, project, searchScope); // try to lookup original name first
+    if (psiClass == null) {
+      int dollar = originalQName.indexOf('$');
+      if (dollar > 0) {
+        final String qName = originalQName.substring(0, dollar);
+        psiClass = DebuggerUtils.findClass(qName, project, searchScope);
+      }
+    }
 
     if (psiClass != null) {
       final PsiElement element = psiClass.getNavigationElement();
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/UnmuteOnStopAction.java b/java/debugger/impl/src/com/intellij/debugger/engine/UnmuteOnStopAction.java
deleted file mode 100644
index 310570d..0000000
--- a/java/debugger/impl/src/com/intellij/debugger/engine/UnmuteOnStopAction.java
+++ /dev/null
@@ -1,44 +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.debugger.engine;
-
-import com.intellij.debugger.DebuggerBundle;
-import com.intellij.debugger.settings.DebuggerSettings;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.ToggleAction;
-
-/**
-* @author egor
-*/
-class UnmuteOnStopAction extends ToggleAction {
-  private volatile boolean myUnmuteOnStop;
-
-  UnmuteOnStopAction() {
-    super(DebuggerBundle.message("action.unmute.on.stop.text"), DebuggerBundle.message("action.unmute.on.stop.text"), null);
-    myUnmuteOnStop = DebuggerSettings.getInstance().UNMUTE_ON_STOP;
-  }
-
-  @Override
-  public boolean isSelected(AnActionEvent e) {
-    return myUnmuteOnStop;
-  }
-
-  @Override
-  public void setSelected(AnActionEvent e, boolean state) {
-    myUnmuteOnStop = state;
-    DebuggerSettings.getInstance().UNMUTE_ON_STOP = state;
-  }
-}
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/CodeFragmentFactoryContextWrapper.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/CodeFragmentFactoryContextWrapper.java
index 805fd8b..7a709ae 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/CodeFragmentFactoryContextWrapper.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/CodeFragmentFactoryContextWrapper.java
@@ -15,10 +15,7 @@
  */
 package com.intellij.debugger.engine.evaluation;
 
-import com.intellij.debugger.DebuggerManagerEx;
-import com.intellij.debugger.engine.DebugProcessImpl;
 import com.intellij.debugger.engine.evaluation.expression.EvaluatorBuilder;
-import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
 import com.intellij.openapi.fileTypes.LanguageFileType;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Key;
@@ -29,13 +26,16 @@
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiLocalVariable;
 import com.intellij.util.StringBuilderSpinAllocator;
+import com.intellij.xdebugger.XDebugSession;
+import com.intellij.xdebugger.XDebuggerManager;
+import com.intellij.xdebugger.impl.XDebugSessionImpl;
+import com.intellij.xdebugger.impl.frame.XValueMarkers;
 import com.intellij.xdebugger.impl.ui.tree.ValueMarkup;
 import com.sun.jdi.ObjectCollectedException;
 import com.sun.jdi.ObjectReference;
 import com.sun.jdi.Value;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 /**
@@ -76,9 +76,11 @@
   private PsiElement wrapContext(Project project, final PsiElement originalContext) {
     if (project.isDefault()) return originalContext;
     PsiElement context = originalContext;
-    final DebugProcessImpl process = DebuggerManagerEx.getInstanceEx(project).getContext().getDebugProcess();
-    if (process != null) {
-      final Map<ObjectReference, ValueMarkup> markupMap = ValueDescriptorImpl.getMarkupMap(process);
+    XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
+    if (session != null) {
+      XValueMarkers<?, ?> markers = ((XDebugSessionImpl)session).getValueMarkers();
+      Map<?, ValueMarkup> markupMap = markers != null ? markers.getAllMarkers() : null;
+      //final Map<ObjectReference, ValueMarkup> markupMap = ValueDescriptorImpl.getMarkupMap(process);
       if (markupMap != null && markupMap.size() > 0) {
         final Pair<String, Map<String, ObjectReference>> markupVariables = createMarkupVariablesText(markupMap);
         int offset = markupVariables.getFirst().length() - 1;
@@ -99,13 +101,12 @@
     return context;
   }
   
-  private static Pair<String, Map<String, ObjectReference>> createMarkupVariablesText(Map<ObjectReference, ValueMarkup> markupMap) {
+  private static Pair<String, Map<String, ObjectReference>> createMarkupVariablesText(Map<?, ValueMarkup> markupMap) {
     final Map<String, ObjectReference> reverseMap = new HashMap<String, ObjectReference>();
     final StringBuilder buffer = StringBuilderSpinAllocator.alloc();
     try {
-      for (Iterator<Map.Entry<ObjectReference, ValueMarkup>> it = markupMap.entrySet().iterator(); it.hasNext();) {
-        Map.Entry<ObjectReference, ValueMarkup> entry = it.next();
-        final ObjectReference objectRef = entry.getKey();
+      for (Map.Entry<?, ValueMarkup> entry : markupMap.entrySet()) {
+        ObjectReference objectRef = (ObjectReference)entry.getKey();
         final ValueMarkup markup = entry.getValue();
         String labelName = markup.getText();
         if (!StringUtil.isJavaIdentifier(labelName)) {
@@ -121,7 +122,7 @@
           reverseMap.put(labelName, objectRef);
         }
         catch (ObjectCollectedException e) {
-          it.remove();
+          //it.remove();
         }
       }
       buffer.append(" ");
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/EvaluatorBuilderImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/EvaluatorBuilderImpl.java
index aa88a0b..d6975e6 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/EvaluatorBuilderImpl.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/EvaluatorBuilderImpl.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.
@@ -40,7 +40,6 @@
 import com.intellij.psi.tree.IElementType;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiTypesUtil;
-import com.intellij.psi.util.PsiUtil;
 import com.intellij.psi.util.TypeConversionUtil;
 import com.intellij.util.IncorrectOperationException;
 import com.sun.jdi.Value;
@@ -961,8 +960,7 @@
 
     @Override
     public void visitLiteralExpression(PsiLiteralExpression expression) {
-      final HighlightInfo parsingError = HighlightUtil.checkLiteralExpressionParsingError(expression, PsiUtil.getLanguageLevel(expression),
-                                                                                          expression.getContainingFile());
+      final HighlightInfo parsingError = HighlightUtil.checkLiteralExpressionParsingError(expression, null, null);
       if (parsingError != null) {
         throwEvaluateException(parsingError.getDescription());
         return;
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java
index ed1ad4c..d299af1 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java
@@ -30,10 +30,7 @@
 import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
 import com.intellij.debugger.impl.DebuggerUtilsEx;
 import com.intellij.openapi.diagnostic.Logger;
-import com.sun.jdi.ClassType;
-import com.sun.jdi.Method;
-import com.sun.jdi.ObjectReference;
-import com.sun.jdi.ReferenceType;
+import com.sun.jdi.*;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -129,7 +126,18 @@
       if (requiresSuperObject && (referenceType instanceof ClassType)) {
         _refType = ((ClassType)referenceType).superclass();
       }
-      final Method jdiMethod = DebuggerUtils.findMethod(_refType, myMethodName, signature);
+      Method jdiMethod = DebuggerUtils.findMethod(_refType, myMethodName, signature);
+      if (jdiMethod == null || jdiMethod.argumentTypes().size() != args.size()) {
+        // dummy matching, may be improved with types matching later
+        List<Method> methods = _refType.methodsByName(myMethodName);
+        for (Method method : methods) {
+          List<Type> types = method.argumentTypes();
+          if (types.size() == args.size()) {
+            jdiMethod = method;
+            break;
+          }
+        }
+      }
       if (jdiMethod == null) {
         throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.no.instance.method", methodName));
       }
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/UnBoxingEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/UnBoxingEvaluator.java
index d2e5dc3..c0d9e13 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/UnBoxingEvaluator.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/UnBoxingEvaluator.java
@@ -38,14 +38,14 @@
   private final Evaluator myOperand;
   private static final Map<String, Couple<String>> TYPES_TO_CONVERSION_METHOD_MAP = new HashMap<String, Couple<String>>();
   static {
-    TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Boolean", Couple.newOne("booleanValue", "()Z"));
-    TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Byte", Couple.newOne("byteValue", "()B"));
-    TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Character", Couple.newOne("charValue", "()C"));
-    TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Short", Couple.newOne("shortValue", "()S"));
-    TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Integer", Couple.newOne("intValue", "()I"));
-    TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Long", Couple.newOne("longValue", "()J"));
-    TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Float", Couple.newOne("floatValue", "()F"));
-    TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Double", Couple.newOne("doubleValue", "()D"));
+    TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Boolean", Couple.of("booleanValue", "()Z"));
+    TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Byte", Couple.of("byteValue", "()B"));
+    TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Character", Couple.of("charValue", "()C"));
+    TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Short", Couple.of("shortValue", "()S"));
+    TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Integer", Couple.of("intValue", "()I"));
+    TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Long", Couple.of("longValue", "()J"));
+    TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Float", Couple.of("floatValue", "()F"));
+    TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Double", Couple.of("doubleValue", "()D"));
   }
 
   public static boolean isTypeUnboxable(String typeName) {
diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerContextUtil.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerContextUtil.java
index b19a811..e75abd2 100644
--- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerContextUtil.java
+++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerContextUtil.java
@@ -16,6 +16,7 @@
 package com.intellij.debugger.impl;
 
 import com.intellij.debugger.engine.SuspendContextImpl;
+import com.intellij.debugger.engine.SuspendManagerUtil;
 import com.intellij.debugger.jdi.StackFrameProxyImpl;
 import com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl;
 import com.intellij.openapi.application.ApplicationManager;
@@ -30,7 +31,8 @@
     }
 
     final DebuggerSession session = context.getDebuggerSession();
-    final DebuggerContextImpl newContext = DebuggerContextImpl.createDebuggerContext(session, context.getSuspendContext(), stackFrame.threadProxy(), stackFrame);
+    SuspendContextImpl threadSuspendContext = SuspendManagerUtil.getSuspendContextForThread(context.getSuspendContext(), stackFrame.threadProxy());
+    final DebuggerContextImpl newContext = DebuggerContextImpl.createDebuggerContext(session, threadSuspendContext, stackFrame.threadProxy(), stackFrame);
 
     manager.setState(newContext, session != null? session.getState() : DebuggerSession.STATE_DISPOSED, DebuggerSession.EVENT_REFRESH, null);
   }
diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java
index 294d9de..e25c895 100644
--- a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java
+++ b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java
@@ -69,7 +69,6 @@
   public volatile boolean WATCH_RETURN_VALUES = false;
   public volatile boolean AUTO_VARIABLES_MODE = false;
   public volatile boolean SHOW_LIBRARY_STACKFRAMES = true;
-  public volatile boolean UNMUTE_ON_STOP = false;
 
   private ClassFilter[] mySteppingFilters = ClassFilter.EMPTY_ARRAY;
 
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
index 93b0e3c..7b4b22e 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
@@ -324,7 +324,6 @@
     }
     settings.add(new WatchLastMethodReturnValueAction());
     settings.add(new AutoVarsSwitchAction());
-    settings.add(new UnmuteOnStopAction());
     settings.addSeparator();
     addActionToGroup(settings, XDebuggerActions.AUTO_TOOLTIP);
 
@@ -597,24 +596,4 @@
       }
     }
   }
-
-  private class UnmuteOnStopAction extends ToggleAction {
-    private volatile boolean myUnmuteOnStop;
-
-    private UnmuteOnStopAction() {
-      super(DebuggerBundle.message("action.unmute.on.stop.text"), DebuggerBundle.message("action.unmute.on.stop.text"), null);
-      myUnmuteOnStop = DebuggerSettings.getInstance().UNMUTE_ON_STOP;
-    }
-
-    @Override
-    public boolean isSelected(AnActionEvent e) {
-      return myUnmuteOnStop;
-    }
-
-    @Override
-    public void setSelected(AnActionEvent e, boolean state) {
-      myUnmuteOnStop = state;
-      DebuggerSettings.getInstance().UNMUTE_ON_STOP = state;
-    }
-  }
 }
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapUIImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapUIImpl.java
index 71e5cfb..11df707 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapUIImpl.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapUIImpl.java
@@ -16,7 +16,6 @@
 package com.intellij.debugger.ui;
 
 import com.intellij.CommonBundle;
-import com.intellij.compiler.CompilerWorkspaceConfiguration;
 import com.intellij.debugger.DebuggerBundle;
 import com.intellij.debugger.DebuggerManager;
 import com.intellij.debugger.DebuggerManagerEx;
@@ -153,8 +152,7 @@
       return;
     }
 
-    final boolean isOutOfProcessMode = CompilerWorkspaceConfiguration.getInstance(myProject).useOutOfProcessBuild();
-    final boolean shouldPerformScan = !isOutOfProcessMode || generatedPaths == null;
+    final boolean shouldPerformScan = generatedPaths == null;
 
     final HotSwapProgressImpl findClassesProgress;
     if (shouldPerformScan) {
@@ -175,7 +173,7 @@
       public void run() {
         final Map<DebuggerSession, Map<String, HotSwapFile>> modifiedClasses;
         if (shouldPerformScan) {
-          modifiedClasses = scanForModifiedClassesWithProgress(sessions, findClassesProgress, !isOutOfProcessMode);
+          modifiedClasses = scanForModifiedClassesWithProgress(sessions, findClassesProgress, false);
         }
         else {
           final List<DebuggerSession> toScan = new ArrayList<DebuggerSession>();
@@ -189,7 +187,7 @@
             modifiedClasses.putAll(HotSwapManager.findModifiedClasses(toUseGenerated, generatedPaths));
           }
           if (!toScan.isEmpty()) {
-            modifiedClasses.putAll(scanForModifiedClassesWithProgress(toScan, findClassesProgress, !isOutOfProcessMode));
+            modifiedClasses.putAll(scanForModifiedClassesWithProgress(toScan, findClassesProgress, !true));
           }
         }
 
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/Breakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/Breakpoint.java
index f9974a6..3c78eae 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/Breakpoint.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/Breakpoint.java
@@ -47,6 +47,8 @@
 import com.intellij.xdebugger.breakpoints.XBreakpoint;
 import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
 import com.intellij.xdebugger.impl.XDebuggerHistoryManager;
+import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
+import com.intellij.xdebugger.impl.breakpoints.XBreakpointBase;
 import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl;
 import com.intellij.xdebugger.impl.breakpoints.ui.XBreakpointActionsPanel;
 import com.sun.jdi.*;
@@ -447,9 +449,8 @@
       if (logMessage != null && !logMessage.isEmpty()) {
         XExpressionImpl expression = XExpressionImpl.fromText(logMessage);
         XDebuggerHistoryManager.getInstance(myProject).addRecentExpression(XBreakpointActionsPanel.LOG_EXPRESSION_HISTORY_ID, expression);
-        if (Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "LOG_EXPRESSION_ENABLED"))) {
-          myXBreakpoint.setLogExpressionObject(expression);
-        }
+        myXBreakpoint.setLogExpressionObject(expression);
+        ((XBreakpointBase)myXBreakpoint).setLogExpressionEnabled(Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "LOG_EXPRESSION_ENABLED")));
       }
     }
     catch (Exception ignored) {
@@ -490,7 +491,7 @@
 
   protected boolean isLogExpressionEnabled() {
     XExpression expression = myXBreakpoint.getLogExpressionObject();
-    if (expression == null || expression.getExpression().isEmpty()) {
+    if (XDebuggerUtilImpl.isEmptyExpression(expression)) {
       return false;
     }
     return !getLogMessage().isEmpty();
@@ -608,7 +609,7 @@
 
   protected boolean isConditionEnabled() {
     XExpression condition = myXBreakpoint.getConditionExpression();
-    if (condition == null || condition.getExpression().isEmpty()) {
+    if (XDebuggerUtilImpl.isEmptyExpression(condition)) {
       return false;
     }
     return !getCondition().isEmpty();
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java
index 979e675..b8fa39e 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java
@@ -22,7 +22,6 @@
 
 import com.intellij.debugger.DebuggerBundle;
 import com.intellij.debugger.DebuggerInvocationUtil;
-import com.intellij.debugger.DebuggerManagerEx;
 import com.intellij.debugger.engine.BreakpointStepMethodFilter;
 import com.intellij.debugger.engine.DebugProcessImpl;
 import com.intellij.debugger.engine.requests.RequestManagerImpl;
@@ -112,10 +111,11 @@
     });
   }
 
-  private boolean checkAndNotifyPossiblySlowBreakpoint(XBreakpoint breakpoint) {
+  private static boolean checkAndNotifyPossiblySlowBreakpoint(XBreakpoint breakpoint) {
     if (breakpoint.isEnabled() &&
         (breakpoint.getType() instanceof JavaMethodBreakpointType || breakpoint.getType() instanceof JavaWildcardMethodBreakpointType)) {
-      XDebugSessionImpl.NOTIFICATION_GROUP.createNotification("Method breakpoints may dramatically slow down debugging", MessageType.WARNING).notify(myProject);
+      XDebugSessionImpl.NOTIFICATION_GROUP.createNotification("Method breakpoints may dramatically slow down debugging", MessageType.WARNING)
+        .notify(((XBreakpointBase)breakpoint).getProject());
       return true;
     }
     return false;
@@ -203,13 +203,12 @@
       return null;
     }
     XLineBreakpoint xLineBreakpoint = addXLineBreakpoint(JavaLineBreakpointType.class, document, lineIndex);
-    LineBreakpoint breakpoint = LineBreakpoint.create(myProject, xLineBreakpoint);
-    if (breakpoint == null) {
-      return null;
+    Breakpoint breakpoint = getJavaBreakpoint(xLineBreakpoint);
+    if (breakpoint instanceof LineBreakpoint) {
+      addBreakpoint(breakpoint);
+      return ((LineBreakpoint)breakpoint);
     }
-
-    addBreakpoint(breakpoint);
-    return breakpoint;
+    return null;
   }
 
   @Nullable
@@ -232,11 +231,14 @@
   public FieldBreakpoint addFieldBreakpoint(Document document, int lineIndex, String fieldName) {
     ApplicationManager.getApplication().assertIsDispatchThread();
     XLineBreakpoint xBreakpoint = addXLineBreakpoint(JavaFieldBreakpointType.class, document, lineIndex);
-    FieldBreakpoint fieldBreakpoint = FieldBreakpoint.create(myProject, fieldName, xBreakpoint);
-    if (fieldBreakpoint != null) {
-      addBreakpoint(fieldBreakpoint);
+    Breakpoint javaBreakpoint = getJavaBreakpoint(xBreakpoint);
+    if (javaBreakpoint instanceof FieldBreakpoint) {
+      FieldBreakpoint fieldBreakpoint = (FieldBreakpoint)javaBreakpoint;
+      fieldBreakpoint.setFieldName(fieldName);
+      addBreakpoint(javaBreakpoint);
+      return fieldBreakpoint;
     }
-    return fieldBreakpoint;
+    return null;
   }
 
   @NotNull
@@ -248,12 +250,18 @@
       public ExceptionBreakpoint compute() {
         XBreakpoint<JavaExceptionBreakpointProperties> xBreakpoint = XDebuggerManager.getInstance(myProject).getBreakpointManager()
           .addBreakpoint(type, new JavaExceptionBreakpointProperties(exceptionClassName, packageName));
-        ExceptionBreakpoint breakpoint = new ExceptionBreakpoint(myProject, exceptionClassName, packageName, xBreakpoint);
-        addBreakpoint(breakpoint);
-        if (LOG.isDebugEnabled()) {
-          LOG.debug("ExceptionBreakpoint Added");
+        Breakpoint javaBreakpoint = getJavaBreakpoint(xBreakpoint);
+        if (javaBreakpoint instanceof ExceptionBreakpoint) {
+          ExceptionBreakpoint exceptionBreakpoint = (ExceptionBreakpoint)javaBreakpoint;
+          exceptionBreakpoint.setQualifiedName(exceptionClassName);
+          exceptionBreakpoint.setPackageName(packageName);
+          addBreakpoint(exceptionBreakpoint);
+          if (LOG.isDebugEnabled()) {
+            LOG.debug("ExceptionBreakpoint Added");
+          }
+          return exceptionBreakpoint;
         }
-        return breakpoint;
+        return null;
       }
     });
   }
@@ -263,13 +271,12 @@
     ApplicationManager.getApplication().assertIsDispatchThread();
 
     XLineBreakpoint xBreakpoint = addXLineBreakpoint(JavaMethodBreakpointType.class, document, lineIndex);
-    MethodBreakpoint breakpoint = MethodBreakpoint.create(myProject, xBreakpoint);
-    if (breakpoint == null) {
-      return null;
+    Breakpoint javaBreakpoint = getJavaBreakpoint(xBreakpoint);
+    if (javaBreakpoint instanceof MethodBreakpoint) {
+      addBreakpoint(javaBreakpoint);
+      return (MethodBreakpoint)javaBreakpoint;
     }
-
-    addBreakpoint(breakpoint);
-    return breakpoint;
+    return null;
   }
 
   private <B extends XBreakpoint<?>> XLineBreakpoint addXLineBreakpoint(Class<? extends XBreakpointType<B,?>> typeCls, Document document, final int lineIndex) {
@@ -496,14 +503,8 @@
     return addXLineBreakpoint(typeCls, doc, line);
   }
 
-  public static void addBreakpointInt(@NotNull Breakpoint breakpoint) {
-    BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(breakpoint.getProject()).getBreakpointManager();
-    breakpointManager.addBreakpoint(breakpoint);
-  }
-
-  //used in Fabrique
-  public void addBreakpoint(@NotNull Breakpoint breakpoint) {
-    breakpoint.myXBreakpoint.putUserData(Breakpoint.DATA_KEY, breakpoint);
+  public static void addBreakpoint(@NotNull Breakpoint breakpoint) {
+    assert breakpoint.myXBreakpoint.getUserData(Breakpoint.DATA_KEY) == breakpoint;
     breakpoint.updateUI();
     checkAndNotifyPossiblySlowBreakpoint(breakpoint.myXBreakpoint);
   }
@@ -548,19 +549,17 @@
   }
 
   @Nullable
-  public static Breakpoint getJavaBreakpoint(@Nullable XBreakpoint xBreakpoint) {
+  public static Breakpoint getJavaBreakpoint(@Nullable final XBreakpoint xBreakpoint) {
     if (xBreakpoint == null) {
       return null;
     }
     Breakpoint breakpoint = xBreakpoint.getUserData(Breakpoint.DATA_KEY);
-    if (breakpoint != null) {
-      return breakpoint;
+    if (breakpoint == null && xBreakpoint.getType() instanceof JavaBreakpointType) {
+      Project project = ((XBreakpointBase)xBreakpoint).getProject();
+      breakpoint = ((JavaBreakpointType)xBreakpoint.getType()).createJavaBreakpoint(project, xBreakpoint);
+      xBreakpoint.putUserData(Breakpoint.DATA_KEY, breakpoint);
     }
-    Project project = ((XBreakpointBase)xBreakpoint).getProject();
-    if (xBreakpoint.getType() instanceof JavaBreakpointType) {
-      return ((JavaBreakpointType)xBreakpoint.getType()).createJavaBreakpoint(project, xBreakpoint);
-    }
-    return null;
+    return breakpoint;
   }
 
   //interaction with RequestManagerImpl
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/ExceptionBreakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/ExceptionBreakpoint.java
index 96ee1cd..88ddf48 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/ExceptionBreakpoint.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/ExceptionBreakpoint.java
@@ -264,11 +264,11 @@
     return getProperties().myQualifiedName;
   }
 
-  private void setQualifiedName(String qualifiedName) {
+  void setQualifiedName(String qualifiedName) {
     getProperties().myQualifiedName = qualifiedName;
   }
 
-  private void setPackageName(String packageName) {
+  void setPackageName(String packageName) {
     getProperties().myPackageName = packageName;
   }
 }
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FieldBreakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FieldBreakpoint.java
index 707b185..664e6ff 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FieldBreakpoint.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FieldBreakpoint.java
@@ -406,7 +406,7 @@
     return getProperties().WATCH_ACCESS;
   }
 
-  private void setFieldName(String fieldName) {
+  void setFieldName(String fieldName) {
     getProperties().myFieldName = fieldName;
   }
 }
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FilteredRequestorImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FilteredRequestorImpl.java
index baa6e57..c764099 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FilteredRequestorImpl.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FilteredRequestorImpl.java
@@ -30,6 +30,7 @@
 import com.intellij.psi.PsiElement;
 import com.intellij.ui.classFilter.ClassFilter;
 import com.intellij.xdebugger.impl.XDebuggerHistoryManager;
+import com.intellij.xdebugger.impl.breakpoints.XBreakpointBase;
 import com.intellij.xdebugger.impl.breakpoints.ui.XLightBreakpointPropertiesPanel;
 import com.sun.jdi.event.LocatableEvent;
 import org.jdom.Element;
@@ -131,7 +132,8 @@
     breakpoint.setCountFilterEnabled(COUNT_FILTER_ENABLED);
     breakpoint.setCountFilter(COUNT_FILTER);
 
-    breakpoint.setCondition(CONDITION_ENABLED ? myCondition : null);
+    breakpoint.setCondition(myCondition);
+    ((XBreakpointBase)breakpoint.myXBreakpoint).setConditionEnabled(CONDITION_ENABLED);
     if (myCondition != null && !myCondition.isEmpty()) {
       XDebuggerHistoryManager.getInstance(myProject).addRecentExpression(XLightBreakpointPropertiesPanel.CONDITION_HISTORY_ID, TextWithImportsImpl.toXExpression(myCondition));
     }
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreeRenderer.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreeRenderer.java
index fe69418..ae2f2c1 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreeRenderer.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreeRenderer.java
@@ -69,31 +69,7 @@
       nodeIcon = stackDescriptor.getIcon();
     }
     else if (descriptor instanceof ValueDescriptorImpl) {
-      final ValueDescriptorImpl valueDescriptor = (ValueDescriptorImpl)descriptor;
-      if (valueDescriptor instanceof FieldDescriptorImpl && ((FieldDescriptorImpl)valueDescriptor).isStatic()) {
-        nodeIcon = PlatformIcons.FIELD_ICON;
-      }
-      else if (valueDescriptor.isArray()) {
-        nodeIcon = AllIcons.Debugger.Db_array;
-      }
-      else if (valueDescriptor.isPrimitive()) {
-        nodeIcon = AllIcons.Debugger.Db_primitive;
-      }
-      else {
-        if (valueDescriptor instanceof WatchItemDescriptor) {
-          nodeIcon = AllIcons.Debugger.Watch;
-        }
-        else {
-          nodeIcon = AllIcons.Debugger.Value;
-        }
-      }
-      final Icon valueIcon = valueDescriptor.getValueIcon();
-      if (nodeIcon != null && valueIcon != null) {
-        final RowIcon composite = new RowIcon(2);
-        composite.setIcon(nodeIcon, 0);
-        composite.setIcon(valueIcon, 1);
-        nodeIcon = composite;
-      }
+      nodeIcon = getValueIcon((ValueDescriptorImpl)descriptor);
     }
     else if (descriptor instanceof MessageDescriptor) {
       MessageDescriptor messageDescriptor = (MessageDescriptor)descriptor;
@@ -114,6 +90,35 @@
     return nodeIcon;
   }
 
+  public static Icon getValueIcon(ValueDescriptorImpl valueDescriptor) {
+    Icon nodeIcon;
+    if (valueDescriptor instanceof FieldDescriptorImpl && ((FieldDescriptorImpl)valueDescriptor).isStatic()) {
+      nodeIcon = PlatformIcons.FIELD_ICON;
+    }
+    else if (valueDescriptor.isArray()) {
+      nodeIcon = AllIcons.Debugger.Db_array;
+    }
+    else if (valueDescriptor.isPrimitive()) {
+      nodeIcon = AllIcons.Debugger.Db_primitive;
+    }
+    else {
+      if (valueDescriptor instanceof WatchItemDescriptor) {
+        nodeIcon = AllIcons.Debugger.Watch;
+      }
+      else {
+        nodeIcon = AllIcons.Debugger.Value;
+      }
+    }
+    final Icon valueIcon = valueDescriptor.getValueIcon();
+    if (nodeIcon != null && valueIcon != null) {
+      final RowIcon composite = new RowIcon(2);
+      composite.setIcon(nodeIcon, 0);
+      composite.setIcon(valueIcon, 1);
+      nodeIcon = composite;
+    }
+    return nodeIcon;
+  }
+
   @NotNull
   public static EditorColorsScheme getColorScheme(@Nullable JComponent component) {
     EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java
index 2b6f292..28062f0 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java
@@ -32,7 +32,10 @@
 import com.intellij.ui.FileColorManager;
 import com.intellij.util.StringBuilderSpinAllocator;
 import com.intellij.util.ui.TextTransferable;
+import com.intellij.xdebugger.XDebugSession;
 import com.intellij.xdebugger.frame.XStackFrame;
+import com.intellij.xdebugger.impl.XDebugSessionImpl;
+import com.intellij.xdebugger.impl.frame.XValueMarkers;
 import com.intellij.xdebugger.impl.ui.tree.ValueMarkup;
 import com.sun.jdi.*;
 import org.jetbrains.annotations.NotNull;
@@ -40,7 +43,6 @@
 
 import javax.swing.*;
 import java.awt.*;
-import java.util.Map;
 
 /**
  * Nodes of this type cannot be updated, because StackFrame objects become invalid as soon as VM has been resumed
@@ -146,9 +148,15 @@
   @Nullable
   public ValueMarkup getValueMarkup() {
     if (myThisObject != null) {
-      final Map<ObjectReference, ValueMarkup> markupMap = getMarkupMap(myFrame.getVirtualMachine().getDebugProcess());
-      if (markupMap != null) {
-        return markupMap.get(myThisObject);
+      DebugProcess process = myFrame.getVirtualMachine().getDebugProcess();
+      if (process instanceof DebugProcessImpl) {
+        XDebugSession session = ((DebugProcessImpl)process).getSession().getXDebugSession();
+        if (session instanceof XDebugSessionImpl) {
+          XValueMarkers<?, ?> markers = ((XDebugSessionImpl)session).getValueMarkers();
+          if (markers != null) {
+            return markers.getAllMarkers().get(myThisObject);
+          }
+        }
       }
     }
     return null;
diff --git a/java/debugger/impl/src/org/jetbrains/java/debugger/JavaDebuggerEditorsProvider.java b/java/debugger/impl/src/org/jetbrains/java/debugger/JavaDebuggerEditorsProvider.java
index 69419f7..8c85e49 100644
--- a/java/debugger/impl/src/org/jetbrains/java/debugger/JavaDebuggerEditorsProvider.java
+++ b/java/debugger/impl/src/org/jetbrains/java/debugger/JavaDebuggerEditorsProvider.java
@@ -1,6 +1,7 @@
 package org.jetbrains.java.debugger;
 
 import com.intellij.debugger.engine.evaluation.CodeFragmentFactory;
+import com.intellij.debugger.engine.evaluation.CodeFragmentFactoryContextWrapper;
 import com.intellij.debugger.engine.evaluation.TextWithImports;
 import com.intellij.debugger.engine.evaluation.TextWithImportsImpl;
 import com.intellij.debugger.impl.DebuggerUtilsEx;
@@ -72,7 +73,7 @@
                                                  boolean isPhysical) {
     TextWithImports text = TextWithImportsImpl.fromXExpression(expression);
     if (text != null && context != null) {
-      CodeFragmentFactory factory = DebuggerEditorImpl.findAppropriateFactory(text, context);
+      CodeFragmentFactory factory = new CodeFragmentFactoryContextWrapper(DebuggerEditorImpl.findAppropriateFactory(text, context));
       JavaCodeFragment codeFragment = factory.createPresentationCodeFragment(text, context, project);
       codeFragment.forceResolveScope(GlobalSearchScope.allScope(project));
       if (context != null) {
diff --git a/java/execution/openapi/src/com/intellij/execution/filters/ExceptionExFilterFactory.java b/java/execution/openapi/src/com/intellij/execution/filters/ExceptionExFilterFactory.java
index 9b42c38..722fb06 100644
--- a/java/execution/openapi/src/com/intellij/execution/filters/ExceptionExFilterFactory.java
+++ b/java/execution/openapi/src/com/intellij/execution/filters/ExceptionExFilterFactory.java
@@ -86,7 +86,7 @@
             worker.execute(text, lineEndOffset);
             Result result = worker.getResult();
             if (result == null) continue;
-            HyperlinkInfo hyperlinkInfo = result.hyperlinkInfo;
+            HyperlinkInfo hyperlinkInfo = result.getHyperlinkInfo();
             if (!(hyperlinkInfo instanceof FileHyperlinkInfo)) continue;
 
             OpenFileDescriptor descriptor = ((FileHyperlinkInfo)hyperlinkInfo).getDescriptor();
diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSettingsStep.java b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSettingsStep.java
index b964013..3c9af05 100644
--- a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSettingsStep.java
+++ b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSettingsStep.java
@@ -88,6 +88,7 @@
 
     myFormatPanel = new ProjectFormatPanel();
     myNamePathComponent = NamePathComponent.initNamePathComponent(context);
+    myNamePathComponent.setShouldBeAbsolute(true);
     if (context.isCreatingNewProject()) {
       mySettingsPanel.add(myNamePathComponent, BorderLayout.NORTH);
       addExpertPanel(myModulePanel);
diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworksTree.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworksTree.java
index b7a4e12..af7cef1 100644
--- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworksTree.java
+++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworksTree.java
@@ -41,6 +41,7 @@
     super(new FrameworksTreeRenderer(model), new CheckedTreeNode(), new CheckPolicy(false, true, true, false));
     setRootVisible(false);
     setShowsRootHandles(false);
+    setRowHeight(0);
     putClientProperty("JTree.lineStyle", "None");
   }
 
diff --git a/java/idea-ui/src/com/intellij/ide/util/projectWizard/NamePathComponent.java b/java/idea-ui/src/com/intellij/ide/util/projectWizard/NamePathComponent.java
index 6602053..d76fa74 100644
--- a/java/idea-ui/src/com/intellij/ide/util/projectWizard/NamePathComponent.java
+++ b/java/idea-ui/src/com/intellij/ide/util/projectWizard/NamePathComponent.java
@@ -59,6 +59,7 @@
   private JLabel myNameLabel;
   private JLabel myPathLabel;
   private boolean myForceSync;
+  private boolean myShouldBeAbsolute;
 
   public NamePathComponent(String nameLabelText, String pathLabelText, char nameMnemonic, char locationMnemonic, final String pathChooserTitle, final String pathChooserDescription) {
     this(nameLabelText, pathLabelText, pathChooserTitle, pathChooserDescription, true);
@@ -159,7 +160,9 @@
     if (projectFileDirectory.length() == 0) {
       throw new ConfigurationException(IdeBundle.message("prompt.enter.project.file.location", context.getPresentationName()));
     }
-
+    if (myShouldBeAbsolute && !new File(projectFileDirectory).isAbsolute()) {
+      throw new ConfigurationException(StringUtil.capitalize(IdeBundle.message("file.location.should.be.absolute", context.getPresentationName())));
+    }
     final boolean shouldPromptCreation = isPathChangedByUser();
     if (!ProjectWizardUtil
       .createDirectoryIfNotExists(IdeBundle.message("directory.project.file.directory", context.getPresentationName()),
@@ -297,6 +300,10 @@
     myTfPath.getDocument().addDocumentListener(adapter);
   }
 
+  public void setShouldBeAbsolute(boolean shouldBeAbsolute) {
+    myShouldBeAbsolute = shouldBeAbsolute;
+  }
+
   private class NameFieldDocument extends PlainDocument {
     public NameFieldDocument() {
       addDocumentListener(new DocumentAdapter() {
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModulesConfigurator.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModulesConfigurator.java
index 7edad1d..3bda0d5 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModulesConfigurator.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModulesConfigurator.java
@@ -116,7 +116,9 @@
 
         myModuleModel.dispose();
 
-        myFacetsConfigurator.disposeEditors();
+        if (myFacetsConfigurator != null) {
+          myFacetsConfigurator.disposeEditors();
+        }
       }
     });
 
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/actions/NewModuleInGroupAction.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/actions/NewModuleInGroupAction.java
index 68f2460..8f9453b 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/actions/NewModuleInGroupAction.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/actions/NewModuleInGroupAction.java
@@ -17,7 +17,7 @@
 
 import com.intellij.ide.projectView.impl.ModuleGroup;
 import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.DataKeys;
+import com.intellij.openapi.actionSystem.LangDataKeys;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.impl.ModuleManagerImpl;
 
@@ -29,7 +29,7 @@
   public void update(final AnActionEvent e) {
     super.update(e);
     final ModuleGroup[] moduleGroups = ModuleGroup.ARRAY_DATA_KEY.getData(e.getDataContext());
-    final Module[] modules = e.getData(DataKeys.MODULE_CONTEXT_ARRAY);
+    final Module[] modules = e.getData(LangDataKeys.MODULE_CONTEXT_ARRAY);
     e.getPresentation().setVisible((moduleGroups != null && moduleGroups.length > 0) ||
                                    (modules != null && modules.length > 0));
   }
diff --git a/java/java-analysis-api/src/com/intellij/codeInsight/intention/QuickFixFactory.java b/java/java-analysis-api/src/com/intellij/codeInsight/intention/QuickFixFactory.java
index 1762179..1a54284 100644
--- a/java/java-analysis-api/src/com/intellij/codeInsight/intention/QuickFixFactory.java
+++ b/java/java-analysis-api/src/com/intellij/codeInsight/intention/QuickFixFactory.java
@@ -16,10 +16,12 @@
 package com.intellij.codeInsight.intention;
 
 import com.intellij.codeInsight.daemon.QuickFixActionRegistrar;
+import com.intellij.codeInspection.IntentionAndQuickFixAction;
 import com.intellij.codeInspection.LocalQuickFix;
 import com.intellij.codeInspection.LocalQuickFixAndIntentionActionOnPsiElement;
 import com.intellij.codeInspection.LocalQuickFixOnPsiElement;
 import com.intellij.openapi.components.ServiceManager;
+import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.Project;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
@@ -28,6 +30,7 @@
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import java.util.Collection;
 import java.util.List;
 
 /**
@@ -131,7 +134,8 @@
 
   @NotNull public abstract IntentionAction createRemoveParameterListFix(@NotNull PsiMethod parent);
 
-  @NotNull public abstract IntentionAction createShowModulePropertiesFix(@NotNull PsiElement element);
+  @NotNull public abstract IntentionAndQuickFixAction createShowModulePropertiesFix(@NotNull PsiElement element);
+  @NotNull public abstract IntentionAndQuickFixAction createShowModulePropertiesFix(@NotNull Module module);
 
   @NotNull public abstract IntentionAction createIncreaseLanguageLevelFix(@NotNull LanguageLevel level);
 
@@ -251,4 +255,11 @@
   @Nullable
   public abstract List<LocalQuickFix> registerOrderEntryFixes(@NotNull QuickFixActionRegistrar registrar,
                                                                                           @NotNull PsiReference reference);
+
+  @NotNull
+  public abstract IntentionAction createAddMissingRequiredAnnotationParametersFix(@NotNull PsiAnnotation annotation,
+                                                                                  @NotNull PsiMethod[] annotationMethods,
+                                                                                  @NotNull Collection<String> missedElements);
+  @NotNull
+  public abstract IntentionAction createSurroundWithQuotesAnnotationParameterValueFix(@NotNull PsiAnnotationMemberValue value, @NotNull PsiType expectedType);
 }
diff --git a/java/java-analysis-api/src/com/intellij/codeInspection/BaseJavaLocalInspectionTool.java b/java/java-analysis-api/src/com/intellij/codeInspection/BaseJavaLocalInspectionTool.java
new file mode 100644
index 0000000..ab807d6
--- /dev/null
+++ b/java/java-analysis-api/src/com/intellij/codeInspection/BaseJavaLocalInspectionTool.java
@@ -0,0 +1,53 @@
+/*
+ * 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.codeInspection;
+
+import com.intellij.codeInsight.daemon.HighlightDisplayKey;
+import com.intellij.psi.PsiElement;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Implement this abstract class in order to provide new inspection tool functionality. The major API limitation here is
+ * subclasses should be stateless. Thus <code>check&lt;XXX&gt;</code> methods will be called in no particular order and
+ * instances of this class provided by {@link InspectionToolProvider#getInspectionClasses()} will be created on demand.
+ * The other important thing is problem anchors (PsiElements) reported by <code>check&lt;XXX&gt;</code> methods should
+ * lie under corresponding first parameter of one method.
+ *
+ * @see GlobalInspectionTool
+ *
+ * Please note that if your inspection/fixes/suppressions don't need UI components (e.g. Editor) to run, consider using
+ * {@link BaseJavaBatchLocalInspectionTool} instead.
+ */
+public abstract class BaseJavaLocalInspectionTool extends AbstractBaseJavaLocalInspectionTool implements CustomSuppressableInspectionTool {
+  @Override
+  public SuppressIntentionAction[] getSuppressActions(final PsiElement element) {
+    String shortName = getShortName();
+    HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
+    if (key == null) {
+      throw new AssertionError("HighlightDisplayKey.find(" + shortName + ") is null. Inspection: "+getClass());
+    }
+    return SuppressManager.getInstance().createSuppressActions(key);
+  }
+
+  @Override
+  public boolean isSuppressedFor(@NotNull PsiElement element) {
+    return isSuppressedFor(element, this);
+  }
+
+  public static boolean isSuppressedFor(@NotNull PsiElement element, @NotNull LocalInspectionTool tool) {
+    return BaseJavaBatchLocalInspectionTool.isSuppressedFor(element, tool);
+  }
+}
diff --git a/java/java-analysis-api/src/com/intellij/codeInspection/GlobalJavaInspectionTool.java b/java/java-analysis-api/src/com/intellij/codeInspection/GlobalJavaInspectionTool.java
new file mode 100644
index 0000000..1d9ff9c
--- /dev/null
+++ b/java/java-analysis-api/src/com/intellij/codeInspection/GlobalJavaInspectionTool.java
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+/*
+ * User: anna
+ * Date: 19-Dec-2007
+ */
+package com.intellij.codeInspection;
+
+import com.intellij.codeInsight.daemon.HighlightDisplayKey;
+import com.intellij.codeInspection.reference.RefManager;
+import com.intellij.psi.PsiElement;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public abstract class GlobalJavaInspectionTool extends GlobalInspectionTool implements CustomSuppressableInspectionTool {
+  @Override
+  public boolean queryExternalUsagesRequests(@NotNull final InspectionManager manager,
+                                             @NotNull final GlobalInspectionContext globalContext,
+                                             @NotNull final ProblemDescriptionsProcessor problemDescriptionsProcessor) {
+    return queryExternalUsagesRequests(globalContext.getRefManager(), globalContext.getExtension(GlobalJavaInspectionContext.CONTEXT), problemDescriptionsProcessor);
+  }
+
+  protected boolean queryExternalUsagesRequests(@NotNull RefManager manager, @NotNull GlobalJavaInspectionContext globalContext, @NotNull ProblemDescriptionsProcessor processor) {
+    return false;
+  }
+
+  @Override
+  @Nullable
+  public SuppressIntentionAction[] getSuppressActions(final PsiElement element) {
+    return SuppressManager.getInstance().createSuppressActions(HighlightDisplayKey.find(getShortName()));
+  }
+
+  @Override
+  public boolean isSuppressedFor(@NotNull final PsiElement element) {
+    return SuppressManager.getInstance().isSuppressedFor(element, getShortName());
+  }
+}
\ No newline at end of file
diff --git a/java/java-analysis-api/src/com/intellij/codeInspection/HTMLJavaHTMLComposer.java b/java/java-analysis-api/src/com/intellij/codeInspection/HTMLJavaHTMLComposer.java
new file mode 100644
index 0000000..fca6423
--- /dev/null
+++ b/java/java-analysis-api/src/com/intellij/codeInspection/HTMLJavaHTMLComposer.java
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+/*
+ * User: anna
+ * Date: 19-Dec-2007
+ */
+package com.intellij.codeInspection;
+
+import com.intellij.codeInspection.lang.HTMLComposerExtension;
+import com.intellij.codeInspection.reference.RefClass;
+import com.intellij.codeInspection.reference.RefMethod;
+import com.intellij.lang.Language;
+import com.intellij.lang.java.JavaLanguage;
+import com.intellij.openapi.util.Key;
+
+public abstract class HTMLJavaHTMLComposer implements HTMLComposerExtension<HTMLJavaHTMLComposer> {
+  public static final Key<HTMLJavaHTMLComposer> COMPOSER = Key.create("HTMLJavaComposer");
+
+  public abstract void appendClassOrInterface(StringBuffer buf, RefClass refClass, boolean capitalizeFirstLetter);
+
+  public static String getClassOrInterface(RefClass refClass, boolean capitalizeFirstLetter) {
+    if (refClass.isInterface()) {
+      return capitalizeFirstLetter ? InspectionsBundle.message("inspection.export.results.capitalized.interface") : InspectionsBundle.message("inspection.export.results.interface");
+    }
+    else if (refClass.isAbstract()) {
+      return capitalizeFirstLetter ? InspectionsBundle.message("inspection.export.results.capitalized.abstract.class") : InspectionsBundle.message("inspection.export.results.abstract.class");
+    }
+    else {
+      return capitalizeFirstLetter ? InspectionsBundle.message("inspection.export.results.capitalized.class") : InspectionsBundle.message("inspection.export.results.class");
+    }
+  }
+
+  public abstract void appendClassExtendsImplements(StringBuffer buf, RefClass refClass);
+
+  public abstract void appendDerivedClasses(StringBuffer buf, RefClass refClass);
+
+  public abstract void appendLibraryMethods(StringBuffer buf, RefClass refClass);
+
+  public abstract void appendSuperMethods(StringBuffer buf, RefMethod refMethod);
+
+  public abstract void appendDerivedMethods(StringBuffer buf, RefMethod refMethod);
+
+  public abstract void appendTypeReferences(StringBuffer buf, RefClass refClass);
+
+  @Override
+  public Key<HTMLJavaHTMLComposer> getID() {
+    return COMPOSER;
+  }
+
+  @Override
+  public Language getLanguage() {
+    return JavaLanguage.INSTANCE;
+  }
+}
\ No newline at end of file
diff --git a/java/java-analysis-api/src/com/intellij/codeInspection/SuppressManager.java b/java/java-analysis-api/src/com/intellij/codeInspection/SuppressManager.java
new file mode 100644
index 0000000..2eaa94b
--- /dev/null
+++ b/java/java-analysis-api/src/com/intellij/codeInspection/SuppressManager.java
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+/*
+ * User: anna
+ * Date: 24-Dec-2007
+ */
+package com.intellij.codeInspection;
+
+import com.intellij.codeInsight.daemon.HighlightDisplayKey;
+import com.intellij.openapi.components.ServiceManager;
+import com.intellij.psi.PsiAnnotation;
+import com.intellij.psi.PsiCodeBlock;
+import com.intellij.psi.PsiField;
+import com.intellij.psi.PsiLiteralExpression;
+import com.intellij.psi.util.PsiTreeUtil;
+import org.jetbrains.annotations.NotNull;
+
+public abstract class SuppressManager implements BatchSuppressManager {
+
+  public static SuppressManager getInstance() {
+    return ServiceManager.getService(SuppressManager.class);
+  }
+
+  public static boolean isSuppressedInspectionName(PsiLiteralExpression expression) {
+    PsiAnnotation annotation = PsiTreeUtil.getParentOfType(expression, PsiAnnotation.class, true, PsiCodeBlock.class, PsiField.class);
+    return annotation != null && SUPPRESS_INSPECTIONS_ANNOTATION_NAME.equals(annotation.getQualifiedName());
+  }
+
+  @NotNull
+  @Override
+  public SuppressQuickFix[] createBatchSuppressActions(@NotNull HighlightDisplayKey key) {
+    return BatchSuppressManager.SERVICE.getInstance().createBatchSuppressActions(key);
+  }
+
+  @NotNull
+  public abstract SuppressIntentionAction[] createSuppressActions(@NotNull HighlightDisplayKey key);
+}
\ No newline at end of file
diff --git a/java/java-analysis-api/src/com/intellij/openapi/module/LanguageLevelUtil.java b/java/java-analysis-api/src/com/intellij/openapi/module/LanguageLevelUtil.java
index 39028e7..08d1133 100644
--- a/java/java-analysis-api/src/com/intellij/openapi/module/LanguageLevelUtil.java
+++ b/java/java-analysis-api/src/com/intellij/openapi/module/LanguageLevelUtil.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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,8 +24,11 @@
  * @author yole
  */
 public class LanguageLevelUtil extends EffectiveLanguageLevelUtil {
-  private LanguageLevelUtil() { }
-
+  /**
+   * @deprecated use JavaPsiImplementationHelper#getEffectiveLanguageLevel(com.intellij.openapi.vfs.VirtualFile)
+   * todo remove in IDEA 15
+   */
+  @SuppressWarnings({"deprecation", "UnusedDeclaration"})
   @NotNull
   public static LanguageLevel getLanguageLevelForFile(@Nullable VirtualFile file) {
     if (file == null) return LanguageLevel.HIGHEST;
diff --git a/java/java-analysis-impl/src/com/intellij/analysis/JavaAnalysisScope.java b/java/java-analysis-impl/src/com/intellij/analysis/JavaAnalysisScope.java
new file mode 100644
index 0000000..c69b373
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/analysis/JavaAnalysisScope.java
@@ -0,0 +1,141 @@
+/*
+ * 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.
+ */
+
+/*
+ * User: anna
+ * Date: 14-Jan-2008
+ */
+package com.intellij.analysis;
+
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.ProjectFileIndex;
+import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.*;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.PackageScope;
+import com.intellij.psi.search.SearchScope;
+import com.intellij.util.containers.ContainerUtil;
+import com.intellij.psi.util.FileTypeUtils;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class JavaAnalysisScope extends AnalysisScope {
+  public static final int PACKAGE = 5;
+
+  public JavaAnalysisScope(PsiPackage pack, Module module) {
+    super(pack.getProject());
+    myModule = module;
+    myElement = pack;
+    myType = PACKAGE;
+  }
+
+  public JavaAnalysisScope(final PsiJavaFile psiFile) {
+    super(psiFile);
+  }
+
+  @Override
+  @NotNull
+  public AnalysisScope getNarrowedComplementaryScope(@NotNull Project defaultProject) {
+    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(defaultProject).getFileIndex();
+    final HashSet<Module> modules = new HashSet<Module>();
+    if (myType == FILE) {
+      if (myElement instanceof PsiJavaFile && !FileTypeUtils.isInServerPageFile(myElement)) {
+        PsiJavaFile psiJavaFile = (PsiJavaFile)myElement;
+        final PsiClass[] classes = psiJavaFile.getClasses();
+        boolean onlyPackLocalClasses = true;
+        for (final PsiClass aClass : classes) {
+          if (aClass.hasModifierProperty(PsiModifier.PUBLIC)) {
+            onlyPackLocalClasses = false;
+          }
+        }
+        if (onlyPackLocalClasses) {
+          final PsiDirectory psiDirectory = psiJavaFile.getContainingDirectory();
+          if (psiDirectory != null) {
+            return new JavaAnalysisScope(JavaDirectoryService.getInstance().getPackage(psiDirectory), null);
+          }
+        }
+      }
+    }
+    else if (myType == PACKAGE) {
+      final PsiDirectory[] directories = ((PsiPackage)myElement).getDirectories();
+      for (PsiDirectory directory : directories) {
+        modules.addAll(getAllInterestingModules(fileIndex, directory.getVirtualFile()));
+      }
+      return collectScopes(defaultProject, modules);
+    }
+    return super.getNarrowedComplementaryScope(defaultProject);
+  }
+
+
+
+  @Override
+  public String getShortenName() {
+    if (myType == PACKAGE)
+       return AnalysisScopeBundle.message("scope.package", ((PsiPackage)myElement).getQualifiedName());
+    return super.getShortenName();
+  }
+
+  @Override
+  public String getDisplayName() {
+    if (myType == PACKAGE) {
+      return AnalysisScopeBundle.message("scope.package", ((PsiPackage)myElement).getQualifiedName());
+    }
+    return super.getDisplayName();
+  }
+
+  @Override
+  protected void initFilesSet() {
+    if (myType == PACKAGE) {
+      myFilesSet = new HashSet<VirtualFile>();
+      accept(createFileSearcher());
+      return;
+    }
+    super.initFilesSet();
+  }
+
+  @Override
+  protected void accept(@NotNull final PsiElementVisitor visitor, final boolean needReadAction) {
+    if (myElement instanceof PsiPackage) {
+      final PsiPackage pack = (PsiPackage)myElement;
+      final Set<PsiDirectory> dirs = new HashSet<PsiDirectory>();
+      ApplicationManager.getApplication().runReadAction(new Runnable() {
+        @Override
+        public void run() {
+          ContainerUtil.addAll(dirs, pack.getDirectories(GlobalSearchScope.projectScope(myElement.getProject())));
+        }
+      });
+      for (PsiDirectory dir : dirs) {
+        accept(dir, visitor, needReadAction);
+      }
+    } else {
+      super.accept(visitor, needReadAction);
+    }
+  }
+
+  @NotNull
+  @Override
+  public SearchScope toSearchScope() {
+    if (myType == PACKAGE) {
+      return new PackageScope((PsiPackage)myElement, true, true);
+    }
+    return super.toSearchScope();
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/analysis/PackagesScopesProvider.java b/java/java-analysis-impl/src/com/intellij/analysis/PackagesScopesProvider.java
new file mode 100644
index 0000000..063f6ad
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/analysis/PackagesScopesProvider.java
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+/*
+ * User: anna
+ * Date: 16-Jan-2008
+ */
+package com.intellij.analysis;
+
+import com.intellij.openapi.extensions.Extensions;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.search.scope.ProjectProductionScope;
+import com.intellij.psi.search.scope.TestsScope;
+import com.intellij.psi.search.scope.packageSet.CustomScopesProviderEx;
+import com.intellij.psi.search.scope.packageSet.NamedScope;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author Konstantin Bulenkov
+ */
+public class PackagesScopesProvider extends CustomScopesProviderEx {
+  private final NamedScope myProjectProductionScope;
+  private final List<NamedScope> myScopes;
+
+  public static PackagesScopesProvider getInstance(Project project) {
+    return Extensions.findExtension(CUSTOM_SCOPES_PROVIDER, project, PackagesScopesProvider.class);
+  }
+
+  public PackagesScopesProvider() {
+    myProjectProductionScope = new ProjectProductionScope();
+    final NamedScope projectTestScope = new TestsScope();
+    myScopes = Arrays.asList(myProjectProductionScope, projectTestScope);
+  }
+
+  @Override
+  @NotNull
+  public List<NamedScope> getCustomScopes() {
+    return myScopes;
+  }
+
+  public NamedScope getProjectProductionScope() {
+    return myProjectProductionScope;
+  }
+}
\ No newline at end of file
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java
new file mode 100644
index 0000000..0b43269
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+/*
+ * User: anna
+ * Date: 21-Feb-2008
+ */
+package com.intellij.codeInsight.daemon;
+
+import com.intellij.codeInspection.ModifiableModel;
+import com.intellij.codeInspection.ex.InspectionToolWrapper;
+import com.intellij.codeInspection.javaDoc.JavaDocLocalInspectionBase;
+import com.intellij.profile.codeInspection.InspectionProfileManager;
+import org.jdom.Element;
+import org.jetbrains.annotations.NonNls;
+
+public class JavaAwareInspectionProfileCoverter extends InspectionProfileConvertor{
+  private String myAdditionalJavadocTags;
+  @NonNls private static final String ADDITONAL_JAVADOC_TAGS_OPTION = "ADDITIONAL_JAVADOC_TAGS";
+
+  public JavaAwareInspectionProfileCoverter(InspectionProfileManager manager) {
+    super(manager);
+  }
+
+  @Override
+  protected boolean processElement(final Element option, final String name) {
+    if (super.processElement(option, name)) {
+      return true;
+    }
+    if (name.equals(ADDITONAL_JAVADOC_TAGS_OPTION)) {
+      myAdditionalJavadocTags = option.getAttributeValue(VALUE_ATT);
+      return true;
+    }
+    return false;
+  }
+
+  @Override
+  protected void fillErrorLevels(final ModifiableModel profile) {
+    super.fillErrorLevels(profile);
+
+    //javadoc attributes
+    final InspectionToolWrapper toolWrapper = profile.getInspectionTool(JavaDocLocalInspectionBase.SHORT_NAME, null);
+    JavaDocLocalInspectionBase inspection = (JavaDocLocalInspectionBase)toolWrapper.getTool();
+    inspection.myAdditionalJavadocTags = myAdditionalJavadocTags;
+  }
+}
\ No newline at end of file
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/JavaProblemHighlightFilter.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/JavaProblemHighlightFilter.java
new file mode 100644
index 0000000..39895d3
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/JavaProblemHighlightFilter.java
@@ -0,0 +1,45 @@
+/*
+ * 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.codeInsight.daemon;
+
+import com.intellij.ide.highlighter.JavaFileType;
+import com.intellij.openapi.roots.JavaProjectRootsUtil;
+import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiFile;
+import org.jetbrains.annotations.NotNull;
+
+
+public class JavaProblemHighlightFilter extends ProblemHighlightFilter {
+  @Override
+  public boolean shouldHighlight(@NotNull PsiFile psiFile) {
+    return psiFile.getFileType() != JavaFileType.INSTANCE || !JavaProjectRootsUtil.isOutsideJavaSourceRoot(psiFile);
+  }
+
+  @Override
+  public boolean shouldProcessInBatch(@NotNull PsiFile psiFile) {
+    final boolean shouldHighlight = shouldHighlightFile(psiFile);
+    if (shouldHighlight) {
+      if (psiFile.getFileType() == JavaFileType.INSTANCE) {
+        final VirtualFile virtualFile = psiFile.getVirtualFile();
+        if (virtualFile != null && ProjectRootManager.getInstance(psiFile.getProject()).getFileIndex().isInLibrarySource(virtualFile)) {
+          return false;
+        }
+      }
+    }
+    return shouldHighlight;
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/GutterIconTooltipHelper.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/GutterIconTooltipHelper.java
new file mode 100644
index 0000000..aad7e39
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/GutterIconTooltipHelper.java
@@ -0,0 +1,76 @@
+/*
+ * 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 max
+ */
+package com.intellij.codeInsight.daemon.impl;
+
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.presentation.java.ClassPresentationUtil;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+
+import java.text.MessageFormat;
+import java.util.Arrays;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+public class GutterIconTooltipHelper {
+  private GutterIconTooltipHelper() {
+  }
+
+  public static String composeText(@NotNull PsiElement[] elements, String start, final String pattern) {
+    return composeText(Arrays.asList(elements), start, pattern);
+  }
+
+  public static String composeText(@NotNull Iterable<? extends PsiElement> elements, String start, final String pattern) {
+    @NonNls StringBuilder result = new StringBuilder();
+    result.append("<html><body>");
+    result.append(start);
+    Set<String> names = new LinkedHashSet<String>();
+    for (PsiElement element : elements) {
+      String descr = "";
+      if (element instanceof PsiClass) {
+        String className = ClassPresentationUtil.getNameForClass((PsiClass)element, true);
+        descr = MessageFormat.format(pattern, className);
+      }
+      else if (element instanceof PsiMethod) {
+        String methodName = ((PsiMethod)element).getName();
+        PsiClass aClass = ((PsiMethod)element).getContainingClass();
+        String className = aClass == null ? "" : ClassPresentationUtil.getNameForClass(aClass, true);
+        descr = MessageFormat.format(pattern, methodName, className);
+      }
+      else if (element instanceof PsiFile) {
+        descr = MessageFormat.format(pattern, ((PsiFile)element).getName());
+      }
+      names.add(descr);
+    }
+
+    @NonNls String sep = "";
+    for (String name : names) {
+      result.append(sep);
+      sep = "<br>";
+      result.append(name);
+    }
+
+    result.append("</body></html>");
+    return result.toString();
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/JavaChangeLocalityDetector.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/JavaChangeLocalityDetector.java
new file mode 100644
index 0000000..9eb0d3c
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/JavaChangeLocalityDetector.java
@@ -0,0 +1,45 @@
+/*
+ * 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 max
+ */
+package com.intellij.codeInsight.daemon.impl;
+
+import com.intellij.codeInsight.daemon.ChangeLocalityDetector;
+import com.intellij.psi.*;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public class JavaChangeLocalityDetector implements ChangeLocalityDetector {
+  @Override
+  @Nullable
+  public PsiElement getChangeHighlightingDirtyScopeFor(@NotNull final PsiElement element) {
+    // optimization
+    PsiElement parent = element.getParent();
+    PsiElement grand;
+    if (element instanceof PsiCodeBlock
+        && parent instanceof PsiMethod
+        && !((PsiMethod)parent).isConstructor()
+        && (grand = parent.getParent()) instanceof PsiClass
+        && !(grand instanceof PsiAnonymousClass)) {
+      // for changes inside method, rehighlight codeblock only
+      // do not use this optimization for constructors and class initializers - to update non-initialized fields
+      return parent;
+    }
+    return null;
+  }
+}
\ No newline at end of file
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/JavaDocAnnotator.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/JavaDocAnnotator.java
new file mode 100644
index 0000000..8f8e0c8
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/JavaDocAnnotator.java
@@ -0,0 +1,45 @@
+/*
+ * 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.codeInsight.daemon.impl;
+
+import com.intellij.lang.annotation.Annotation;
+import com.intellij.lang.annotation.AnnotationHolder;
+import com.intellij.lang.annotation.Annotator;
+import com.intellij.openapi.editor.colors.CodeInsightColors;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.javadoc.PsiDocTag;
+import com.intellij.psi.javadoc.PsiDocTagValue;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Dmitry Avdeev
+ *         Date: 11/8/11
+ */
+public class JavaDocAnnotator implements Annotator {
+  @Override
+  public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
+    if (element instanceof PsiDocTag) {
+      String name = ((PsiDocTag)element).getName();
+      if ("param".equals(name)) {
+        PsiDocTagValue tagValue = ((PsiDocTag)element).getValueElement();
+        if (tagValue != null) {
+          Annotation annotation = holder.createInfoAnnotation(tagValue, null);
+          annotation.setTextAttributes(CodeInsightColors.DOC_COMMENT_TAG_VALUE);
+        }
+      }
+    }
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java
index 0ebedbc..06b11a3 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java
@@ -49,6 +49,7 @@
 import com.intellij.openapi.util.Key;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.pom.PomNamedTarget;
+import com.intellij.pom.java.LanguageLevel;
 import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.JavaCodeStyleManager;
@@ -72,14 +73,12 @@
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.annotations.PropertyKey;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 public class PostHighlightingPass extends ProgressableTextEditorHighlightingPass {
   private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.PostHighlightingPass");
   private static final Key<Long> LAST_POST_PASS_TIMESTAMP = Key.create("LAST_POST_PASS_TIMESTAMP");
+  private final LanguageLevel myLanguageLevel;
   private RefCountHolder myRefCountHolder;
   private final PsiFile myFile;
   @Nullable private final Editor myEditor;
@@ -112,6 +111,7 @@
     myEndOffset = file.getTextLength();
 
     myCurrentEntryIndex = -1;
+    myLanguageLevel = PsiUtil.getLanguageLevel(file);
   }
 
   static boolean isUpToDate(@NotNull PsiFile file) {
@@ -165,9 +165,11 @@
     }
   }
 
+  @NotNull
   @Override
   public List<HighlightInfo> getInfos() {
-    return myHighlights == null ? null : new ArrayList<HighlightInfo>(myHighlights);
+    Collection<HighlightInfo> infos = myHighlights;
+    return infos == null ? Collections.<HighlightInfo>emptyList() : new ArrayList<HighlightInfo>(infos);
   }
 
   @Override
@@ -510,7 +512,7 @@
       //parameter is defined by functional interface
       final PsiElement declarationScope = parameter.getDeclarationScope();
       if (declarationScope instanceof PsiMethod && 
-          myRefCountHolder.isReferencedByMethodReference((PsiMethod)declarationScope)) {
+          myRefCountHolder.isReferencedByMethodReference((PsiMethod)declarationScope, myLanguageLevel)) {
         return null;
       }
       String message = JavaErrorMessages.message("parameter.is.not.used", identifier.getText());
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/RefCountHolder.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/RefCountHolder.java
index 80fa573..7bb3181 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/RefCountHolder.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/RefCountHolder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -20,6 +20,7 @@
 import com.intellij.openapi.util.Key;
 import com.intellij.openapi.util.TextRange;
 import com.intellij.openapi.util.UserDataHolderEx;
+import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
 import com.intellij.psi.util.PsiMatcherImpl;
 import com.intellij.psi.util.PsiMatchers;
@@ -28,6 +29,7 @@
 import com.intellij.util.ArrayUtilRt;
 import com.intellij.util.containers.BidirectionalMap;
 import com.intellij.util.containers.ConcurrentHashMap;
+import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -42,8 +44,8 @@
   private final PsiFile myFile;
   private final BidirectionalMap<PsiReference,PsiElement> myLocalRefsMap = new BidirectionalMap<PsiReference, PsiElement>();
 
-  private final Map<PsiNamedElement, Boolean> myDclsUsedMap = new ConcurrentHashMap<PsiNamedElement, Boolean>();
-  private final Map<PsiReference, PsiImportStatementBase> myImportStatements = new ConcurrentHashMap<PsiReference, PsiImportStatementBase>();
+  private final Map<PsiAnchor, Boolean> myDclsUsedMap = ContainerUtil.newConcurrentMap();
+  private final Map<PsiReference, PsiImportStatementBase> myImportStatements = ContainerUtil.newConcurrentMap();
   private final AtomicReference<ProgressIndicator> myState = new AtomicReference<ProgressIndicator>(VIRGIN);
   private static final ProgressIndicator VIRGIN = new DaemonProgressIndicator(); // just created or cleared
   private static final ProgressIndicator READY = new DaemonProgressIndicator();
@@ -130,7 +132,7 @@
   }
 
   public void registerLocallyReferenced(@NotNull PsiNamedElement result) {
-    myDclsUsedMap.put(result,Boolean.TRUE);
+    myDclsUsedMap.put(PsiAnchor.create(result), Boolean.TRUE);
   }
 
   public void registerReference(@NotNull PsiJavaReference ref, @NotNull JavaResolveResult resolveResult) {
@@ -185,10 +187,10 @@
     removeInvalidFrom(myDclsUsedMap.keySet());
   }
 
-  private static void removeInvalidFrom(@NotNull Collection<? extends PsiElement> collection) {
-    for (Iterator<? extends PsiElement> it = collection.iterator(); it.hasNext();) {
-      PsiElement element = it.next();
-      if (!element.isValid()) it.remove();
+  private static void removeInvalidFrom(@NotNull Collection<? extends PsiAnchor> collection) {
+    for (Iterator<? extends PsiAnchor> it = collection.iterator(); it.hasNext();) {
+      PsiAnchor element = it.next();
+      if (element.retrieve() == null) it.remove();
     }
   }
 
@@ -199,12 +201,12 @@
     }
     if (array != null && !array.isEmpty() && !isParameterUsedRecursively(element, array)) return true;
 
-    Boolean usedStatus = myDclsUsedMap.get(element);
+    Boolean usedStatus = myDclsUsedMap.get(PsiAnchor.create(element));
     return usedStatus == Boolean.TRUE;
   }
 
-  public boolean isReferencedByMethodReference(@NotNull PsiMethod method) {
-    if (!PsiUtil.isLanguageLevel8OrHigher(method)) return false;
+  public boolean isReferencedByMethodReference(@NotNull PsiMethod method, @NotNull LanguageLevel languageLevel) {
+    if (!languageLevel.isAtLeast(LanguageLevel.JDK_1_8)) return false;
 
     List<PsiReference> array;
     synchronized (myLocalRefsMap) {
@@ -252,11 +254,10 @@
     return true;
   }
 
-  public boolean isReferencedForRead(@NotNull PsiElement element) {
-    LOG.assertTrue(element instanceof PsiVariable);
+  public boolean isReferencedForRead(@NotNull PsiVariable variable) {
     List<PsiReference> array;
     synchronized (myLocalRefsMap) {
-      array = myLocalRefsMap.getKeysByValue(element);
+      array = myLocalRefsMap.getKeysByValue(variable);
     }
     if (array == null) return false;
     for (PsiReference ref : array) {
@@ -276,11 +277,10 @@
     return false;
   }
 
-  public boolean isReferencedForWrite(@NotNull PsiElement element) {
-    LOG.assertTrue(element instanceof PsiVariable);
+  public boolean isReferencedForWrite(@NotNull PsiVariable variable) {
     List<PsiReference> array;
     synchronized (myLocalRefsMap) {
-      array = myLocalRefsMap.getKeysByValue(element);
+      array = myLocalRefsMap.getKeysByValue(variable);
     }
     if (array == null) return false;
     for (PsiReference ref : array) {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/actions/SuppressWarningsFoldingBuilder.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/actions/SuppressWarningsFoldingBuilder.java
new file mode 100644
index 0000000..df96f75
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/actions/SuppressWarningsFoldingBuilder.java
@@ -0,0 +1,99 @@
+/*
+ * 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.
+ */
+
+/*
+ * User: anna
+ * Date: 25-May-2010
+ */
+package com.intellij.codeInsight.daemon.impl.actions;
+
+import com.intellij.codeInsight.folding.JavaCodeFoldingSettings;
+import com.intellij.lang.ASTNode;
+import com.intellij.lang.folding.FoldingBuilderEx;
+import com.intellij.lang.folding.FoldingDescriptor;
+import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.util.Function;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SuppressWarningsFoldingBuilder extends FoldingBuilderEx {
+  @NotNull
+  @Override
+  public FoldingDescriptor[] buildFoldRegions(@NotNull PsiElement root, @NotNull Document document, boolean quick) {
+    if (!(root instanceof PsiJavaFile) || quick || !JavaCodeFoldingSettings.getInstance().isCollapseSuppressWarnings()) {
+      return FoldingDescriptor.EMPTY;
+    }
+    if (!PsiUtil.isLanguageLevel5OrHigher(root)) {
+      return FoldingDescriptor.EMPTY;
+    }
+    final List<FoldingDescriptor> result = new ArrayList<FoldingDescriptor>();
+    root.accept(new JavaRecursiveElementWalkingVisitor(){
+      @Override
+      public void visitAnnotation(PsiAnnotation annotation) {
+        if (Comparing.strEqual(annotation.getQualifiedName(), SuppressWarnings.class.getName())) {
+          result.add(new FoldingDescriptor(annotation, annotation.getTextRange()));
+        }
+        super.visitAnnotation(annotation);
+      }
+    });
+    return result.toArray(new FoldingDescriptor[result.size()]);
+  }
+
+  @Override
+  public String getPlaceholderText(@NotNull ASTNode node) {
+    final PsiElement element = node.getPsi();
+    if (element instanceof PsiAnnotation) {
+      return "/" + StringUtil.join(((PsiAnnotation)element).getParameterList().getAttributes(), new Function<PsiNameValuePair, String>() {
+        @Override
+        public String fun(PsiNameValuePair value) {
+          return getMemberValueText(value.getValue());
+        }
+      }, ", ") + "/";
+    }
+    return element.getText();
+  }
+
+  private static String getMemberValueText(PsiAnnotationMemberValue memberValue) {
+    if (memberValue instanceof PsiArrayInitializerMemberValue) {
+      final PsiAnnotationMemberValue[] initializers = ((PsiArrayInitializerMemberValue)memberValue).getInitializers();
+      return StringUtil.join(initializers, new Function<PsiAnnotationMemberValue, String>() {
+        @Override
+        public String fun(PsiAnnotationMemberValue psiAnnotationMemberValue) {
+          return getMemberValueText(psiAnnotationMemberValue);
+        }
+      }, ", ");
+    }
+    if (memberValue instanceof PsiLiteral) {
+      final Object o = ((PsiLiteral)memberValue).getValue();
+      if (o != null) {
+        return o.toString();
+      }
+    }
+    return memberValue != null ? memberValue.getText() : "";
+  }
+
+
+  @Override
+  public boolean isCollapsedByDefault(@NotNull ASTNode node) {
+    return JavaCodeFoldingSettings.getInstance().isCollapseSuppressWarnings();
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/AnnotationsHighlightUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/AnnotationsHighlightUtil.java
index c445cec..10b9330 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/AnnotationsHighlightUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/AnnotationsHighlightUtil.java
@@ -153,14 +153,17 @@
 
       String description = JavaErrorMessages.message("annotation.incompatible.types",
                                                      JavaHighlightUtil.formatType(type), JavaHighlightUtil.formatType(expectedType));
-      return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(value).descriptionAndTooltip(description).create();
+      final HighlightInfo info =
+        HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(value).descriptionAndTooltip(description).create();
+      QuickFixAction.registerQuickFixAction(info, QuickFixFactory.getInstance().createSurroundWithQuotesAnnotationParameterValueFix(value, expectedType));
+      return info;
     }
 
     LOG.error("Unknown annotation member value: " + value);
     return null;
   }
 
-  static HighlightInfo checkDuplicateAnnotations(@NotNull PsiAnnotation annotationToCheck) {
+  static HighlightInfo checkDuplicateAnnotations(@NotNull PsiAnnotation annotationToCheck, @NotNull LanguageLevel languageLevel) {
     PsiAnnotationOwner owner = annotationToCheck.getOwner();
     if (owner == null) return null;
 
@@ -183,7 +186,7 @@
       }
     }
     else if (isAnnotationRepeatedTwice(owner, annotationType.getQualifiedName())) {
-      if (!PsiUtil.isLanguageLevel8OrHigher(annotationToCheck)) {
+      if (!languageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
         String description = JavaErrorMessages.message("annotation.duplicate.annotation");
         return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(element).descriptionAndTooltip(description).create();
       }
@@ -294,7 +297,12 @@
         }
 
         String description = JavaErrorMessages.message("annotation.missing.attribute", buff);
-        return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(nameRef).descriptionAndTooltip(description).create();
+        HighlightInfo info =
+          HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(nameRef).descriptionAndTooltip(description).create();
+        IntentionAction fix = QuickFixFactory.getInstance().createAddMissingRequiredAnnotationParametersFix(
+          annotation, annotationMethods, missed);
+        QuickFixAction.registerQuickFixAction(info, fix);
+        return info;
       }
     }
 
@@ -332,9 +340,7 @@
   );
 
   @Nullable
-  public static HighlightInfo checkApplicability(@NotNull PsiAnnotation annotation,
-                                                 @NotNull LanguageLevel languageLevel,
-                                                 @NotNull PsiFile containingFile) {
+  public static HighlightInfo checkApplicability(@NotNull PsiAnnotation annotation, @NotNull LanguageLevel level, @NotNull PsiFile file) {
     if (ANY_ANNOTATION_ALLOWED.accepts(annotation)) {
       return null;
     }
@@ -350,7 +356,7 @@
     }
 
     if (!(owner instanceof PsiModifierList)) {
-      HighlightInfo info = HighlightUtil.checkTypeAnnotationFeature(annotation, languageLevel,containingFile);
+      HighlightInfo info = HighlightUtil.checkFeature(annotation, HighlightUtil.Feature.TYPE_ANNOTATIONS, level, file);
       if (info != null) return info;
     }
 
@@ -700,7 +706,7 @@
         if (field instanceof PsiEnumConstant) {
           String name = ((PsiEnumConstant)field).getName();
           try {
-            return RetentionPolicy.valueOf(name);
+            return RetentionPolicy.valueOf(RetentionPolicy.class, name);
           }
           catch (Exception e) {
             LOG.warn("Unknown policy: " + name);
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
index af64080..7f8d013 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
@@ -137,7 +137,7 @@
       if (targetParametersNum == 0) {
         if (PsiTreeUtil.getParentOfType(referenceParameterList, PsiCall.class) != null &&
             typeParameterListOwner instanceof PsiMethod &&
-            javaSdkVersion.isAtLeast(JavaSdkVersion.JDK_1_7)) {
+            (javaSdkVersion.isAtLeast(JavaSdkVersion.JDK_1_7) || hasSuperMethodsWithTypeParams((PsiMethod)typeParameterListOwner))) {
           description = null;
         }
         else {
@@ -196,6 +196,13 @@
     return null;
   }
 
+  private static boolean hasSuperMethodsWithTypeParams(PsiMethod method) {
+    for (PsiMethod superMethod : method.findDeepestSuperMethods()) {
+      if (superMethod.hasTypeParameters()) return true;
+    }
+    return false;
+  }
+
   private static PsiType detectExpectedType(PsiReferenceParameterList referenceParameterList) {
     final PsiNewExpression newExpression = PsiTreeUtil.getParentOfType(referenceParameterList, PsiNewExpression.class);
     LOG.assertTrue(newExpression != null);
@@ -704,7 +711,8 @@
     final PsiMember constructorOrInitializer = PsiUtil.findEnclosingConstructorOrInitializer(expr);
     if (constructorOrInitializer == null) return null;
     if (constructorOrInitializer.hasModifierProperty(PsiModifier.STATIC)) return null;
-    final PsiClass aClass = constructorOrInitializer.getContainingClass();
+    final PsiClass aClass = constructorOrInitializer instanceof PsiEnumConstantInitializer ? 
+                            (PsiClass)constructorOrInitializer : constructorOrInitializer.getContainingClass();
     if (aClass == null || !(aClass.isEnum() || aClass instanceof PsiEnumConstantInitializer)) return null;
     final PsiField field = (PsiField)resolved;
     if (aClass instanceof PsiEnumConstantInitializer) {
@@ -764,43 +772,38 @@
   }
 
   @Nullable
-  public static HighlightInfo checkTypeParametersList(PsiTypeParameterList parameterList, @NotNull LanguageLevel languageLevel,@NotNull PsiFile containingFile) {
-    PsiTypeParameter[] typeParameters = parameterList.getTypeParameters();
-    if (typeParameters.length == 0) return null;
-    HighlightInfo info = HighlightUtil.checkGenericsFeature(parameterList, typeParameters.length, languageLevel, containingFile);
-    if (info != null) return info;
-
-    final PsiElement parent = parameterList.getParent();
+  public static HighlightInfo checkTypeParametersList(PsiTypeParameterList list, PsiTypeParameter[] parameters, @NotNull LanguageLevel level) {
+    final PsiElement parent = list.getParent();
     if (parent instanceof PsiClass && ((PsiClass)parent).isEnum()) {
       String description = JavaErrorMessages.message("generics.enum.may.not.have.type.parameters");
-      return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(parameterList).descriptionAndTooltip(description).create();
+      return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(list).descriptionAndTooltip(description).create();
     }
     if (PsiUtil.isAnnotationMethod(parent)) {
       String description = JavaErrorMessages.message("generics.annotation.members.may.not.have.type.parameters");
-      return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(parameterList).descriptionAndTooltip(description).create();
+      return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(list).descriptionAndTooltip(description).create();
     }
     if (parent instanceof PsiClass && ((PsiClass)parent).isAnnotationType()) {
       String description = JavaErrorMessages.message("annotation.may.not.have.type.parameters");
-      return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(parameterList).descriptionAndTooltip(description).create();
+      return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(list).descriptionAndTooltip(description).create();
     }
 
-    for (int i = 0; i < typeParameters.length; i++) {
-      final PsiTypeParameter typeParameter1 = typeParameters[i];
+    for (int i = 0; i < parameters.length; i++) {
+      final PsiTypeParameter typeParameter1 = parameters[i];
       final HighlightInfo cyclicInheritance = HighlightClassUtil.checkCyclicInheritance(typeParameter1);
       if (cyclicInheritance != null) return cyclicInheritance;
       String name1 = typeParameter1.getName();
-      for (int j = i + 1; j < typeParameters.length; j++) {
-        final PsiTypeParameter typeParameter2 = typeParameters[j];
+      for (int j = i + 1; j < parameters.length; j++) {
+        final PsiTypeParameter typeParameter2 = parameters[j];
         String name2 = typeParameter2.getName();
         if (Comparing.strEqual(name1, name2)) {
           String message = JavaErrorMessages.message("generics.duplicate.type.parameter", name1);
           return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(typeParameter2).descriptionAndTooltip(message).create();
         }
       }
-      if (!languageLevel.isAtLeast(LanguageLevel.JDK_1_7)) {
+      if (!level.isAtLeast(LanguageLevel.JDK_1_7)) {
         for (PsiJavaCodeReferenceElement referenceElement : typeParameter1.getExtendsList().getReferenceElements()) {
           final PsiElement resolve = referenceElement.resolve();
-          if (resolve instanceof PsiTypeParameter && ArrayUtilRt.find(typeParameters, resolve) > i) {
+          if (resolve instanceof PsiTypeParameter && ArrayUtilRt.find(parameters, resolve) > i) {
             return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(referenceElement.getTextRange()).descriptionAndTooltip("Illegal forward reference").create();
           }
         }
@@ -1020,20 +1023,15 @@
   }
 
   @Nullable
-  public static HighlightInfo checkVarArgParameterIsLast(@NotNull PsiParameter parameter, @NotNull LanguageLevel languageLevel,@NotNull PsiFile containingFile) {
+  public static HighlightInfo checkVarArgParameterIsLast(@NotNull PsiParameter parameter) {
     PsiElement declarationScope = parameter.getDeclarationScope();
     if (declarationScope instanceof PsiMethod) {
       PsiParameter[] params = ((PsiMethod)declarationScope).getParameterList().getParameters();
-      if (parameter.isVarArgs()) {
-        HighlightInfo info = HighlightUtil.checkVarargFeature(parameter, languageLevel,containingFile);
-        if (info != null) return info;
-
-        if (params[params.length - 1] != parameter) {
-          String description = JavaErrorMessages.message("vararg.not.last.parameter");
-          info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(parameter).descriptionAndTooltip(description).create();
-          QuickFixAction.registerQuickFixAction(info, QUICK_FIX_FACTORY.createMakeVarargParameterLastFix(parameter));
-          return info;
-        }
+      if (params[params.length - 1] != parameter) {
+        String description = JavaErrorMessages.message("vararg.not.last.parameter");
+        HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(parameter).descriptionAndTooltip(description).create();
+        QuickFixAction.registerQuickFixAction(info, QUICK_FIX_FACTORY.createMakeVarargParameterLastFix(parameter));
+        return info;
       }
     }
     return null;
@@ -1056,19 +1054,13 @@
   }
 
   @Nullable
-  public static HighlightInfo checkParametersAllowed(PsiReferenceParameterList refParamList, @NotNull LanguageLevel languageLevel,@NotNull PsiFile containingFile) {
-    HighlightInfo info = HighlightUtil.checkGenericsFeature(refParamList, refParamList.getTypeParameterElements().length,
-                                                            languageLevel, containingFile);
-    if (info != null) return info;
-
-    if (refParamList.getTextLength() != 0) {
-      final PsiElement parent = refParamList.getParent();
-      if (parent instanceof PsiReferenceExpression) {
-        final PsiElement grandParent = parent.getParent();
-        if (!(grandParent instanceof PsiMethodCallExpression) && !(parent instanceof PsiMethodReferenceExpression)) {
-          final String message = JavaErrorMessages.message("generics.reference.parameters.not.allowed");
-          return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(refParamList).descriptionAndTooltip(message).create();
-        }
+  public static HighlightInfo checkParametersAllowed(PsiReferenceParameterList refParamList) {
+    final PsiElement parent = refParamList.getParent();
+    if (parent instanceof PsiReferenceExpression) {
+      final PsiElement grandParent = parent.getParent();
+      if (!(grandParent instanceof PsiMethodCallExpression) && !(parent instanceof PsiMethodReferenceExpression)) {
+        final String message = JavaErrorMessages.message("generics.reference.parameters.not.allowed");
+        return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(refParamList).descriptionAndTooltip(message).create();
       }
     }
 
@@ -1077,7 +1069,6 @@
 
   @Nullable
   public static HighlightInfo checkParametersOnRaw(PsiReferenceParameterList refParamList) {
-    if (refParamList.getTypeArguments().length == 0) return null;
     JavaResolveResult resolveResult = null;
     PsiElement parent = refParamList.getParent();
     PsiElement qualifier = null;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightControlFlowUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightControlFlowUtil.java
index 40463be..602e3fe 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightControlFlowUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightControlFlowUtil.java
@@ -279,7 +279,7 @@
         if (topBlock == null) return null;
         final PsiElement parent = topBlock.getParent();
         // access to final fields from inner classes always allowed
-        if ((parent instanceof PsiMethod || parent instanceof PsiClassInitializer) && inInnerClass(expression, ((PsiField)variable).getContainingClass(),containingFile)) return null;
+        if (inInnerClass(expression, ((PsiField)variable).getContainingClass(),containingFile)) return null;
         final PsiCodeBlock block;
         final PsiClass aClass;
         if (parent instanceof PsiMethod) {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java
index 8c1bc66..410be64 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java
@@ -506,42 +506,36 @@
     if (methodCandidate2 != null) {
       return null;
     }
+    if (element != null && !resolveResult.isAccessible()) {
+      description = HighlightUtil.buildProblemWithAccessDescription(referenceToMethod, resolveResult);
+      elementToHighlight = referenceToMethod.getReferenceNameElement();
+    }
+    else if (element != null && !resolveResult.isStaticsScopeCorrect()) {
+      description = HighlightUtil.buildProblemWithStaticDescription(element);
+      elementToHighlight = referenceToMethod.getReferenceNameElement();
+    }
     else {
-      if (element != null && !resolveResult.isAccessible()) {
-        description = HighlightUtil.buildProblemWithAccessDescription(referenceToMethod, resolveResult);
+      String methodName = referenceToMethod.getReferenceName() + buildArgTypesList(list);
+      description = JavaErrorMessages.message("cannot.resolve.method", methodName);
+      if (candidates.length == 0) {
         elementToHighlight = referenceToMethod.getReferenceNameElement();
-      }
-      else if (element != null && !resolveResult.isStaticsScopeCorrect()) {
-        description = HighlightUtil.buildProblemWithStaticDescription(element);
-        elementToHighlight = referenceToMethod.getReferenceNameElement();
+        highlightInfoType = HighlightInfoType.WRONG_REF;
       }
       else {
-        String methodName = referenceToMethod.getReferenceName() + buildArgTypesList(list);
-        description = JavaErrorMessages.message("cannot.resolve.method", methodName);
-        if (candidates.length == 0) {
-          elementToHighlight = referenceToMethod.getReferenceNameElement();
-          highlightInfoType = HighlightInfoType.WRONG_REF;
-        }
-        else {
-          return null;
-        }
+        return null;
       }
-      toolTip = XmlStringUtil.escapeString(description);
     }
+    toolTip = XmlStringUtil.escapeString(description);
     HighlightInfo info =
       HighlightInfo.newHighlightInfo(highlightInfoType).range(elementToHighlight).description(description).escapedToolTip(toolTip).create();
-    if (methodCandidate2 == null) {
-      registerMethodCallIntentions(info, methodCall, list, resolveHelper);
-    }
-    if (!resolveResult.isAccessible() && resolveResult.isStaticsScopeCorrect() && methodCandidate2 != null) {
-      HighlightUtil.registerAccessQuickFixAction((PsiMember)element, referenceToMethod, info, resolveResult.getCurrentFileResolveScope());
-    }
+    registerMethodCallIntentions(info, methodCall, list, resolveHelper);
     if (element != null && !resolveResult.isStaticsScopeCorrect()) {
       HighlightUtil.registerStaticProblemQuickFixAction(element, info, referenceToMethod);
     }
 
     TextRange fixRange = getFixRange(elementToHighlight);
     CastMethodArgumentFix.REGISTRAR.registerCastActions(candidates, methodCall, info, fixRange);
+    WrapArrayToArraysAsListFix.REGISTAR.registerCastActions(candidates, methodCall, info, fixRange);
     PermuteArgumentsFix.registerFix(info, methodCall, candidates, fixRange);
     WrapExpressionFix.registerWrapAction(candidates, list.getExpressions(), info);
     registerChangeParameterClassFix(methodCall, list, info);
@@ -633,6 +627,7 @@
 
     TextRange fixRange = getFixRange(elementToHighlight);
     CastMethodArgumentFix.REGISTRAR.registerCastActions(candidates, methodCall, info, fixRange);
+    WrapArrayToArraysAsListFix.REGISTAR.registerCastActions(candidates, methodCall, info, fixRange);
     PermuteArgumentsFix.registerFix(info, methodCall, candidates, fixRange);
     WrapExpressionFix.registerWrapAction(candidates, list.getExpressions(), info);
     registerChangeParameterClassFix(methodCall, list, info);
@@ -666,6 +661,7 @@
     CastMethodArgumentFix.REGISTRAR.registerCastActions(methodCandidates, methodCall, highlightInfo, fixRange);
     PermuteArgumentsFix.registerFix(highlightInfo, methodCall, methodCandidates, fixRange);
     AddTypeArgumentsFix.REGISTRAR.registerCastActions(methodCandidates, methodCall, highlightInfo, fixRange);
+    WrapArrayToArraysAsListFix.REGISTAR.registerCastActions(methodCandidates, methodCall, highlightInfo, fixRange);
     registerMethodAccessLevelIntentions(methodCandidates, methodCall, list, highlightInfo);
     registerChangeMethodSignatureFromUsageIntentions(methodCandidates, list, highlightInfo, fixRange);
     RemoveRedundantArgumentsFix.registerIntentions(methodCandidates, list, highlightInfo, fixRange);
@@ -1011,7 +1007,7 @@
   }
 
   @Nullable
-  static HighlightInfo checkMethodCanHaveBody(PsiMethod method, @NotNull LanguageLevel languageLevel,@NotNull PsiFile containingFile) {
+  static HighlightInfo checkMethodCanHaveBody(@NotNull PsiMethod method, @NotNull LanguageLevel languageLevel) {
     PsiClass aClass = method.getContainingClass();
     boolean hasNoBody = method.getBody() == null;
     boolean isInterface = aClass != null && aClass.isInterface();
@@ -1032,7 +1028,7 @@
     else if (isInterface) {
       if (!isExtension && !isStatic) {
         description = JavaErrorMessages.message("interface.methods.cannot.have.body");
-        if (PsiUtil.isLanguageLevel8OrHigher(method)) {
+        if (languageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
           additionalFixes.add(QUICK_FIX_FACTORY.createModifierListFix(method, PsiModifier.DEFAULT, true, false));
           additionalFixes.add(QUICK_FIX_FACTORY.createModifierListFix(method, PsiModifier.STATIC, true, false));
         }
@@ -1239,7 +1235,7 @@
       }
       return createIncompatibleReturnTypeMessage(currentMethod, otherSuperMethod, otherSuperReturnType,
                                                  currentType, JavaErrorMessages.message("unrelated.overriding.methods.return.types"),
-                                                 false ? currentMethod.getReturnTypeElement().getTextRange() : TextRange.EMPTY_RANGE);
+                                                 TextRange.EMPTY_RANGE);
     }
     return null;
   }
@@ -1259,7 +1255,7 @@
       if (aClass.equals(containingClass)) continue; //to be checked at method level
 
       if (aClass.isInterface() && !containingClass.isInterface()) continue;
-      HighlightInfo highlightInfo = null;
+      HighlightInfo highlightInfo;
       if (allAbstracts) {
         superSignatures = new ArrayList<HierarchicalMethodSignature>(superSignatures);
         superSignatures.add(signature);
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java
index 086d354..0dc8e3d 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java
@@ -24,6 +24,7 @@
 import com.intellij.codeInsight.highlighting.HighlightUsagesDescriptionLocation;
 import com.intellij.codeInsight.intention.IntentionAction;
 import com.intellij.codeInsight.intention.QuickFixFactory;
+import com.intellij.codeInsight.intention.impl.PriorityActionWrapper;
 import com.intellij.codeInsight.quickfix.ChangeVariableTypeQuickFixProvider;
 import com.intellij.codeInsight.quickfix.UnresolvedReferenceQuickFixProvider;
 import com.intellij.codeInspection.LocalQuickFixOnPsiElementAsIntentionAdapter;
@@ -298,12 +299,12 @@
 
 
   @Nullable
-  static HighlightInfo checkIntersectionInTypeCast(@NotNull PsiTypeCastExpression expression) {
+  static HighlightInfo checkIntersectionInTypeCast(@NotNull PsiTypeCastExpression expression, @NotNull LanguageLevel languageLevel) {
     final PsiTypeElement castTypeElement = expression.getCastType();
     if (castTypeElement == null) return null;
     PsiType castType = castTypeElement.getType();
     if (isIntersection(castTypeElement, castType)) {
-      if (PsiUtil.isLanguageLevel8OrHigher(expression)) {
+      if (languageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
         final PsiTypeElement[] conjuncts = PsiTreeUtil.getChildrenOfType(castTypeElement, PsiTypeElement.class);
         if (conjuncts != null) {
           final List<PsiTypeElement> conjList = new ArrayList<PsiTypeElement>(Arrays.asList(conjuncts));
@@ -347,7 +348,7 @@
     PsiType operandType = operand.getType();
 
     if (operandType != null &&
-        !TypeConversionUtil.areTypesConvertible(operandType, castType) &&
+        !TypeConversionUtil.areTypesConvertible(operandType, castType, PsiUtil.getLanguageLevel(expression)) &&
         !RedundantCastUtil.isInPolymorphicCall(expression)) {
       String message = JavaErrorMessages.message("inconvertible.type.cast", JavaHighlightUtil.formatType(operandType), JavaHighlightUtil
         .formatType(castType));
@@ -679,8 +680,8 @@
   }
 
   @Nullable
-  public static HighlightInfo checkUnderscore(@NotNull PsiIdentifier identifier, @NotNull PsiVariable variable) {
-    if ("_".equals(variable.getName()) && PsiUtil.isLanguageLevel8OrHigher(variable)) {
+  public static HighlightInfo checkUnderscore(@NotNull PsiIdentifier identifier, @NotNull PsiVariable variable, @NotNull LanguageLevel languageLevel) {
+    if ("_".equals(variable.getName()) && languageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
       if (variable instanceof PsiParameter && ((PsiParameter)variable).getDeclarationScope() instanceof PsiLambdaExpression) {
         String message = JavaErrorMessages.message("underscore.lambda.identifier");
         return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(identifier).descriptionAndTooltip(message).create();
@@ -915,8 +916,7 @@
   }
 
   @Nullable
-  public static HighlightInfo checkLiteralExpressionParsingError(@NotNull final PsiLiteralExpression expression,
-                                                                 @NotNull LanguageLevel languageLevel, @NotNull PsiFile containingFile) {
+  public static HighlightInfo checkLiteralExpressionParsingError(@NotNull PsiLiteralExpression expression, LanguageLevel level, PsiFile file) {
     PsiElement literal = expression.getFirstChild();
     assert literal instanceof PsiJavaToken : literal;
     IElementType type = ((PsiJavaToken)literal).getTokenType();
@@ -929,24 +929,26 @@
     String text = isInt || isFP ? literal.getText().toLowerCase() : literal.getText();
     Object value = expression.getValue();
 
-    if (isFP) {
-      if (text.startsWith(PsiLiteralExpressionImpl.HEX_PREFIX)) {
-        final HighlightInfo info = checkFeature(expression, Feature.HEX_FP_LITERALS, languageLevel, containingFile);
-        if (info != null) return info;
+    if (level != null && file != null) {
+      if (isFP) {
+        if (text.startsWith(PsiLiteralExpressionImpl.HEX_PREFIX)) {
+          final HighlightInfo info = checkFeature(expression, Feature.HEX_FP_LITERALS, level, file);
+          if (info != null) return info;
+        }
       }
-    }
-    if (isInt) {
-      if (text.startsWith(PsiLiteralExpressionImpl.BIN_PREFIX)) {
-        final HighlightInfo info = checkFeature(expression, Feature.BIN_LITERALS, languageLevel, containingFile);
-        if (info != null) return info;
+      if (isInt) {
+        if (text.startsWith(PsiLiteralExpressionImpl.BIN_PREFIX)) {
+          final HighlightInfo info = checkFeature(expression, Feature.BIN_LITERALS, level, file);
+          if (info != null) return info;
+        }
       }
-    }
-    if (isInt || isFP) {
-      if (text.contains("_")) {
-        HighlightInfo info = checkFeature(expression, Feature.UNDERSCORES, languageLevel, containingFile);
-        if (info != null) return info;
-        info = checkUnderscores(expression, text, isInt);
-        if (info != null) return info;
+      if (isInt || isFP) {
+        if (text.contains("_")) {
+          HighlightInfo info = checkFeature(expression, Feature.UNDERSCORES, level, file);
+          if (info != null) return info;
+          info = checkUnderscores(expression, text, isInt);
+          if (info != null) return info;
+        }
       }
     }
 
@@ -1313,48 +1315,62 @@
 
 
   @Nullable
-  public static HighlightInfo checkSwitchSelectorType(@NotNull PsiSwitchStatement statement) {
-    final PsiExpression expression = statement.getExpression();
-    PsiType type = expression == null ? null : expression.getType();
-    if (type == null) {
-      return null;
-    }
-    HighlightInfo errorResult = null;
-    final boolean atLeastJava7 = PsiUtil.isLanguageLevel7OrHigher(expression);
-    if (!isValidTypeForSwitchSelector(type, atLeastJava7)) {
-      final String switchSelectorMessage = atLeastJava7 ? JavaErrorMessages.message("valid.switch.17.selector.types") 
-                                                        : JavaErrorMessages.message("valid.switch.selector.types");
-      String message =
-        JavaErrorMessages.message("incompatible.types", switchSelectorMessage, JavaHighlightUtil.formatType(type));
-      errorResult = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
-      QuickFixAction.registerQuickFixAction(errorResult, QUICK_FIX_FACTORY.createConvertSwitchToIfIntention(statement));
+  public static HighlightInfo checkSwitchSelectorType(@NotNull PsiSwitchStatement statement, @NotNull LanguageLevel level) {
+    PsiExpression expression = statement.getExpression();
+    if (expression == null) return null;
+    PsiType type = expression.getType();
+    if (type == null) return null;
+
+    SelectorKind kind = getSwitchSelectorKind(type);
+    if (kind == SelectorKind.INT) return null;
+
+    LanguageLevel requiredLevel = null;
+    if (kind == SelectorKind.ENUM) requiredLevel = LanguageLevel.JDK_1_5;
+    if (kind == SelectorKind.STRING) requiredLevel = LanguageLevel.JDK_1_7;
+
+    if (kind == null || requiredLevel != null && !level.isAtLeast(requiredLevel)) {
+      boolean is7 = level.isAtLeast(LanguageLevel.JDK_1_7);
+      String expected = JavaErrorMessages.message(is7 ? "valid.switch.17.selector.types" : "valid.switch.selector.types");
+      String message = JavaErrorMessages.message("incompatible.types", expected, JavaHighlightUtil.formatType(type));
+      HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+      QuickFixAction.registerQuickFixAction(info, QUICK_FIX_FACTORY.createConvertSwitchToIfIntention(statement));
       if (PsiType.LONG.equals(type) || PsiType.FLOAT.equals(type) || PsiType.DOUBLE.equals(type)) {
-        QuickFixAction.registerQuickFixAction(errorResult, QUICK_FIX_FACTORY.createAddTypeCastFix(PsiType.INT, expression));
+        QuickFixAction.registerQuickFixAction(info, QUICK_FIX_FACTORY.createAddTypeCastFix(PsiType.INT, expression));
       }
-    }
-    else {
-      final PsiClass member = PsiUtil.resolveClassInClassTypeOnly(type);
-      if (member != null && !PsiUtil.isAccessible(member.getProject(), member, expression, null)) {
-        String message = PsiFormatUtil.formatClass(member, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_FQ_NAME) + " is inaccessible here";
-        errorResult = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+      if (requiredLevel != null) {
+        QuickFixAction.registerQuickFixAction(info, QUICK_FIX_FACTORY.createIncreaseLanguageLevelFix(requiredLevel));
       }
+      return info;
     }
-    return errorResult;
+
+    PsiClass member = PsiUtil.resolveClassInClassTypeOnly(type);
+    if (member != null && !PsiUtil.isAccessible(member.getProject(), member, expression, null)) {
+      String className = PsiFormatUtil.formatClass(member, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_FQ_NAME);
+      String message = JavaErrorMessages.message("inaccessible.type", className);
+      return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
+    }
+
+    return null;
   }
 
-  public static boolean isValidTypeForSwitchSelector(@NotNull PsiType type, final boolean languageLevel7OrHigher) {
-    if (TypeConversionUtil.getTypeRank(type) <= TypeConversionUtil.INT_RANK) return true;
-    if (type instanceof PsiClassType) {
-      PsiClass psiClass = ((PsiClassType)type).resolve();
-      if (psiClass == null) return false;
+  private enum SelectorKind { INT, ENUM, STRING }
+
+  private static SelectorKind getSwitchSelectorKind(@NotNull PsiType type) {
+    if (TypeConversionUtil.getTypeRank(type) <= TypeConversionUtil.INT_RANK) {
+      return SelectorKind.INT;
+    }
+
+    PsiClass psiClass = PsiUtil.resolveClassInClassTypeOnly(type);
+    if (psiClass != null) {
       if (psiClass.isEnum()) {
-        return true;
+        return SelectorKind.ENUM;
       }
-      if (languageLevel7OrHigher) {
-        return Comparing.strEqual(psiClass.getQualifiedName(), CommonClassNames.JAVA_LANG_STRING);
+      if (Comparing.strEqual(psiClass.getQualifiedName(), CommonClassNames.JAVA_LANG_STRING)) {
+        return SelectorKind.STRING;
       }
     }
-    return false;
+
+    return null;
   }
 
   @Nullable
@@ -1400,7 +1416,8 @@
 
   @Nullable
   static HighlightInfo checkThisOrSuperExpressionInIllegalContext(@NotNull PsiExpression expr,
-                                                                  @Nullable PsiJavaCodeReferenceElement qualifier) {
+                                                                  @Nullable PsiJavaCodeReferenceElement qualifier,
+                                                                  @NotNull LanguageLevel languageLevel) {
     if (expr instanceof PsiSuperExpression) {
       final PsiElement parent = expr.getParent();
       if (!(parent instanceof PsiReferenceExpression)) {
@@ -1426,7 +1443,7 @@
     if (aClass == null) return null;
 
     if (!InheritanceUtil.hasEnclosingInstanceInScope(aClass, expr, false, false) &&
-        !resolvesToImmediateSuperInterface(expr, qualifier, aClass)) {
+        !resolvesToImmediateSuperInterface(expr, qualifier, aClass, languageLevel)) {
       return HighlightClassUtil.reportIllegalEnclosingUsage(expr, null, aClass, expr);
     }
 
@@ -1476,8 +1493,9 @@
 
   private static boolean resolvesToImmediateSuperInterface(@NotNull PsiExpression expr,
                                                            @Nullable PsiJavaCodeReferenceElement qualifier,
-                                                           @NotNull PsiClass aClass) {
-    if (!(expr instanceof PsiSuperExpression) || qualifier == null || !PsiUtil.isLanguageLevel8OrHigher(expr)) return false;
+                                                           @NotNull PsiClass aClass,
+                                                           @NotNull LanguageLevel languageLevel) {
+    if (!(expr instanceof PsiSuperExpression) || qualifier == null || !languageLevel.isAtLeast(LanguageLevel.JDK_1_8)) return false;
     final PsiType superType = expr.getType();
     if (!(superType instanceof PsiClassType)) return false;
     final PsiClass superClass = ((PsiClassType)superType).resolve();
@@ -2671,7 +2689,8 @@
     if (expr instanceof PsiMethodCallExpression) {
       final PsiMethod method = ((PsiMethodCallExpression)expr).resolveMethod();
       if (method != null) {
-        QuickFixAction.registerQuickFixAction(highlightInfo, QUICK_FIX_FACTORY.createMethodReturnFix(method, parameter.getType(), true));
+        QuickFixAction.registerQuickFixAction(highlightInfo, PriorityActionWrapper
+          .lowPriority(method, QUICK_FIX_FACTORY.createMethodReturnFix(method, parameter.getType(), true)));
       }
     } else if (expr instanceof PsiReferenceExpression) {
       final PsiElement resolve = ((PsiReferenceExpression)expr).resolve();
@@ -2764,7 +2783,7 @@
     }
   }
 
-  private enum Feature {
+  public enum Feature {
     GENERICS(LanguageLevel.JDK_1_5, "feature.generics"),
     ANNOTATIONS(LanguageLevel.JDK_1_5, "feature.annotations"),
     STATIC_IMPORTS(LanguageLevel.JDK_1_5, "feature.static.imports"),
@@ -2781,9 +2800,7 @@
     LAMBDA_EXPRESSIONS(LanguageLevel.JDK_1_8, "feature.lambda.expressions"),
     TYPE_ANNOTATIONS(LanguageLevel.JDK_1_8, "feature.type.annotations");
 
-    @NotNull
     private final LanguageLevel level;
-    @NotNull
     private final String key;
 
     Feature(@NotNull LanguageLevel level, @NotNull @PropertyKey(resourceBundle = JavaErrorMessages.BUNDLE) final String key) {
@@ -2793,11 +2810,8 @@
   }
 
   @Nullable
-  private static HighlightInfo checkFeature(@NotNull final PsiElement element,
-                                            @NotNull Feature feature,
-                                            @NotNull LanguageLevel languageLevel,
-                                            @NotNull PsiFile containingFile) {
-    if (containingFile.getManager().isInProject(containingFile) && !languageLevel.isAtLeast(feature.level)) {
+  public static HighlightInfo checkFeature(@NotNull PsiElement element, @NotNull Feature feature, @NotNull LanguageLevel level, @NotNull PsiFile file) {
+    if (file.getManager().isInProject(file) && !level.isAtLeast(feature.level)) {
       String message = JavaErrorMessages.message("insufficient.language.level", JavaErrorMessages.message(feature.key));
       HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(element).descriptionAndTooltip(message).create();
       QuickFixAction.registerQuickFixAction(info, QUICK_FIX_FACTORY.createIncreaseLanguageLevelFix(feature.level));
@@ -2807,76 +2821,4 @@
 
     return null;
   }
-
-  @Nullable
-  public static HighlightInfo checkGenericsFeature(@NotNull PsiElement parameterList,
-                                                   int listSize,
-                                                   @NotNull LanguageLevel languageLevel,
-                                                   @NotNull PsiFile containingFile) {
-    return listSize > 0 ? checkFeature(parameterList, Feature.GENERICS, languageLevel, containingFile) : null;
-  }
-
-  @Nullable
-  public static HighlightInfo checkAnnotationFeature(@NotNull PsiElement element,
-                                                     @NotNull LanguageLevel languageLevel,
-                                                     @NotNull PsiFile containingFile) {
-    return checkFeature(element, Feature.ANNOTATIONS, languageLevel, containingFile);
-  }
-
-  @Nullable
-  public static HighlightInfo checkForEachFeature(@NotNull PsiForeachStatement statement, @NotNull LanguageLevel languageLevel,@NotNull PsiFile containingFile) {
-    return checkFeature(statement, Feature.FOR_EACH, languageLevel, containingFile);
-  }
-
-  @Nullable
-  public static HighlightInfo checkStaticImportFeature(@NotNull PsiImportStaticStatement statement, @NotNull LanguageLevel languageLevel,@NotNull PsiFile containingFile) {
-    return checkFeature(statement, Feature.STATIC_IMPORTS, languageLevel, containingFile);
-  }
-
-  @Nullable
-  public static HighlightInfo checkVarargFeature(@NotNull PsiParameter parameter, @NotNull LanguageLevel languageLevel,@NotNull PsiFile containingFile) {
-    return checkFeature(parameter, Feature.VARARGS, languageLevel, containingFile);
-  }
-
-  @Nullable
-  public static HighlightInfo checkDiamondFeature(@NotNull PsiType type,
-                                                  @NotNull PsiElement toHighlight,
-                                                  @NotNull LanguageLevel languageLevel,
-                                                  @NotNull PsiFile containingFile) {
-    if (type instanceof PsiDiamondType) {
-      return checkFeature(toHighlight, Feature.DIAMOND_TYPES, languageLevel, containingFile);
-    }
-    return null;
-  }
-
-  @Nullable
-  public static HighlightInfo checkMultiCatchFeature(@NotNull PsiParameter parameter, @NotNull LanguageLevel languageLevel,@NotNull PsiFile containingFile) {
-    return parameter.getType() instanceof PsiDisjunctionType ? checkFeature(parameter, Feature.MULTI_CATCH,
-                                                                            languageLevel, containingFile) : null;
-  }
-
-  @Nullable
-  public static HighlightInfo checkTryWithResourcesFeature(@NotNull PsiElement toHighlight, @NotNull LanguageLevel languageLevel,@NotNull PsiFile containingFile) {
-    return checkFeature(toHighlight, Feature.TRY_WITH_RESOURCES, languageLevel, containingFile);
-  }
-
-  @Nullable
-  public static HighlightInfo checkExtensionMethodsFeature(@NotNull PsiMethod method, @NotNull LanguageLevel languageLevel,@NotNull PsiFile containingFile) {
-    return checkFeature(method, Feature.EXTENSION_METHODS, languageLevel, containingFile);
-  }
-
-  @Nullable
-  public static HighlightInfo checkMethodReferencesFeature(@NotNull PsiMethodReferenceExpression expression, @NotNull LanguageLevel languageLevel,@NotNull PsiFile containingFile) {
-    return checkFeature(expression, Feature.METHOD_REFERENCES, languageLevel, containingFile);
-  }
-
-  @Nullable
-  public static HighlightInfo checkLambdaFeature(@NotNull PsiLambdaExpression expression, @NotNull LanguageLevel languageLevel,@NotNull PsiFile containingFile) {
-    return checkFeature(expression, Feature.LAMBDA_EXPRESSIONS, languageLevel, containingFile);
-  }
-
-  @Nullable
-  public static HighlightInfo checkTypeAnnotationFeature(@NotNull PsiAnnotation annotation, @NotNull LanguageLevel languageLevel,@NotNull PsiFile containingFile) {
-    return checkFeature(annotation, Feature.TYPE_ANNOTATIONS, languageLevel, containingFile);
-  }
 }
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
index 2186e43..cbfb5f4 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
@@ -48,6 +48,8 @@
 import gnu.trove.THashMap;
 import gnu.trove.TObjectIntHashMap;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import com.intellij.codeInsight.daemon.impl.analysis.HighlightUtil.Feature;
 
 import java.util.Collection;
 import java.util.List;
@@ -213,12 +215,12 @@
   @Override
   public void visitAnnotation(PsiAnnotation annotation) {
     super.visitAnnotation(annotation);
-    if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkAnnotationFeature(annotation, myLanguageLevel, myFile));
+    if (!myHolder.hasErrorResults()) myHolder.add(checkFeature(annotation, Feature.ANNOTATIONS));
     if (!myHolder.hasErrorResults()) myHolder.add(AnnotationsHighlightUtil.checkApplicability(annotation, myLanguageLevel, myFile));
     if (!myHolder.hasErrorResults()) myHolder.add(AnnotationsHighlightUtil.checkAnnotationType(annotation));
     if (!myHolder.hasErrorResults()) myHolder.add(AnnotationsHighlightUtil.checkMissingAttributes(annotation));
     if (!myHolder.hasErrorResults()) myHolder.add(AnnotationsHighlightUtil.checkTargetAnnotationDuplicates(annotation));
-    if (!myHolder.hasErrorResults()) myHolder.add(AnnotationsHighlightUtil.checkDuplicateAnnotations(annotation));
+    if (!myHolder.hasErrorResults()) myHolder.add(AnnotationsHighlightUtil.checkDuplicateAnnotations(annotation, myLanguageLevel));
     if (!myHolder.hasErrorResults()) myHolder.add(AnnotationsHighlightUtil.checkForeignInnerClassesUsed(annotation));
     if (!myHolder.hasErrorResults()) myHolder.add(AnnotationsHighlightUtil.checkFunctionalInterface(annotation, myLanguageLevel));
     if (!myHolder.hasErrorResults()) myHolder.add(AnnotationsHighlightUtil.checkRepeatableAnnotation(annotation));
@@ -283,7 +285,7 @@
 
   @Override
   public void visitLambdaExpression(PsiLambdaExpression expression) {
-    myHolder.add(HighlightUtil.checkLambdaFeature(expression, myLanguageLevel, myFile));
+    myHolder.add(checkFeature(expression, Feature.LAMBDA_EXPRESSIONS));
     if (!myHolder.hasErrorResults()) {
       if (LambdaUtil.isValidLambdaContext(expression.getParent())) {
         final PsiType functionalInterfaceType = expression.getFunctionalInterfaceType();
@@ -315,41 +317,14 @@
                 final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(resolveResult);
                 if (interfaceMethod != null) {
                   final PsiParameter[] parameters = interfaceMethod.getParameterList().getParameters();
-                  final PsiParameter[] lambdaParameters = expression.getParameterList().getParameters();
-                  final String incompatibleTypesMessage = "Incompatible parameter types in lambda expression";
-                  if (lambdaParameters.length != parameters.length) {
-                    HighlightInfo result = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression)
+                  PsiElement incompatibleElt = LambdaHighlightingUtil
+                    .checkParametersCompatible(expression, parameters, LambdaUtil.getSubstitutor(interfaceMethod, resolveResult));
+                  if (incompatibleElt != null) {
+                    final String incompatibleTypesMessage = "Incompatible parameter types in lambda expression";
+                    HighlightInfo result = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(incompatibleElt)
                       .descriptionAndTooltip(incompatibleTypesMessage).create();
                     myHolder.add(result);
-                  }
-                  else {
-                    final PsiSubstitutor substitutor = LambdaUtil.getSubstitutor(interfaceMethod, resolveResult);
-                    if (expression.hasFormalParameterTypes()) {
-                      for (int i = 0; i < lambdaParameters.length; i++) {
-                        if (!PsiTypesUtil.compareTypes(lambdaParameters[i].getType(), substitutor.substitute(parameters[i].getType()), true)) {
-                          HighlightInfo result = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
-                            .range(lambdaParameters[i])
-                            .descriptionAndTooltip(incompatibleTypesMessage)
-                            .create();
-                          myHolder.add(result);
-                          break;
-                        }
-                      }
-                    } else {
-                      for (int i = 0; i < lambdaParameters.length; i++) {
-                        PsiParameter lambdaParameter = lambdaParameters[i];
-                        if (!TypeConversionUtil.isAssignable(lambdaParameter.getType(), substitutor.substitute(parameters[i].getType()))) {
-                          HighlightInfo result = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
-                            .range(lambdaParameter)
-                            .descriptionAndTooltip(incompatibleTypesMessage)
-                            .create();
-                          myHolder.add(result);
-                          break;
-                        }
-                      }
-                    }
-                  }
-                  if (!myHolder.hasErrorResults()) {
+                  } else {
                     final PsiClass samClass = resolveResult.getElement();
                     if (!PsiUtil.isAccessible(myFile.getProject(), samClass, expression, null)) {
                       myHolder.add(HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression)
@@ -577,14 +552,14 @@
   }
 
   @Override
-  public void visitForeachStatement(final PsiForeachStatement statement) {
-    myHolder.add(HighlightUtil.checkForEachFeature(statement, myLanguageLevel, myFile));
+  public void visitForeachStatement(PsiForeachStatement statement) {
+    myHolder.add(checkFeature(statement, Feature.FOR_EACH));
     if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkForeachLoopParameterType(statement));
   }
 
   @Override
-  public void visitImportStaticStatement(final PsiImportStaticStatement statement) {
-    myHolder.add(HighlightUtil.checkStaticImportFeature(statement, myLanguageLevel, myFile));
+  public void visitImportStaticStatement(PsiImportStaticStatement statement) {
+    myHolder.add(checkFeature(statement, Feature.STATIC_IMPORTS));
   }
 
   @Override
@@ -615,12 +590,12 @@
         }
       }
 
-      myHolder.add(HighlightUtil.checkUnderscore(identifier, variable));
+      myHolder.add(HighlightUtil.checkUnderscore(identifier, variable, myLanguageLevel));
     }
     else if (parent instanceof PsiClass) {
       PsiClass aClass = (PsiClass)parent;
       if (aClass.isAnnotationType()) {
-        myHolder.add(HighlightUtil.checkAnnotationFeature(identifier, myLanguageLevel, myFile));
+        myHolder.add(checkFeature(identifier, Feature.ANNOTATIONS));
       }
 
       myHolder.add(HighlightClassUtil.checkClassAlreadyImported(aClass, identifier));
@@ -759,16 +734,20 @@
     if (!myHolder.hasErrorResults()) myHolder.add(HighlightMethodUtil.checkRecursiveConstructorInvocation(method));
     if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkOverrideAnnotation(method, myLanguageLevel));
     if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkSafeVarargsAnnotation(method));
+
     PsiClass aClass = method.getContainingClass();
     if (!myHolder.hasErrorResults() && method.isConstructor()) {
       myHolder.add(HighlightClassUtil.checkThingNotAllowedInInterface(method, aClass));
     }
-    if (!myHolder.hasErrorResults() && (method.hasModifierProperty(PsiModifier.DEFAULT) || 
-                                        aClass != null && aClass.isInterface() && method.hasModifierProperty(PsiModifier.STATIC))) {
-      myHolder.add(HighlightUtil.checkExtensionMethodsFeature(method, myLanguageLevel, myFile));
+    if (!myHolder.hasErrorResults() && method.hasModifierProperty(PsiModifier.DEFAULT)) {
+      myHolder.add(checkFeature(method, Feature.EXTENSION_METHODS));
     }
-
-    if (!myHolder.hasErrorResults()) myHolder.add(HighlightMethodUtil.checkDuplicateMethod(aClass, method, getDuplicateMethods(aClass)));
+    if (!myHolder.hasErrorResults() && aClass != null && aClass.isInterface() && method.hasModifierProperty(PsiModifier.STATIC)) {
+      myHolder.add(checkFeature(method, Feature.EXTENSION_METHODS));
+    }
+    if (!myHolder.hasErrorResults() && aClass != null) {
+      myHolder.add(HighlightMethodUtil.checkDuplicateMethod(aClass, method, getDuplicateMethods(aClass)));
+    }
 
     // method params are highlighted in visitMethod since we should make sure the method body was visited before
     PsiParameter[] parameters = method.getParameterList().getParameters();
@@ -854,7 +833,7 @@
     PsiElement parent = list.getParent();
     if (parent instanceof PsiMethod) {
       PsiMethod method = (PsiMethod)parent;
-      if (!myHolder.hasErrorResults()) myHolder.add(HighlightMethodUtil.checkMethodCanHaveBody(method, myLanguageLevel,myFile));
+      if (!myHolder.hasErrorResults()) myHolder.add(HighlightMethodUtil.checkMethodCanHaveBody(method, myLanguageLevel));
       MethodSignatureBackedByPsiMethod methodSignature = MethodSignatureBackedByPsiMethod.create(method, PsiSubstitutor.EMPTY);
       if (!method.isConstructor()) {
         try {
@@ -944,12 +923,14 @@
     super.visitParameter(parameter);
 
     final PsiElement parent = parameter.getParent();
-    if (parent instanceof PsiParameterList) {
-      if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkVarArgParameterIsLast(parameter,
-                                                                                                     myLanguageLevel,myFile));
+    if (parent instanceof PsiParameterList && parameter.isVarArgs()) {
+      if (!myHolder.hasErrorResults()) myHolder.add(checkFeature(parameter, Feature.VARARGS));
+      if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkVarArgParameterIsLast(parameter));
     }
     else if (parent instanceof PsiCatchSection) {
-      if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkMultiCatchFeature(parameter, myLanguageLevel,myFile));
+      if (!myHolder.hasErrorResults() && parameter.getType() instanceof PsiDisjunctionType) {
+        myHolder.add(checkFeature(parameter, Feature.MULTI_CATCH));
+      }
       if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkCatchParameterIsThrowable(parameter));
       if (!myHolder.hasErrorResults()) myHolder.addAll(GenericsHighlightUtil.checkCatchParameterIsClass(parameter));
       if (!myHolder.hasErrorResults()) myHolder.addAll(HighlightUtil.checkCatchTypeIsDisjoint(parameter));
@@ -1213,7 +1194,8 @@
 
   @Override
   public void visitMethodReferenceExpression(PsiMethodReferenceExpression expression) {
-    myHolder.add(HighlightUtil.checkMethodReferencesFeature(expression, myLanguageLevel,myFile));
+    myHolder.add(checkFeature(expression, Feature.METHOD_REFERENCES));
+
     final JavaResolveResult result;
     final JavaResolveResult[] results;
     try {
@@ -1364,11 +1346,16 @@
 
   @Override
   public void visitReferenceParameterList(PsiReferenceParameterList list) {
-    myHolder.add(GenericsHighlightUtil.checkParametersAllowed(list, myLanguageLevel,myFile));
+    if (list.getTextLength() == 0) return;
+
+    myHolder.add(checkFeature(list, Feature.GENERICS));
+    if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkParametersAllowed(list));
     if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkParametersOnRaw(list));
     if (!myHolder.hasErrorResults()) {
       for (PsiTypeElement typeElement : list.getTypeParameterElements()) {
-        myHolder.add(HighlightUtil.checkDiamondFeature(typeElement.getType(), list, myLanguageLevel,myFile));
+        if (typeElement.getType() instanceof PsiDiamondType) {
+          myHolder.add(checkFeature(list, Feature.DIAMOND_TYPES));
+        }
       }
     }
   }
@@ -1391,7 +1378,7 @@
 
   @Override
   public void visitSuperExpression(PsiSuperExpression expr) {
-    myHolder.add(HighlightUtil.checkThisOrSuperExpressionInIllegalContext(expr, expr.getQualifier()));
+    myHolder.add(HighlightUtil.checkThisOrSuperExpressionInIllegalContext(expr, expr.getQualifier(), myLanguageLevel));
     if (!myHolder.hasErrorResults()) visitExpression(expr);
   }
 
@@ -1404,12 +1391,12 @@
   @Override
   public void visitSwitchStatement(PsiSwitchStatement statement) {
     super.visitSwitchStatement(statement);
-    if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkSwitchSelectorType(statement));
+    if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkSwitchSelectorType(statement, myLanguageLevel));
   }
 
   @Override
   public void visitThisExpression(PsiThisExpression expr) {
-    myHolder.add(HighlightUtil.checkThisOrSuperExpressionInIllegalContext(expr, expr.getQualifier()));
+    myHolder.add(HighlightUtil.checkThisOrSuperExpressionInIllegalContext(expr, expr.getQualifier(), myLanguageLevel));
     if (!myHolder.hasErrorResults()) {
       myHolder.add(HighlightUtil.checkMemberReferencedBeforeConstructorCalled(expr, null, myFile));
     }
@@ -1451,7 +1438,7 @@
   @Override
   public void visitResourceList(PsiResourceList resourceList) {
     super.visitResourceList(resourceList);
-    if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkTryWithResourcesFeature(resourceList, myLanguageLevel, myFile));
+    if (!myHolder.hasErrorResults()) myHolder.add(checkFeature(resourceList, Feature.TRY_WITH_RESOURCES));
   }
 
   @Override
@@ -1465,7 +1452,7 @@
   public void visitTypeCastExpression(PsiTypeCastExpression typeCast) {
     super.visitTypeCastExpression(typeCast);
     try {
-      if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkIntersectionInTypeCast(typeCast));
+      if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkIntersectionInTypeCast(typeCast, myLanguageLevel));
       if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkInconvertibleTypeCast(typeCast));
     }
     catch (IndexNotReadyException ignore) {
@@ -1474,7 +1461,11 @@
 
   @Override
   public void visitTypeParameterList(PsiTypeParameterList list) {
-    myHolder.add(GenericsHighlightUtil.checkTypeParametersList(list, myLanguageLevel,myFile));
+    PsiTypeParameter[] typeParameters = list.getTypeParameters();
+    if (typeParameters.length > 0) {
+      myHolder.add(checkFeature(list, Feature.GENERICS));
+      if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkTypeParametersList(list, typeParameters, myLanguageLevel));
+    }
   }
 
   @Override
@@ -1507,7 +1498,7 @@
   @Override
   public void visitConditionalExpression(PsiConditionalExpression expression) {
     super.visitConditionalExpression(expression);
-    if (PsiUtil.isLanguageLevel8OrHigher(expression) && PsiPolyExpressionUtil.isPolyExpression(expression)) {
+    if (myLanguageLevel.isAtLeast(LanguageLevel.JDK_1_8) && PsiPolyExpressionUtil.isPolyExpression(expression)) {
       final PsiExpression thenExpression = expression.getThenExpression();
       final PsiExpression elseExpression = expression.getElseExpression();
       if (thenExpression != null && elseExpression != null) {
@@ -1524,4 +1515,9 @@
       }
     }
   }
+
+  @Nullable
+  private HighlightInfo checkFeature(@NotNull PsiElement element, @NotNull Feature feature) {
+    return HighlightUtil.checkFeature(element, feature, myLanguageLevel, myFile);
+  }
 }
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaGenericsUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaGenericsUtil.java
index a79aece..f24a5db 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaGenericsUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaGenericsUtil.java
@@ -286,6 +286,14 @@
       PsiType itemType = superClassSubstitutor.substitute(typeParameter);
       return itemType == null ? PsiType.getJavaLangObject(manager, aClass.getResolveScope()) : itemType;
     }
+    if (type instanceof PsiIntersectionType) {
+      for (PsiType conjunct : ((PsiIntersectionType)type).getConjuncts()) {
+        final PsiType itemType = getCollectionItemType(conjunct, scope);
+        if (itemType != null) {
+          return itemType;
+        }
+      }
+    }
     return null;
   }
 
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavadocErrorFilter.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavadocErrorFilter.java
new file mode 100644
index 0000000..373e6c2
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavadocErrorFilter.java
@@ -0,0 +1,37 @@
+/*
+ * 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.codeInsight.daemon.impl.analysis;
+
+import com.intellij.codeInsight.highlighting.HighlightErrorFilter;
+import com.intellij.psi.PsiErrorElement;
+import com.intellij.psi.javadoc.PsiDocComment;
+import com.intellij.psi.util.PsiTreeUtil;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author yole
+ */
+public class JavadocErrorFilter extends HighlightErrorFilter {
+
+  @Override
+  public boolean shouldHighlightErrorElement(@NotNull final PsiErrorElement element) {
+    return !value(element);
+  }
+
+  public static boolean value(final PsiErrorElement element) {
+    return PsiTreeUtil.getParentOfType(element, PsiDocComment.class) != null;
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ClassKind.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ClassKind.java
new file mode 100644
index 0000000..fd1c7e0
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ClassKind.java
@@ -0,0 +1,23 @@
+/*
+ * 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.codeInsight.daemon.impl.quickfix;
+
+/**
+ * Created by Max Medvedev on 28/05/14
+ */
+public interface ClassKind {
+  String getDescription();
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateClassKind.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateClassKind.java
index 5aa7b63..1f78bba 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateClassKind.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateClassKind.java
@@ -20,7 +20,7 @@
 /**
  * @author ven
 */
-public enum CreateClassKind {
+public enum CreateClassKind implements ClassKind {
   CLASS     (QuickFixBundle.message("create.class")),
   INTERFACE (QuickFixBundle.message("create.interface")),
   ENUM      (QuickFixBundle.message("create.enum")),
@@ -32,6 +32,7 @@
     myDescription = description;
   }
 
+  @Override
   public String getDescription() {
     return myDescription;
   }
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisArgumentFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisArgumentFix.java
index 3b427e8..c5bba78 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisArgumentFix.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisArgumentFix.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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,10 +24,6 @@
 package com.intellij.codeInsight.daemon.impl.quickfix;
 
 import com.intellij.codeInsight.daemon.impl.HighlightInfo;
-import com.intellij.codeInsight.intention.IntentionAction;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.TextRange;
 import com.intellij.psi.*;
 import com.intellij.psi.infos.CandidateInfo;
@@ -35,7 +31,6 @@
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.psi.util.TypeConversionUtil;
 import com.intellij.refactoring.util.RefactoringChangeUtil;
-import com.intellij.util.IncorrectOperationException;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.HashSet;
@@ -81,7 +76,6 @@
         for (CandidateInfo candidate : candidates) {
           PsiMethod method = (PsiMethod)candidate.getElement();
           PsiSubstitutor substitutor = candidate.getSubstitutor();
-          assert method != null;
           PsiParameter[] parameters = method.getParameterList().getParameters();
           if (expressions.length != parameters.length) {
             continue;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RemoveUnusedVariableUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RemoveUnusedVariableUtil.java
index dd32cd0..59f7cad 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RemoveUnusedVariableUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RemoveUnusedVariableUtil.java
@@ -18,7 +18,6 @@
 import com.intellij.psi.*;
 import com.intellij.psi.util.InheritanceUtil;
 import com.intellij.psi.util.PropertyUtil;
-import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.IncorrectOperationException;
 import gnu.trove.THashSet;
@@ -221,7 +220,12 @@
         }
       }
       else if (element instanceof PsiExpressionStatement && deleteMode != CANCEL) {
-        element.delete();
+        final PsiElement parent = element.getParent();
+        if (parent instanceof PsiIfStatement || parent instanceof PsiLoopStatement && ((PsiLoopStatement)parent).getBody() == element) {
+          element.replace(JavaPsiFacade.getElementFactory(element.getProject()).createStatementFromText(";", element));
+        } else {
+          element.delete();
+        }
         break;
       }
       else if (element instanceof PsiVariable && element == variable) {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/WrapArrayToArraysAsListFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/WrapArrayToArraysAsListFix.java
new file mode 100644
index 0000000..39c630a
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/WrapArrayToArraysAsListFix.java
@@ -0,0 +1,94 @@
+/*
+ * 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.codeInsight.daemon.impl.quickfix;
+
+import com.intellij.codeInsight.daemon.QuickFixBundle;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.JavaCodeStyleManager;
+import com.intellij.psi.util.InheritanceUtil;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class WrapArrayToArraysAsListFix extends MethodArgumentFix {
+  public static final ArgumentFixerActionFactory REGISTAR = new MyFixerActionFactory();
+
+  protected WrapArrayToArraysAsListFix(final @NotNull PsiExpressionList list,
+                                       final int i,
+                                       final @NotNull PsiType toType,
+                                       final @NotNull ArgumentFixerActionFactory fixerActionFactory) {
+    super(list, i, toType, fixerActionFactory);
+  }
+
+  @NotNull
+  @Override
+  public String getText() {
+    if (myArgList.getExpressions().length == 1) {
+      return QuickFixBundle.message("wrap.array.to.arrays.as.list.single.parameter.text");
+    } else {
+      return QuickFixBundle.message("wrap.array.to.arrays.as.list.parameter.text", myIndex + 1);
+    }
+  }
+
+  public static class MyFixerActionFactory extends ArgumentFixerActionFactory {
+
+    @Nullable
+    @Override
+    protected PsiExpression getModifiedArgument(final PsiExpression expression, final PsiType toType) throws IncorrectOperationException {
+      final PsiType exprType = expression.getType();
+      if (!(exprType instanceof PsiArrayType && toType instanceof PsiClassType)) {
+        return null;
+      }
+      final PsiClass resolvedToType = ((PsiClassType)toType).resolve();
+      if (resolvedToType == null) {
+        return null;
+      }
+      final PsiClass javaUtilList = getJavaUtilList(expression);
+      if (javaUtilList == null || !InheritanceUtil.isInheritorOrSelf(javaUtilList, resolvedToType, true)) {
+        return null;
+      }
+      final PsiType[] parameters = ((PsiClassType)toType).getParameters();
+      final PsiType arrayComponentType = ((PsiArrayType)exprType).getComponentType();
+      if (!(parameters.length == 1 && parameters[0].equals(arrayComponentType))) {
+        return null;
+      }
+
+      final String rawNewExpression = String.format("java.util.Arrays.asList(%s)", expression.getText());
+      final Project project = expression.getProject();
+      final PsiExpression newExpression = JavaPsiFacade.getInstance(project).getElementFactory().createExpressionFromText(rawNewExpression, null);
+      return (PsiExpression)JavaCodeStyleManager.getInstance(project).shortenClassReferences(newExpression);
+    }
+
+    @Nullable
+    private static PsiClass getJavaUtilList(final PsiElement context) {
+      return JavaPsiFacade.getInstance(context.getProject()).findClass(CommonClassNames.JAVA_UTIL_LIST, context.getResolveScope());
+    }
+
+    @Override
+    public boolean areTypesConvertible(final PsiType exprType, final PsiType parameterType, final PsiElement context) {
+      return true;
+    }
+
+    @Override
+    public MethodArgumentFix createFix(final PsiExpressionList list, final int i, final PsiType toType) {
+      return new WrapArrayToArraysAsListFix(list, i, toType, this);
+    }
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/intention/AddAnnotationFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/intention/AddAnnotationFix.java
new file mode 100644
index 0000000..1d72ba7
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/intention/AddAnnotationFix.java
@@ -0,0 +1,56 @@
+/*
+ * 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.codeInsight.intention;
+
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiModifierListOwner;
+import com.intellij.psi.PsiNameValuePair;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author ven
+ */
+public class AddAnnotationFix extends AddAnnotationPsiFix implements IntentionAction {
+  public AddAnnotationFix(@NotNull String fqn, @NotNull PsiModifierListOwner modifierListOwner, @NotNull String... annotationsToRemove) {
+    this(fqn, modifierListOwner, PsiNameValuePair.EMPTY_ARRAY, annotationsToRemove);
+  }
+
+  public AddAnnotationFix(@NotNull String fqn,
+                          @NotNull PsiModifierListOwner modifierListOwner,
+                          @NotNull PsiNameValuePair[] values,
+                          @NotNull String... annotationsToRemove) {
+    super(fqn, modifierListOwner, values, annotationsToRemove);
+  }
+
+  @Override
+  public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
+    return isAvailable();
+  }
+
+  @Override
+  public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
+    applyFix();
+  }
+
+  @Override
+  public boolean startInWriteAction() {
+    return true;
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/intention/EmptyQuickFixFactory.java b/java/java-analysis-impl/src/com/intellij/codeInsight/intention/EmptyQuickFixFactory.java
new file mode 100644
index 0000000..a69603b
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/intention/EmptyQuickFixFactory.java
@@ -0,0 +1,605 @@
+/*
+ * 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.codeInsight.intention;
+
+import com.intellij.codeInsight.daemon.QuickFixActionRegistrar;
+import com.intellij.codeInspection.IntentionAndQuickFixAction;
+import com.intellij.codeInspection.LocalQuickFix;
+import com.intellij.codeInspection.LocalQuickFixAndIntentionActionOnPsiElement;
+import com.intellij.codeInspection.LocalQuickFixOnPsiElement;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.project.Project;
+import com.intellij.pom.java.LanguageLevel;
+import com.intellij.psi.*;
+import com.intellij.psi.tree.IElementType;
+import com.intellij.psi.util.PropertyMemberType;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+@SuppressWarnings("UnusedDeclaration") // upsource
+public class EmptyQuickFixFactory extends QuickFixFactory {
+  @NotNull
+  @Override
+  public LocalQuickFixAndIntentionActionOnPsiElement createModifierListFix(@NotNull PsiModifierList psiModifierList, @PsiModifier.ModifierConstant @NotNull String s, boolean b, boolean b2) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public LocalQuickFixAndIntentionActionOnPsiElement createModifierListFix(@NotNull PsiModifierListOwner psiModifierListOwner, @PsiModifier.ModifierConstant @NotNull String s, boolean b, boolean b2) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public LocalQuickFixAndIntentionActionOnPsiElement createMethodReturnFix(@NotNull PsiMethod psiMethod, @NotNull PsiType psiType, boolean b) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public LocalQuickFixAndIntentionActionOnPsiElement createAddMethodFix(@NotNull PsiMethod psiMethod, @NotNull PsiClass psiClass) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public LocalQuickFixAndIntentionActionOnPsiElement createAddMethodFix(@NotNull String s, @NotNull PsiClass psiClass, @NotNull String... strings) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public LocalQuickFixAndIntentionActionOnPsiElement createImplementMethodsFix(@NotNull PsiElement psiElement) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public LocalQuickFixAndIntentionActionOnPsiElement createImplementMethodsFix(@NotNull PsiClass psiClass) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public LocalQuickFixOnPsiElement createMethodThrowsFix(@NotNull PsiMethod psiMethod, @NotNull PsiClassType psiClassType, boolean b, boolean b2) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public LocalQuickFixAndIntentionActionOnPsiElement createAddDefaultConstructorFix(@NotNull PsiClass psiClass) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @Nullable
+  @Override
+  public LocalQuickFixAndIntentionActionOnPsiElement createAddConstructorFix(@NotNull PsiClass psiClass, @PsiModifier.ModifierConstant @NotNull String s) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public LocalQuickFixAndIntentionActionOnPsiElement createMethodParameterTypeFix(@NotNull PsiMethod psiMethod, int i, @NotNull PsiType psiType, boolean b) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public LocalQuickFixAndIntentionActionOnPsiElement createMakeClassInterfaceFix(@NotNull PsiClass psiClass) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public LocalQuickFixAndIntentionActionOnPsiElement createMakeClassInterfaceFix(@NotNull PsiClass psiClass, boolean b) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public LocalQuickFixAndIntentionActionOnPsiElement createExtendsListFix(@NotNull PsiClass psiClass, @NotNull PsiClassType psiClassType, boolean b) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public LocalQuickFixAndIntentionActionOnPsiElement createRemoveUnusedParameterFix(@NotNull PsiParameter psiParameter) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createRemoveUnusedVariableFix(@NotNull PsiVariable psiVariable) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @Nullable
+  @Override
+  public IntentionAction createCreateClassOrPackageFix(@NotNull PsiElement psiElement, @NotNull String s, boolean b, String s2) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @Nullable
+  @Override
+  public IntentionAction createCreateClassOrInterfaceFix(@NotNull PsiElement psiElement, @NotNull String s, boolean b, String s2) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createCreateFieldOrPropertyFix(@NotNull PsiClass psiClass, @NotNull String s, @NotNull PsiType psiType, @NotNull PropertyMemberType propertyMemberType, @NotNull PsiAnnotation... psiAnnotations) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createSetupJDKFix() {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createAddExceptionToCatchFix() {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createAddExceptionToThrowsFix(@NotNull PsiElement psiElement) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createSurroundWithTryCatchFix(@NotNull PsiElement psiElement) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createGeneralizeCatchFix(@NotNull PsiElement psiElement, @NotNull PsiClassType psiClassType) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createChangeToAppendFix(@NotNull IElementType iElementType, @NotNull PsiType psiType, @NotNull PsiAssignmentExpression psiAssignmentExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createAddTypeCastFix(@NotNull PsiType psiType, @NotNull PsiExpression psiExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createWrapExpressionFix(@NotNull PsiType psiType, @NotNull PsiExpression psiExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createReuseVariableDeclarationFix(@NotNull PsiLocalVariable psiLocalVariable) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createConvertToStringLiteralAction() {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createDeleteCatchFix(@NotNull PsiParameter psiParameter) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createDeleteMultiCatchFix(@NotNull PsiTypeElement psiTypeElement) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createConvertSwitchToIfIntention(@NotNull PsiSwitchStatement psiSwitchStatement) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createNegationBroadScopeFix(@NotNull PsiPrefixExpression psiPrefixExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createCreateFieldFromUsageFix(@NotNull PsiReferenceExpression psiReferenceExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createReplaceWithListAccessFix(@NotNull PsiArrayAccessExpression psiArrayAccessExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createAddNewArrayExpressionFix(@NotNull PsiArrayInitializerExpression psiArrayInitializerExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createMoveCatchUpFix(@NotNull PsiCatchSection psiCatchSection, @NotNull PsiCatchSection psiCatchSection2) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createRenameWrongRefFix(@NotNull PsiReferenceExpression psiReferenceExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createRemoveQualifierFix(@NotNull PsiExpression psiExpression, @NotNull PsiReferenceExpression psiReferenceExpression, @NotNull PsiClass psiClass) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createRemoveParameterListFix(@NotNull PsiMethod psiMethod) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAndQuickFixAction createShowModulePropertiesFix(@NotNull PsiElement psiElement) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createIncreaseLanguageLevelFix(@NotNull LanguageLevel languageLevel) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createChangeParameterClassFix(@NotNull PsiClass psiClass, @NotNull PsiClassType psiClassType) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createReplaceInaccessibleFieldWithGetterSetterFix(@NotNull PsiElement psiElement, @NotNull PsiMethod psiMethod, boolean b) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createSurroundWithArrayFix(@Nullable PsiCall psiCall, @Nullable PsiExpression psiExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createImplementAbstractClassMethodsFix(@NotNull PsiElement psiElement) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createMoveClassToSeparateFileFix(@NotNull PsiClass psiClass) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createRenameFileFix(@NotNull String s) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public LocalQuickFixAndIntentionActionOnPsiElement createRenameElementFix(@NotNull PsiNamedElement psiNamedElement) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public LocalQuickFixAndIntentionActionOnPsiElement createRenameElementFix(@NotNull PsiNamedElement psiNamedElement, @NotNull String s) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createChangeExtendsToImplementsFix(@NotNull PsiClass psiClass, @NotNull PsiClassType psiClassType) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createCreateConstructorMatchingSuperFix(@NotNull PsiClass psiClass) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createRemoveNewQualifierFix(@NotNull PsiNewExpression psiNewExpression, @Nullable PsiClass psiClass) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createSuperMethodReturnFix(@NotNull PsiMethod psiMethod, @NotNull PsiType psiType) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createInsertNewFix(@NotNull PsiMethodCallExpression psiMethodCallExpression, @NotNull PsiClass psiClass) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createAddMethodBodyFix(@NotNull PsiMethod psiMethod) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createDeleteMethodBodyFix(@NotNull PsiMethod psiMethod) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createInsertSuperFix(@NotNull PsiMethod psiMethod) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createChangeMethodSignatureFromUsageFix(@NotNull PsiMethod psiMethod, @NotNull PsiExpression[] psiExpressions, @NotNull PsiSubstitutor psiSubstitutor, @NotNull PsiElement psiElement, boolean b, int i) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createChangeMethodSignatureFromUsageReverseOrderFix(@NotNull PsiMethod psiMethod, @NotNull PsiExpression[] psiExpressions, @NotNull PsiSubstitutor psiSubstitutor, @NotNull PsiElement psiElement, boolean b, int i) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createCreateMethodFromUsageFix(@NotNull PsiMethodCallExpression psiMethodCallExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createCreateAbstractMethodFromUsageFix(@NotNull PsiMethodCallExpression psiMethodCallExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createCreatePropertyFromUsageFix(@NotNull PsiMethodCallExpression psiMethodCallExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createCreateConstructorFromSuperFix(@NotNull PsiMethodCallExpression psiMethodCallExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createCreateConstructorFromThisFix(@NotNull PsiMethodCallExpression psiMethodCallExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createCreateGetterSetterPropertyFromUsageFix(@NotNull PsiMethodCallExpression psiMethodCallExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createStaticImportMethodFix(@NotNull PsiMethodCallExpression psiMethodCallExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createReplaceAddAllArrayToCollectionFix(@NotNull PsiMethodCallExpression psiMethodCallExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createCreateConstructorFromCallFix(@NotNull PsiConstructorCall psiConstructorCall) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public List<IntentionAction> getVariableTypeFromCallFixes(@NotNull PsiMethodCallExpression psiMethodCallExpression, @NotNull PsiExpressionList psiExpressionList) {
+    return Collections.emptyList();
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createAddReturnFix(@NotNull PsiMethod psiMethod) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createAddVariableInitializerFix(@NotNull PsiVariable psiVariable) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createDeferFinalAssignmentFix(@NotNull PsiVariable psiVariable, @NotNull PsiReferenceExpression psiReferenceExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createCreateConstructorParameterFromFieldFix(@NotNull PsiField psiField) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createInitializeFinalFieldInConstructorFix(@NotNull PsiField psiField) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createRemoveTypeArgumentsFix(@NotNull PsiElement psiElement) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createChangeClassSignatureFromUsageFix(@NotNull PsiClass psiClass, @NotNull PsiReferenceParameterList psiReferenceParameterList) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createReplacePrimitiveWithBoxedTypeAction(@NotNull PsiTypeElement psiTypeElement, @NotNull String s, @NotNull String s2) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createMakeVarargParameterLastFix(@NotNull PsiParameter psiParameter) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createMoveBoundClassToFrontFix(@NotNull PsiClass psiClass, @NotNull PsiClassType psiClassType) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @Override
+  public void registerPullAsAbstractUpFixes(@NotNull PsiMethod psiMethod, @NotNull QuickFixActionRegistrar quickFixActionRegistrar) {
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createCreateAnnotationMethodFromUsageFix(@NotNull PsiNameValuePair psiNameValuePair) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createOptimizeImportsFix(boolean onTheFly) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @Override
+  public void registerFixesForUnusedParameter(@NotNull PsiParameter psiParameter, @NotNull Object o) {
+
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createAddToDependencyInjectionAnnotationsFix(@NotNull Project project, @NotNull String s, @NotNull String s2) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createCreateGetterOrSetterFix(boolean b, boolean b2, @NotNull PsiField psiField) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createRenameToIgnoredFix(@NotNull PsiNamedElement psiNamedElement) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createEnableOptimizeImportsOnTheFlyFix() {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createSafeDeleteFix(@NotNull PsiElement psiElement) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createCreateMethodFromUsageFix(PsiMethodReferenceExpression methodReferenceExpression) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createVariableAccessFromInnerClassFix(@NotNull PsiVariable variable, @NotNull PsiElement scope) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAndQuickFixAction createShowModulePropertiesFix(@NotNull Module module) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Nullable
+  @Override
+  public List<LocalQuickFix> registerOrderEntryFixes(@NotNull QuickFixActionRegistrar registrar, @NotNull PsiReference reference) {
+    return null;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createAddMissingRequiredAnnotationParametersFix(@NotNull PsiAnnotation psiAnnotation, @NotNull PsiMethod[] psiMethods, @NotNull Collection<String> strings) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createSurroundWithQuotesAnnotationParameterValueFix(@NotNull PsiAnnotationMemberValue value,
+                                                                             @NotNull PsiType expectedType) {
+    return QuickFixes.EMPTY_FIX;
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
index 96bb18a..87ad7d9 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
@@ -30,9 +30,13 @@
 import com.intellij.psi.controlFlow.AnalysisCanceledException;
 import com.intellij.psi.controlFlow.ControlFlow;
 import com.intellij.psi.controlFlow.ControlFlowUtil;
+import com.intellij.psi.impl.source.resolve.DefaultParameterTypeInferencePolicy;
+import com.intellij.psi.infos.MethodCandidateInfo;
 import com.intellij.psi.util.InheritanceUtil;
 import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.PsiTypesUtil;
 import com.intellij.psi.util.PsiUtil;
+import com.intellij.util.ArrayUtilRt;
 import com.intellij.util.Function;
 import com.intellij.util.containers.ContainerUtilRt;
 import com.intellij.util.containers.hash.LinkedHashMap;
@@ -106,6 +110,43 @@
     };
   }
 
+  private static PsiType getInferredType(PsiAnonymousClass aClass) {
+    final PsiExpression expression = (PsiExpression)aClass.getParent();
+    final PsiType psiType = PsiTypesUtil.getExpectedTypeByParent(expression);
+    if (psiType != null) {
+      return psiType;
+    }
+
+    PsiExpression topExpr = expression;
+    while (topExpr.getParent() instanceof PsiParenthesizedExpression) {
+      topExpr = (PsiExpression)topExpr.getParent();
+    }
+
+    final PsiElement parent = topExpr.getParent();
+    if (parent instanceof PsiExpressionList) {
+      PsiExpressionList expressionList = (PsiExpressionList)parent;
+      final PsiElement callExpr = expressionList.getParent();
+      if (callExpr instanceof PsiCallExpression) {
+        final JavaResolveResult result = ((PsiCallExpression)callExpr).resolveMethodGenerics();
+        if (result instanceof MethodCandidateInfo) {
+          final PsiMethod method = ((MethodCandidateInfo)result).getElement();
+          PsiExpression[] expressions = expressionList.getExpressions();
+          int i = ArrayUtilRt.find(expressions, topExpr);
+          if (i < 0) return null;
+          expressions[i] = null;
+
+          final PsiParameter[] parameters = method.getParameterList().getParameters();
+          final PsiSubstitutor substitutor = PsiResolveHelper.SERVICE.getInstance(aClass.getProject())
+            .inferTypeArguments(method.getTypeParameters(), parameters, expressions,
+                                ((MethodCandidateInfo)result).getSiteSubstitutor(), callExpr.getParent(),
+                                DefaultParameterTypeInferencePolicy.INSTANCE);
+          return substitutor.substitute(parameters[i].getType());
+        }
+      }
+    }
+    return null;
+  }
+
   private static class ReplaceWithLambdaFix implements LocalQuickFix, HighPriorityAction {
     @NotNull
     @Override
@@ -328,10 +369,14 @@
     private final PsiMethod myMethod;
     private final PsiAnonymousClass myAnonymClass;
 
+    private final boolean myRawType;
+
     public ForbiddenRefsChecker(PsiMethod method,
                                 PsiAnonymousClass aClass) {
       myMethod = method;
       myAnonymClass = aClass;
+      final PsiType inferredType = getInferredType(aClass);
+      myRawType = inferredType instanceof PsiClassType && ((PsiClassType)inferredType).isRaw(); 
     }
 
     @Override
@@ -390,6 +435,7 @@
             if (initializer == null ||
                 initializer.getTextOffset() > myAnonymClass.getTextOffset() && !((PsiField)resolved).hasModifierProperty(PsiModifier.STATIC)) {
               myBodyContainsForbiddenRefs = true;
+              return;
             }
           }
         } else {
@@ -407,16 +453,31 @@
                   final Collection<PsiVariable> writtenVariables = ControlFlowUtil.getWrittenVariables(flow, 0, startOffset, false);
                   if (!writtenVariables.contains(resolved)) {
                     myBodyContainsForbiddenRefs = true;
+                    return;
                   }
                 }
               }
               catch (AnalysisCanceledException e) {
                 myBodyContainsForbiddenRefs = true;
+                return;
               }
             }
           }
         }
       }
+
+      if (myRawType) {
+        final PsiElement resolved = expression.resolve();
+        if (resolved instanceof PsiParameter && ((PsiParameter)resolved).getDeclarationScope() == myMethod) {
+          final int parameterIndex = myMethod.getParameterList().getParameterIndex((PsiParameter)resolved);
+          for (PsiMethod superMethod : myMethod.findDeepestSuperMethods()) {
+            if (PsiUtil.resolveClassInType(superMethod.getParameterList().getParameters()[parameterIndex].getType()) instanceof PsiTypeParameter) {
+              myBodyContainsForbiddenRefs = true;
+              return;
+            }
+          }
+        }
+      }
     }
 
     public boolean hasForbiddenRefs() {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/BlockMarkerCommentsInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/BlockMarkerCommentsInspection.java
new file mode 100644
index 0000000..f2d8f77
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/BlockMarkerCommentsInspection.java
@@ -0,0 +1,122 @@
+/*
+ * 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.codeInspection;
+
+import com.intellij.lang.Commenter;
+import com.intellij.lang.LanguageCommenters;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.patterns.ElementPattern;
+import com.intellij.patterns.PatternCondition;
+import com.intellij.patterns.PsiJavaElementPattern;
+import com.intellij.psi.*;
+import com.intellij.psi.tree.IElementType;
+import com.intellij.util.ProcessingContext;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+
+import static com.intellij.patterns.PsiJavaPatterns.*;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class BlockMarkerCommentsInspection extends BaseJavaBatchLocalInspectionTool {
+  private static final PsiJavaElementPattern ANONYMOUS_CLASS_MARKER_PATTERN = psiElement().
+    withParent(psiElement(PsiDeclarationStatement.class, PsiExpressionStatement.class))
+    .afterSiblingSkipping(or(psiElement(PsiWhiteSpace.class), psiElement(PsiJavaToken.class).with(new PatternCondition<PsiJavaToken>(null) {
+                            @Override
+                            public boolean accepts(@NotNull final PsiJavaToken psiJavaToken, final ProcessingContext context) {
+                              return psiJavaToken.getTokenType().equals(JavaTokenType.SEMICOLON);
+                            }
+                          })),
+                          psiElement(PsiLocalVariable.class, PsiAssignmentExpression.class)
+                            .withChild(psiElement(PsiNewExpression.class).withChild(psiElement(PsiAnonymousClass.class))));
+  private static final PsiJavaElementPattern CLASS_MARKER_PATTERN = psiElement().
+    withParent(PsiClass.class).
+    afterSiblingSkipping(psiElement(PsiWhiteSpace.class), psiElement(PsiJavaToken.class).with(new PatternCondition<PsiJavaToken>(null) {
+      @Override
+      public boolean accepts(@NotNull final PsiJavaToken token, final ProcessingContext context) {
+        return JavaTokenType.RBRACE.equals(token.getTokenType());
+      }
+    }));
+  private static final PsiJavaElementPattern TRY_CATCH_MARKER_PATTERN = psiElement().
+    withParent(PsiTryStatement.class).
+    afterSiblingSkipping(psiElement(PsiWhiteSpace.class), psiElement(PsiCodeBlock.class, PsiCatchSection.class));
+  private static final PsiJavaElementPattern LOOP_OR_IF_MARKER =
+    psiElement().afterSiblingSkipping(psiElement(PsiWhiteSpace.class), psiElement(PsiCodeBlock.class)).
+      withParent(psiElement(PsiBlockStatement.class).withParent(psiElement(PsiLoopStatement.class, PsiIfStatement.class)));
+  private static final PsiJavaElementPattern METHOD_MARKER_PATTERN =
+    psiElement().withParent(PsiMethod.class).afterSiblingSkipping(psiElement(PsiWhiteSpace.class), psiElement(PsiCodeBlock.class));
+  
+  private static final ElementPattern MARKER_PATTERN = or(ANONYMOUS_CLASS_MARKER_PATTERN,
+                                                          CLASS_MARKER_PATTERN,
+                                                          TRY_CATCH_MARKER_PATTERN,
+                                                          LOOP_OR_IF_MARKER,
+                                                          METHOD_MARKER_PATTERN);
+  
+  private static final String END_WORD = "end";
+
+  @NotNull
+  @Override
+  public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
+    return new PsiElementVisitor() {
+      @Override
+      public void visitComment(final PsiComment element) {
+        final IElementType tokenType = element.getTokenType();
+        if (!(tokenType.equals(JavaTokenType.END_OF_LINE_COMMENT))) {
+          return;
+        }
+        final Commenter commenter = LanguageCommenters.INSTANCE.forLanguage(element.getLanguage());
+        String rawCommentText = element.getText();
+        final String prefix = commenter.getLineCommentPrefix();
+        if (prefix != null && rawCommentText.startsWith(prefix)) {
+          rawCommentText = rawCommentText.substring(prefix.length());
+        }
+        final String commentText = rawCommentText.trim().toLowerCase();
+        if (!commentText.startsWith(END_WORD) || StringUtil.split(commentText, " ").size() > 3) {
+          return;
+        }
+        if (MARKER_PATTERN.accepts(element)) {
+          holder.registerProblem(element, "Redundant block marker", new LocalQuickFix() {
+            @NotNull
+            @Override
+            public String getName() {
+              return getFamilyName();
+            }
+
+            @NotNull
+            @Override
+            public String getFamilyName() {
+              return "Remove block marker comments";
+            }
+
+            @Override
+            public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
+              descriptor.getPsiElement().delete();
+            }
+          });
+        }
+      }
+    };
+  }
+
+  @Nls
+  @NotNull
+  @Override
+  public String getDisplayName() {
+    return "Block marker comment";
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantSuppressInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantSuppressInspection.java
new file mode 100644
index 0000000..b084be7
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantSuppressInspection.java
@@ -0,0 +1,31 @@
+/*
+ * 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.codeInspection;
+
+import com.intellij.codeInspection.ex.GlobalInspectionContextBase;
+import com.intellij.psi.PsiFile;
+
+/**
+ * User: anna
+ * Date: 11/27/13
+ */
+public class RedundantSuppressInspection extends RedundantSuppressInspectionBase {
+  @Override
+  protected GlobalInspectionContextBase createContext(PsiFile file) {
+    final InspectionManager inspectionManagerEx = InspectionManager.getInstance(file.getProject());
+    return (GlobalInspectionContextBase)inspectionManagerEx.createNewGlobalContext(false);
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/SuppressManagerImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/SuppressManagerImpl.java
new file mode 100644
index 0000000..6136e01
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/SuppressManagerImpl.java
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+
+/*
+ * User: anna
+ * Date: 24-Dec-2007
+ */
+package com.intellij.codeInspection;
+
+import com.intellij.codeInsight.daemon.HighlightDisplayKey;
+import com.intellij.psi.PsiDocCommentOwner;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiModifierListOwner;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collection;
+
+public class SuppressManagerImpl extends SuppressManager {
+  @Override
+  @NotNull
+  public SuppressIntentionAction[] createSuppressActions(@NotNull final HighlightDisplayKey displayKey) {
+    SuppressQuickFix[] batchSuppressActions = createBatchSuppressActions(displayKey);
+    return SuppressIntentionActionFromFix.convertBatchToSuppressIntentionActions(batchSuppressActions);
+  }
+
+  @Override
+  public boolean isSuppressedFor(@NotNull final PsiElement element, final String toolId) {
+    return JavaSuppressionUtil.getElementToolSuppressedIn(element, toolId) != null;
+  }
+
+  @Override
+  @Nullable
+  public PsiElement getElementMemberSuppressedIn(@NotNull final PsiDocCommentOwner owner, final String inspectionToolID) {
+    return JavaSuppressionUtil.getElementMemberSuppressedIn(owner, inspectionToolID);
+  }
+
+  @Override
+  @Nullable
+  public PsiElement getAnnotationMemberSuppressedIn(@NotNull final PsiModifierListOwner owner, final String inspectionToolID) {
+    return JavaSuppressionUtil.getAnnotationMemberSuppressedIn(owner, inspectionToolID);
+  }
+
+  @Override
+  @Nullable
+  public PsiElement getDocCommentToolSuppressedIn(@NotNull final PsiDocCommentOwner owner, final String inspectionToolID) {
+    return JavaSuppressionUtil.getDocCommentToolSuppressedIn(owner, inspectionToolID);
+  }
+
+  @Override
+  @NotNull
+  public Collection<String> getInspectionIdsSuppressedInAnnotation(@NotNull final PsiModifierListOwner owner) {
+    return JavaSuppressionUtil.getInspectionIdsSuppressedInAnnotation(owner);
+  }
+
+  @Override
+  @Nullable
+  public String getSuppressedInspectionIdsIn(@NotNull PsiElement element) {
+    return JavaSuppressionUtil.getSuppressedInspectionIdsIn(element);
+  }
+
+  @Override
+  @Nullable
+  public PsiElement getElementToolSuppressedIn(@NotNull final PsiElement place, final String toolId) {
+    return JavaSuppressionUtil.getElementToolSuppressedIn(place, toolId);
+  }
+
+  @Override
+  public boolean canHave15Suppressions(@NotNull final PsiElement file) {
+    return JavaSuppressionUtil.canHave15Suppressions(file);
+  }
+
+  @Override
+  public boolean alreadyHas14Suppressions(@NotNull final PsiDocCommentOwner commentOwner) {
+    return JavaSuppressionUtil.alreadyHas14Suppressions(commentOwner);
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractChecker.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractChecker.java
new file mode 100644
index 0000000..b527b8c
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractChecker.java
@@ -0,0 +1,145 @@
+/*
+ * 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.codeInspection.dataFlow;
+
+import com.intellij.codeInspection.dataFlow.instructions.CheckReturnValueInstruction;
+import com.intellij.codeInspection.dataFlow.instructions.Instruction;
+import com.intellij.codeInspection.dataFlow.instructions.ReturnInstruction;
+import com.intellij.codeInspection.dataFlow.value.DfaConstValue;
+import com.intellij.codeInspection.dataFlow.value.DfaValue;
+import com.intellij.codeInspection.dataFlow.value.DfaValueFactory;
+import com.intellij.codeInspection.dataFlow.value.DfaVariableValue;
+import com.intellij.psi.*;
+import com.intellij.util.containers.ContainerUtil;
+
+import java.util.*;
+
+/**
+* @author peter
+*/
+class ContractChecker extends DataFlowRunner {
+  private final PsiMethod myMethod;
+  private final MethodContract myContract;
+  private final boolean myOnTheFly;
+  private final Set<PsiElement> myViolations = ContainerUtil.newHashSet();
+  private final Set<PsiElement> myNonViolations = ContainerUtil.newHashSet();
+  private final Set<PsiElement> myFailures = ContainerUtil.newHashSet();
+
+  ContractChecker(PsiMethod method, PsiCodeBlock body, MethodContract contract, final boolean onTheFly) {
+    super(body);
+    myMethod = method;
+    myContract = contract;
+    myOnTheFly = onTheFly;
+  }
+
+  static Map<PsiElement, String> checkContractClause(PsiMethod method,
+                                                     MethodContract contract,
+                                                     boolean ignoreAssertions, final boolean onTheFly) {
+
+    PsiCodeBlock body = method.getBody();
+    if (body == null) return Collections.emptyMap();
+
+    ContractChecker checker = new ContractChecker(method, body, contract, onTheFly);
+
+    PsiParameter[] parameters = method.getParameterList().getParameters();
+    final DfaMemoryState initialState = checker.createMemoryState();
+    final DfaValueFactory factory = checker.getFactory();
+    for (int i = 0; i < contract.arguments.length; i++) {
+      MethodContract.ValueConstraint constraint = contract.arguments[i];
+      DfaConstValue comparisonValue = constraint.getComparisonValue(factory);
+      if (comparisonValue != null) {
+        boolean negated = constraint.shouldUseNonEqComparison();
+        DfaVariableValue dfaParam = factory.getVarFactory().createVariableValue(parameters[i], false);
+        initialState.applyCondition(factory.getRelationFactory().createRelation(dfaParam, comparisonValue, JavaTokenType.EQEQ, negated));
+      }
+    }
+
+    checker.analyzeMethod(body, new StandardInstructionVisitor(), ignoreAssertions, Arrays.asList(initialState));
+    return checker.getErrors();
+  }
+
+  @Override
+  protected boolean shouldCheckTimeLimit() {
+    if (!myOnTheFly) return false;
+    return super.shouldCheckTimeLimit();
+  }
+
+  @Override
+  protected DfaInstructionState[] acceptInstruction(InstructionVisitor visitor, DfaInstructionState instructionState) {
+    DfaMemoryState memState = instructionState.getMemoryState();
+    if (memState.isEphemeral()) {
+      return DfaInstructionState.EMPTY_ARRAY;
+    }
+    Instruction instruction = instructionState.getInstruction();
+    if (instruction instanceof CheckReturnValueInstruction) {
+      PsiElement anchor = ((CheckReturnValueInstruction)instruction).getReturn();
+      DfaValue retValue = memState.pop();
+      if (breaksContract(retValue, myContract.returnValue, memState)) {
+        myViolations.add(anchor);
+      } else {
+        myNonViolations.add(anchor);
+      }
+      return InstructionVisitor.nextInstruction(instruction, this, memState);
+
+    }
+
+    if (instruction instanceof ReturnInstruction) {
+      if (((ReturnInstruction)instruction).isViaException()) {
+        ContainerUtil.addIfNotNull(myFailures, ((ReturnInstruction)instruction).getAnchor());
+      }
+    }
+
+    return super.acceptInstruction(visitor, instructionState);
+  }
+
+
+  private Map<PsiElement, String> getErrors() {
+    HashMap<PsiElement, String> errors = ContainerUtil.newHashMap();
+    for (PsiElement element : myViolations) {
+      if (!myNonViolations.contains(element)) {
+        errors.put(element, "Contract clause '" + myContract + "' is violated");
+      }
+    }
+
+    if (myContract.returnValue != MethodContract.ValueConstraint.THROW_EXCEPTION) {
+      for (PsiElement element : myFailures) {
+        errors.put(element, "Contract clause '" + myContract + "' is violated: exception might be thrown instead of returning " + myContract.returnValue);
+      }
+    } else if (myFailures.isEmpty() && errors.isEmpty()) {
+      PsiIdentifier nameIdentifier = myMethod.getNameIdentifier();
+      errors.put(nameIdentifier != null ? nameIdentifier : myMethod,
+                 "Contract clause '" + myContract + "' is violated: no exception is thrown");
+    }
+
+    return errors;
+  }
+
+  private boolean breaksContract(DfaValue retValue, MethodContract.ValueConstraint constraint, DfaMemoryState state) {
+    switch (constraint) {
+      case NULL_VALUE: return state.isNotNull(retValue);
+      case NOT_NULL_VALUE: return state.isNull(retValue);
+      case TRUE_VALUE: return isEquivalentTo(retValue, getFactory().getConstFactory().getFalse(), state);
+      case FALSE_VALUE: return isEquivalentTo(retValue, getFactory().getConstFactory().getTrue(), state);
+      case THROW_EXCEPTION: return true;
+      default: return false;
+    }
+  }
+
+  private static boolean isEquivalentTo(DfaValue val, DfaConstValue constValue, DfaMemoryState state) {
+    return val == constValue || val instanceof DfaVariableValue && constValue == state.getConstantValue((DfaVariableValue)val);
+  }
+
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractInference.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractInference.java
new file mode 100644
index 0000000..b76177e
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractInference.java
@@ -0,0 +1,292 @@
+/*
+ * 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.codeInspection.dataFlow;
+
+import com.intellij.codeInspection.dataFlow.MethodContract.ValueConstraint;
+import com.intellij.openapi.util.Condition;
+import com.intellij.psi.*;
+import com.intellij.psi.tree.IElementType;
+import com.intellij.util.Function;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collections;
+import java.util.List;
+
+import static com.intellij.codeInspection.dataFlow.MethodContract.ValueConstraint.*;
+
+/**
+ * @author peter
+ */
+public class ContractInference {
+
+  @NotNull
+  public static List<MethodContract> inferContracts(@NotNull PsiMethod method) {
+    return new ContractInferenceInterpreter(method).inferContracts();
+  }
+}
+
+class ContractInferenceInterpreter {
+  private final PsiMethod myMethod;
+
+  public ContractInferenceInterpreter(PsiMethod method) {
+    myMethod = method;
+  }
+
+  List<MethodContract> inferContracts() {
+    PsiCodeBlock body = myMethod.getBody();
+    if (body == null) return Collections.emptyList();
+
+    PsiStatement[] statements = body.getStatements();
+    if (statements.length == 0) return Collections.emptyList();
+
+    ValueConstraint[] emptyState = MethodContract.createConstraintArray(myMethod.getParameterList().getParametersCount());
+    return visitStatements(Collections.singletonList(emptyState), statements);
+  }
+
+  @NotNull
+  private List<MethodContract> visitExpression(final List<ValueConstraint[]> states, @Nullable PsiExpression expr) {
+    if (states.isEmpty()) return Collections.emptyList();
+    if (states.size() > 300) return Collections.emptyList(); // too complex
+
+    if (expr instanceof PsiPolyadicExpression) {
+      PsiExpression[] operands = ((PsiPolyadicExpression)expr).getOperands();
+      IElementType op = ((PsiPolyadicExpression)expr).getOperationTokenType();
+      if (operands.length == 2 && (op == JavaTokenType.EQEQ || op == JavaTokenType.NE)) {
+        return visitEqualityComparison(states, operands[0], operands[1], op == JavaTokenType.EQEQ);
+      }
+      if (op == JavaTokenType.ANDAND || op == JavaTokenType.OROR) {
+        return visitLogicalOperation(operands, op == JavaTokenType.ANDAND, states);
+      }
+    }
+
+    if (expr instanceof PsiConditionalExpression) {
+      List<MethodContract> conditionResults = visitExpression(states, ((PsiConditionalExpression)expr).getCondition());
+      return ContainerUtil.concat(
+        visitExpression(antecedentsOf(filterReturning(conditionResults, TRUE_VALUE)), ((PsiConditionalExpression)expr).getThenExpression()),
+        visitExpression(antecedentsOf(filterReturning(conditionResults, FALSE_VALUE)), ((PsiConditionalExpression)expr).getElseExpression()));
+    }
+
+
+    if (expr instanceof PsiParenthesizedExpression) {
+      return visitExpression(states, ((PsiParenthesizedExpression)expr).getExpression());
+    }
+
+    if (expr instanceof PsiPrefixExpression && ((PsiPrefixExpression)expr).getOperationTokenType() == JavaTokenType.EXCL) {
+      List<MethodContract> result = ContainerUtil.newArrayList();
+      for (MethodContract contract : visitExpression(states, ((PsiPrefixExpression)expr).getOperand())) {
+        if (contract.returnValue == TRUE_VALUE || contract.returnValue == FALSE_VALUE) {
+          result.add(new MethodContract(contract.arguments, negateConstraint(contract.returnValue)));
+        }
+      }
+      return result;
+    }
+
+    if (expr instanceof PsiInstanceOfExpression) {
+      final int parameter = resolveParameter(((PsiInstanceOfExpression)expr).getOperand());
+      if (parameter >= 0) {
+        return ContainerUtil.map(states, new Function<ValueConstraint[], MethodContract>() {
+          @Override
+          public MethodContract fun(ValueConstraint[] state) {
+            return new MethodContract(withConstraint(state, parameter, NULL_VALUE), FALSE_VALUE);
+          }
+        });
+      }
+    }
+
+    final ValueConstraint constraint = getLiteralConstraint(expr);
+    if (constraint != null) {
+      return toContracts(states, constraint);
+    }
+
+    int parameter = resolveParameter(expr);
+    if (parameter >= 0) {
+      List<MethodContract> result = ContainerUtil.newArrayList();
+      for (ValueConstraint[] state : states) {
+        if (state[parameter] != ANY_VALUE) {
+          // the second 'o' reference in cases like: if (o != null) return o;
+          result.add(new MethodContract(state, state[parameter]));
+        } else {
+          // if (boolValue) ...
+          result.add(new MethodContract(withConstraint(state, parameter, TRUE_VALUE), TRUE_VALUE));
+          result.add(new MethodContract(withConstraint(state, parameter, FALSE_VALUE), FALSE_VALUE));
+        }
+      }
+      return result;
+    }
+
+    return Collections.emptyList();
+  }
+
+  private List<MethodContract> visitEqualityComparison(List<ValueConstraint[]> states,
+                                                       PsiExpression op1,
+                                                       PsiExpression op2,
+                                                       boolean equality) {
+    int parameter = resolveParameter(op1);
+    ValueConstraint constraint = getLiteralConstraint(op2);
+    if (parameter < 0 || constraint == null) {
+      parameter = resolveParameter(op2);
+      constraint = getLiteralConstraint(op1);
+    }
+    if (parameter >= 0 && constraint != null) {
+      List<MethodContract> result = ContainerUtil.newArrayList();
+      for (ValueConstraint[] state : states) {
+        result.add(new MethodContract(withConstraint(state, parameter, constraint), equality ? TRUE_VALUE : FALSE_VALUE));
+        result.add(new MethodContract(withConstraint(state, parameter, negateConstraint(constraint)), equality ? FALSE_VALUE : TRUE_VALUE));
+      }
+      return result;
+    }
+    return Collections.emptyList();
+  }
+
+  private static List<MethodContract> toContracts(List<ValueConstraint[]> states,
+                                                  final ValueConstraint constraint) {
+    return ContainerUtil.map(states, new Function<ValueConstraint[], MethodContract>() {
+      @Override
+      public MethodContract fun(ValueConstraint[] state) {
+        return new MethodContract(state, constraint);
+      }
+    });
+  }
+
+  private List<MethodContract> visitLogicalOperation(PsiExpression[] operands, boolean conjunction, List<ValueConstraint[]> states) {
+    ValueConstraint breakValue = conjunction ? FALSE_VALUE : TRUE_VALUE;
+    List<MethodContract> finalStates = ContainerUtil.newArrayList();
+    for (PsiExpression operand : operands) {
+      List<MethodContract> opResults = visitExpression(states, operand);
+      finalStates.addAll(filterReturning(opResults, breakValue));
+      states = antecedentsOf(filterReturning(opResults, negateConstraint(breakValue)));
+    }
+    finalStates.addAll(toContracts(states, negateConstraint(breakValue)));
+    return finalStates;
+  }
+
+  private static List<ValueConstraint[]> antecedentsOf(List<MethodContract> values) {
+    return ContainerUtil.map(values, new Function<MethodContract, ValueConstraint[]>() {
+      @Override
+      public ValueConstraint[] fun(MethodContract contract) {
+        return contract.arguments;
+      }
+    });
+  }
+
+  private static List<MethodContract> filterReturning(List<MethodContract> values, final ValueConstraint result) {
+    return ContainerUtil.filter(values, new Condition<MethodContract>() {
+      @Override
+      public boolean value(MethodContract contract) {
+        return contract.returnValue == result;
+      }
+    });
+  }
+
+  @NotNull
+  private List<MethodContract> visitStatements(List<ValueConstraint[]> states, PsiStatement... statements) {
+    List<MethodContract> result = ContainerUtil.newArrayList();
+    for (PsiStatement statement : statements) {
+      if (statement instanceof PsiBlockStatement && ((PsiBlockStatement)statement).getCodeBlock().getStatements().length == 1) {
+        result.addAll(visitStatements(states, ((PsiBlockStatement)statement).getCodeBlock().getStatements()));
+      }
+      else if (statement instanceof PsiIfStatement) {
+        List<MethodContract> conditionResults = visitExpression(states, ((PsiIfStatement)statement).getCondition());
+
+        PsiStatement thenBranch = ((PsiIfStatement)statement).getThenBranch();
+        if (thenBranch != null) {
+          result.addAll(visitStatements(antecedentsOf(filterReturning(conditionResults, TRUE_VALUE)), thenBranch));
+        }
+
+        List<ValueConstraint[]> falseStates = antecedentsOf(filterReturning(conditionResults, FALSE_VALUE));
+        PsiStatement elseBranch = ((PsiIfStatement)statement).getElseBranch();
+        if (elseBranch != null) {
+          result.addAll(visitStatements(falseStates, elseBranch));
+        } else if (alwaysReturns(thenBranch)) {
+          states = falseStates;
+          continue;
+        }
+      }
+      else if (statement instanceof PsiThrowStatement) {
+        result.addAll(toContracts(states, THROW_EXCEPTION));
+      }
+      else if (statement instanceof PsiReturnStatement) {
+        result.addAll(visitExpression(states, ((PsiReturnStatement)statement).getReturnValue()));
+      }
+      else if (statement instanceof PsiAssertStatement) {
+        List<MethodContract> conditionResults = visitExpression(states, ((PsiAssertStatement)statement).getAssertCondition());
+        result.addAll(toContracts(antecedentsOf(filterReturning(conditionResults, FALSE_VALUE)), THROW_EXCEPTION));
+      }
+
+      break; // visit only the first statement unless it's 'if' whose 'then' always returns and the next statement is effectively 'else'
+    }
+    return result;
+  }
+
+  private static boolean alwaysReturns(@Nullable PsiStatement statement) {
+    if (statement instanceof PsiReturnStatement || statement instanceof PsiThrowStatement) return true;
+    if (statement instanceof PsiBlockStatement) {
+      for (PsiStatement child : ((PsiBlockStatement)statement).getCodeBlock().getStatements()) {
+        if (alwaysReturns(child)) {
+          return true;
+        }
+      }
+    }
+    if (statement instanceof PsiIfStatement) {
+      return alwaysReturns(((PsiIfStatement)statement).getThenBranch()) &&
+             alwaysReturns(((PsiIfStatement)statement).getElseBranch());
+    }
+    return false;
+  }
+
+  @Nullable
+  private static ValueConstraint getLiteralConstraint(@Nullable PsiExpression expr) {
+    if (expr instanceof PsiLiteralExpression) {
+      if (expr.textMatches(PsiKeyword.TRUE)) return TRUE_VALUE;
+      if (expr.textMatches(PsiKeyword.FALSE)) return FALSE_VALUE;
+      if (expr.textMatches(PsiKeyword.NULL)) return NULL_VALUE;
+    }
+    return null;
+  }
+
+  private static ValueConstraint negateConstraint(@NotNull ValueConstraint constraint) {
+    //noinspection EnumSwitchStatementWhichMissesCases
+    switch (constraint) {
+      case NULL_VALUE: return NOT_NULL_VALUE;
+      case NOT_NULL_VALUE: return NULL_VALUE;
+      case TRUE_VALUE: return FALSE_VALUE;
+      case FALSE_VALUE: return TRUE_VALUE;
+    }
+    return constraint;
+  }
+
+  private int resolveParameter(@Nullable PsiExpression expr) {
+    if (expr instanceof PsiReferenceExpression && !((PsiReferenceExpression)expr).isQualified()) {
+      String name = expr.getText();
+      PsiParameter[] parameters = myMethod.getParameterList().getParameters();
+      for (int i = 0; i < parameters.length; i++) {
+        if (name.equals(parameters[i].getName())) {
+          return i;
+        }
+      }
+    }
+    return -1;
+  }
+
+  private static ValueConstraint[] withConstraint(ValueConstraint[] constraints, int index, ValueConstraint constraint) {
+    ValueConstraint[] copy = constraints.clone();
+    copy[index] = constraint;
+    return copy;
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractInspection.java
new file mode 100644
index 0000000..463ca73
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ContractInspection.java
@@ -0,0 +1,97 @@
+/*
+ * 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.codeInspection.dataFlow;
+
+import com.intellij.codeInsight.AnnotationUtil;
+import com.intellij.codeInspection.BaseJavaBatchLocalInspectionTool;
+import com.intellij.codeInspection.ProblemsHolder;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.psi.util.PsiTreeUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author peter
+ */
+public class ContractInspection extends BaseJavaBatchLocalInspectionTool {
+
+  @Override
+  @NotNull
+  public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
+    return new JavaElementVisitor() {
+
+      @Override
+      public void visitMethod(PsiMethod method) {
+        for (MethodContract contract : ControlFlowAnalyzer.getMethodContracts(method)) {
+          Map<PsiElement, String> errors = ContractChecker.checkContractClause(method, contract, false, isOnTheFly);
+          for (Map.Entry<PsiElement, String> entry : errors.entrySet()) {
+            PsiElement element = entry.getKey();
+            holder.registerProblem(element, entry.getValue());
+          }
+        }
+      }
+
+      @Override
+      public void visitAnnotation(PsiAnnotation annotation) {
+        if (!ControlFlowAnalyzer.ORG_JETBRAINS_ANNOTATIONS_CONTRACT.equals(annotation.getQualifiedName())) return;
+
+        PsiMethod method = PsiTreeUtil.getParentOfType(annotation, PsiMethod.class);
+        if (method == null) return;
+
+        String text = AnnotationUtil.getStringAttributeValue(annotation, null);
+        if (StringUtil.isNotEmpty(text)) {
+          String error = checkContract(method, text);
+          if (error != null) {
+            PsiAnnotationMemberValue value = annotation.findAttributeValue(null);
+            assert value != null;
+            holder.registerProblem(value, error);
+            return;
+          }
+        }
+
+        if (Boolean.TRUE.equals(AnnotationUtil.getBooleanAttributeValue(annotation, "pure")) &&
+            PsiType.VOID.equals(method.getReturnType())) {
+          PsiAnnotationMemberValue value = annotation.findDeclaredAttributeValue("pure");
+          assert value != null;
+          holder.registerProblem(value, "Pure methods must return something, void is not allowed as a return type");
+        }
+      }
+    };
+  }
+
+  @Nullable
+  public static String checkContract(PsiMethod method, String text) {
+    List<MethodContract> contracts;
+    try {
+      contracts = MethodContract.parseContract(text);
+    }
+    catch (MethodContract.ParseException e) {
+      return e.getMessage();
+    }
+    int paramCount = method.getParameterList().getParametersCount();
+    for (int i = 0; i < contracts.size(); i++) {
+      MethodContract contract = contracts.get(i);
+      if (contract.arguments.length != paramCount) {
+        return "Method takes " + paramCount + " parameters, while contract clause number " + (i + 1) + " expects " + contract.arguments.length;
+      }
+    }
+    return null;
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java
index eb49887..65e7fd7 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java
@@ -16,20 +16,16 @@
 package com.intellij.codeInspection.dataFlow;
 
 import com.intellij.codeInsight.AnnotationUtil;
-import com.intellij.codeInsight.ConditionCheckManager;
-import com.intellij.codeInsight.ConditionChecker;
 import com.intellij.codeInspection.dataFlow.instructions.*;
 import com.intellij.codeInspection.dataFlow.value.*;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.Condition;
 import com.intellij.openapi.util.registry.Registry;
-import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.*;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.tree.IElementType;
 import com.intellij.psi.util.*;
 import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.SmartList;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.Stack;
 import com.siyeh.ig.numeric.UnnecessaryExplicitNumericCastInspection;
@@ -41,7 +37,6 @@
 import java.util.*;
 import java.util.regex.Pattern;
 
-import static com.intellij.codeInsight.ConditionChecker.Type.*;
 import static com.intellij.codeInspection.dataFlow.MethodContract.ValueConstraint;
 import static com.intellij.psi.CommonClassNames.*;
 
@@ -61,6 +56,7 @@
     }
     catch (Exception e) {
       LOG.error(e);
+      //noinspection unchecked
       return Condition.FALSE;
     }
   }
@@ -117,7 +113,7 @@
       addInstruction(new CheckReturnValueInstruction(codeFragment));
     }
 
-    addInstruction(new ReturnInstruction(false));
+    addInstruction(new ReturnInstruction(false, null));
 
     return myCurrentFlow;
   }
@@ -242,7 +238,7 @@
       }
       
       initException(myAssertionError);
-      addThrowCode(false);
+      addThrowCode(false, statement);
     }
     finishElement(statement);
   }
@@ -572,11 +568,11 @@
       addInstruction(new CheckReturnValueInstruction(returnValue));
     }
 
-    returnCheckingFinally();
+    returnCheckingFinally(false, statement);
     finishElement(statement);
   }
 
-  private void returnCheckingFinally() {
+  private void returnCheckingFinally(boolean viaException, @NotNull PsiElement anchor) {
     ControlFlow.ControlFlowOffset finallyOffset = getFinallyOffset();
     if (finallyOffset != null) {
       addInstruction(new PushInstruction(myExceptionHolder, null));
@@ -586,7 +582,7 @@
       
       addInstruction(new GotoInstruction(finallyOffset));
     } else {
-      addInstruction(new ReturnInstruction(false));
+      addInstruction(new ReturnInstruction(viaException, anchor));
     }
   }
 
@@ -701,7 +697,7 @@
     if (exception != null) {
       exception.accept(this);
       if (myCatchStack.isEmpty()) {
-        addInstruction(new ReturnInstruction(true));
+        addInstruction(new ReturnInstruction(true, statement));
         finishElement(statement);
         return;
       }
@@ -715,14 +711,14 @@
       
       addInstruction(new PopInstruction());
       initException(myNpe);
-      addThrowCode(false);
+      addThrowCode(false, statement);
 
       gotoInstruction.setOffset(myCurrentFlow.getInstructionCount());
       addInstruction(new PushInstruction(myExceptionHolder, null));
       addInstruction(new SwapInstruction());
       addInstruction(new AssignInstruction(null));
       addInstruction(new PopInstruction());
-      addThrowCode(false);
+      addThrowCode(false, statement);
     }
 
     finishElement(statement);
@@ -750,7 +746,7 @@
     addInstruction(new AssignInstruction(null));
     addInstruction(new PopInstruction());
     
-    addThrowCode(false);
+    addThrowCode(false, null);
 
     ifNoException.setOffset(myCurrentFlow.getInstructionCount());
   }
@@ -768,9 +764,9 @@
   }
 
   // the exception object should be in $exception$ variable
-  private void addThrowCode(boolean catchRethrow) {
+  private void addThrowCode(boolean catchRethrow, @Nullable PsiElement explicitThrower) {
     if (myCatchStack.isEmpty()) {
-      addInstruction(new ReturnInstruction(true));
+      addInstruction(new ReturnInstruction(true, explicitThrower));
       return;
     }
     
@@ -783,7 +779,7 @@
         i--;
       }
       if (i < 0) {
-        addInstruction(new ReturnInstruction(true));
+        addInstruction(new ReturnInstruction(true, explicitThrower));
         return;
       }
       cd = myCatchStack.get(i);
@@ -925,7 +921,7 @@
       addInstruction(new ConditionalGotoInstruction(getEndOffset(statement), false, null));
       
       // else throw $exception$
-      addThrowCode(false);
+      addThrowCode(false, null);
     }
 
     finishElement(statement);
@@ -950,7 +946,7 @@
       }
       
       // not assignable => rethrow 
-      addThrowCode(true);
+      addThrowCode(true, null);
 
       // e = $exception$
       addInstruction(new PushInstruction(myFactory.getVarFactory().createVariableValue(section.getParameter(), false), null));
@@ -974,7 +970,7 @@
       }
       PsiMethod closer = PsiUtil.getResourceCloserMethod(variable);
       if (closer != null) {
-        addMethodThrows(closer);
+        addMethodThrows(closer, null);
       }
     }
   }
@@ -1339,7 +1335,7 @@
     finishElement(expression);
   }
 
-  private void addMethodThrows(PsiMethod method) {
+  private void addMethodThrows(PsiMethod method, @Nullable PsiElement explicitCall) {
     if (method != null) {
       PsiClassType[] refs = method.getThrowsList().getReferencedTypes();
       for (PsiClassType ref : refs) {
@@ -1348,7 +1344,7 @@
         addInstruction(cond);
         addInstruction(new EmptyStackInstruction());
         initException(ref);
-        addThrowCode(false);
+        addThrowCode(false, explicitCall);
         cond.setOffset(myCurrentFlow.getInstructionCount());
       }
     }
@@ -1364,11 +1360,6 @@
   @Override public void visitMethodCallExpression(PsiMethodCallExpression expression) {
     startElement(expression);
 
-    if (handleContracts(expression, getCallContracts(expression))) {
-      finishElement(expression);
-      return;
-    }
-
     PsiReferenceExpression methodExpression = expression.getMethodExpression();
     PsiExpression qualifierExpression = methodExpression.getQualifierExpression();
 
@@ -1405,10 +1396,21 @@
     }
 
     addConditionalRuntimeThrow();
-    addInstruction(new MethodCallInstruction(expression, createChainedVariableValue(expression)));
+    List<MethodContract> contracts = method instanceof PsiMethod ? getMethodContracts((PsiMethod)method) : Collections.<MethodContract>emptyList();
+    addInstruction(new MethodCallInstruction(expression, createChainedVariableValue(expression), contracts));
+    if (!contracts.isEmpty()) {
+      // if a contract resulted in 'fail', handle it
+      addInstruction(new DupInstruction());
+      addInstruction(new PushInstruction(myFactory.getConstFactory().getContractFail(), null));
+      addInstruction(new BinopInstruction(JavaTokenType.EQEQ, null, expression.getProject()));
+      ConditionalGotoInstruction ifNotFail = new ConditionalGotoInstruction(null, true, null);
+      addInstruction(ifNotFail);
+      returnCheckingFinally(true, expression);
+      ifNotFail.setOffset(myCurrentFlow.getInstructionCount());
+    }
 
     if (!myCatchStack.isEmpty()) {
-      addMethodThrows(expression.resolveMethod());
+      addMethodThrows(expression.resolveMethod(), expression);
     }
 
     if (isEqualsCall) {
@@ -1429,189 +1431,70 @@
     finishElement(expression);
   }
 
-  private boolean handleContracts(PsiMethodCallExpression expression, List<MethodContract> _contracts) {
-    if (_contracts.isEmpty()) {
-      return false;
-    }
-
-    PsiMethod method = expression.resolveMethod();
-    if (method == null) {
-      return false;
-    }
-
+  static List<MethodContract> getMethodContracts(@NotNull final PsiMethod method) {
+    final PsiAnnotation contractAnno = findContractAnnotation(method);
     final int paramCount = method.getParameterList().getParametersCount();
-    boolean varArgs = method.isVarArgs();
-    final PsiExpression[] args = expression.getArgumentList().getExpressions();
-    if (varArgs && args.length < paramCount - 1 || !varArgs && args.length != paramCount) {
-      return false;
-    }
-    
-    List<MethodContract> contracts = ContainerUtil.findAll(_contracts, new Condition<MethodContract>() {
-      @Override
-      public boolean value(MethodContract contract) {
-        return paramCount == contract.arguments.length;
-      }
-    });
-    if (contracts.isEmpty()) {
-      return false;
-    }
-
-    for (PsiExpression arg : args) {
-      arg.accept(this);
-    }
-    if (varArgs) {
-      for (int i = 0; i < args.length - paramCount + 1; i++) {
-        addInstruction(new PopInstruction());
-      }
-      pushUnknown();
-    }
-
-    if (contracts.size() > 1) {
-      addInstruction(new DupInstruction(args.length, contracts.size() - 1));
-    }
-    for (int i = 0; i < contracts.size(); i++) {
-      handleContract(expression, contracts.get(i), contracts.size() - 1 - i, paramCount);
-    }
-    pushUnknownReturnValue(expression); // goto here if all contracts are false
-    return true;
-  }
-  
-  private void handleContract(PsiMethodCallExpression expression, MethodContract contract, int remainingContracts, int paramCount) {
-    final ControlFlow.ControlFlowOffset exitPoint = getEndOffset(expression);
-
-    List<GotoInstruction> gotoContractFalse = new SmartList<GotoInstruction>();
-    for (int i = paramCount - 1; i >= 0; i--) {
-      ValueConstraint arg = contract.arguments[i];
-      if (arg == ValueConstraint.NULL_VALUE || arg == ValueConstraint.NOT_NULL_VALUE) {
-        addInstruction(new PushInstruction(myFactory.getConstFactory().getNull(), null));
-        addInstruction(new BinopInstruction(JavaTokenType.EQEQ, null, expression.getProject()));
-      }
-      else if (arg != ValueConstraint.TRUE_VALUE && arg != ValueConstraint.FALSE_VALUE) {
-        addInstruction(new PopInstruction());
-        continue;
-      }
-
-      boolean expectingTrueOnStack = arg == ValueConstraint.NULL_VALUE || arg == ValueConstraint.TRUE_VALUE;
-      ConditionalGotoInstruction continueCheckingContract = addInstruction(new ConditionalGotoInstruction(null, !expectingTrueOnStack, null));
-
-      for (int j = 0; j < i; j++) {
-        addInstruction(new PopInstruction());
-      }
-      gotoContractFalse.add(addInstruction(new GotoInstruction(null)));
-      continueCheckingContract.setOffset(myCurrentFlow.getInstructionCount());
-    }
-
-    for (int j = 0; j < remainingContracts * paramCount; j++) {
-      addInstruction(new PopInstruction());
-    }
-
-    // if contract is true
-    switch (contract.returnValue) {
-      case ANY_VALUE:
-        pushUnknownReturnValue(expression);
-        addInstruction(new GotoInstruction(exitPoint));
-        break;
-      case NULL_VALUE:
-        addInstruction(new PushInstruction(myFactory.getConstFactory().getNull(), null));
-        addInstruction(new GotoInstruction(exitPoint));
-        break;
-      case NOT_NULL_VALUE:
-        PsiType type = expression.getType();
-        addInstruction(new PushInstruction(myFactory.createTypeValue(type, Nullness.NOT_NULL), null));
-        addInstruction(new GotoInstruction(exitPoint));
-        break;
-      case TRUE_VALUE:
-        addInstruction(new PushInstruction(myFactory.getConstFactory().getTrue(), null));
-        addInstruction(new GotoInstruction(exitPoint));
-        break;
-      case FALSE_VALUE:
-        addInstruction(new PushInstruction(myFactory.getConstFactory().getFalse(), null));
-        addInstruction(new GotoInstruction(exitPoint));
-        break;
-      case THROW_EXCEPTION:
-        returnCheckingFinally();
-        break;
-    }
-
-    // if contract is false
-    for (GotoInstruction instruction : gotoContractFalse) {
-      instruction.setOffset(myCurrentFlow.getInstructionCount());
-    }
-  }
-
-  private void pushUnknownReturnValue(PsiMethodCallExpression expression) {
-    PsiMethod method = expression.resolveMethod();
-    if (method != null) {
-      PsiType type = expression.getType();
-      addInstruction(new PushInstruction(myFactory.createTypeValue(type, DfaPsiUtil.getElementNullability(type, method)), null));
-    }
-    else {
-      pushUnknown();
-    }
-  }
-
-  private static List<MethodContract> getCallContracts(PsiMethodCallExpression expression) {
-    PsiMethod resolved = expression.resolveMethod();
-    if (resolved != null) {
-      final PsiAnnotation contractAnno = findContractAnnotation(resolved);
-      if (contractAnno != null) {
-        return CachedValuesManager.getCachedValue(contractAnno, new CachedValueProvider<List<MethodContract>>() {
-          @Nullable
-          @Override
-          public Result<List<MethodContract>> compute() {
-            String text = AnnotationUtil.getStringAttributeValue(contractAnno, null);
-            if (text != null) {
-              try {
-                return Result.create(parseContract(text), contractAnno);
-              }
-              catch (Exception ignored) {
-              }
+    if (contractAnno != null) {
+      return CachedValuesManager.getCachedValue(contractAnno, new CachedValueProvider<List<MethodContract>>() {
+        @Nullable
+        @Override
+        public Result<List<MethodContract>> compute() {
+          String text = AnnotationUtil.getStringAttributeValue(contractAnno, null);
+          if (text != null) {
+            try {
+              List<MethodContract> applicable = ContainerUtil.filter(MethodContract.parseContract(text), new Condition<MethodContract>() {
+                @Override
+                public boolean value(MethodContract contract) {
+                  return contract.arguments.length == paramCount;
+                }
+              });
+              return Result.create(applicable, contractAnno);
             }
-            return Result.create(Collections.<MethodContract>emptyList(), contractAnno);
+            catch (Exception ignored) {
+            }
           }
-        });
-      }
-
-      @NonNls String methodName = resolved.getName();
-
-      PsiExpression[] params = expression.getArgumentList().getExpressions();
-      PsiClass owner = resolved.getContainingClass();
-      if (owner != null) {
-        final String className = owner.getQualifiedName();
-        if ("java.lang.System".equals(className)) {
-          if ("exit".equals(methodName)) {
-            return Collections.singletonList(new MethodContract(getAnyArgConstraints(params), ValueConstraint.THROW_EXCEPTION));
-          }
+          return Result.create(Collections.<MethodContract>emptyList(), contractAnno);
         }
-        else if ("junit.framework.Assert".equals(className) || "org.junit.Assert".equals(className) ||
-                 "junit.framework.TestCase".equals(className) || "org.testng.Assert".equals(className) || "org.testng.AssertJUnit".equals(className)) {
-          boolean testng = className.startsWith("org.testng.");
-          if ("fail".equals(methodName)) {
-            return Collections.singletonList(new MethodContract(getAnyArgConstraints(params), ValueConstraint.THROW_EXCEPTION));
-          }
+      });
+    }
 
-          int checkedParam = testng ? 0 : params.length - 1;
-          ValueConstraint[] constraints = getAnyArgConstraints(params);
-          if ("assertTrue".equals(methodName)) {
-            constraints[checkedParam] = ValueConstraint.FALSE_VALUE;
-            return Collections.singletonList(new MethodContract(constraints, ValueConstraint.THROW_EXCEPTION));
-          }
-          if ("assertFalse".equals(methodName)) {
-            constraints[checkedParam] = ValueConstraint.TRUE_VALUE;
-            return Collections.singletonList(new MethodContract(constraints, ValueConstraint.THROW_EXCEPTION));
-          }
-          if ("assertNull".equals(methodName)) {
-            constraints[checkedParam] = ValueConstraint.NOT_NULL_VALUE;
-            return Collections.singletonList(new MethodContract(constraints, ValueConstraint.THROW_EXCEPTION));
-          }
-          if ("assertNotNull".equals(methodName)) {
-            constraints[checkedParam] = ValueConstraint.NULL_VALUE;
-            return Collections.singletonList(new MethodContract(constraints, ValueConstraint.THROW_EXCEPTION));
-          }
-          return Collections.emptyList();
+    @NonNls String methodName = method.getName();
+
+    PsiClass owner = method.getContainingClass();
+    if (owner != null) {
+      final String className = owner.getQualifiedName();
+      if ("java.lang.System".equals(className)) {
+        if ("exit".equals(methodName)) {
+          return Collections.singletonList(new MethodContract(MethodContract.createConstraintArray(paramCount), ValueConstraint.THROW_EXCEPTION));
         }
       }
+      else if ("junit.framework.Assert".equals(className) || "org.junit.Assert".equals(className) ||
+               "junit.framework.TestCase".equals(className) || "org.testng.Assert".equals(className) || "org.testng.AssertJUnit".equals(className)) {
+        boolean testng = className.startsWith("org.testng.");
+        if ("fail".equals(methodName)) {
+          return Collections.singletonList(new MethodContract(MethodContract.createConstraintArray(paramCount), ValueConstraint.THROW_EXCEPTION));
+        }
 
+        int checkedParam = testng ? 0 : paramCount - 1;
+        ValueConstraint[] constraints = MethodContract.createConstraintArray(paramCount);
+        if ("assertTrue".equals(methodName)) {
+          constraints[checkedParam] = ValueConstraint.FALSE_VALUE;
+          return Collections.singletonList(new MethodContract(constraints, ValueConstraint.THROW_EXCEPTION));
+        }
+        if ("assertFalse".equals(methodName)) {
+          constraints[checkedParam] = ValueConstraint.TRUE_VALUE;
+          return Collections.singletonList(new MethodContract(constraints, ValueConstraint.THROW_EXCEPTION));
+        }
+        if ("assertNull".equals(methodName)) {
+          constraints[checkedParam] = ValueConstraint.NOT_NULL_VALUE;
+          return Collections.singletonList(new MethodContract(constraints, ValueConstraint.THROW_EXCEPTION));
+        }
+        if ("assertNotNull".equals(methodName)) {
+          constraints[checkedParam] = ValueConstraint.NULL_VALUE;
+          return Collections.singletonList(new MethodContract(constraints, ValueConstraint.THROW_EXCEPTION));
+        }
+        return Collections.emptyList();
+      }
     }
 
     return Collections.emptyList();
@@ -1622,50 +1505,6 @@
     return AnnotationUtil.findAnnotation(method, ORG_JETBRAINS_ANNOTATIONS_CONTRACT);
   }
 
-  public static List<MethodContract> parseContract(String text) throws ParseException {
-    List<MethodContract> result = ContainerUtil.newArrayList();
-    for (String clause : StringUtil.replace(text, " ", "").split(";")) {
-      String arrow = "->";
-      int arrowIndex = clause.indexOf(arrow);
-      if (arrowIndex < 0) {
-        throw new ParseException("A contract clause must be in form arg1, ..., argN -> return-value");
-      }
-      
-      String[] argStrings = clause.substring(0, arrowIndex).split(",");
-      ValueConstraint[] args = new ValueConstraint[argStrings.length];
-      for (int i = 0; i < args.length; i++) {
-        args[i] = parseConstraint(argStrings[i]);
-      }
-      result.add(new MethodContract(args, parseConstraint(clause.substring(arrowIndex + arrow.length()))));
-    }
-    return result;
-  }
-  
-  private static ValueConstraint parseConstraint(String name) throws ParseException {
-    if (StringUtil.isEmpty(name)) throw new ParseException("Constraint should not be empty");
-    if ("null".equals(name)) return ValueConstraint.NULL_VALUE;
-    if ("!null".equals(name)) return ValueConstraint.NOT_NULL_VALUE;
-    if ("true".equals(name)) return ValueConstraint.TRUE_VALUE;
-    if ("false".equals(name)) return ValueConstraint.FALSE_VALUE;
-    if ("fail".equals(name)) return ValueConstraint.THROW_EXCEPTION;
-    if ("_".equals(name)) return ValueConstraint.ANY_VALUE;
-    throw new ParseException("Constraint should be one of: null, !null, true, false, fail, _. Found: " + name);
-  }
-  
-  public static class ParseException extends Exception {
-    private ParseException(String message) {
-      super(message);
-    }
-  }
-
-  private static ValueConstraint[] getAnyArgConstraints(PsiExpression[] params) {
-    ValueConstraint[] args = new ValueConstraint[params.length];
-    for (int i = 0; i < args.length; i++) {
-      args[i] = ValueConstraint.ANY_VALUE;
-    }
-    return args;
-  }
-
   private void pushTypeOrUnknown(PsiExpression expr) {
     PsiType type = expr.getType();
 
@@ -1701,7 +1540,7 @@
         }
       }
       addConditionalRuntimeThrow();
-      addInstruction(new MethodCallInstruction(expression, null));
+      addInstruction(new MethodCallInstruction(expression, null, Collections.<MethodContract>emptyList()));
     }
     else {
       final PsiExpressionList args = expression.getArgumentList();
@@ -1719,10 +1558,10 @@
       }
 
       addConditionalRuntimeThrow();
-      addInstruction(new MethodCallInstruction(expression, null));
+      addInstruction(new MethodCallInstruction(expression, null, Collections.<MethodContract>emptyList()));
 
       if (!myCatchStack.isEmpty()) {
-        addMethodThrows(ctr);
+        addMethodThrows(ctr, expression);
       }
 
     }
@@ -1951,17 +1790,3 @@
 
 }
 
-class MethodContract {
-  public final ValueConstraint[] arguments;
-  public final ValueConstraint returnValue;
-
-  public MethodContract(ValueConstraint[] arguments, ValueConstraint returnValue) {
-    this.arguments = arguments;
-    this.returnValue = returnValue;
-  }
-
-  public enum ValueConstraint {
-    ANY_VALUE, NULL_VALUE, NOT_NULL_VALUE, TRUE_VALUE, FALSE_VALUE, THROW_EXCEPTION
-  }
-}
-
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java
index ec1589d..3e017e0 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java
@@ -32,8 +32,7 @@
 import com.intellij.codeInsight.intention.impl.AddNullableAnnotationFix;
 import com.intellij.codeInspection.*;
 import com.intellij.codeInspection.dataFlow.instructions.*;
-import com.intellij.codeInspection.dataFlow.value.DfaConstValue;
-import com.intellij.codeInspection.dataFlow.value.DfaValue;
+import com.intellij.codeInspection.dataFlow.value.*;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Condition;
@@ -113,53 +112,9 @@
         }
       }
 
-      @Override
-      public void visitAnnotation(PsiAnnotation annotation) {
-        if (!ControlFlowAnalyzer.ORG_JETBRAINS_ANNOTATIONS_CONTRACT.equals(annotation.getQualifiedName())) return;
-
-        PsiMethod method = PsiTreeUtil.getParentOfType(annotation, PsiMethod.class);
-        if (method == null) return;
-
-        String text = AnnotationUtil.getStringAttributeValue(annotation, null);
-        if (StringUtil.isNotEmpty(text)) {
-          String error = checkContract(method, text);
-          if (error != null) {
-            PsiAnnotationMemberValue value = annotation.findAttributeValue(null);
-            assert value != null;
-            holder.registerProblem(value, error);
-            return;
-          }
-        }
-
-        if (Boolean.TRUE.equals(AnnotationUtil.getBooleanAttributeValue(annotation, "pure")) && 
-            PsiType.VOID.equals(method.getReturnType())) {
-          PsiAnnotationMemberValue value = annotation.findDeclaredAttributeValue("pure");
-          assert value != null;
-          holder.registerProblem(value, "Pure methods must return something, void is not allowed as a return type");
-        }
-      }
     };
   }
 
-  @Nullable
-  public static String checkContract(PsiMethod method, String text) {
-    List<MethodContract> contracts;
-    try {
-      contracts = ControlFlowAnalyzer.parseContract(text);
-    }
-    catch (ControlFlowAnalyzer.ParseException e) {
-      return e.getMessage();
-    }
-    int paramCount = method.getParameterList().getParametersCount();
-    for (int i = 0; i < contracts.size(); i++) {
-      MethodContract contract = contracts.get(i);
-      if (contract.arguments.length != paramCount) {
-        return "Method takes " + paramCount + " parameters, while contract clause number " + (i + 1) + " expects " + contract.arguments.length;
-      }
-    }
-    return null;
-  }
-
   private void analyzeCodeBlock(@Nullable final PsiElement scope, ProblemsHolder holder, final boolean onTheFly) {
     if (scope == null) return;
 
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowRunner.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowRunner.java
index d3e2ed8..07e5fcc 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowRunner.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowRunner.java
@@ -114,11 +114,14 @@
       myNestedClosures.clear();
       
       Set<Instruction> joinInstructions = ContainerUtil.newHashSet();
-      for (Instruction instruction : myInstructions) {
+      for (int index = 0; index < myInstructions.length; index++) {
+        Instruction instruction = myInstructions[index];
         if (instruction instanceof GotoInstruction) {
           joinInstructions.add(myInstructions[((GotoInstruction)instruction).getOffset()]);
         } else if (instruction instanceof ConditionalGotoInstruction) {
           joinInstructions.add(myInstructions[((ConditionalGotoInstruction)instruction).getOffset()]);
+        } else if (instruction instanceof MethodCallInstruction) {
+          joinInstructions.add(myInstructions[index + 1]);
         }
       }
 
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaMemoryStateImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaMemoryStateImpl.java
index c2da3fb..3b44c82 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaMemoryStateImpl.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaMemoryStateImpl.java
@@ -474,6 +474,9 @@
     if (dfaVar instanceof DfaConstValue && ((DfaConstValue)dfaVar).getValue() != null) {
       return true;
     }
+    if (dfaVar instanceof DfaTypeValue && ((DfaTypeValue)dfaVar).isNotNull()) {
+      return true;
+    }
 
     DfaConstValue dfaNull = myFactory.getConstFactory().getNull();
     int c1Index = getEqClassIndex(dfaVar);
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/MethodContract.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/MethodContract.java
new file mode 100644
index 0000000..160f69b
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/MethodContract.java
@@ -0,0 +1,115 @@
+/*
+ * 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.codeInspection.dataFlow;
+
+import com.intellij.codeInspection.dataFlow.value.DfaConstValue;
+import com.intellij.codeInspection.dataFlow.value.DfaValueFactory;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.util.Function;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+
+/**
+ * @author peter
+ */
+public class MethodContract {
+  public final ValueConstraint[] arguments;
+  public final ValueConstraint returnValue;
+
+  public MethodContract(ValueConstraint[] arguments, ValueConstraint returnValue) {
+    this.arguments = arguments;
+    this.returnValue = returnValue;
+  }
+
+  static ValueConstraint[] createConstraintArray(int paramCount) {
+    ValueConstraint[] args = new ValueConstraint[paramCount];
+    for (int i = 0; i < args.length; i++) {
+      args[i] = ValueConstraint.ANY_VALUE;
+    }
+    return args;
+  }
+
+  @Override
+  public String toString() {
+    return StringUtil.join(arguments, new Function<ValueConstraint, String>() {
+      @Override
+      public String fun(ValueConstraint constraint) {
+        return constraint.toString();
+      }
+    }, ", ") + " -> " + returnValue;
+  }
+
+  public enum ValueConstraint {
+    ANY_VALUE("_"), NULL_VALUE("null"), NOT_NULL_VALUE("!null"), TRUE_VALUE("true"), FALSE_VALUE("false"), THROW_EXCEPTION("fail");
+    private final String myPresentableName;
+
+    ValueConstraint(String presentableName) {
+      myPresentableName = presentableName;
+    }
+
+    @Nullable
+    DfaConstValue getComparisonValue(DfaValueFactory factory) {
+      if (this == NULL_VALUE || this == NOT_NULL_VALUE) return factory.getConstFactory().getNull();
+      if (this == TRUE_VALUE || this == FALSE_VALUE) return factory.getConstFactory().getTrue();
+      return null;
+    }
+
+    boolean shouldUseNonEqComparison() {
+      return this == NOT_NULL_VALUE || this == FALSE_VALUE;
+    }
+
+    @Override
+    public String toString() {
+      return myPresentableName;
+    }
+  }
+
+  public static List<MethodContract> parseContract(String text) throws ParseException {
+    List<MethodContract> result = ContainerUtil.newArrayList();
+    for (String clause : StringUtil.replace(text, " ", "").split(";")) {
+      String arrow = "->";
+      int arrowIndex = clause.indexOf(arrow);
+      if (arrowIndex < 0) {
+        throw new ParseException("A contract clause must be in form arg1, ..., argN -> return-value");
+      }
+
+      String[] argStrings = clause.substring(0, arrowIndex).split(",");
+      ValueConstraint[] args = new ValueConstraint[argStrings.length];
+      for (int i = 0; i < args.length; i++) {
+        args[i] = parseConstraint(argStrings[i]);
+      }
+      result.add(new MethodContract(args, parseConstraint(clause.substring(arrowIndex + arrow.length()))));
+    }
+    return result;
+  }
+
+  private static ValueConstraint parseConstraint(String name) throws ParseException {
+    if (StringUtil.isEmpty(name)) throw new ParseException("Constraint should not be empty");
+    for (ValueConstraint constraint : ValueConstraint.values()) {
+      if (constraint.toString().equals(name)) return constraint;
+    }
+    throw new ParseException("Constraint should be one of: null, !null, true, false, fail, _. Found: " + name);
+  }
+
+  public static class ParseException extends Exception {
+    private ParseException(String message) {
+      super(message);
+    }
+  }
+
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java
index 2fbced0..29bcecd 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java
@@ -22,6 +22,7 @@
 import com.intellij.psi.tree.IElementType;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.TypeConversionUtil;
+import com.intellij.util.Function;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.FactoryMap;
 import com.intellij.util.containers.MultiMap;
@@ -29,11 +30,12 @@
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
 
 import static com.intellij.psi.JavaTokenType.*;
-import static com.intellij.psi.JavaTokenType.EQEQ;
-import static com.intellij.psi.JavaTokenType.NE;
 
 /**
  * @author peter
@@ -46,14 +48,6 @@
   private final Set<PsiElement> myNotToReportReachability = new THashSet<PsiElement>();
   private final Set<InstanceofInstruction> myUsefulInstanceofs = new THashSet<InstanceofInstruction>();
   @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
-  private final FactoryMap<MethodCallInstruction, Map<PsiExpression, Nullness>> myParametersNullability = new FactoryMap<MethodCallInstruction, Map<PsiExpression, Nullness>>() {
-    @Nullable
-    @Override
-    protected Map<PsiExpression, Nullness> create(MethodCallInstruction key) {
-      return calcParameterNullability(key.getCallExpression());
-    }
-  };
-  @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
   private final FactoryMap<MethodCallInstruction, Nullness> myReturnTypeNullability = new FactoryMap<MethodCallInstruction, Nullness>() {
     @Override
     protected Nullness create(MethodCallInstruction key) {
@@ -66,51 +60,6 @@
     }
   };
 
-  private static Map<PsiExpression, Nullness> calcParameterNullability(@Nullable PsiCallExpression callExpression) {
-    PsiExpressionList argumentList = callExpression == null ? null : callExpression.getArgumentList();
-    if (argumentList != null) {
-      JavaResolveResult result = callExpression.resolveMethodGenerics();
-      PsiMethod method = (PsiMethod)result.getElement();
-      if (method != null) {
-        PsiSubstitutor substitutor = result.getSubstitutor();
-        PsiExpression[] args = argumentList.getExpressions();
-        PsiParameter[] parameters = method.getParameterList().getParameters();
-
-        boolean varArg = isVarArgCall(method, substitutor, args, parameters);
-        int checkedCount = Math.min(args.length, parameters.length) - (varArg ? 1 : 0);
-
-        Map<PsiExpression, Nullness> map = ContainerUtil.newHashMap();
-        for (int i = 0; i < checkedCount; i++) {
-          map.put(args[i], DfaPsiUtil.getElementNullability(substitutor.substitute(parameters[i].getType()), parameters[i]));
-        }
-        return map;
-      }
-    }
-    return Collections.emptyMap();
-  }
-
-  private static boolean isVarArgCall(PsiMethod method, PsiSubstitutor substitutor, PsiExpression[] args, PsiParameter[] parameters) {
-    if (!method.isVarArgs()) {
-      return false;
-    }
-
-    int argCount = args.length;
-    int paramCount = parameters.length;
-    if (argCount > paramCount) {
-      return true;
-    }
-    else if (paramCount > 0) {
-      if (argCount == paramCount) {
-        PsiType lastArgType = args[argCount - 1].getType();
-        if (lastArgType != null &&
-            !substitutor.substitute(parameters[paramCount - 1].getType()).isAssignableFrom(lastArgType)) {
-          return true;
-        }
-      }
-    }
-    return false;
-  }
-
   @Override
   public DfaInstructionState[] visitAssign(AssignInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) {
     DfaValue dfaSource = memState.pop();
@@ -153,10 +102,7 @@
   public DfaInstructionState[] visitFieldReference(FieldReferenceInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) {
     final DfaValue qualifier = memState.pop();
     if (!checkNotNullable(memState, qualifier, NullabilityProblem.fieldAccessNPE, instruction.getElementToAssert())) {
-      if (qualifier instanceof DfaVariableValue) {
-        memState.setVarValue((DfaVariableValue)qualifier, runner.getFactory()
-          .createTypeValue(((DfaVariableValue)qualifier).getVariableType(), Nullness.NOT_NULL));
-      }
+      forceNotNull(runner, memState, qualifier);
     }
 
     return nextInstruction(instruction, runner, memState);
@@ -210,49 +156,162 @@
   protected void onInstructionProducesCCE(TypeCastInstruction instruction) {}
 
   @Override
-  public DfaInstructionState[] visitMethodCall(MethodCallInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) {
+  public DfaInstructionState[] visitMethodCall(final MethodCallInstruction instruction, final DataFlowRunner runner, final DfaMemoryState memState) {
+    DfaValue[] argValues = popCallArguments(instruction, runner, memState);
+    final DfaValue qualifier = popQualifier(instruction, runner, memState);
+
+    List<DfaMemoryState> currentStates = ContainerUtil.newArrayList(memState);
+    Set<DfaMemoryState> finalStates = ContainerUtil.newLinkedHashSet();
+    if (argValues != null) {
+      for (MethodContract contract : instruction.getContracts()) {
+        currentStates = addContractResults(argValues, contract, currentStates, instruction, runner.getFactory(), finalStates);
+      }
+    }
+    for (DfaMemoryState state : currentStates) {
+      state.push(getMethodResultValue(instruction, qualifier, runner.getFactory()));
+      finalStates.add(state);
+    }
+    
+    return ContainerUtil.map2Array(finalStates, DfaInstructionState.class, new Function<DfaMemoryState, DfaInstructionState>() {
+      @Override
+      public DfaInstructionState fun(DfaMemoryState state) {
+        if (instruction.shouldFlushFields()) {
+          state.flushFields();
+        }
+        return new DfaInstructionState(runner.getInstruction(instruction.getIndex() + 1), state);
+      }
+    });
+  }
+
+  @Nullable 
+  private DfaValue[] popCallArguments(MethodCallInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) {
     final PsiExpression[] args = instruction.getArgs();
-    Map<PsiExpression, Nullness> map = myParametersNullability.get(instruction);
+
+    PsiMethod method = instruction.getTargetMethod();
+    boolean varargCall = instruction.isVarArgCall();
+    DfaValue[] argValues;
+    if (method == null || instruction.getContracts().isEmpty()) {
+      argValues = null;
+    } else {
+      int paramCount = method.getParameterList().getParametersCount();
+      if (paramCount == args.length || method.isVarArgs() && args.length >= paramCount - 1) {
+        argValues = new DfaValue[paramCount];
+        if (varargCall) {
+          argValues[paramCount - 1] = DfaUnknownValue.getInstance();
+        }
+      } else {
+        argValues = null;
+      }
+    }
+
     for (int i = 0; i < args.length; i++) {
       final DfaValue arg = memState.pop();
-      PsiExpression expr = args[(args.length - i - 1)];
-      if (map.get(expr) == Nullness.NOT_NULL) {
+      int paramIndex = args.length - i - 1;
+      if (argValues != null && (paramIndex < argValues.length - 1 || !varargCall)) {
+        argValues[paramIndex] = arg;
+      }
+
+      PsiExpression expr = args[paramIndex];
+      Nullness requiredNullability = instruction.getArgRequiredNullability(expr);
+      if (requiredNullability == Nullness.NOT_NULL) {
         if (!checkNotNullable(memState, arg, NullabilityProblem.passingNullableToNotNullParameter, expr)) {
-          if (arg instanceof DfaVariableValue) {
-            memState.setVarValue((DfaVariableValue)arg, runner.getFactory()
-              .createTypeValue(((DfaVariableValue)arg).getVariableType(), Nullness.NOT_NULL));
-          }
+          forceNotNull(runner, memState, arg);
         }
       }
-      else if (map.get(expr) == Nullness.UNKNOWN) {
+      else if (requiredNullability == Nullness.UNKNOWN) {
         checkNotNullable(memState, arg, NullabilityProblem.passingNullableArgumentToNonAnnotatedParameter, expr);
       }
     }
+    return argValues;
+  }
 
+  private DfaValue popQualifier(MethodCallInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) {
     @NotNull final DfaValue qualifier = memState.pop();
-    try {
-      boolean unboxing = instruction.getMethodType() == MethodCallInstruction.MethodType.UNBOXING;
-      NullabilityProblem problem = unboxing ? NullabilityProblem.unboxingNullable : NullabilityProblem.callNPE;
-      PsiExpression anchor = unboxing ? instruction.getContext() : instruction.getCallExpression();
-      if (!checkNotNullable(memState, qualifier, problem, anchor)) {
-        if (qualifier instanceof DfaVariableValue) {
-          memState.setVarValue((DfaVariableValue)qualifier, runner.getFactory().createTypeValue(
-            ((DfaVariableValue)qualifier).getVariableType(), Nullness.NOT_NULL));
+    boolean unboxing = instruction.getMethodType() == MethodCallInstruction.MethodType.UNBOXING;
+    NullabilityProblem problem = unboxing ? NullabilityProblem.unboxingNullable : NullabilityProblem.callNPE;
+    PsiExpression anchor = unboxing ? instruction.getContext() : instruction.getCallExpression();
+    if (!checkNotNullable(memState, qualifier, problem, anchor)) {
+      forceNotNull(runner, memState, qualifier);
+    }
+    return qualifier;
+  }
+
+  private List<DfaMemoryState> addContractResults(DfaValue[] argValues,
+                                                  MethodContract contract,
+                                                  List<DfaMemoryState> states,
+                                                  MethodCallInstruction instruction,
+                                                  DfaValueFactory factory,
+                                                  Set<DfaMemoryState> finalStates) {
+    DfaConstValue.Factory constFactory = factory.getConstFactory();
+    List<DfaMemoryState> falseStates = ContainerUtil.newArrayList();
+    for (int i = 0; i < argValues.length; i++) {
+      DfaValue argValue = argValues[i];
+      MethodContract.ValueConstraint constraint = contract.arguments[i];
+      DfaConstValue expectedValue = constraint.getComparisonValue(factory);
+      if (expectedValue == null) continue;
+      
+      boolean invertCondition = constraint.shouldUseNonEqComparison();
+      DfaValue condition = factory.getRelationFactory().createRelation(argValue, expectedValue, EQEQ, invertCondition);
+      if (condition == null) {
+        if (!(argValue instanceof DfaConstValue)) {
+          falseStates.addAll(states);
+          continue;
+        }
+        condition = constFactory.createFromValue((argValue == expectedValue) != invertCondition, PsiType.BOOLEAN, null);
+      }
+
+      List<DfaMemoryState> nextStates = ContainerUtil.newArrayList();
+      for (DfaMemoryState state : states) {
+        boolean unknownVsNull = expectedValue == constFactory.getNull() &&
+                                argValue instanceof DfaVariableValue &&
+                                ((DfaMemoryStateImpl)state).getVariableState((DfaVariableValue)argValue).getNullability() == Nullness.UNKNOWN;
+        DfaMemoryState falseCopy = state.createCopy();
+        if (state.applyCondition(condition)) {
+          if (unknownVsNull && !invertCondition) {
+            state.markEphemeral();
+          }
+          nextStates.add(state);
+        }
+        if (falseCopy.applyCondition(condition.createNegated())) {
+          if (unknownVsNull && invertCondition) {
+            falseCopy.markEphemeral();
+          }
+          falseStates.add(falseCopy);
         }
       }
-
-      return nextInstruction(instruction, runner, memState);
+      states = nextStates;
     }
-    finally {
-      memState.push(getMethodResultValue(instruction, qualifier, runner.getFactory()));
-      if (instruction.shouldFlushFields()) {
-        memState.flushFields();
-      }
+
+    for (DfaMemoryState state : states) {
+      state.push(getDfaContractReturnValue(contract, instruction, factory));
+      finalStates.add(state);
+    }
+    
+    return falseStates;
+  }
+
+  private DfaValue getDfaContractReturnValue(MethodContract contract,
+                                             MethodCallInstruction instruction,
+                                             DfaValueFactory factory) {
+    switch (contract.returnValue) {
+      case NULL_VALUE: return factory.getConstFactory().getNull();
+      case NOT_NULL_VALUE: return factory.createTypeValue(instruction.getResultType(), Nullness.NOT_NULL);
+      case TRUE_VALUE: return factory.getConstFactory().getTrue();
+      case FALSE_VALUE: return factory.getConstFactory().getFalse();
+      case THROW_EXCEPTION: return factory.getConstFactory().getContractFail();
+      default: return getMethodResultValue(instruction, null, factory);
+    }
+  }
+
+  private static void forceNotNull(DataFlowRunner runner, DfaMemoryState memState, DfaValue arg) {
+    if (arg instanceof DfaVariableValue) {
+      DfaVariableValue var = (DfaVariableValue)arg;
+      memState.setVarValue(var, runner.getFactory().createTypeValue(var.getVariableType(), Nullness.NOT_NULL));
     }
   }
 
   @NotNull
-  private DfaValue getMethodResultValue(MethodCallInstruction instruction, @NotNull DfaValue qualifierValue, DfaValueFactory factory) {
+  private DfaValue getMethodResultValue(MethodCallInstruction instruction, @Nullable DfaValue qualifierValue, DfaValueFactory factory) {
     DfaValue precalculated = instruction.getPrecalculatedReturnValue();
     if (precalculated != null) {
       return precalculated;
@@ -271,6 +330,7 @@
     }
 
     if (methodType == MethodCallInstruction.MethodType.CAST) {
+      assert qualifierValue != null;
       if (qualifierValue instanceof DfaConstValue) {
         Object casted = TypeConversionUtil.computeCastTo(((DfaConstValue)qualifierValue).getValue(), type);
         return factory.getConstFactory().createFromValue(casted, type, ((DfaConstValue)qualifierValue).getConstant());
@@ -346,15 +406,10 @@
 
     myCanBeNullInInstanceof.add(instruction);
 
-    boolean specialContractTreatment = isUnknownComparisonWithNullInContract(instruction, dfaLeft, dfaRight, factory, memState);
-
     ArrayList<DfaInstructionState> states = new ArrayList<DfaInstructionState>();
 
     final DfaMemoryState trueCopy = memState.createCopy();
     if (trueCopy.applyCondition(dfaRelation)) {
-      if (specialContractTreatment && !dfaRelation.isNegated()) {
-        trueCopy.markEphemeral();
-      }
       trueCopy.push(factory.getConstFactory().getTrue());
       instruction.setTrueReachable();
       states.add(new DfaInstructionState(next, trueCopy));
@@ -363,9 +418,6 @@
     //noinspection UnnecessaryLocalVariable
     DfaMemoryState falseCopy = memState;
     if (falseCopy.applyCondition(dfaRelation.createNegated())) {
-      if (specialContractTreatment && dfaRelation.isNegated()) {
-        falseCopy.markEphemeral();
-      }
       falseCopy.push(factory.getConstFactory().getFalse());
       instruction.setFalseReachable();
       states.add(new DfaInstructionState(next, falseCopy));
@@ -377,23 +429,6 @@
     return states.toArray(new DfaInstructionState[states.size()]);
   }
 
-  private static boolean isUnknownComparisonWithNullInContract(BinopInstruction instruction,
-                                                               DfaValue dfaLeft,
-                                                               DfaValue dfaRight,
-                                                               DfaValueFactory factory,
-                                                               DfaMemoryState memoryState) {
-    if (instruction.getPsiAnchor() != null || dfaRight != factory.getConstFactory().getNull()) {
-      return false;
-    }
-    if (dfaLeft instanceof DfaVariableValue) {
-      return ((DfaMemoryStateImpl)memoryState).getVariableState((DfaVariableValue)dfaLeft).getNullability() == Nullness.UNKNOWN;
-    }
-    if (dfaLeft instanceof DfaTypeValue) {
-      return ((DfaTypeValue)dfaLeft).getNullness() == Nullness.UNKNOWN;
-    }
-    return false;
-  }
-
   public void skipConstantConditionReporting(@Nullable PsiElement anchor) {
     ContainerUtil.addIfNotNull(myNotToReportReachability, anchor);
   }
@@ -431,16 +466,21 @@
       return handleConstantComparison(instruction, runner, memState, dfaLeft, dfaRight, DfaRelationValue.getSymmetricOperation(opSign));
     }
 
-    if (EQEQ != opSign && NE != opSign ||
-        !(dfaLeft instanceof DfaConstValue) || !(dfaRight instanceof DfaConstValue)) {
+    if (EQEQ != opSign && NE != opSign) {
       return null;
     }
 
-    boolean negated = (NE == opSign) ^ (DfaMemoryStateImpl.isNaN(dfaLeft) || DfaMemoryStateImpl.isNaN(dfaRight));
-    if (dfaLeft == dfaRight ^ negated) {
-      return alwaysTrue(instruction, runner, memState);
+    if (dfaLeft instanceof DfaConstValue && dfaRight instanceof DfaConstValue ||
+        dfaLeft == runner.getFactory().getConstFactory().getContractFail() ||
+        dfaRight == runner.getFactory().getConstFactory().getContractFail()) {
+      boolean negated = (NE == opSign) ^ (DfaMemoryStateImpl.isNaN(dfaLeft) || DfaMemoryStateImpl.isNaN(dfaRight));
+      if (dfaLeft == dfaRight ^ negated) {
+        return alwaysTrue(instruction, runner, memState);
+      }
+      return alwaysFalse(instruction, runner, memState);
     }
-    return alwaysFalse(instruction, runner, memState);
+
+    return null;
   }
 
   private static DfaInstructionState[] checkTypeRanges(BinopInstruction instruction,
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/instructions/MethodCallInstruction.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/instructions/MethodCallInstruction.java
index 76fd8d7..442ee43 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/instructions/MethodCallInstruction.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/instructions/MethodCallInstruction.java
@@ -29,9 +29,14 @@
 import com.intellij.codeInspection.dataFlow.value.DfaValue;
 import com.intellij.psi.*;
 import com.intellij.psi.util.PropertyUtil;
+import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
 
 public class MethodCallInstruction extends Instruction {
   @Nullable private final PsiCallExpression myCall;
@@ -39,40 +44,92 @@
   @NotNull private final PsiExpression[] myArgs;
   private final boolean myShouldFlushFields;
   @NotNull private final PsiExpression myContext;
+  @Nullable private final PsiMethod myTargetMethod;
+  private final List<MethodContract> myContracts;
   private final MethodType myMethodType;
   @Nullable private final DfaValue myPrecalculatedReturnValue;
+  private final boolean myVarArgCall;
+  private final Map<PsiExpression, Nullness> myArgRequiredNullability;
+
   public enum MethodType {
     BOXING, UNBOXING, REGULAR_METHOD_CALL, CAST
   }
 
   public MethodCallInstruction(@NotNull PsiExpression context, MethodType methodType, @Nullable PsiType resultType) {
     myContext = context;
+    myContracts = Collections.emptyList();
     myMethodType = methodType;
     myCall = null;
     myArgs = PsiExpression.EMPTY_ARRAY;
     myType = resultType;
     myShouldFlushFields = false;
     myPrecalculatedReturnValue = null;
+    myTargetMethod = null;
+    myVarArgCall = false;
+    myArgRequiredNullability = Collections.emptyMap();
   }
 
-  public MethodCallInstruction(@NotNull PsiCallExpression call, @Nullable DfaValue precalculatedReturnValue) {
+  public MethodCallInstruction(@NotNull PsiCallExpression call, @Nullable DfaValue precalculatedReturnValue, List<MethodContract> contracts) {
     myContext = call;
+    myContracts = contracts;
     myMethodType = MethodType.REGULAR_METHOD_CALL;
     myCall = call;
     final PsiExpressionList argList = call.getArgumentList();
     myArgs = argList != null ? argList.getExpressions() : PsiExpression.EMPTY_ARRAY;
     myType = myCall.getType();
 
-    myShouldFlushFields = !(myCall instanceof PsiNewExpression && myType != null && myType.getArrayDimensions() > 0) && !isPureCall(call);
+    JavaResolveResult result = call.resolveMethodGenerics();
+    myTargetMethod = (PsiMethod)result.getElement();
+
+    PsiSubstitutor substitutor = result.getSubstitutor();
+    if (argList != null && myTargetMethod != null) {
+      PsiParameter[] parameters = myTargetMethod.getParameterList().getParameters();
+      myVarArgCall = isVarArgCall(myTargetMethod, substitutor, myArgs, parameters);
+      myArgRequiredNullability = calcArgRequiredNullability(substitutor, parameters);
+    } else {
+      myVarArgCall = false;
+      myArgRequiredNullability = Collections.emptyMap();
+    }
+
+    myShouldFlushFields = !(call instanceof PsiNewExpression && myType != null && myType.getArrayDimensions() > 0) && !isPureCall();
     myPrecalculatedReturnValue = precalculatedReturnValue;
   }
 
-  private static boolean isPureCall(PsiCallExpression call) {
-    PsiMethod method = call.resolveMethod();
-    if (method == null) return false;
-    PsiAnnotation anno = ControlFlowAnalyzer.findContractAnnotation(method);
+  private Map<PsiExpression, Nullness> calcArgRequiredNullability(PsiSubstitutor substitutor, PsiParameter[] parameters) {
+    int checkedCount = Math.min(myArgs.length, parameters.length) - (myVarArgCall ? 1 : 0);
+
+    Map<PsiExpression, Nullness> map = ContainerUtil.newHashMap();
+    for (int i = 0; i < checkedCount; i++) {
+      map.put(myArgs[i], DfaPsiUtil.getElementNullability(substitutor.substitute(parameters[i].getType()), parameters[i]));
+    }
+    return map;
+  }
+
+  private static boolean isVarArgCall(PsiMethod method, PsiSubstitutor substitutor, PsiExpression[] args, PsiParameter[] parameters) {
+    if (!method.isVarArgs()) {
+      return false;
+    }
+
+    int argCount = args.length;
+    int paramCount = parameters.length;
+    if (argCount > paramCount) {
+      return true;
+    }
+
+    if (paramCount > 0 && argCount == paramCount) {
+      PsiType lastArgType = args[argCount - 1].getType();
+      if (lastArgType != null && !substitutor.substitute(parameters[paramCount - 1].getType()).isAssignableFrom(lastArgType)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  private boolean isPureCall() {
+    if (myTargetMethod == null) return false;
+    PsiAnnotation anno = ControlFlowAnalyzer.findContractAnnotation(myTargetMethod);
     if (anno != null && Boolean.TRUE.equals(AnnotationUtil.getBooleanAttributeValue(anno, "pure"))) return true;
-    return PropertyUtil.isSimplePropertyGetter(method);
+    return PropertyUtil.isSimplePropertyGetter(myTargetMethod);
   }
 
   @Nullable
@@ -93,6 +150,24 @@
     return myShouldFlushFields;
   }
 
+  @Nullable
+  public PsiMethod getTargetMethod() {
+    return myTargetMethod;
+  }
+
+  public boolean isVarArgCall() {
+    return myVarArgCall;
+  }
+
+  @Nullable 
+  public Nullness getArgRequiredNullability(@NotNull PsiExpression arg) {
+    return myArgRequiredNullability.get(arg);
+  }
+
+  public List<MethodContract> getContracts() {
+    return myContracts;
+  }
+
   @Override
   public DfaInstructionState[] accept(DataFlowRunner runner, DfaMemoryState stateBefore, InstructionVisitor visitor) {
     return visitor.visitMethodCall(this, runner, stateBefore);
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/instructions/ReturnInstruction.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/instructions/ReturnInstruction.java
index 55c0000..9c67fbe 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/instructions/ReturnInstruction.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/instructions/ReturnInstruction.java
@@ -25,12 +25,21 @@
 package com.intellij.codeInspection.dataFlow.instructions;
 
 import com.intellij.codeInspection.dataFlow.*;
+import com.intellij.psi.PsiElement;
+import org.jetbrains.annotations.Nullable;
 
 public class ReturnInstruction extends Instruction {
   private final boolean isViaException;
+  private final PsiElement myAnchor;
 
-  public ReturnInstruction(boolean isViaException) {
+  public ReturnInstruction(boolean isViaException, @Nullable PsiElement anchor) {
     this.isViaException = isViaException;
+    myAnchor = anchor;
+  }
+
+  @Nullable
+  public PsiElement getAnchor() {
+    return myAnchor;
   }
 
   public boolean isViaException() {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaConstValue.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaConstValue.java
index f00f3ce..5c8d7ca 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaConstValue.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaConstValue.java
@@ -34,10 +34,12 @@
 import java.util.Map;
 
 public class DfaConstValue extends DfaValue {
+  private static final Throwable ourThrowable = new Throwable();
   public static class Factory {
     private final DfaConstValue dfaNull;
     private final DfaConstValue dfaFalse;
     private final DfaConstValue dfaTrue;
+    private final DfaConstValue dfaFail;
     private final DfaValueFactory myFactory;
     private final Map<Object, DfaConstValue> myValues = ContainerUtil.newHashMap();
 
@@ -46,6 +48,7 @@
       dfaNull = new DfaConstValue(null, factory, null);
       dfaFalse = new DfaConstValue(Boolean.FALSE, factory, null);
       dfaTrue = new DfaConstValue(Boolean.TRUE, factory, null);
+      dfaFail = new DfaConstValue(ourThrowable, factory, null);
     }
 
     @Nullable
@@ -103,6 +106,10 @@
       return instance;
     }
 
+    public DfaConstValue getContractFail() {
+      return dfaFail;
+    }
+
     public DfaConstValue getFalse() {
       return dfaFalse;
     }
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaVariableValue.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaVariableValue.java
index 63be252..31492bb 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaVariableValue.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/value/DfaVariableValue.java
@@ -31,6 +31,7 @@
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.Trinity;
 import com.intellij.psi.*;
+import com.intellij.psi.util.PsiUtil;
 import com.intellij.psi.util.TypeConversionUtil;
 import com.intellij.util.SmartList;
 import com.intellij.util.containers.MultiMap;
@@ -86,7 +87,7 @@
   private final DfaTypeValue myTypeValue;
   private final List<DfaVariableValue> myDependents = new SmartList<DfaVariableValue>();
 
-  private DfaVariableValue(@NotNull PsiModifierListOwner variable, PsiType varType, boolean isNegated, DfaValueFactory factory, @Nullable DfaVariableValue qualifier) {
+  private DfaVariableValue(@NotNull PsiModifierListOwner variable, @Nullable PsiType varType, boolean isNegated, DfaValueFactory factory, @Nullable DfaVariableValue qualifier) {
     super(factory);
     myVariable = variable;
     myIsNegated = isNegated;
@@ -94,6 +95,9 @@
     myVarType = varType;
     DfaValue typeValue = myFactory.createTypeValue(varType, Nullness.UNKNOWN);
     myTypeValue = typeValue instanceof DfaTypeValue ? (DfaTypeValue)typeValue : null;
+    if (varType != null && !varType.isValid()) {
+      PsiUtil.ensureValidType(varType, "Variable: " + variable + " of class " + variable.getClass());
+    }
   }
 
   @Nullable
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java b/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java
new file mode 100644
index 0000000..4a49391
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java
@@ -0,0 +1,64 @@
+/*
+ * 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.codeInspection.deadCode;
+
+import com.intellij.analysis.AnalysisScope;
+import com.intellij.codeInspection.GlobalInspectionContext;
+import com.intellij.codeInspection.InspectionManager;
+import com.intellij.codeInspection.InspectionsBundle;
+import com.intellij.codeInspection.ProblemDescriptionsProcessor;
+import com.intellij.codeInspection.ex.JobDescriptor;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author max
+ */
+public class DummyEntryPointsTool extends UnusedDeclarationInspection {
+  public DummyEntryPointsTool() {
+  }
+
+  @Override
+  public void runInspection(@NotNull AnalysisScope scope,
+                            @NotNull InspectionManager manager,
+                            @NotNull GlobalInspectionContext globalContext,
+                            @NotNull ProblemDescriptionsProcessor problemDescriptionsProcessor) {
+  }
+
+  @Nullable
+  @Override
+  public JobDescriptor[] getAdditionalJobs() {
+    return JobDescriptor.EMPTY_ARRAY;
+  }
+
+  @Override
+  @NotNull
+  public String getDisplayName() {
+    return InspectionsBundle.message("inspection.dead.code.entry.points.display.name");
+  }
+
+  @Override
+  @NotNull
+  public String getGroupDisplayName() {
+    return "";
+  }
+
+  @Override
+  @NotNull
+  public String getShortName() {
+    return "";
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/RefEntryPointFilter.java b/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/RefEntryPointFilter.java
new file mode 100644
index 0000000..1bbf602
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/RefEntryPointFilter.java
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+/*
+ * Created by IntelliJ IDEA.
+ * User: max
+ * Date: Dec 2, 2001
+ * Time: 12:05:14 AM
+ * To change template for new class use
+ * Code Style | Class Templates options (Tools | IDE Options).
+ */
+package com.intellij.codeInspection.deadCode;
+
+import com.intellij.codeInspection.reference.RefJavaElement;
+import com.intellij.codeInspection.reference.RefParameter;
+import com.intellij.codeInspection.util.RefFilter;
+import org.jetbrains.annotations.NotNull;
+
+public class RefEntryPointFilter extends RefFilter {
+  @Override
+  public int getElementProblemCount(@NotNull RefJavaElement refElement) {
+    if (refElement instanceof RefParameter) return 0;
+    return refElement.isEntry() && !refElement.isSyntheticJSP() ? 1 : 0;
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/deprecation/DeprecationInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/deprecation/DeprecationInspection.java
index a490f81..b02c026 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/deprecation/DeprecationInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/deprecation/DeprecationInspection.java
@@ -18,7 +18,10 @@
 import com.intellij.codeInsight.daemon.JavaErrorMessages;
 import com.intellij.codeInsight.daemon.impl.analysis.HighlightMessageUtil;
 import com.intellij.codeInsight.daemon.impl.analysis.JavaHighlightUtil;
-import com.intellij.codeInspection.*;
+import com.intellij.codeInspection.BaseJavaBatchLocalInspectionTool;
+import com.intellij.codeInspection.DeprecationUtil;
+import com.intellij.codeInspection.ProblemHighlightType;
+import com.intellij.codeInspection.ProblemsHolder;
 import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel;
 import com.intellij.openapi.util.TextRange;
 import com.intellij.psi.*;
@@ -39,15 +42,18 @@
   @NonNls public static final String SHORT_NAME = DeprecationUtil.DEPRECATION_SHORT_NAME;
   @NonNls public static final String ID = DeprecationUtil.DEPRECATION_ID;
   public static final String DISPLAY_NAME = DeprecationUtil.DEPRECATION_DISPLAY_NAME;
+  public static final String IGNORE_METHODS_OF_DEPRECATED_NAME = "IGNORE_METHODS_OF_DEPRECATED";
 
   public boolean IGNORE_INSIDE_DEPRECATED = false;
   public boolean IGNORE_ABSTRACT_DEPRECATED_OVERRIDES = true;
   public boolean IGNORE_IMPORT_STATEMENTS = true;
+  public boolean IGNORE_METHODS_OF_DEPRECATED = true;
 
   @Override
   @NotNull
   public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
-    return new DeprecationElementVisitor(holder, IGNORE_INSIDE_DEPRECATED, IGNORE_ABSTRACT_DEPRECATED_OVERRIDES, IGNORE_IMPORT_STATEMENTS);
+    return new DeprecationElementVisitor(holder, IGNORE_INSIDE_DEPRECATED, IGNORE_ABSTRACT_DEPRECATED_OVERRIDES, 
+                                         IGNORE_IMPORT_STATEMENTS, IGNORE_METHODS_OF_DEPRECATED);
   }
 
   @Override
@@ -86,6 +92,7 @@
     panel.addCheckbox("Ignore inside deprecated members", "IGNORE_INSIDE_DEPRECATED");
     panel.addCheckbox("Ignore inside non-static imports", "IGNORE_IMPORT_STATEMENTS");
     panel.addCheckbox("<html>Ignore overrides of deprecated abstract methods from non-deprecated supers</html>", "IGNORE_ABSTRACT_DEPRECATED_OVERRIDES");
+    panel.addCheckbox("Ignore members of deprecated classes", IGNORE_METHODS_OF_DEPRECATED_NAME);
     return panel;
 
   }
@@ -95,29 +102,32 @@
     private final boolean myIgnoreInsideDeprecated;
     private final boolean myIgnoreAbstractDeprecatedOverrides;
     private final boolean myIgnoreImportStatements;
+    private final boolean myIgnoreMethodsOfDeprecated;
 
     public DeprecationElementVisitor(final ProblemsHolder holder,
                                      boolean ignoreInsideDeprecated,
                                      boolean ignoreAbstractDeprecatedOverrides,
-                                     boolean ignoreImportStatements) {
+                                     boolean ignoreImportStatements, 
+                                     boolean ignoreMethodsOfDeprecated) {
       myHolder = holder;
       myIgnoreInsideDeprecated = ignoreInsideDeprecated;
       myIgnoreAbstractDeprecatedOverrides = ignoreAbstractDeprecatedOverrides;
       myIgnoreImportStatements = ignoreImportStatements;
+      myIgnoreMethodsOfDeprecated = ignoreMethodsOfDeprecated;
     }
 
     @Override
     public void visitReferenceElement(PsiJavaCodeReferenceElement reference) {
       JavaResolveResult result = reference.advancedResolve(true);
       PsiElement resolved = result.getElement();
-      checkDeprecated(resolved, reference.getReferenceNameElement(), null, myIgnoreInsideDeprecated, myIgnoreImportStatements, myHolder);
+      checkDeprecated(resolved, reference.getReferenceNameElement(), null, myIgnoreInsideDeprecated, myIgnoreImportStatements, myIgnoreMethodsOfDeprecated, myHolder);
     }
 
     @Override
     public void visitImportStaticStatement(PsiImportStaticStatement statement) {
       final PsiJavaCodeReferenceElement importReference = statement.getImportReference();
       if (importReference != null) {
-        checkDeprecated(importReference.resolve(), importReference.getReferenceNameElement(), null, myIgnoreInsideDeprecated, false, myHolder);
+        checkDeprecated(importReference.resolve(), importReference.getReferenceNameElement(), null, myIgnoreInsideDeprecated, false, true, myHolder);
       }
     }
 
@@ -148,7 +158,7 @@
         PsiMethod constructor = result == null ? null : result.getElement();
         if (constructor != null && expression.getClassOrAnonymousClassReference() != null) {
           if (expression.getClassReference() == null && constructor.getParameterList().getParametersCount() == 0) return;
-          checkDeprecated(constructor, expression.getClassOrAnonymousClassReference(), null, myIgnoreInsideDeprecated, myIgnoreImportStatements, myHolder);
+          checkDeprecated(constructor, expression.getClassOrAnonymousClassReference(), null, myIgnoreInsideDeprecated, myIgnoreImportStatements, true, myHolder);
         }
       }
     }
@@ -241,7 +251,7 @@
                                      PsiElement elementToHighlight,
                                      @Nullable TextRange rangeInElement,
                                      ProblemsHolder holder) {
-    checkDeprecated(refElement, elementToHighlight, rangeInElement, false, false, holder);
+    checkDeprecated(refElement, elementToHighlight, rangeInElement, false, false, true, holder);
   }
 
   public static void checkDeprecated(PsiElement refElement,
@@ -249,9 +259,16 @@
                                      @Nullable TextRange rangeInElement,
                                      boolean ignoreInsideDeprecated,
                                      boolean ignoreImportStatements,
+                                     boolean ignoreMethodsOfDeprecated, 
                                      ProblemsHolder holder) {
     if (!(refElement instanceof PsiDocCommentOwner)) return;
-    if (!((PsiDocCommentOwner)refElement).isDeprecated()) return;
+    if (!((PsiDocCommentOwner)refElement).isDeprecated()) {
+      if (!ignoreMethodsOfDeprecated) {
+        checkDeprecated(((PsiDocCommentOwner)refElement).getContainingClass(), elementToHighlight, rangeInElement, 
+                        ignoreInsideDeprecated, ignoreImportStatements, false, holder);
+      }
+      return;
+    }
 
     if (ignoreInsideDeprecated) {
       PsiElement parent = elementToHighlight;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/inconsistentLanguageLevel/InconsistentLanguageLevelInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/inconsistentLanguageLevel/InconsistentLanguageLevelInspection.java
new file mode 100644
index 0000000..24a8fc5
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/inconsistentLanguageLevel/InconsistentLanguageLevelInspection.java
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+
+/*
+ * User: anna
+ * Date: 03-Nov-2009
+ */
+package com.intellij.codeInspection.inconsistentLanguageLevel;
+
+import com.intellij.analysis.AnalysisScope;
+import com.intellij.codeInsight.daemon.GroupNames;
+import com.intellij.codeInsight.intention.QuickFixFactory;
+import com.intellij.codeInspection.*;
+import com.intellij.codeInspection.reference.RefManager;
+import com.intellij.codeInspection.reference.RefModule;
+import com.intellij.codeInspection.unnecessaryModuleDependency.UnnecessaryModuleDependencyInspection;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleUtilCore;
+import com.intellij.openapi.roots.*;
+import com.intellij.pom.java.LanguageLevel;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiElementVisitor;
+import gnu.trove.THashSet;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Set;
+
+public class InconsistentLanguageLevelInspection extends GlobalInspectionTool {
+  @Override
+  public boolean isGraphNeeded() {
+    return false;
+  }
+
+  @Override
+  public void runInspection(@NotNull AnalysisScope scope,
+                            @NotNull InspectionManager manager,
+                            @NotNull GlobalInspectionContext globalContext,
+                            @NotNull ProblemDescriptionsProcessor problemProcessor) {
+    final Set<Module> modules = new THashSet<Module>();
+    scope.accept(new PsiElementVisitor(){
+      @Override
+      public void visitElement(PsiElement element) {
+        final Module module = ModuleUtilCore.findModuleForPsiElement(element);
+        if (module != null) {
+          modules.add(module);
+        }
+      }
+    });
+
+    LanguageLevel projectLanguageLevel = LanguageLevelProjectExtension.getInstance(manager.getProject()).getLanguageLevel();
+    for (Module module : modules) {
+      LanguageLevel languageLevel = LanguageLevelModuleExtension.getInstance(module).getLanguageLevel();
+      if (languageLevel == null) {
+        languageLevel = projectLanguageLevel;
+      }
+      RefManager refManager = globalContext.getRefManager();
+      final RefModule refModule = refManager.getRefModule(module);
+      for (OrderEntry entry : ModuleRootManager.getInstance(module).getOrderEntries()) {
+        if (!(entry instanceof ModuleOrderEntry)) continue;
+        final Module dependantModule = ((ModuleOrderEntry)entry).getModule();
+        if (dependantModule == null) continue;
+        LanguageLevel dependantLanguageLevel = LanguageLevelModuleExtension.getInstance(dependantModule).getLanguageLevel();
+        if (dependantLanguageLevel == null) {
+          dependantLanguageLevel = projectLanguageLevel;
+        }
+        if (languageLevel.compareTo(dependantLanguageLevel) < 0) {
+          final CommonProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
+            "Inconsistent language level settings: module " + module.getName() + " with language level " + languageLevel +
+            " depends on module " + dependantModule.getName() +" with language level " + dependantLanguageLevel,
+            new UnnecessaryModuleDependencyInspection.RemoveModuleDependencyFix(module, dependantModule),
+            QuickFixFactory.getInstance().createShowModulePropertiesFix(module));
+          problemProcessor.addProblemElement(refModule, problemDescriptor);
+        }
+      }
+    }
+  }
+
+  @Override
+  public boolean isEnabledByDefault() {
+    return false;
+  }
+
+  @Override
+  @Nls
+  @NotNull
+  public String getGroupDisplayName() {
+    return GroupNames.MODULARIZATION_GROUP_NAME;
+  }
+
+  @Override
+  @NotNull
+  public String getDisplayName() {
+    return "Inconsistent language level settings";
+  }
+
+  @Override
+  @NonNls
+  @NotNull
+  public String getShortName() {
+    return "InconsistentLanguageLevel";
+  }
+
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/localCanBeFinal/LocalCanBeFinal.java b/java/java-analysis-impl/src/com/intellij/codeInspection/localCanBeFinal/LocalCanBeFinal.java
index ddc01ee..6f1f69b 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/localCanBeFinal/LocalCanBeFinal.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/localCanBeFinal/LocalCanBeFinal.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -94,7 +94,7 @@
     try {
       ControlFlowPolicy policy = new ControlFlowPolicy() {
         @Override
-        public PsiVariable getUsedVariable(PsiReferenceExpression refExpr) {
+        public PsiVariable getUsedVariable(@NotNull PsiReferenceExpression refExpr) {
           if (refExpr.isQualified()) return null;
 
           PsiElement refElement = refExpr.resolve();
@@ -107,12 +107,12 @@
         }
 
         @Override
-        public boolean isParameterAccepted(PsiParameter psiParameter) {
+        public boolean isParameterAccepted(@NotNull PsiParameter psiParameter) {
           return isVariableDeclaredInMethod(psiParameter);
         }
 
         @Override
-        public boolean isLocalVariableAccepted(PsiLocalVariable psiVariable) {
+        public boolean isLocalVariableAccepted(@NotNull PsiLocalVariable psiVariable) {
           return isVariableDeclaredInMethod(psiVariable);
         }
 
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/miscGenerics/SuspiciousMethodCallUtil.java b/java/java-analysis-impl/src/com/intellij/codeInspection/miscGenerics/SuspiciousMethodCallUtil.java
index 3f8b5fe..ecf21db 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/miscGenerics/SuspiciousMethodCallUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/miscGenerics/SuspiciousMethodCallUtil.java
@@ -15,11 +15,14 @@
  */
 package com.intellij.codeInspection.miscGenerics;
 
+import com.intellij.codeInsight.daemon.impl.analysis.JavaGenericsUtil;
 import com.intellij.codeInspection.InspectionsBundle;
 import com.intellij.psi.*;
+import com.intellij.psi.impl.PsiImplUtil;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.util.*;
 import com.intellij.util.containers.IntArrayList;
+import com.sun.corba.se.impl.corba.TCUtility;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -39,9 +42,15 @@
     if (collectionClass != null) {
       PsiMethod remove = MethodSignatureUtil.findMethodBySignature(collectionClass, removeSignature, false);
       addMethod(remove, 0, patternMethods, indices);
+
       MethodSignature containsSignature = MethodSignatureUtil.createMethodSignature("contains", javaLangObject, PsiTypeParameter.EMPTY_ARRAY, PsiSubstitutor.EMPTY);
       PsiMethod contains = MethodSignatureUtil.findMethodBySignature(collectionClass, containsSignature, false);
       addMethod(contains, 0, patternMethods, indices);
+
+      PsiClassType wildcardCollection = javaPsiFacade.getElementFactory().createType(collectionClass, PsiWildcardType.createUnbounded(manager));
+      MethodSignature removeAllSignature = MethodSignatureUtil.createMethodSignature("removeAll", new PsiType[] {wildcardCollection}, PsiTypeParameter.EMPTY_ARRAY, PsiSubstitutor.EMPTY);
+      PsiMethod removeAll = MethodSignatureUtil.findMethodBySignature(collectionClass, removeAllSignature, false);
+      addMethod(removeAll, 0, patternMethods, indices);
     }
 
     final PsiClass listClass = javaPsiFacade.findClass(CommonClassNames.JAVA_UTIL_LIST, searchScope);
@@ -143,6 +152,25 @@
       final PsiTypeParameter typeParameter = typeParameters[index];
       PsiType typeParamMapping = substitutor.substitute(typeParameter);
       if (typeParamMapping == null) return null;
+
+      PsiParameter[] parameters = patternMethod.getParameterList().getParameters();
+      if (parameters.length == 1 && "removeAll".equals(patternMethod.getName())) {
+        PsiType paramType = parameters[0].getType();
+        if (InheritanceUtil.isInheritor(paramType, CommonClassNames.JAVA_UTIL_COLLECTION)) {
+          PsiType qualifierType = qualifier.getType();
+          if (qualifierType != null) {
+            final PsiType itemType = JavaGenericsUtil.getCollectionItemType(argType, calleeMethod.getResolveScope());
+            final PsiType qualifierItemType = JavaGenericsUtil.getCollectionItemType(qualifierType, calleeMethod.getResolveScope());
+            if (qualifierItemType != null && itemType != null && !qualifierItemType.isAssignableFrom(itemType)) {
+              return InspectionsBundle.message("inspection.suspicious.collections.method.calls.problem.descriptor",
+                                                  PsiFormatUtil.formatType(qualifierType, 0, PsiSubstitutor.EMPTY),
+                                                  PsiFormatUtil.formatType(itemType, 0, PsiSubstitutor.EMPTY));
+            }
+          }
+          return null;
+        }
+      }
+
       String message = null;
       if (typeParamMapping instanceof PsiCapturedWildcardType) {
         typeParamMapping = ((PsiCapturedWildcardType)typeParamMapping).getWildcard();
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaElementImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaElementImpl.java
index 359c9c9..e1057c7 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaElementImpl.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaElementImpl.java
@@ -249,6 +249,7 @@
           }
         }
       }
+      getRefManager().fireNodeMarkedReferenced(psiWhat, psiFrom, false);
     }
   }
 
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java
new file mode 100644
index 0000000..d929166
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java
@@ -0,0 +1,511 @@
+/*
+ * 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.codeInspection.reference;
+
+import com.intellij.codeInspection.*;
+import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
+import com.intellij.codeInspection.ex.*;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.Ref;
+import com.intellij.openapi.util.UserDataCache;
+import com.intellij.psi.*;
+import com.intellij.psi.javadoc.PsiDocComment;
+import com.intellij.psi.javadoc.PsiDocTag;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.util.IncorrectOperationException;
+import gnu.trove.THashMap;
+import org.jdom.Element;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author anna
+ * Date: 20-Dec-2007
+ */
+public class RefJavaManagerImpl extends RefJavaManager {
+  private static final Logger LOG = Logger.getInstance("#" + RefJavaManagerImpl.class.getName());
+  private PsiMethod myAppMainPattern;
+  private PsiMethod myAppPremainPattern;
+  private PsiMethod myAppAgentmainPattern;
+  private PsiClass myApplet;
+  private PsiClass myServlet;
+  private RefPackage myDefaultPackage;
+  private THashMap<String, RefPackage> myPackages;
+  private final RefManagerImpl myRefManager;
+  private PsiElementVisitor myProjectIterator;
+  private EntryPointsManager myEntryPointsManager;
+
+  public RefJavaManagerImpl(@NotNull RefManagerImpl manager) {
+    myRefManager = manager;
+    final Project project = manager.getProject();
+    final PsiManager psiManager = PsiManager.getInstance(project);
+    PsiElementFactory factory = JavaPsiFacade.getInstance(psiManager.getProject()).getElementFactory();
+    try {
+      myAppMainPattern = factory.createMethodFromText("void main(String[] args);", null);
+      myAppPremainPattern = factory.createMethodFromText("void premain(String[] args, java.lang.instrument.Instrumentation i);", null);
+      myAppAgentmainPattern = factory.createMethodFromText("void agentmain(String[] args, java.lang.instrument.Instrumentation i);", null);
+    }
+    catch (IncorrectOperationException e) {
+      LOG.error(e);
+    }
+
+    myApplet = JavaPsiFacade.getInstance(psiManager.getProject()).findClass("java.applet.Applet", GlobalSearchScope.allScope(project));
+    myServlet = JavaPsiFacade.getInstance(psiManager.getProject()).findClass("javax.servlet.Servlet", GlobalSearchScope.allScope(project));
+
+  }
+
+  @Override
+  public RefPackage getPackage(String packageName) {
+    if (myPackages == null) {
+      myPackages = new THashMap<String, RefPackage>();
+    }
+
+    RefPackage refPackage = myPackages.get(packageName);
+    if (refPackage == null) {
+      refPackage = new RefPackageImpl(packageName, myRefManager);
+      myPackages.put(packageName, refPackage);
+
+      int dotIndex = packageName.lastIndexOf('.');
+      if (dotIndex >= 0) {
+        ((RefPackageImpl)getPackage(packageName.substring(0, dotIndex))).add(refPackage);
+      }
+      else {
+        ((RefProjectImpl)myRefManager.getRefProject()).add(refPackage);
+      }
+    }
+
+    return refPackage;
+  }
+
+
+  public boolean isEntryPoint(final RefElement element) {
+    UnusedDeclarationInspection tool = getDeadCodeTool(element);
+    return tool != null && tool.isEntryPoint(element);
+  }
+
+  @Nullable
+  private UnusedDeclarationInspection getDeadCodeTool(RefElement element) {
+    PsiFile file = ((RefElementImpl)element).getContainingFile();
+    if (file == null) return null;
+
+    return getDeadCodeTool(file);
+  }
+
+  private static final UserDataCache<Ref<UnusedDeclarationInspection>, PsiFile, RefManagerImpl> DEAD_CODE_TOOL = new UserDataCache<Ref<UnusedDeclarationInspection>, PsiFile, RefManagerImpl>("DEAD_CODE_TOOL") {
+    @Override
+    protected Ref<UnusedDeclarationInspection> compute(PsiFile file, RefManagerImpl refManager) {
+      Tools tools = ((GlobalInspectionContextBase)refManager.getContext()).getTools().get(UnusedDeclarationInspection.SHORT_NAME);
+      InspectionToolWrapper toolWrapper = tools == null ? null : tools.getEnabledTool(file);
+      InspectionProfileEntry tool = toolWrapper == null ? null : toolWrapper.getTool();
+      return Ref.create(tool instanceof UnusedDeclarationInspection ? (UnusedDeclarationInspection)tool : null);
+    }
+  };
+
+  @Nullable
+  private UnusedDeclarationInspection getDeadCodeTool(PsiElement element) {
+    PsiFile file = element.getContainingFile();
+    return file != null ? DEAD_CODE_TOOL.get(file, myRefManager).get() : null;
+  }
+
+  @Override
+  public RefPackage getDefaultPackage() {
+    if (myDefaultPackage == null) {
+      myDefaultPackage = getPackage(InspectionsBundle.message("inspection.reference.default.package"));
+    }
+    return myDefaultPackage;
+  }
+
+  @Override
+  public PsiMethod getAppMainPattern() {
+    return myAppMainPattern;
+  }
+
+  @Override
+  public PsiMethod getAppPremainPattern() {
+    return myAppPremainPattern;
+  }
+
+  @Override
+  public PsiMethod getAppAgentmainPattern() {
+    return myAppAgentmainPattern;
+  }
+
+  @Override
+  public PsiClass getApplet() {
+    return myApplet;
+  }
+
+  @Override
+  public PsiClass getServlet() {
+    return myServlet;
+  }
+
+  @Override
+  public RefParameter getParameterReference(PsiParameter param, int index) {
+    LOG.assertTrue(myRefManager.isValidPointForReference(), "References may become invalid after process is finished");
+    RefElement ref = myRefManager.getFromRefTable(param);
+
+    if (ref == null) {
+      ref = new RefParameterImpl(param, index, myRefManager);
+      ((RefParameterImpl)ref).initialize();
+      myRefManager.putToRefTable(param, ref);
+    }
+
+    return (RefParameter)ref;
+  }
+
+
+
+  @Override
+  public void iterate(@NotNull final RefVisitor visitor) {
+    if (myPackages != null) {
+      for (RefPackage refPackage : myPackages.values()) {
+        refPackage.accept(visitor);
+      }
+    }
+    for (RefElement refElement : myRefManager.getSortedElements()) {
+      if (refElement instanceof RefClass) {
+        RefClass refClass = (RefClass)refElement;
+        RefMethod refDefaultConstructor = refClass.getDefaultConstructor();
+        if (refDefaultConstructor instanceof RefImplicitConstructor) {
+          refClass.getDefaultConstructor().accept(visitor);
+        }
+      }
+    }
+  }
+
+  @Override
+  public void cleanup() {
+    if (myEntryPointsManager != null) {
+      Disposer.dispose(myEntryPointsManager);
+      myEntryPointsManager = null;
+    }
+    myPackages = null;
+    myApplet = null;
+    myAppMainPattern = null;
+    myAppPremainPattern = null;
+    myAppAgentmainPattern = null;
+    myServlet = null;
+    myDefaultPackage = null;
+    myProjectIterator = null;
+  }
+
+  @Override
+  public void removeReference(final RefElement refElement) {
+    if (refElement instanceof RefMethod) {
+      RefMethod refMethod = (RefMethod)refElement;
+      RefParameter[] params = refMethod.getParameters();
+      for (RefParameter param : params) {
+        myRefManager.removeReference(param);
+      }
+    }
+  }
+
+  @Override
+  @Nullable
+  public RefElement createRefElement(final PsiElement elem) {
+    if (elem instanceof PsiClass) {
+      return new RefClassImpl((PsiClass)elem, myRefManager);
+    }
+    else if (elem instanceof PsiMethod) {
+      final PsiMethod method = (PsiMethod)elem;
+      final RefElement ref = myRefManager.getReference(method.getContainingClass(), true);
+      if (ref instanceof RefClass) {
+        return new RefMethodImpl((RefClass)ref, method, myRefManager);
+      }
+    }
+    else if (elem instanceof PsiField) {
+      final PsiField field = (PsiField)elem;
+      final RefElement ref = myRefManager.getReference(field.getContainingClass(), true);
+      if (ref instanceof RefClass) {
+        return new RefFieldImpl((RefClass)ref, field, myRefManager);
+      }
+    }
+    else if (elem instanceof PsiJavaFile) {
+      return new RefJavaFileImpl((PsiJavaFile)elem, myRefManager);
+    }
+    return null;
+  }
+
+  @Override
+  @Nullable
+  public RefEntity getReference(final String type, final String fqName) {
+    if (METHOD.equals(type)) {
+      return RefMethodImpl.methodFromExternalName(myRefManager, fqName);
+    }
+    else if (CLASS.equals(type)) {
+      return RefClassImpl.classFromExternalName(myRefManager, fqName);
+    }
+    else if (FIELD.equals(type)) {
+      return RefFieldImpl.fieldFromExternalName(myRefManager, fqName);
+    }
+    else if (PARAMETER.equals(type)) {
+      return RefParameterImpl.parameterFromExternalName(myRefManager, fqName);
+    }
+    else if (PACKAGE.equals(type)) {
+      return RefPackageImpl.packageFromFQName(myRefManager, fqName);
+    }
+    return null;
+  }
+
+  @Override
+  @Nullable
+  public String getType(final RefEntity ref) {
+    if (ref instanceof RefMethod) {
+      return METHOD;
+    }
+    else if (ref instanceof RefClass) {
+      return CLASS;
+    }
+    else if (ref instanceof RefField) {
+      return FIELD;
+    }
+    else if (ref instanceof RefParameter) {
+      return PARAMETER;
+    }
+    else if (ref instanceof RefPackage) {
+      return PACKAGE;
+    }
+    return null;
+  }
+
+  @NotNull
+  @Override
+  public RefEntity getRefinedElement(@NotNull final RefEntity ref) {
+    if (ref instanceof RefImplicitConstructor) {
+      return ((RefImplicitConstructor)ref).getOwnerClass();
+    }
+    return ref;
+  }
+
+  @Override
+  public void visitElement(final PsiElement element) {
+    if (myProjectIterator == null) {
+      myProjectIterator = new MyJavaElementVisitor();
+    }
+    element.accept(myProjectIterator);
+  }
+
+  @Override
+  @Nullable
+  public String getGroupName(final RefEntity entity) {
+    if (entity instanceof RefFile && !(entity instanceof RefJavaFileImpl)) return null;
+    return RefJavaUtil.getInstance().getPackageName(entity);
+  }
+
+  @Override
+  public boolean belongsToScope(final PsiElement psiElement) {
+    return !(psiElement instanceof PsiTypeParameter);
+  }
+
+  @Override
+  public void export(@NotNull final RefEntity refEntity, @NotNull final Element element) {
+    if (refEntity instanceof RefElement) {
+      final SmartPsiElementPointer pointer = ((RefElement)refEntity).getPointer();
+      if (pointer != null) {
+        final PsiFile psiFile = pointer.getContainingFile();
+        if (psiFile instanceof PsiJavaFile) {
+          appendPackageElement(element, ((PsiJavaFile)psiFile).getPackageName());
+        }
+      }
+    }
+  }
+
+  @Override
+  public void onEntityInitialized(RefElement refElement, PsiElement psiElement) {
+    if (isEntryPoint(refElement)) {
+      getEntryPointsManager().addEntryPoint(refElement, false);
+    }
+
+    if (psiElement instanceof PsiClass) {
+      PsiClass psiClass = (PsiClass)psiElement;
+
+      EntryPointsManager entryPointsManager = getEntryPointsManager();
+      if (psiClass.isAnnotationType()){
+        entryPointsManager.addEntryPoint(refElement, false);
+        for (PsiMethod psiMethod : psiClass.getMethods()) {
+          entryPointsManager.addEntryPoint(myRefManager.getReference(psiMethod), false);
+        }
+      }
+      else if (psiClass.isEnum()) {
+        entryPointsManager.addEntryPoint(refElement, false);
+      }
+    }
+  }
+
+  private static void appendPackageElement(final Element element, final String packageName) {
+    final Element packageElement = new Element("package");
+    packageElement.addContent(packageName.isEmpty() ? InspectionsBundle.message("inspection.export.results.default") : packageName);
+    element.addContent(packageElement);
+  }
+
+  @Override
+  public EntryPointsManager getEntryPointsManager() {
+    if (myEntryPointsManager == null) {
+      final Project project = myRefManager.getProject();
+      myEntryPointsManager = EntryPointsManager.getInstance(project);
+      ((EntryPointsManagerBase)myEntryPointsManager).addAllPersistentEntries(EntryPointsManagerBase.getInstance(project));
+    }
+    return myEntryPointsManager;
+  }
+
+  private class MyJavaElementVisitor extends JavaElementVisitor {
+    private final RefJavaUtil myRefUtil;
+
+    public MyJavaElementVisitor() {
+      myRefUtil = RefJavaUtil.getInstance();
+    }
+
+    @Override
+    public void visitReferenceExpression(PsiReferenceExpression expression) {
+      visitElement(expression);
+    }
+
+    @Override
+    public void visitReferenceElement(PsiJavaCodeReferenceElement reference) {
+    }
+
+
+    @Override
+    public void visitReferenceParameterList(final PsiReferenceParameterList list) {
+      super.visitReferenceParameterList(list);
+      final PsiMember member = PsiTreeUtil.getParentOfType(list, PsiMember.class);
+
+      if (member instanceof PsiTypeParameter) {
+        final PsiMember owner = ((PsiTypeParameter)member).getOwner();
+        if (owner != null) {
+          for (PsiClassType type : ((PsiTypeParameter)member).getExtendsListTypes()) {
+            myRefUtil.addTypeReference(owner, type, myRefManager);
+          }
+        }
+      }
+
+      final PsiType[] typeArguments = list.getTypeArguments();
+      for (PsiType type : typeArguments) {
+        myRefUtil.addTypeReference(member, type, myRefManager);
+      }
+    }
+
+    @Override
+    public void visitClass(PsiClass aClass) {
+      if (!(aClass instanceof PsiTypeParameter)) {
+        super.visitClass(aClass);
+        RefElement refClass = myRefManager.getReference(aClass);
+        if (refClass != null) {
+          ((RefClassImpl)refClass).buildReferences();
+        }
+      }
+    }
+
+    @Override
+    public void visitMethod(final PsiMethod method) {
+      super.visitMethod(method);
+      final RefElement refElement = myRefManager.getReference(method);
+      if (refElement instanceof RefMethodImpl) {
+        ((RefMethodImpl)refElement).buildReferences();
+      }
+    }
+
+    @Override
+    public void visitField(final PsiField field) {
+      super.visitField(field);
+      final RefElement refElement = myRefManager.getReference(field);
+      if (refElement instanceof RefFieldImpl) {
+        ((RefFieldImpl)refElement).buildReferences();
+      }
+    }
+
+    @Override
+    public void visitDocComment(PsiDocComment comment) {
+      super.visitDocComment(comment);
+      final PsiDocTag[] tags = comment.getTags();
+      for (PsiDocTag tag : tags) {
+        if (Comparing.strEqual(tag.getName(), SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME)) {
+          final PsiElement[] dataElements = tag.getDataElements();
+          if (dataElements != null && dataElements.length > 0) {
+            final PsiModifierListOwner listOwner = PsiTreeUtil.getParentOfType(comment, PsiModifierListOwner.class);
+            if (listOwner != null) {
+              final RefElementImpl element = (RefElementImpl)myRefManager.getReference(listOwner);
+              if (element != null) {
+                String suppression = "";
+                for (PsiElement dataElement : dataElements) {
+                  suppression += "," + dataElement.getText();
+                }
+                element.addSuppression(suppression);
+              }
+            }
+          }
+        }
+      }
+    }
+
+    @Override
+    public void visitAnnotation(PsiAnnotation annotation) {
+      super.visitAnnotation(annotation);
+      if (Comparing.strEqual(annotation.getQualifiedName(), BatchSuppressManager.SUPPRESS_INSPECTIONS_ANNOTATION_NAME)) {
+        final PsiModifierListOwner listOwner = PsiTreeUtil.getParentOfType(annotation, PsiModifierListOwner.class);
+        if (listOwner != null) {
+          final RefElementImpl element = (RefElementImpl)myRefManager.getReference(listOwner);
+          if (element != null) {
+            StringBuilder buf = new StringBuilder();
+            final PsiNameValuePair[] nameValuePairs = annotation.getParameterList().getAttributes();
+            for (PsiNameValuePair nameValuePair : nameValuePairs) {
+              buf.append(",").append(nameValuePair.getText().replaceAll("[{}\"\"]", ""));
+            }
+            if (buf.length() > 0) {
+              element.addSuppression(buf.substring(1));
+            }
+          }
+        }
+      }
+    }
+
+    @Override
+    public void visitVariable(PsiVariable variable) {
+      super.visitVariable(variable);
+      myRefUtil.addTypeReference(variable, variable.getType(), myRefManager);
+    }
+
+    @Override
+    public void visitInstanceOfExpression(PsiInstanceOfExpression expression) {
+      super.visitInstanceOfExpression(expression);
+      final PsiTypeElement typeElement = expression.getCheckType();
+      if (typeElement != null) {
+        myRefUtil.addTypeReference(expression, typeElement.getType(), myRefManager);
+      }
+    }
+
+    @Override
+    public void visitThisExpression(PsiThisExpression expression) {
+      super.visitThisExpression(expression);
+      final PsiJavaCodeReferenceElement qualifier = expression.getQualifier();
+      if (qualifier != null) {
+        myRefUtil.addTypeReference(expression, expression.getType(), myRefManager);
+        RefClass ownerClass = myRefUtil.getOwnerClass(myRefManager, expression);
+        if (ownerClass != null) {
+          RefClassImpl refClass = (RefClassImpl)myRefManager.getReference(qualifier.resolve());
+          if (refClass != null) {
+            refClass.addInstanceReference(ownerClass);
+          }
+        }
+      }
+    }
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/sameParameterValue/SameParameterValueInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/sameParameterValue/SameParameterValueInspectionBase.java
new file mode 100644
index 0000000..298ad55
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/sameParameterValue/SameParameterValueInspectionBase.java
@@ -0,0 +1,129 @@
+/*
+ * 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.codeInspection.sameParameterValue;
+
+import com.intellij.analysis.AnalysisScope;
+import com.intellij.codeInsight.daemon.GroupNames;
+import com.intellij.codeInspection.*;
+import com.intellij.codeInspection.reference.*;
+import com.intellij.psi.PsiReference;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author max
+ */
+public class SameParameterValueInspectionBase extends GlobalJavaBatchInspectionTool {
+  @Override
+  @Nullable
+  public CommonProblemDescriptor[] checkElement(@NotNull RefEntity refEntity,
+                                                @NotNull AnalysisScope scope,
+                                                @NotNull InspectionManager manager,
+                                                @NotNull GlobalInspectionContext globalContext,
+                                                @NotNull ProblemDescriptionsProcessor processor) {
+    List<ProblemDescriptor> problems = null;
+    if (refEntity instanceof RefMethod) {
+      final RefMethod refMethod = (RefMethod)refEntity;
+
+      if (refMethod.hasSuperMethods()) return null;
+
+      if (refMethod.isEntry()) return null;
+
+      RefParameter[] parameters = refMethod.getParameters();
+      for (RefParameter refParameter : parameters) {
+        String value = refParameter.getActualValueIfSame();
+        if (value != null) {
+          if (problems == null) problems = new ArrayList<ProblemDescriptor>(1);
+          final String paramName = refParameter.getName();
+          problems.add(manager.createProblemDescriptor(refParameter.getElement(), InspectionsBundle.message(
+            "inspection.same.parameter.problem.descriptor", "<code>" + paramName + "</code>", "<code>" + value + "</code>"),
+                                                       createFix(paramName, value),
+                                                       ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false));
+        }
+      }
+    }
+
+    return problems == null ? null : problems.toArray(new CommonProblemDescriptor[problems.size()]);
+  }
+
+
+  @Override
+  protected boolean queryExternalUsagesRequests(@NotNull final RefManager manager, @NotNull final GlobalJavaInspectionContext globalContext,
+                                                @NotNull final ProblemDescriptionsProcessor processor) {
+    manager.iterate(new RefJavaVisitor() {
+      @Override public void visitElement(@NotNull RefEntity refEntity) {
+        if (refEntity instanceof RefElement && processor.getDescriptions(refEntity) != null) {
+          refEntity.accept(new RefJavaVisitor() {
+            @Override public void visitMethod(@NotNull final RefMethod refMethod) {
+              globalContext.enqueueMethodUsagesProcessor(refMethod, new GlobalJavaInspectionContext.UsagesProcessor() {
+                @Override
+                public boolean process(PsiReference psiReference) {
+                  processor.ignoreElement(refMethod);
+                  return false;
+                }
+              });
+            }
+          });
+        }
+      }
+    });
+
+    return false;
+  }
+
+  @Override
+  @NotNull
+  public String getDisplayName() {
+    return InspectionsBundle.message("inspection.same.parameter.display.name");
+  }
+
+  @Override
+  @NotNull
+  public String getGroupDisplayName() {
+    return GroupNames.DECLARATION_REDUNDANCY;
+  }
+
+  @Override
+  @NotNull
+  public String getShortName() {
+    return "SameParameterValue";
+  }
+
+  @Override
+  @Nullable
+  public QuickFix getQuickFix(final String hint) {
+    if (hint == null) return null;
+    final int spaceIdx = hint.indexOf(' ');
+    if (spaceIdx == -1 || spaceIdx >= hint.length() - 1) return null; //invalid hint
+    final String paramName = hint.substring(0, spaceIdx);
+    final String value = hint.substring(spaceIdx + 1);
+    return createFix(paramName, value);
+  }
+
+  protected LocalQuickFix createFix(String paramName, String value) {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  @Nullable
+  public String getHint(@NotNull final QuickFix fix) {
+    return fix.toString();
+  }
+
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/sillyAssignment/SillyAssignmentInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/sillyAssignment/SillyAssignmentInspection.java
deleted file mode 100644
index 3135f48..0000000
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/sillyAssignment/SillyAssignmentInspection.java
+++ /dev/null
@@ -1,170 +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.sillyAssignment;
-
-import com.intellij.codeInspection.*;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.psi.*;
-import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.psi.util.PsiUtil;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * User: anna
- * Date: 15-Nov-2005
- */
-public class SillyAssignmentInspection extends BaseJavaBatchLocalInspectionTool {
-  @Override
-  @NotNull
-  public String getGroupDisplayName() {
-    return "";
-  }
-
-  @Override
-  @NotNull
-  public String getDisplayName() {
-    return InspectionsBundle.message("inspection.variable.assigned.to.itself.display.name");
-  }
-
-  @Override
-  @NotNull
-  @NonNls
-  public String getShortName() {
-    return "SillyAssignment";
-  }
-
-  @Override
-  public boolean isEnabledByDefault() {
-    return true;
-  }
-
-  @Override
-  @NotNull
-  public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
-    return new JavaElementVisitor() {
-
-      @Override public void visitAssignmentExpression(PsiAssignmentExpression expression) {
-        checkSillyAssignment(expression, holder);
-      }
-
-      @Override public void visitReferenceExpression(PsiReferenceExpression expression) {
-        visitElement(expression);
-      }
-
-      @Override public void visitVariable(final PsiVariable variable) {
-        final PsiExpression initializer = PsiUtil.deparenthesizeExpression(variable.getInitializer());
-        if (initializer instanceof PsiAssignmentExpression) {
-          final PsiExpression lExpr = PsiUtil.deparenthesizeExpression(((PsiAssignmentExpression)initializer).getLExpression());
-          checkExpression(variable, lExpr);
-        }
-        else {
-          checkExpression(variable, initializer);
-        }
-      }
-
-      private void checkExpression(PsiVariable variable, PsiExpression expression) {
-        if (!(expression instanceof PsiReferenceExpression)) {
-          return;
-        }
-        final PsiReferenceExpression refExpr = (PsiReferenceExpression)expression;
-        final PsiExpression qualifier = refExpr.getQualifierExpression();
-        if (qualifier == null || qualifier instanceof PsiThisExpression || qualifier instanceof PsiSuperExpression ||
-            variable.hasModifierProperty(PsiModifier.STATIC)) {
-          if (refExpr.isReferenceTo(variable)) {
-            holder.registerProblem(expression, InspectionsBundle.message("assignment.to.declared.variable.problem.descriptor",
-                                                                         variable.getName()), ProblemHighlightType.LIKE_UNUSED_SYMBOL);
-          }
-        }
-      }
-    };
-  }
-
-  private static void checkSillyAssignment(PsiAssignmentExpression assignment, ProblemsHolder holder) {
-    if (assignment.getOperationTokenType() != JavaTokenType.EQ) return;
-    PsiExpression lExpression = assignment.getLExpression();
-    PsiExpression rExpression = assignment.getRExpression();
-    if (rExpression == null) return;
-    lExpression = PsiUtil.deparenthesizeExpression(lExpression);
-    rExpression = PsiUtil.deparenthesizeExpression(rExpression);
-    if (!(lExpression instanceof PsiReferenceExpression)) return;
-    PsiReferenceExpression rRef;
-    if (!(rExpression instanceof PsiReferenceExpression)) {
-      if (!(rExpression instanceof PsiAssignmentExpression)) return;
-      final PsiAssignmentExpression rAssignmentExpression = (PsiAssignmentExpression)rExpression;
-      final PsiExpression assignee = PsiUtil.deparenthesizeExpression(rAssignmentExpression.getLExpression());
-      if (!(assignee instanceof PsiReferenceExpression)) return;
-      rRef = (PsiReferenceExpression)assignee;
-    } else {
-      rRef = (PsiReferenceExpression)rExpression;
-    }
-    PsiReferenceExpression lRef = (PsiReferenceExpression)lExpression;
-    PsiManager manager = assignment.getManager();
-    if (!sameInstanceReferences(lRef, rRef, manager)) return;
-    final PsiVariable variable = (PsiVariable)lRef.resolve();
-    if (variable == null) return;
-    holder.registerProblem(assignment, InspectionsBundle.message("assignment.to.itself.problem.descriptor", variable.getName()),
-                           ProblemHighlightType.LIKE_UNUSED_SYMBOL);
-  }
-
-  /**
-   * @return true if both expressions resolve to the same variable/class or field in the same instance of the class
-   */
-  private static boolean sameInstanceReferences(@Nullable PsiJavaCodeReferenceElement lRef, @Nullable PsiJavaCodeReferenceElement rRef, PsiManager manager) {
-    if (lRef == null && rRef == null) return true;
-    if (lRef == null || rRef == null) return false;
-    PsiElement lResolved = lRef.resolve();
-    PsiElement rResolved = rRef.resolve();
-    if (!manager.areElementsEquivalent(lResolved, rResolved)) return false;
-    if (!(lResolved instanceof PsiVariable)) return false;
-    final PsiVariable variable = (PsiVariable)lResolved;
-    if (variable.hasModifierProperty(PsiModifier.STATIC)) return true;
-
-    final PsiElement lQualifier = lRef.getQualifier();
-    final PsiElement rQualifier = rRef.getQualifier();
-    if (lQualifier instanceof PsiJavaCodeReferenceElement && rQualifier instanceof PsiJavaCodeReferenceElement) {
-      return sameInstanceReferences((PsiJavaCodeReferenceElement)lQualifier, (PsiJavaCodeReferenceElement)rQualifier, manager);
-    }
-
-    if (Comparing.equal(lQualifier, rQualifier)) return true;
-    boolean lThis = lQualifier == null || lQualifier instanceof PsiThisExpression || lQualifier instanceof PsiSuperExpression;
-    boolean rThis = rQualifier == null || rQualifier instanceof PsiThisExpression || rQualifier instanceof PsiSuperExpression;
-    if (lThis && rThis) {
-      final PsiJavaCodeReferenceElement llQualifier = getQualifier(lQualifier);
-      final PsiJavaCodeReferenceElement rrQualifier = getQualifier(rQualifier);
-      return sameInstanceReferences(llQualifier, rrQualifier, manager);
-    }
-    return false;
-  }
-
-  private static PsiJavaCodeReferenceElement getQualifier(PsiElement qualifier) {
-    if (qualifier instanceof PsiThisExpression) {
-      final PsiJavaCodeReferenceElement thisQualifier = ((PsiThisExpression)qualifier).getQualifier();
-      if (thisQualifier != null) {
-        final PsiClass innerMostClass = PsiTreeUtil.getParentOfType(thisQualifier, PsiClass.class);
-        if (innerMostClass == thisQualifier.resolve()) {
-          return null;
-        }
-      }
-      return thisQualifier;
-    }
-    if (qualifier != null) {
-      return  ((PsiSuperExpression)qualifier).getQualifier();
-    }
-    return null;
-  }
-}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/sillyAssignment/SillyAssignmentInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/sillyAssignment/SillyAssignmentInspectionBase.java
new file mode 100644
index 0000000..c6aeb59
--- /dev/null
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/sillyAssignment/SillyAssignmentInspectionBase.java
@@ -0,0 +1,171 @@
+/*
+ * 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.codeInspection.sillyAssignment;
+
+import com.intellij.codeInspection.*;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.psi.*;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.PsiUtil;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public class SillyAssignmentInspectionBase extends BaseJavaBatchLocalInspectionTool {
+
+  @Override
+  @NotNull
+  public String getGroupDisplayName() {
+    return "";
+  }
+
+  @Override
+  @NotNull
+  public String getDisplayName() {
+    return InspectionsBundle.message("inspection.variable.assigned.to.itself.display.name");
+  }
+
+  @Override
+  @NotNull
+  @NonNls
+  public String getShortName() {
+    return "SillyAssignment";
+  }
+
+  @Override
+  public boolean isEnabledByDefault() {
+    return true;
+  }
+
+  @Override
+  @NotNull
+  public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
+    return new JavaElementVisitor() {
+
+      @Override public void visitAssignmentExpression(PsiAssignmentExpression expression) {
+        checkSillyAssignment(expression, holder);
+      }
+
+      @Override public void visitReferenceExpression(PsiReferenceExpression expression) {
+        visitElement(expression);
+      }
+
+      @Override public void visitVariable(final PsiVariable variable) {
+        final PsiExpression initializer = PsiUtil.deparenthesizeExpression(variable.getInitializer());
+        if (initializer instanceof PsiAssignmentExpression) {
+          final PsiExpression lExpr = PsiUtil.deparenthesizeExpression(((PsiAssignmentExpression)initializer).getLExpression());
+          checkExpression(variable, lExpr);
+        }
+        else {
+          checkExpression(variable, initializer);
+        }
+      }
+
+      private void checkExpression(PsiVariable variable, PsiExpression expression) {
+        if (!(expression instanceof PsiReferenceExpression)) {
+          return;
+        }
+        final PsiReferenceExpression refExpr = (PsiReferenceExpression)expression;
+        final PsiExpression qualifier = refExpr.getQualifierExpression();
+        if (qualifier == null || qualifier instanceof PsiThisExpression || qualifier instanceof PsiSuperExpression ||
+            variable.hasModifierProperty(PsiModifier.STATIC)) {
+          if (refExpr.isReferenceTo(variable)) {
+            holder.registerProblem(expression, InspectionsBundle.message("assignment.to.declared.variable.problem.descriptor",
+                                                                         variable.getName()), ProblemHighlightType.LIKE_UNUSED_SYMBOL);
+          }
+        }
+      }
+    };
+  }
+
+  private void checkSillyAssignment(PsiAssignmentExpression assignment, ProblemsHolder holder) {
+    if (assignment.getOperationTokenType() != JavaTokenType.EQ) return;
+    PsiExpression lExpression = assignment.getLExpression();
+    PsiExpression rExpression = assignment.getRExpression();
+    if (rExpression == null) return;
+    lExpression = PsiUtil.deparenthesizeExpression(lExpression);
+    rExpression = PsiUtil.deparenthesizeExpression(rExpression);
+    if (!(lExpression instanceof PsiReferenceExpression)) return;
+    PsiReferenceExpression rRef;
+    if (!(rExpression instanceof PsiReferenceExpression)) {
+      if (!(rExpression instanceof PsiAssignmentExpression)) return;
+      final PsiAssignmentExpression rAssignmentExpression = (PsiAssignmentExpression)rExpression;
+      final PsiExpression assignee = PsiUtil.deparenthesizeExpression(rAssignmentExpression.getLExpression());
+      if (!(assignee instanceof PsiReferenceExpression)) return;
+      rRef = (PsiReferenceExpression)assignee;
+    } else {
+      rRef = (PsiReferenceExpression)rExpression;
+    }
+    PsiReferenceExpression lRef = (PsiReferenceExpression)lExpression;
+    PsiManager manager = assignment.getManager();
+    if (!sameInstanceReferences(lRef, rRef, manager)) return;
+    final PsiVariable variable = (PsiVariable)lRef.resolve();
+    if (variable == null) return;
+    holder.registerProblem(assignment, InspectionsBundle.message("assignment.to.itself.problem.descriptor", variable.getName()),
+                           ProblemHighlightType.LIKE_UNUSED_SYMBOL, createRemoveAssignmentFix());
+  }
+
+  protected LocalQuickFix createRemoveAssignmentFix() {
+    return null;
+  }
+
+  /**
+   * @return true if both expressions resolve to the same variable/class or field in the same instance of the class
+   */
+  private static boolean sameInstanceReferences(@Nullable PsiJavaCodeReferenceElement lRef, @Nullable PsiJavaCodeReferenceElement rRef, PsiManager manager) {
+    if (lRef == null && rRef == null) return true;
+    if (lRef == null || rRef == null) return false;
+    PsiElement lResolved = lRef.resolve();
+    PsiElement rResolved = rRef.resolve();
+    if (!manager.areElementsEquivalent(lResolved, rResolved)) return false;
+    if (!(lResolved instanceof PsiVariable)) return false;
+    final PsiVariable variable = (PsiVariable)lResolved;
+    if (variable.hasModifierProperty(PsiModifier.STATIC)) return true;
+
+    final PsiElement lQualifier = lRef.getQualifier();
+    final PsiElement rQualifier = rRef.getQualifier();
+    if (lQualifier instanceof PsiJavaCodeReferenceElement && rQualifier instanceof PsiJavaCodeReferenceElement) {
+      return sameInstanceReferences((PsiJavaCodeReferenceElement)lQualifier, (PsiJavaCodeReferenceElement)rQualifier, manager);
+    }
+
+    if (Comparing.equal(lQualifier, rQualifier)) return true;
+    boolean lThis = lQualifier == null || lQualifier instanceof PsiThisExpression || lQualifier instanceof PsiSuperExpression;
+    boolean rThis = rQualifier == null || rQualifier instanceof PsiThisExpression || rQualifier instanceof PsiSuperExpression;
+    if (lThis && rThis) {
+      final PsiJavaCodeReferenceElement llQualifier = getQualifier(lQualifier);
+      final PsiJavaCodeReferenceElement rrQualifier = getQualifier(rQualifier);
+      return sameInstanceReferences(llQualifier, rrQualifier, manager);
+    }
+    return false;
+  }
+
+  private static PsiJavaCodeReferenceElement getQualifier(PsiElement qualifier) {
+    if (qualifier instanceof PsiThisExpression) {
+      final PsiJavaCodeReferenceElement thisQualifier = ((PsiThisExpression)qualifier).getQualifier();
+      if (thisQualifier != null) {
+        final PsiClass innerMostClass = PsiTreeUtil.getParentOfType(thisQualifier, PsiClass.class);
+        if (innerMostClass == thisQualifier.resolve()) {
+          return null;
+        }
+      }
+      return thisQualifier;
+    }
+    if (qualifier != null) {
+      return  ((PsiSuperExpression)qualifier).getQualifier();
+    }
+    return null;
+  }
+}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/unnecessaryModuleDependency/UnnecessaryModuleDependencyInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/unnecessaryModuleDependency/UnnecessaryModuleDependencyInspection.java
index d552212..f3884b3 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/unnecessaryModuleDependency/UnnecessaryModuleDependencyInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/unnecessaryModuleDependency/UnnecessaryModuleDependencyInspection.java
@@ -8,16 +8,22 @@
 import com.intellij.codeInspection.reference.RefManager;
 import com.intellij.codeInspection.reference.RefModule;
 import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleManager;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.roots.ModifiableRootModel;
 import com.intellij.openapi.roots.ModuleOrderEntry;
 import com.intellij.openapi.roots.ModuleRootManager;
 import com.intellij.openapi.roots.OrderEntry;
 import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.reference.SoftReference;
+import com.intellij.util.ArrayUtil;
+import com.intellij.util.graph.Graph;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -27,6 +33,8 @@
  */
 public class UnnecessaryModuleDependencyInspection extends GlobalInspectionTool {
 
+  private SoftReference<Graph<Module>> myGraph = new SoftReference<Graph<Module>>(null);
+
   @Override
   public RefGraphAnnotator getAnnotator(@NotNull final RefManager refManager) {
     return new UnnecessaryModuleDependencyAnnotator(refManager);
@@ -38,23 +46,62 @@
       final RefModule refModule = (RefModule)refEntity;
       final Module module = refModule.getModule();
       if (module.isDisposed()) return CommonProblemDescriptor.EMPTY_ARRAY;
-      final Module[] declaredDependencies = ModuleRootManager.getInstance(module).getDependencies();
+      final ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
+      final OrderEntry[] declaredDependencies = moduleRootManager.getOrderEntries();
+      final Module[] declaredModuleDependencies = moduleRootManager.getDependencies();
+
       List<CommonProblemDescriptor> descriptors = new ArrayList<CommonProblemDescriptor>();
       final Set<Module> modules = refModule.getUserData(UnnecessaryModuleDependencyAnnotator.DEPENDENCIES);
-      for (final Module dependency : declaredDependencies) {
-        if (modules == null || !modules.contains(dependency)) {
-         final CommonProblemDescriptor problemDescriptor;
-          if (scope.containsModule(dependency)) { //external references are rejected -> annotator doesn't provide any information on them -> false positives
-            problemDescriptor = manager.createProblemDescriptor(
-              InspectionsBundle.message("unnecessary.module.dependency.problem.descriptor", module.getName(), dependency.getName()),
-              new RemoveModuleDependencyFix(module, dependency));
-          } else {
-            String message = InspectionsBundle
-              .message("suspected.module.dependency.problem.descriptor", module.getName(), dependency.getName(), scope.getDisplayName(),
-                       dependency.getName());
-            problemDescriptor = manager.createProblemDescriptor(message);
+      Graph<Module> graph = myGraph.get();
+      if (graph == null) {
+        graph = ModuleManager.getInstance(globalContext.getProject()).moduleGraph();
+        myGraph = new SoftReference<Graph<Module>>(graph);
+      }
+
+      final RefManager refManager = globalContext.getRefManager();
+      for (final OrderEntry entry : declaredDependencies) {
+        if (entry instanceof ModuleOrderEntry) {
+          final Module dependency = ((ModuleOrderEntry)entry).getModule();
+          if (dependency != null) {
+            if (modules == null || !modules.contains(dependency)) {
+              List<String> dependenciesThroughExported = null;
+              if (((ModuleOrderEntry)entry).isExported()) {
+                final Iterator<Module> iterator = graph.getOut(module);
+                while (iterator.hasNext()) {
+                  final Module dep = iterator.next();
+                  final RefModule depRefModule = refManager.getRefModule(dep);
+                  if (depRefModule != null) {
+                    final Set<Module> neededModules = depRefModule.getUserData(UnnecessaryModuleDependencyAnnotator.DEPENDENCIES);
+                    if (neededModules != null && neededModules.contains(dependency)) {
+                      if (dependenciesThroughExported == null) {
+                        dependenciesThroughExported = new ArrayList<String>();
+                      }
+                      dependenciesThroughExported.add(dep.getName());
+                    }
+                  }
+                }
+              }
+              if (modules != null) {
+                List<String> transitiveDependencies = new ArrayList<String>();
+                final OrderEntry[] dependenciesOfDependencies = ModuleRootManager.getInstance(dependency).getOrderEntries();
+                for (OrderEntry secondDependency : dependenciesOfDependencies) {
+                  if (secondDependency instanceof ModuleOrderEntry && ((ModuleOrderEntry)secondDependency).isExported()) {
+                    final Module mod = ((ModuleOrderEntry)secondDependency).getModule();
+                    if (mod != null && modules.contains(mod) && ArrayUtil.find(declaredModuleDependencies, mod) < 0) {
+                      transitiveDependencies.add(mod.getName());
+                    }
+                  }
+                }
+                if (!transitiveDependencies.isEmpty()) {
+                  final String exported = StringUtil.join(transitiveDependencies, ", ");
+                  descriptors.add(manager.createProblemDescriptor(InspectionsBundle.message("unnecessary.module.dependency.exported.problem.descriptor1", module.getName(), dependency.getName(), exported)));
+                  continue;
+                }
+              }
+
+              descriptors.add(createDescriptor(scope, manager, module, dependency, dependenciesThroughExported));
+            }
           }
-          descriptors.add(problemDescriptor);
         }
       }
       return descriptors.isEmpty() ? null : descriptors.toArray(new CommonProblemDescriptor[descriptors.size()]);
@@ -62,6 +109,25 @@
     return null;
   }
 
+  private static CommonProblemDescriptor createDescriptor(AnalysisScope scope,
+                                                          InspectionManager manager,
+                                                          Module module,
+                                                          Module dependency, 
+                                                          List<String> exportedDependencies) {
+    if (exportedDependencies != null) {
+      final String exported = StringUtil.join(exportedDependencies, ", ");
+      return manager.createProblemDescriptor(InspectionsBundle.message("unnecessary.module.dependency.exported.problem.descriptor", module.getName(), dependency.getName(), exported));
+    }
+
+    if (scope.containsModule(dependency)) { //external references are rejected -> annotator doesn't provide any information on them -> false positives
+      final String allContainsMessage = InspectionsBundle.message("unnecessary.module.dependency.problem.descriptor", module.getName(), dependency.getName());
+      return manager.createProblemDescriptor(allContainsMessage, new RemoveModuleDependencyFix(module, dependency));
+    } else {
+      String message = InspectionsBundle.message("suspected.module.dependency.problem.descriptor", module.getName(), dependency.getName(), scope.getDisplayName(), dependency.getName());
+      return manager.createProblemDescriptor(message);
+    }
+  }
+
   @Override
   @NotNull
   public String getGroupDisplayName() {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/unusedLibraries/UnusedLibrariesInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/unusedLibraries/UnusedLibrariesInspection.java
index 0b72b71..5a419df 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/unusedLibraries/UnusedLibrariesInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/unusedLibraries/UnusedLibrariesInspection.java
@@ -23,35 +23,22 @@
 import com.intellij.analysis.AnalysisScope;
 import com.intellij.codeInsight.daemon.GroupNames;
 import com.intellij.codeInspection.*;
-import com.intellij.codeInspection.ex.JobDescriptor;
-import com.intellij.codeInspection.reference.RefManager;
-import com.intellij.codeInspection.reference.RefModule;
+import com.intellij.codeInspection.reference.*;
 import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleUtilCore;
-import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.progress.ProgressManager;
-import com.intellij.openapi.progress.util.AbstractProgressIndicatorBase;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.roots.*;
+import com.intellij.openapi.roots.impl.DirectoryIndex;
+import com.intellij.openapi.roots.impl.DirectoryInfo;
 import com.intellij.openapi.roots.libraries.Library;
-import com.intellij.openapi.roots.libraries.LibraryUtil;
 import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.Key;
 import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VfsUtilCore;
 import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.packageDependencies.BackwardDependenciesBuilder;
-import com.intellij.psi.PsiCompiledElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiRecursiveElementVisitor;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.GlobalSearchScopesCore;
-import com.intellij.psi.search.scope.packageSet.NamedScope;
-import com.intellij.psi.search.scope.packageSet.PackageSetFactory;
-import com.intellij.psi.search.scope.packageSet.ParsingException;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.util.PsiUtilCore;
 import com.intellij.util.Function;
-import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.Nls;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -60,140 +47,63 @@
 import java.util.*;
 
 public class UnusedLibrariesInspection extends GlobalInspectionTool {
-  private static final Logger LOG = Logger.getInstance("#" + UnusedLibrariesInspection.class.getName());
-  private final JobDescriptor BACKWARD_ANALYSIS = new JobDescriptor(InspectionsBundle.message("unused.library.backward.analysis.job.description"));
+
+  @Override
+  public boolean isGraphNeeded() {
+    return true;
+  }
 
   @Nullable
   @Override
-  public JobDescriptor[] getAdditionalJobs() {
-    return new JobDescriptor[]{BACKWARD_ANALYSIS};
+  public RefGraphAnnotator getAnnotator(@NotNull RefManager refManager) {
+    return new UnusedLibraryGraphAnnotator(refManager);
   }
 
+  @Nullable
   @Override
-  public void runInspection(@NotNull AnalysisScope scope,
-                            @NotNull InspectionManager manager,
-                            @NotNull final GlobalInspectionContext globalContext,
-                            @NotNull ProblemDescriptionsProcessor problemProcessor) {
-    final Project project = manager.getProject();
-    final ArrayList<VirtualFile> libraryRoots = new ArrayList<VirtualFile>();
-    if (scope.getScopeType() == AnalysisScope.PROJECT) {
-      ContainerUtil.addAll(libraryRoots, LibraryUtil.getLibraryRoots(project, false, false));
-    }
-    else {
-      final Set<Module> modules = new HashSet<Module>();
-      scope.accept(new PsiRecursiveElementVisitor() {
-        @Override
-        public void visitFile(PsiFile file) {
-          if (!(file instanceof PsiCompiledElement)) {
-            final VirtualFile virtualFile = file.getVirtualFile();
-            if (virtualFile != null) {
-              final Module module = ModuleUtilCore.findModuleForFile(virtualFile, project);
-              if (module != null) {
-                modules.add(module);
-              }
+  public CommonProblemDescriptor[] checkElement(@NotNull RefEntity refEntity,
+                                                @NotNull AnalysisScope scope,
+                                                @NotNull InspectionManager manager,
+                                                @NotNull GlobalInspectionContext globalContext,
+                                                @NotNull ProblemDescriptionsProcessor processor) {
+    if (refEntity instanceof RefModule) {
+      final RefModule refModule = (RefModule)refEntity;
+      final Module module = refModule.getModule();
+      if (module.isDisposed()) return CommonProblemDescriptor.EMPTY_ARRAY;
+      final ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
+      final Set<VirtualFile> usedRoots = refModule.getUserData(UnusedLibraryGraphAnnotator.USED_LIBRARY_ROOTS);
+
+      final List<CommonProblemDescriptor> result = new ArrayList<CommonProblemDescriptor>();
+      for (OrderEntry entry : moduleRootManager.getOrderEntries()) {
+        if (entry instanceof LibraryOrderEntry && !((LibraryOrderEntry)entry).isExported()) {
+          if (usedRoots == null) {
+            String message = InspectionsBundle.message("unused.library.problem.descriptor", entry.getPresentableName());
+            result.add(manager.createProblemDescriptor(message, new RemoveUnusedLibrary(refModule, entry, null)));
+          } else {
+            final Set<VirtualFile> files = new HashSet<VirtualFile>(Arrays.asList(((LibraryOrderEntry)entry).getRootFiles(OrderRootType.CLASSES)));
+            files.removeAll(usedRoots);
+            if (!files.isEmpty()) {
+              final String unusedLibraryRoots = StringUtil.join(files, new Function<VirtualFile, String>() {
+                @Override
+                public String fun(final VirtualFile file) {
+                  return file.getPresentableName();
+                }
+              }, ",");
+              String message =
+                InspectionsBundle.message("unused.library.roots.problem.descriptor", unusedLibraryRoots, entry.getPresentableName());
+              processor.addProblemElement(refModule,
+                                          manager.createProblemDescriptor(message, new RemoveUnusedLibrary(refModule, entry, files)));
             }
           }
         }
-      });
-      ContainerUtil.addAll(libraryRoots, LibraryUtil.getLibraryRoots(modules.toArray(new Module[modules.size()]), false, false));
-    }
-    if (libraryRoots.isEmpty()) {
-      return;
-    }
-
-    GlobalSearchScope searchScope;
-    try {
-      @NonNls final String libsName = "libs";
-      NamedScope libScope = new NamedScope(libsName, PackageSetFactory.getInstance().compile("lib:*..*"));
-      searchScope = GlobalSearchScopesCore.filterScope(project, libScope);
-    }
-    catch (ParsingException e) {
-      //can't be
-      LOG.error(e);
-      return;
-    }
-    final AnalysisScope analysisScope = new AnalysisScope(searchScope, project);
-    analysisScope.setSearchInLibraries(true);
-    final BackwardDependenciesBuilder builder = new BackwardDependenciesBuilder(project, analysisScope);
-
-    final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
-
-    BACKWARD_ANALYSIS.setTotalAmount(builder.getTotalFileCount());
-    ProgressIndicator progress = new AbstractProgressIndicatorBase() {
-      @Override
-      public void setFraction(final double fraction) {
-        super.setFraction(fraction);
-        int nextAmount = (int)(fraction * BACKWARD_ANALYSIS.getTotalAmount());
-        if (nextAmount > BACKWARD_ANALYSIS.getDoneAmount() && nextAmount < BACKWARD_ANALYSIS.getTotalAmount()) {
-          BACKWARD_ANALYSIS.setDoneAmount(nextAmount);
-          globalContext.incrementJobDoneAmount(BACKWARD_ANALYSIS, getText2());
-        }
       }
 
-      @Override
-      public boolean isCanceled() {
-        return progressIndicator != null && progressIndicator.isCanceled() || super.isCanceled();
-      }
-    };
-    ProgressManager.getInstance().executeProcessUnderProgress(new Runnable() {
-      @Override
-      public void run() {
-        builder.analyze();
-      }
-    }, progress);
-    BACKWARD_ANALYSIS.setDoneAmount(BACKWARD_ANALYSIS.getTotalAmount());
-    final Map<PsiFile, Set<PsiFile>> dependencies = builder.getDependencies();
-    for (PsiFile file : dependencies.keySet()) {
-      final VirtualFile virtualFile = file.getVirtualFile();
-      LOG.assertTrue(virtualFile != null);
-      for (Iterator<VirtualFile> i = libraryRoots.iterator(); i.hasNext();) {
-        if (VfsUtilCore.isAncestor(i.next(), virtualFile, false)) {
-          i.remove();
-        }
-      }
+      return result.isEmpty() ? null : result.toArray(new CommonProblemDescriptor[result.size()]);
     }
-    if (libraryRoots.isEmpty()) {
-      return;
-    }
-    ProjectFileIndex projectIndex = ProjectRootManager.getInstance(project).getFileIndex();
-    Map<OrderEntry, Set<VirtualFile>> unusedLibs = new HashMap<OrderEntry, Set<VirtualFile>>();
-    for (VirtualFile libraryRoot : libraryRoots) {
-      final List<OrderEntry> orderEntries = projectIndex.getOrderEntriesForFile(libraryRoot);
-      for (OrderEntry orderEntry : orderEntries) {
-        Set<VirtualFile> files = unusedLibs.get(orderEntry);
-        if (files == null) {
-          files = new HashSet<VirtualFile>();
-          unusedLibs.put(orderEntry, files);
-        }
-        files.add(libraryRoot);
-      }
-    }
-    final RefManager refManager = globalContext.getRefManager();
-    for (OrderEntry orderEntry : unusedLibs.keySet()) {
-      if (!(orderEntry instanceof LibraryOrderEntry)) continue;
-      final RefModule refModule = refManager.getRefModule(orderEntry.getOwnerModule());
-      final Set<VirtualFile> files = unusedLibs.get(orderEntry);
-      final VirtualFile[] roots = ((LibraryOrderEntry)orderEntry).getRootFiles(OrderRootType.CLASSES);
-      if (files.size() < roots.length) {
-        final String unusedLibraryRoots = StringUtil.join(files, new Function<VirtualFile, String>() {
-            @Override
-            public String fun(final VirtualFile file) {
-              return file.getPresentableName();
-            }
-          }, ",");
-        String message =
-          InspectionsBundle.message("unused.library.roots.problem.descriptor", unusedLibraryRoots, orderEntry.getPresentableName());
-        problemProcessor.addProblemElement(refModule,
-                                           manager.createProblemDescriptor(message, new RemoveUnusedLibrary(refModule, orderEntry, files)));
-      }
-      else {
-        String message = InspectionsBundle.message("unused.library.problem.descriptor", orderEntry.getPresentableName());
-        problemProcessor.addProblemElement(refModule,
-                                           manager.createProblemDescriptor(message, new RemoveUnusedLibrary(refModule, orderEntry, null)));
-      }
-    }
+    return null;
   }
 
+
   @Override
   public boolean isEnabledByDefault() {
     return false;
@@ -272,4 +182,41 @@
       });
     }
   }
+
+  private static class UnusedLibraryGraphAnnotator extends RefGraphAnnotator {
+    public static final Key<Set<VirtualFile>> USED_LIBRARY_ROOTS = Key.create("inspection.dependencies");
+    private final DirectoryIndex myDirectoryIndex;
+    private RefManager myManager;
+
+    public UnusedLibraryGraphAnnotator(RefManager manager) {
+      myManager = manager;
+      myDirectoryIndex = DirectoryIndex.getInstance(manager.getProject());
+    }
+
+    @Override
+    public void onMarkReferenced(PsiElement what, PsiElement from, boolean referencedFromClassInitializer) {
+      if (what != null && from != null){
+        final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(what);
+        final VirtualFile containingDir = virtualFile != null ? virtualFile.getParent() : null;
+        if (containingDir != null) {
+          final DirectoryInfo infoForDirectory = myDirectoryIndex.getInfoForDirectory(containingDir);
+          final VirtualFile libraryClassRoot = infoForDirectory != null ? infoForDirectory.getLibraryClassRoot() : null;
+          if (libraryClassRoot != null) {
+            final Module fromModule = ModuleUtilCore.findModuleForPsiElement(from);
+            if (fromModule != null){
+              final RefModule refModule = myManager.getRefModule(fromModule);
+              if (refModule != null) {
+                Set<VirtualFile> modules = refModule.getUserData(USED_LIBRARY_ROOTS);
+                if (modules == null){
+                  modules = new HashSet<VirtualFile>();
+                  refModule.putUserData(USED_LIBRARY_ROOTS, modules);
+                }
+                modules.add(libraryClassRoot);
+              }
+            }
+          }
+        }
+      }
+    }
+  }
 }
diff --git a/java/java-analysis-impl/src/com/intellij/lang/java/JavaSyntaxHighlighterFactory.java b/java/java-analysis-impl/src/com/intellij/lang/java/JavaSyntaxHighlighterFactory.java
index 2c427bd..ae32573 100644
--- a/java/java-analysis-impl/src/com/intellij/lang/java/JavaSyntaxHighlighterFactory.java
+++ b/java/java-analysis-impl/src/com/intellij/lang/java/JavaSyntaxHighlighterFactory.java
@@ -20,12 +20,12 @@
 import com.intellij.openapi.fileTypes.SyntaxHighlighter;
 import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory;
 import com.intellij.openapi.fileTypes.SyntaxHighlighterProvider;
-import com.intellij.openapi.module.LanguageLevelUtil;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiManager;
+import com.intellij.psi.impl.JavaPsiImplementationHelper;
 import com.intellij.psi.impl.compiled.ClsFileImpl;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -37,7 +37,7 @@
   @Override
   @NotNull
   public SyntaxHighlighter getSyntaxHighlighter(@Nullable Project project, @Nullable VirtualFile file) {
-    return new JavaFileHighlighter(LanguageLevelUtil.getLanguageLevelForFile(file));
+    return new JavaFileHighlighter(project == null ? LanguageLevel.HIGHEST : JavaPsiImplementationHelper.getInstance(project).getEffectiveLanguageLevel(file));
   }
 
   /**
diff --git a/java/java-impl/src/com/intellij/analysis/JavaAnalysisScope.java b/java/java-impl/src/com/intellij/analysis/JavaAnalysisScope.java
deleted file mode 100644
index 1c49c3b..0000000
--- a/java/java-impl/src/com/intellij/analysis/JavaAnalysisScope.java
+++ /dev/null
@@ -1,141 +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.
- */
-
-/*
- * User: anna
- * Date: 14-Jan-2008
- */
-package com.intellij.analysis;
-
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.ProjectFileIndex;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.*;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.PackageScope;
-import com.intellij.psi.search.SearchScope;
-import com.intellij.util.containers.ContainerUtil;
-import com.intellij.psi.util.FileTypeUtils;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.HashSet;
-import java.util.Set;
-
-public class JavaAnalysisScope extends AnalysisScope {
-  public static final int PACKAGE = 5;
-
-  public JavaAnalysisScope(PsiPackage pack, Module module) {
-    super(pack.getProject());
-    myModule = module;
-    myElement = pack;
-    myType = PACKAGE;
-  }
-
-  public JavaAnalysisScope(final PsiJavaFile psiFile) {
-    super(psiFile);
-  }
-
-  @Override
-  @NotNull
-  public AnalysisScope getNarrowedComplementaryScope(@NotNull Project defaultProject) {
-    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(defaultProject).getFileIndex();
-    final HashSet<Module> modules = new HashSet<Module>();
-    if (myType == FILE) {
-      if (myElement instanceof PsiJavaFile && !FileTypeUtils.isInServerPageFile(myElement)) {
-        PsiJavaFile psiJavaFile = (PsiJavaFile)myElement;
-        final PsiClass[] classes = psiJavaFile.getClasses();
-        boolean onlyPackLocalClasses = true;
-        for (final PsiClass aClass : classes) {
-          if (aClass.hasModifierProperty(PsiModifier.PUBLIC)) {
-            onlyPackLocalClasses = false;
-          }
-        }
-        if (onlyPackLocalClasses) {
-          final PsiDirectory psiDirectory = psiJavaFile.getContainingDirectory();
-          if (psiDirectory != null) {
-            return new JavaAnalysisScope(JavaDirectoryService.getInstance().getPackage(psiDirectory), null);
-          }
-        }
-      }
-    }
-    else if (myType == PACKAGE) {
-      final PsiDirectory[] directories = ((PsiPackage)myElement).getDirectories();
-      for (PsiDirectory directory : directories) {
-        modules.addAll(getAllInterestingModules(fileIndex, directory.getVirtualFile()));
-      }
-      return collectScopes(defaultProject, modules);
-    }
-    return super.getNarrowedComplementaryScope(defaultProject);
-  }
-
-
-
-  @Override
-  public String getShortenName() {
-    if (myType == PACKAGE)
-       return AnalysisScopeBundle.message("scope.package", ((PsiPackage)myElement).getQualifiedName());
-    return super.getShortenName();
-  }
-
-  @Override
-  public String getDisplayName() {
-    if (myType == PACKAGE) {
-      return AnalysisScopeBundle.message("scope.package", ((PsiPackage)myElement).getQualifiedName());
-    }
-    return super.getDisplayName();
-  }
-
-  @Override
-  protected void initFilesSet() {
-    if (myType == PACKAGE) {
-      myFilesSet = new HashSet<VirtualFile>();
-      accept(createFileSearcher());
-      return;
-    }
-    super.initFilesSet();
-  }
-
-  @Override
-  protected void accept(@NotNull final PsiElementVisitor visitor, final boolean needReadAction) {
-    if (myElement instanceof PsiPackage) {
-      final PsiPackage pack = (PsiPackage)myElement;
-      final Set<PsiDirectory> dirs = new HashSet<PsiDirectory>();
-      ApplicationManager.getApplication().runReadAction(new Runnable() {
-        @Override
-        public void run() {
-          ContainerUtil.addAll(dirs, pack.getDirectories(GlobalSearchScope.projectScope(myElement.getProject())));
-        }
-      });
-      for (PsiDirectory dir : dirs) {
-        accept(dir, visitor, needReadAction);
-      }
-    } else {
-      super.accept(visitor, needReadAction);
-    }
-  }
-
-  @NotNull
-  @Override
-  public SearchScope toSearchScope() {
-    if (myType == PACKAGE) {
-      return new PackageScope((PsiPackage)myElement, true, true);
-    }
-    return super.toSearchScope();
-  }
-}
diff --git a/java/java-impl/src/com/intellij/analysis/PackagesScopesProvider.java b/java/java-impl/src/com/intellij/analysis/PackagesScopesProvider.java
deleted file mode 100644
index b1bb15c..0000000
--- a/java/java-impl/src/com/intellij/analysis/PackagesScopesProvider.java
+++ /dev/null
@@ -1,60 +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.
- */
-
-/*
- * User: anna
- * Date: 16-Jan-2008
- */
-package com.intellij.analysis;
-
-import com.intellij.openapi.extensions.Extensions;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.search.scope.ProjectProductionScope;
-import com.intellij.psi.search.scope.TestsScope;
-import com.intellij.psi.search.scope.packageSet.CustomScopesProviderEx;
-import com.intellij.psi.search.scope.packageSet.NamedScope;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @author Konstantin Bulenkov
- */
-public class PackagesScopesProvider extends CustomScopesProviderEx {
-  private final NamedScope myProjectProductionScope;
-  private final List<NamedScope> myScopes;
-
-  public static PackagesScopesProvider getInstance(Project project) {
-    return Extensions.findExtension(CUSTOM_SCOPES_PROVIDER, project, PackagesScopesProvider.class);
-  }
-
-  public PackagesScopesProvider() {
-    myProjectProductionScope = new ProjectProductionScope();
-    final NamedScope projectTestScope = new TestsScope();
-    myScopes = Arrays.asList(myProjectProductionScope, projectTestScope);
-  }
-
-  @Override
-  @NotNull
-  public List<NamedScope> getCustomScopes() {
-    return myScopes;
-  }
-
-  public NamedScope getProjectProductionScope() {
-    return myProjectProductionScope;
-  }
-}
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/codeInsight/ExpectedTypesProvider.java b/java/java-impl/src/com/intellij/codeInsight/ExpectedTypesProvider.java
index 7ff2d6f..08a0712 100644
--- a/java/java-impl/src/com/intellij/codeInsight/ExpectedTypesProvider.java
+++ b/java/java-impl/src/com/intellij/codeInsight/ExpectedTypesProvider.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -938,7 +938,6 @@
         for (CandidateInfo candidate : methodCandidates) {
           PsiMethod method = (PsiMethod)candidate.getElement();
           PsiSubstitutor substitutor = candidate.getSubstitutor();
-          assert method != null;
           PsiParameter[] params = method.getParameterList().getParameters();
           if (params.length <= index) continue;
           PsiParameter param = params[index];
diff --git a/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsLineMarkerProvider.java b/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsLineMarkerProvider.java
index ce73a96..d5d927c 100644
--- a/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsLineMarkerProvider.java
+++ b/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsLineMarkerProvider.java
@@ -42,9 +42,7 @@
 
 import java.awt.event.MouseEvent;
 import java.util.Collection;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
 public class ExternalAnnotationsLineMarkerProvider implements LineMarkerProvider {
   @Nullable
@@ -81,7 +79,7 @@
         return XmlStringUtil.wrapInHtml(JavaDocInfoGenerator.generateSignature(owner));
       }
     };
-    return new LineMarkerInfo<PsiModifierListOwner>(owner, owner.getTextOffset(), AllIcons.Nodes.Annotationtype,
+    return new LineMarkerInfo<PsiModifierListOwner>(owner, owner.getTextOffset(), AllIcons.Gutter.ExtAnnotation,
                                                     Pass.UPDATE_ALL,
                                                     annotationsCollector, new MyIconGutterHandler(),
                                                     GutterIconRenderer.Alignment.LEFT);
diff --git a/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java b/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java
index 8680943..81968fe 100644
--- a/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java
+++ b/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java
@@ -63,6 +63,7 @@
 import com.intellij.openapi.vfs.*;
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
+import com.intellij.psi.impl.PsiModificationTrackerImpl;
 import com.intellij.psi.xml.XmlDocument;
 import com.intellij.psi.xml.XmlFile;
 import com.intellij.psi.xml.XmlTag;
@@ -115,10 +116,12 @@
 
   private void notifyAfterAnnotationChanging(@NotNull PsiModifierListOwner owner, @NotNull String annotationFQName, boolean successful) {
     myBus.syncPublisher(TOPIC).afterExternalAnnotationChanging(owner, annotationFQName, successful);
+    ((PsiModificationTrackerImpl)myPsiManager.getModificationTracker()).incCounter();
   }
 
   private void notifyChangedExternally() {
     myBus.syncPublisher(TOPIC).externalAnnotationsChangedExternally();
+    ((PsiModificationTrackerImpl)myPsiManager.getModificationTracker()).incCounter();
   }
 
   @Override
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/ConstructorInsertHandler.java b/java/java-impl/src/com/intellij/codeInsight/completion/ConstructorInsertHandler.java
index 2b3ef76..311e8bd 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/ConstructorInsertHandler.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/ConstructorInsertHandler.java
@@ -3,16 +3,21 @@
 import com.intellij.codeInsight.ExpectedTypeInfo;
 import com.intellij.codeInsight.ExpectedTypesProvider;
 import com.intellij.codeInsight.generation.GenerateMembersUtil;
+import com.intellij.codeInsight.generation.OverrideImplementExploreUtil;
 import com.intellij.codeInsight.generation.OverrideImplementUtil;
 import com.intellij.codeInsight.generation.PsiGenerationInfo;
+import com.intellij.codeInsight.intention.impl.TypeExpression;
 import com.intellij.codeInsight.lookup.Lookup;
 import com.intellij.codeInsight.lookup.LookupElementDecorator;
 import com.intellij.codeInsight.lookup.LookupItem;
 import com.intellij.codeInsight.lookup.PsiTypeLookupItem;
+import com.intellij.codeInsight.template.*;
 import com.intellij.featureStatistics.FeatureUsageTracker;
 import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.application.Result;
 import com.intellij.openapi.command.CommandProcessor;
 import com.intellij.openapi.command.UndoConfirmationPolicy;
+import com.intellij.openapi.command.WriteCommandAction;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
@@ -25,6 +30,7 @@
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtilCore;
 import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.Contract;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -241,17 +247,28 @@
     editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
     editor.getSelectionModel().removeSelection();
 
+    final PsiReferenceParameterList parameterList = parent.getBaseClassReference().getParameterList();
+    final PsiTypeElement[] parameters = parameterList != null ? parameterList.getTypeParameterElements() : null;
+    if (shouldStartTypeTemplate(parameters)) {
+      startTemplate(parent, editor, createOverrideRunnable(editor, file, project), parameters);
+      return null;
+    }
+
+    return createOverrideRunnable(editor, file, project);
+  }
+
+  private static Runnable createOverrideRunnable(final Editor editor, final PsiFile file, final Project project) {
     return new Runnable() {
       @Override
-      public void run(){
+      public void run() {
+        PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
+        final PsiAnonymousClass
+          aClass = PsiTreeUtil.findElementOfClassAtOffset(file, editor.getCaretModel().getOffset(), PsiAnonymousClass.class, false);
+        if (aClass == null) return;
         CommandProcessor.getInstance().executeCommand(project, new Runnable() {
           @Override
           public void run() {
-            PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
-            final PsiAnonymousClass aClass = PsiTreeUtil.findElementOfClassAtOffset(file, editor.getCaretModel().getOffset(), PsiAnonymousClass.class, false);
-            if (aClass == null) return;
-
-            final Collection<CandidateInfo> candidatesToImplement = OverrideImplementUtil.getMethodsToOverrideImplement(aClass, true);
+            final Collection<CandidateInfo> candidatesToImplement = OverrideImplementExploreUtil.getMethodsToOverrideImplement(aClass, true);
             for (Iterator<CandidateInfo> iterator = candidatesToImplement.iterator(); iterator.hasNext(); ) {
               final CandidateInfo candidate = iterator.next();
               final PsiElement element = candidate.getElement();
@@ -260,29 +277,70 @@
               }
             }
             boolean invokeOverride = candidatesToImplement.isEmpty();
-            if (invokeOverride){
+            if (invokeOverride) {
               OverrideImplementUtil.chooseAndOverrideOrImplementMethods(project, editor, aClass, false);
             }
-            else{
+            else {
               ApplicationManager.getApplication().runWriteAction(new Runnable() {
                 @Override
                 public void run() {
-                  try{
+                  try {
                     List<PsiMethod> methods = OverrideImplementUtil.overrideOrImplementMethodCandidates(aClass, candidatesToImplement, false);
                     List<PsiGenerationInfo<PsiMethod>> prototypes = OverrideImplementUtil.convert2GenerationInfos(methods);
-                    List<PsiGenerationInfo<PsiMethod>> resultMembers = GenerateMembersUtil.insertMembersBeforeAnchor(aClass, null, prototypes);
+                    List<PsiGenerationInfo<PsiMethod>> resultMembers =
+                      GenerateMembersUtil.insertMembersBeforeAnchor(aClass, null, prototypes);
                     resultMembers.get(0).positionCaret(editor, true);
                   }
-                  catch(IncorrectOperationException ioe){
+                  catch (IncorrectOperationException ioe) {
                     LOG.error(ioe);
                   }
                 }
               });
             }
-
           }
-        }, CompletionBundle.message("completion.smart.type.generate.anonymous.body"), null, UndoConfirmationPolicy.DEFAULT, editor.getDocument());
+        }, getCommandName(), getCommandName(), UndoConfirmationPolicy.DEFAULT, editor.getDocument());
       }
     };
   }
+
+  @Contract("null -> false")
+  private static boolean shouldStartTypeTemplate(PsiTypeElement[] parameters) {
+    if (parameters != null && parameters.length > 0) {
+      for (PsiTypeElement parameter : parameters) {
+        if (parameter.getType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) {
+          return true;
+        }
+      }
+    }
+    return false;
+  }
+
+  private static void startTemplate(final PsiAnonymousClass aClass, final Editor editor, final Runnable runnable, @NotNull final PsiTypeElement[] parameters) {
+    final Project project = aClass.getProject();
+    new WriteCommandAction(project, getCommandName(), getCommandName()) {
+      @Override
+      protected void run(@NotNull Result result) throws Throwable {
+        PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(editor.getDocument());
+        editor.getCaretModel().moveToOffset(aClass.getTextOffset());
+        final TemplateBuilderImpl templateBuilder = (TemplateBuilderImpl)TemplateBuilderFactory.getInstance().createTemplateBuilder(aClass);
+        for (int i = 0; i < parameters.length; i++) {
+          PsiTypeElement parameter = parameters[i];
+          templateBuilder.replaceElement(parameter, "param" + i, new TypeExpression(project, new PsiType[]{parameter.getType()}), true);
+        }
+        Template template = templateBuilder.buildInlineTemplate();
+        TemplateManager.getInstance(project).startTemplate(editor, template, false, null, new TemplateEditingAdapter() {
+          @Override
+          public void templateFinished(Template template, boolean brokenOff) {
+            if (!brokenOff) {
+              runnable.run();
+            }
+          }
+        });
+      }
+    }.execute();
+  }
+
+  private static String getCommandName() {
+    return CompletionBundle.message("completion.smart.type.generate.anonymous.body");
+  }
 }
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
index 036ddcb..5ac1495 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
@@ -465,8 +465,10 @@
         result.addElement(TailTypeDecorator.withTail(createKeyword(position, PsiKeyword.NEW), TailType.INSERT_SPACE));
         result.addElement(createKeyword(position, PsiKeyword.NULL));
       }
-      result.addElement(createKeyword(position, PsiKeyword.TRUE));
-      result.addElement(createKeyword(position, PsiKeyword.FALSE));
+      if (mayExpectBoolean(parameters)) {
+        result.addElement(createKeyword(position, PsiKeyword.TRUE));
+        result.addElement(createKeyword(position, PsiKeyword.FALSE));
+      }
     }
 
     PsiFile file = position.getContainingFile();
@@ -527,6 +529,14 @@
     }
   }
 
+  private static boolean mayExpectBoolean(CompletionParameters parameters) {
+    for (ExpectedTypeInfo info : JavaSmartCompletionContributor.getExpectedTypes(parameters)) {
+      PsiType type = info.getType();
+      if (type instanceof PsiClassType || type == PsiType.BOOLEAN) return true;
+    }
+    return false;
+  }
+
   private static boolean isExpressionPosition(PsiElement position) {
     return EXPR_KEYWORDS.accepts(position) ||
            psiElement().insideStarting(psiElement(PsiClassObjectAccessExpression.class)).accepts(position);
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaGenerateMemberCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaGenerateMemberCompletionContributor.java
index 144be8a..7015004 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaGenerateMemberCompletionContributor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaGenerateMemberCompletionContributor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -97,7 +97,6 @@
   private static void addSuperSignatureElements(final PsiClass parent, boolean implemented, CompletionResultSet result, Set<MethodSignature> addedSignatures) {
     for (CandidateInfo candidate : OverrideImplementExploreUtil.getMethodsToOverrideImplement(parent, implemented)) {
       PsiMethod baseMethod = (PsiMethod)candidate.getElement();
-      assert baseMethod != null;
       PsiClass baseClass = baseMethod.getContainingClass();
       PsiSubstitutor substitutor = candidate.getSubstitutor();
       if (!baseMethod.isConstructor() && baseClass != null && addedSignatures.add(baseMethod.getSignature(substitutor))) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java b/java/java-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java
deleted file mode 100644
index a6f3e94..0000000
--- a/java/java-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java
+++ /dev/null
@@ -1,66 +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.codeInsight.completion.scope;
-
-import com.intellij.psi.*;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Created by IntelliJ IDEA.
- * User: ik
- * Date: 20.01.2003
- * Time: 16:17:14
- * To change this template use Options | File Templates.
- */
-public class CompletionElement{
-  private final Object myElement;
-  private final PsiSubstitutor mySubstitutor;
-
-  public CompletionElement(Object element, PsiSubstitutor substitutor) {
-    myElement = element;
-    mySubstitutor = substitutor;
-  }
-
-  public PsiSubstitutor getSubstitutor(){
-    return mySubstitutor;
-  }
-
-  public Object getElement(){
-    return myElement;
-  }
-
-  @Nullable
-  Object getUniqueId(){
-    if(myElement instanceof PsiClass){
-      return ((PsiClass)myElement).getQualifiedName();
-    }
-    if(myElement instanceof PsiPackage){
-      return ((PsiPackage)myElement).getQualifiedName();
-    }
-    if(myElement instanceof PsiMethod){
-      return ((PsiMethod)myElement).getSignature(mySubstitutor);
-    }
-    if (myElement instanceof PsiVariable) {
-      return getVariableUniqueId((PsiVariable)myElement);
-    }
-
-    return null;
-  }
-
-  public static String getVariableUniqueId(final PsiVariable variable) {
-    return "#" + variable.getName();
-  }
-}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java b/java/java-impl/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java
deleted file mode 100644
index 58e6faf..0000000
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java
+++ /dev/null
@@ -1,60 +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.
- */
-
-/*
- * User: anna
- * Date: 21-Feb-2008
- */
-package com.intellij.codeInsight.daemon;
-
-import com.intellij.codeInspection.ModifiableModel;
-import com.intellij.codeInspection.ex.InspectionToolWrapper;
-import com.intellij.codeInspection.javaDoc.JavaDocLocalInspection;
-import com.intellij.codeInspection.javaDoc.JavaDocLocalInspectionBase;
-import com.intellij.profile.codeInspection.InspectionProfileManager;
-import org.jdom.Element;
-import org.jetbrains.annotations.NonNls;
-
-public class JavaAwareInspectionProfileCoverter extends InspectionProfileConvertor{
-  private String myAdditionalJavadocTags;
-  @NonNls private static final String ADDITONAL_JAVADOC_TAGS_OPTION = "ADDITIONAL_JAVADOC_TAGS";
-
-  public JavaAwareInspectionProfileCoverter(InspectionProfileManager manager) {
-    super(manager);
-  }
-
-  @Override
-  protected boolean processElement(final Element option, final String name) {
-    if (super.processElement(option, name)) {
-      return true;
-    }
-    if (name.equals(ADDITONAL_JAVADOC_TAGS_OPTION)) {
-      myAdditionalJavadocTags = option.getAttributeValue(VALUE_ATT);
-      return true;
-    }
-    return false;
-  }
-
-  @Override
-  protected void fillErrorLevels(final ModifiableModel profile) {
-    super.fillErrorLevels(profile);
-
-    //javadoc attributes
-    final InspectionToolWrapper toolWrapper = profile.getInspectionTool(JavaDocLocalInspectionBase.SHORT_NAME, null);
-    JavaDocLocalInspection inspection = (JavaDocLocalInspection)toolWrapper.getTool();
-    inspection.myAdditionalJavadocTags = myAdditionalJavadocTags;
-  }
-}
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/JavaProblemHighlightFilter.java b/java/java-impl/src/com/intellij/codeInsight/daemon/JavaProblemHighlightFilter.java
deleted file mode 100644
index 956de93..0000000
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/JavaProblemHighlightFilter.java
+++ /dev/null
@@ -1,45 +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.codeInsight.daemon;
-
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.roots.JavaProjectRootsUtil;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiFile;
-import org.jetbrains.annotations.NotNull;
-
-
-public class JavaProblemHighlightFilter extends ProblemHighlightFilter {
-  @Override
-  public boolean shouldHighlight(@NotNull PsiFile psiFile) {
-    return psiFile.getFileType() != StdFileTypes.JAVA || !JavaProjectRootsUtil.isOutsideJavaSourceRoot(psiFile);
-  }
-
-  @Override
-  public boolean shouldProcessInBatch(@NotNull PsiFile psiFile) {
-    final boolean shouldHighlight = shouldHighlightFile(psiFile);
-    if (shouldHighlight) {
-      if (psiFile.getFileType() == StdFileTypes.JAVA) {
-        final VirtualFile virtualFile = psiFile.getVirtualFile();
-        if (virtualFile != null && ProjectRootManager.getInstance(psiFile.getProject()).getFileIndex().isInLibrarySource(virtualFile)) {
-          return false;
-        }
-      }
-    }
-    return shouldHighlight;
-  }
-}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/GutterIconTooltipHelper.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/GutterIconTooltipHelper.java
deleted file mode 100644
index d539559..0000000
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/GutterIconTooltipHelper.java
+++ /dev/null
@@ -1,76 +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.
- */
-
-/*
- * @author max
- */
-package com.intellij.codeInsight.daemon.impl;
-
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiMethod;
-import com.intellij.psi.presentation.java.ClassPresentationUtil;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-import java.text.MessageFormat;
-import java.util.Arrays;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-public class GutterIconTooltipHelper {
-  private GutterIconTooltipHelper() {
-  }
-
-  public static String composeText(@NotNull PsiElement[] elements, String start, final String pattern) {
-    return composeText(Arrays.asList(elements), start, pattern);
-  }
-
-  public static String composeText(@NotNull Iterable<? extends PsiElement> elements, String start, final String pattern) {
-    @NonNls StringBuilder result = new StringBuilder();
-    result.append("<html><body>");
-    result.append(start);
-    Set<String> names = new LinkedHashSet<String>();
-    for (PsiElement element : elements) {
-      String descr = "";
-      if (element instanceof PsiClass) {
-        String className = ClassPresentationUtil.getNameForClass((PsiClass)element, true);
-        descr = MessageFormat.format(pattern, className);
-      }
-      else if (element instanceof PsiMethod) {
-        String methodName = ((PsiMethod)element).getName();
-        PsiClass aClass = ((PsiMethod)element).getContainingClass();
-        String className = aClass == null ? "" : ClassPresentationUtil.getNameForClass(aClass, true);
-        descr = MessageFormat.format(pattern, methodName, className);
-      }
-      else if (element instanceof PsiFile) {
-        descr = MessageFormat.format(pattern, ((PsiFile)element).getName());
-      }
-      names.add(descr);
-    }
-
-    @NonNls String sep = "";
-    for (String name : names) {
-      result.append(sep);
-      sep = "<br>";
-      result.append(name);
-    }
-
-    result.append("</body></html>");
-    return result.toString();
-  }
-}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaChangeLocalityDetector.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaChangeLocalityDetector.java
deleted file mode 100644
index 4f55574..0000000
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaChangeLocalityDetector.java
+++ /dev/null
@@ -1,45 +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 max
- */
-package com.intellij.codeInsight.daemon.impl;
-
-import com.intellij.codeInsight.daemon.ChangeLocalityDetector;
-import com.intellij.psi.*;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-public class JavaChangeLocalityDetector implements ChangeLocalityDetector {
-  @Override
-  @Nullable
-  public PsiElement getChangeHighlightingDirtyScopeFor(@NotNull final PsiElement element) {
-    // optimization
-    PsiElement parent = element.getParent();
-    PsiElement grand;
-    if (element instanceof PsiCodeBlock
-        && parent instanceof PsiMethod
-        && !((PsiMethod)parent).isConstructor()
-        && (grand = parent.getParent()) instanceof PsiClass
-        && !(grand instanceof PsiAnonymousClass)) {
-      // for changes inside method, rehighlight codeblock only
-      // do not use this optimization for constructors and class initializers - to update non-initialized fields
-      return parent;
-    }
-    return null;
-  }
-}
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaDocAnnotator.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaDocAnnotator.java
deleted file mode 100644
index 82c9080..0000000
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaDocAnnotator.java
+++ /dev/null
@@ -1,45 +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.codeInsight.daemon.impl;
-
-import com.intellij.lang.annotation.Annotation;
-import com.intellij.lang.annotation.AnnotationHolder;
-import com.intellij.lang.annotation.Annotator;
-import com.intellij.openapi.editor.colors.CodeInsightColors;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.javadoc.PsiDocTag;
-import com.intellij.psi.javadoc.PsiDocTagValue;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Dmitry Avdeev
- *         Date: 11/8/11
- */
-public class JavaDocAnnotator implements Annotator {
-  @Override
-  public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
-    if (element instanceof PsiDocTag) {
-      String name = ((PsiDocTag)element).getName();
-      if ("param".equals(name)) {
-        PsiDocTagValue tagValue = ((PsiDocTag)element).getValueElement();
-        if (tagValue != null) {
-          Annotation annotation = holder.createInfoAnnotation(tagValue, null);
-          annotation.setTextAttributes(CodeInsightColors.DOC_COMMENT_TAG_VALUE);
-        }
-      }
-    }
-  }
-}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/actions/SuppressWarningsFoldingBuilder.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/actions/SuppressWarningsFoldingBuilder.java
deleted file mode 100644
index f99abde..0000000
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/actions/SuppressWarningsFoldingBuilder.java
+++ /dev/null
@@ -1,99 +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.
- */
-
-/*
- * User: anna
- * Date: 25-May-2010
- */
-package com.intellij.codeInsight.daemon.impl.actions;
-
-import com.intellij.codeInsight.folding.JavaCodeFoldingSettings;
-import com.intellij.lang.ASTNode;
-import com.intellij.lang.folding.FoldingBuilderEx;
-import com.intellij.lang.folding.FoldingDescriptor;
-import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.psi.*;
-import com.intellij.psi.util.PsiUtil;
-import com.intellij.util.Function;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SuppressWarningsFoldingBuilder extends FoldingBuilderEx {
-  @NotNull
-  @Override
-  public FoldingDescriptor[] buildFoldRegions(@NotNull PsiElement root, @NotNull Document document, boolean quick) {
-    if (!(root instanceof PsiJavaFile) || quick || !JavaCodeFoldingSettings.getInstance().isCollapseSuppressWarnings()) {
-      return FoldingDescriptor.EMPTY;
-    }
-    if (!PsiUtil.isLanguageLevel5OrHigher(root)) {
-      return FoldingDescriptor.EMPTY;
-    }
-    final List<FoldingDescriptor> result = new ArrayList<FoldingDescriptor>();
-    root.accept(new JavaRecursiveElementWalkingVisitor(){
-      @Override
-      public void visitAnnotation(PsiAnnotation annotation) {
-        if (Comparing.strEqual(annotation.getQualifiedName(), SuppressWarnings.class.getName())) {
-          result.add(new FoldingDescriptor(annotation, annotation.getTextRange()));
-        }
-        super.visitAnnotation(annotation);
-      }
-    });
-    return result.toArray(new FoldingDescriptor[result.size()]);
-  }
-
-  @Override
-  public String getPlaceholderText(@NotNull ASTNode node) {
-    final PsiElement element = node.getPsi();
-    if (element instanceof PsiAnnotation) {
-      return "/" + StringUtil.join(((PsiAnnotation)element).getParameterList().getAttributes(), new Function<PsiNameValuePair, String>() {
-        @Override
-        public String fun(PsiNameValuePair value) {
-          return getMemberValueText(value.getValue());
-        }
-      }, ", ") + "/";
-    }
-    return element.getText();
-  }
-
-  private static String getMemberValueText(PsiAnnotationMemberValue memberValue) {
-    if (memberValue instanceof PsiArrayInitializerMemberValue) {
-      final PsiAnnotationMemberValue[] initializers = ((PsiArrayInitializerMemberValue)memberValue).getInitializers();
-      return StringUtil.join(initializers, new Function<PsiAnnotationMemberValue, String>() {
-        @Override
-        public String fun(PsiAnnotationMemberValue psiAnnotationMemberValue) {
-          return getMemberValueText(psiAnnotationMemberValue);
-        }
-      }, ", ");
-    }
-    if (memberValue instanceof PsiLiteral) {
-      final Object o = ((PsiLiteral)memberValue).getValue();
-      if (o != null) {
-        return o.toString();
-      }
-    }
-    return memberValue != null ? memberValue.getText() : "";
-  }
-
-
-  @Override
-  public boolean isCollapsedByDefault(@NotNull ASTNode node) {
-    return JavaCodeFoldingSettings.getInstance().isCollapseSuppressWarnings();
-  }
-}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavadocErrorFilter.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavadocErrorFilter.java
deleted file mode 100644
index 660b241..0000000
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavadocErrorFilter.java
+++ /dev/null
@@ -1,37 +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.codeInsight.daemon.impl.analysis;
-
-import com.intellij.codeInsight.highlighting.HighlightErrorFilter;
-import com.intellij.psi.PsiErrorElement;
-import com.intellij.psi.javadoc.PsiDocComment;
-import com.intellij.psi.util.PsiTreeUtil;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author yole
- */
-public class JavadocErrorFilter extends HighlightErrorFilter {
-
-  @Override
-  public boolean shouldHighlightErrorElement(@NotNull final PsiErrorElement element) {
-    return !value(element);
-  }
-
-  public static boolean value(final PsiErrorElement element) {
-    return PsiTreeUtil.getParentOfType(element, PsiDocComment.class) != null;
-  }
-}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddMissingRequiredAnnotationParametersFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddMissingRequiredAnnotationParametersFix.java
new file mode 100644
index 0000000..348fcde
--- /dev/null
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddMissingRequiredAnnotationParametersFix.java
@@ -0,0 +1,163 @@
+/*
+ * 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.codeInsight.daemon.impl.quickfix;
+
+import com.intellij.codeInsight.daemon.QuickFixBundle;
+import com.intellij.codeInsight.intention.IntentionAction;
+import com.intellij.codeInsight.template.TemplateBuilderImpl;
+import com.intellij.codeInsight.template.TemplateManager;
+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.openapi.util.Pair;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.util.IncorrectOperationException;
+import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.HashSet;
+import gnu.trove.TObjectIntHashMap;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+/**
+* @author Dmitry Batkovich
+*/
+public class AddMissingRequiredAnnotationParametersFix implements IntentionAction {
+  private static final Logger LOG = Logger.getInstance(AddMissingRequiredAnnotationParametersFix.class);
+
+  private final PsiAnnotation myAnnotation;
+  private final PsiMethod[] myAnnotationMethods;
+  private final Collection<String> myMissedElements;
+
+  public AddMissingRequiredAnnotationParametersFix(final PsiAnnotation annotation,
+                                                   final PsiMethod[] annotationMethods,
+                                                   final Collection<String> missedElements) {
+    if (missedElements.isEmpty()) {
+      throw new IllegalArgumentException("missedElements can't be empty");
+    }
+    myAnnotation = annotation;
+    myAnnotationMethods = annotationMethods;
+    myMissedElements = missedElements;
+  }
+
+  @NotNull
+  @Override
+  public String getText() {
+    return myMissedElements.size() == 1
+           ? QuickFixBundle.message("add.missing.annotation.single.parameter.fix", ContainerUtil.getFirstItem(myMissedElements))
+           : QuickFixBundle.message("add.missing.annotation.parameters.fix", StringUtil.join(myMissedElements, ", "));
+  }
+
+  @NotNull
+  @Override
+  public String getFamilyName() {
+    return QuickFixBundle.message("annotations.fix");
+  }
+
+  @Override
+  public boolean isAvailable(@NotNull final Project project, final Editor editor, final PsiFile file) {
+    return true;
+  }
+
+  @Override
+  public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
+    final PsiNameValuePair[] addedParameters = myAnnotation.getParameterList().getAttributes();
+
+    final TObjectIntHashMap<String> annotationsOrderMap = getAnnotationsOrderMap();
+    final SortedSet<Pair<String, PsiAnnotationMemberValue>>
+      newParameters = new TreeSet<Pair<String, PsiAnnotationMemberValue>>(new Comparator<Pair<String, PsiAnnotationMemberValue>>() {
+      @Override
+      public int compare(final Pair<String, PsiAnnotationMemberValue> o1, final Pair<String, PsiAnnotationMemberValue> o2) {
+        return annotationsOrderMap.get(o1.getFirst()) - annotationsOrderMap.get(o2.getFirst());
+      }
+    });
+    final boolean order = isAlreadyAddedOrdered(annotationsOrderMap, addedParameters);
+    if (order) {
+      if (addedParameters.length != 0) {
+        final PsiAnnotationParameterList parameterList = myAnnotation.getParameterList();
+        parameterList.deleteChildRange(addedParameters[0], addedParameters[addedParameters.length - 1]);
+        for (final PsiNameValuePair addedParameter : addedParameters) {
+          final String name = addedParameter.getName();
+          final PsiAnnotationMemberValue value = addedParameter.getValue();
+          if (name == null || value == null) {
+            LOG.error(String.format("Invalid annotation parameter name = %s, value = %s", name, value));
+            continue;
+          }
+          newParameters.add(Pair.create(name, value));
+        }
+      }
+    }
+
+    final PsiExpression nullValue = JavaPsiFacade.getElementFactory(myAnnotation.getProject()).createExpressionFromText(PsiKeyword.NULL, null);
+    for (final String misssedParameter : myMissedElements) {
+      newParameters.add(Pair.<String, PsiAnnotationMemberValue>create(misssedParameter, nullValue));
+    }
+
+    TemplateBuilderImpl builder = null;
+    for (final Pair<String, PsiAnnotationMemberValue> newParameter : newParameters) {
+      final PsiAnnotationMemberValue value =
+        myAnnotation.setDeclaredAttributeValue(newParameter.getFirst(), newParameter.getSecond());
+      if (myMissedElements.contains(newParameter.getFirst())) {
+        if (builder == null) {
+          builder = new TemplateBuilderImpl(myAnnotation.getParameterList());
+        }
+        builder.replaceElement(value, new EmptyExpression(), true);
+      }
+    }
+
+    editor.getCaretModel().moveToOffset(myAnnotation.getParameterList().getTextRange().getStartOffset());
+    final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project);
+    final Document document = documentManager.getDocument(file);
+    if (document == null) {
+      throw new IllegalStateException();
+    }
+    documentManager.doPostponedOperationsAndUnblockDocument(document);
+    TemplateManager.getInstance(project).startTemplate(editor, builder.buildInlineTemplate(), null);
+  }
+
+  @Override
+  public boolean startInWriteAction() {
+    return true;
+  }
+
+  private TObjectIntHashMap<String> getAnnotationsOrderMap() {
+    final TObjectIntHashMap<String> map = new TObjectIntHashMap<String>();
+    for (int i = 0; i < myAnnotationMethods.length; i++) {
+      map.put(myAnnotationMethods[i].getName(), i);
+    }
+    return map;
+  }
+
+  private static boolean isAlreadyAddedOrdered(final TObjectIntHashMap<String> orderMap, final PsiNameValuePair[] addedParameters) {
+    if (addedParameters.length <= 1) {
+      return true;
+    }
+    int previousOrder = orderMap.get(addedParameters[0].getName());
+    for (int i = 1; i < addedParameters.length; i++) {
+      final int currentOrder = orderMap.get(addedParameters[i].getName());
+      if (currentOrder < previousOrder) {
+        return false;
+      }
+      previousOrder = currentOrder;
+    }
+    return true;
+  }
+}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateConstructorParameterFromFieldFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateConstructorParameterFromFieldFix.java
index f47a780..14e7478 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateConstructorParameterFromFieldFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateConstructorParameterFromFieldFix.java
@@ -25,6 +25,7 @@
 import com.intellij.codeInsight.intention.IntentionAction;
 import com.intellij.codeInsight.intention.impl.AssignFieldFromParameterAction;
 import com.intellij.codeInsight.intention.impl.FieldFromParameterUtils;
+import com.intellij.codeInspection.ex.GlobalInspectionContextBase;
 import com.intellij.ide.util.MemberChooser;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.editor.Editor;
@@ -123,6 +124,7 @@
         }
       }
     });
+    final List<PsiElement> cleanupElements = new ArrayList<PsiElement>(); 
     final ArrayList<PsiMethod> constrs = filterConstructorsIfFieldAlreadyAssigned(constructors, getField());
     if (constrs.size() > 1) {
       final PsiMethodMember[] members = new PsiMethodMember[constrs.size()];
@@ -142,7 +144,7 @@
       }
 
       for (PsiMethodMember member : elements) {
-        if (!addParameterToConstructor(project, file, editor, member.getElement(), new PsiField[] {getField()})) break;
+        if (!addParameterToConstructor(project, file, editor, member.getElement(), new PsiField[] {getField()}, cleanupElements)) break;
       }
 
     } else if (!constrs.isEmpty()) {
@@ -177,12 +179,13 @@
 
         addParameterToConstructor(project, file, editor, constructor, constrs.size() == constructors.length
                                                                       ? fields.toArray(new PsiField[fields.size()])
-                                                                      : new PsiField[]{getField()});
+                                                                      : new PsiField[]{getField()}, cleanupElements);
       }
       finally {
         fieldsToFix.clear();
       }
     }
+    GlobalInspectionContextBase.cleanupElements(project, null, cleanupElements.toArray(new PsiElement[cleanupElements.size()]));
   }
 
    @NotNull
@@ -231,7 +234,7 @@
                                                    final PsiFile file,
                                                    final Editor editor,
                                                    final PsiMethod constructor,
-                                                   final PsiField[] fields) throws IncorrectOperationException {
+                                                   final PsiField[] fields, final List<PsiElement> cleanupElements) throws IncorrectOperationException {
     final PsiParameterList parameterList = constructor.getParameterList();
     final PsiParameter[] parameters = parameterList.getParameters();
     ParameterInfoImpl[] newParamInfos = new ParameterInfoImpl[parameters.length + fields.length];
@@ -267,7 +270,7 @@
     return ApplicationManager.getApplication().runWriteAction(new Computable<Boolean>() {
       @Override
       public Boolean compute() {
-        return doCreate(project, editor, parameters, constructorPointer, resultParams, usedFields);
+        return doCreate(project, editor, parameters, constructorPointer, resultParams, usedFields, cleanupElements);
       }
     });
   }
@@ -309,7 +312,7 @@
   }
 
   private static boolean doCreate(Project project, Editor editor, PsiParameter[] parameters, SmartPsiElementPointer constructorPointer,
-                                  ParameterInfoImpl[] parameterInfos, HashMap<PsiField, String> fields) {
+                                  ParameterInfoImpl[] parameterInfos, HashMap<PsiField, String> fields, List<PsiElement> cleanupElements) {
     PsiMethod constructor = (PsiMethod)constructorPointer.getElement();
     assert constructor != null;
     PsiParameter[] newParameters = constructor.getParameterList().getParameters();
@@ -324,7 +327,11 @@
           continue;
         }
         notNull(project, field, parameter);
-        AssignFieldFromParameterAction.addFieldAssignmentStatement(project, field, parameter, editor);
+        cleanupElements.add(parameter);
+        final PsiElement assignmentStatement = AssignFieldFromParameterAction.addFieldAssignmentStatement(project, field, parameter, editor);
+        if (assignmentStatement != null) {
+          cleanupElements.add(assignmentStatement);
+        }
         created = true;
       }
     }
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageUtils.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageUtils.java
index a66a758..c5763cc 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageUtils.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageUtils.java
@@ -28,6 +28,7 @@
 import com.intellij.ide.fileTemplates.FileTemplateManager;
 import com.intellij.ide.fileTemplates.FileTemplateUtil;
 import com.intellij.ide.fileTemplates.JavaTemplateUtil;
+import com.intellij.lang.java.JavaLanguage;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Editor;
@@ -135,7 +136,10 @@
 
     JVMElementFactory factory = JVMElementFactories.getFactory(aClass.getLanguage(), aClass.getProject());
 
-    LOG.assertTrue(!aClass.isInterface() || method.hasModifierProperty(PsiModifier.DEFAULT) || method.hasModifierProperty(PsiModifier.STATIC), "Interface bodies should be already set up");
+    LOG.assertTrue(!aClass.isInterface() ||
+                   method.hasModifierProperty(PsiModifier.DEFAULT) ||
+                   method.hasModifierProperty(PsiModifier.STATIC) ||
+                   method.getLanguage() != JavaLanguage.INSTANCE, "Interface bodies should be already set up");
 
     FileType fileType = FileTypeManager.getInstance().getFileTypeByExtension(template.getExtension());
     Properties properties = new Properties();
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ShowModulePropertiesFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ShowModulePropertiesFix.java
index 203612e..16b2c2d 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ShowModulePropertiesFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ShowModulePropertiesFix.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,7 +15,7 @@
  */
 package com.intellij.codeInsight.daemon.impl.quickfix;
 
-import com.intellij.codeInsight.intention.IntentionAction;
+import com.intellij.codeInspection.IntentionAndQuickFixAction;
 import com.intellij.openapi.actionSystem.ActionManager;
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.IdeActions;
@@ -26,20 +26,23 @@
 import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiFile;
-import com.intellij.util.IncorrectOperationException;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
-public class ShowModulePropertiesFix implements IntentionAction {
+public class ShowModulePropertiesFix extends IntentionAndQuickFixAction {
   private final String myModuleName;
 
   public ShowModulePropertiesFix(@NotNull PsiElement context) {
-    Module module = ModuleUtilCore.findModuleForPsiElement(context);
+    this(ModuleUtilCore.findModuleForPsiElement(context));
+  }
+
+  public ShowModulePropertiesFix(@Nullable Module module) {
     myModuleName = module == null ? null : module.getName();
   }
 
-  @Override
   @NotNull
-  public String getText() {
+  @Override
+  public String getName() {
     AnAction action = ActionManager.getInstance().getAction(IdeActions.MODULE_SETTINGS);
     return action.getTemplatePresentation().getText();
   }
@@ -56,7 +59,7 @@
   }
 
   @Override
-  public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
+  public void applyFix(@NotNull Project project, PsiFile file, @Nullable Editor editor) {
     ProjectSettingsService.getInstance(project).showModuleConfigurationDialog(myModuleName, null);
   }
 
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SurroundWithQuotesAnnotationParameterValueFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SurroundWithQuotesAnnotationParameterValueFix.java
new file mode 100644
index 0000000..0468ec8
--- /dev/null
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/SurroundWithQuotesAnnotationParameterValueFix.java
@@ -0,0 +1,75 @@
+/*
+ * 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.codeInsight.daemon.impl.quickfix;
+
+import com.intellij.codeInsight.intention.IntentionAction;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class SurroundWithQuotesAnnotationParameterValueFix implements IntentionAction {
+  private final PsiAnnotationMemberValue myValue;
+  private final PsiType myExpectedType;
+
+  public SurroundWithQuotesAnnotationParameterValueFix(final PsiAnnotationMemberValue value, final PsiType expectedType) {
+    myValue = value;
+    myExpectedType = expectedType;
+  }
+
+  @Override
+  public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
+    if (!myValue.isValid() || !(myExpectedType instanceof PsiClassType)) {
+      return false;
+    }
+    final PsiClass resolvedType = ((PsiClassType)myExpectedType).resolve();
+    return resolvedType != null && CommonClassNames.JAVA_LANG_STRING.equals(resolvedType.getQualifiedName()) && myValue instanceof PsiLiteralExpression;
+  }
+
+  @Override
+  public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
+    String newText = myValue.getText();
+    newText = StringUtil.stripQuotesAroundValue(newText);
+    newText = "\"" + newText + "\"";
+    PsiElement newToken = JavaPsiFacade.getInstance(project).getElementFactory().createExpressionFromText(newText, null);
+    final PsiElement newElement = myValue.replace(newToken);
+    editor.getCaretModel().moveToOffset(newElement.getTextOffset() + newElement.getTextLength());
+  }
+
+  @NotNull
+  @Override
+  public String getFamilyName() {
+    return "Surround annotation parameter value with quotes";
+  }
+
+  @NotNull
+  @Override
+  public String getText() {
+    return getFamilyName();
+  }
+
+  @Override
+  public boolean startInWriteAction() {
+    return true;
+  }
+
+
+}
diff --git a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java
index c6cdb98..8646805 100644
--- a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java
+++ b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.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,11 +18,9 @@
 import com.intellij.codeInsight.ExpectedTypeInfo;
 import com.intellij.codeInsight.ExpectedTypesProvider;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.TextRange;
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.CodeStyleSettings;
 import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
-import org.jetbrains.annotations.Nullable;
 
 public class JavaFoldingBuilder extends JavaFoldingBuilderBase {
 
@@ -42,14 +40,5 @@
     ExpectedTypeInfo[] types = ExpectedTypesProvider.getExpectedTypes(expression, false);
     return types.length != 1 || !types[0].getType().equals(anonymousClass.getBaseClassType());
   }
-
-  @Nullable
-  @Override
-  public TextRange getRangeToFold(PsiElement element) {
-    if (element instanceof SyntheticElement) {
-      return null;
-    }
-    return super.getRangeToFold(element);    //To change body of overridden methods use File | Settings | File Templates.
-  }
 }
 
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateMembersHandlerBase.java b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateMembersHandlerBase.java
index 6b33a3b..f165247 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateMembersHandlerBase.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateMembersHandlerBase.java
@@ -136,8 +136,7 @@
         }
       }
 
-      AnalysisScope scope = new AnalysisScope(new LocalSearchScope(elements.toArray(new PsiElement[elements.size()])), project);
-      GlobalInspectionContextBase.codeCleanup(project, scope, null);
+      GlobalInspectionContextBase.cleanupElements(project, null, elements.toArray(new PsiElement[elements.size()]));
     }
 
     final ArrayList<TemplateGenerationInfo> templates = new ArrayList<TemplateGenerationInfo>();
diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/AddAnnotationFix.java b/java/java-impl/src/com/intellij/codeInsight/intention/AddAnnotationFix.java
deleted file mode 100644
index f8d2501..0000000
--- a/java/java-impl/src/com/intellij/codeInsight/intention/AddAnnotationFix.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.codeInsight.intention;
-
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiModifierListOwner;
-import com.intellij.psi.PsiNameValuePair;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author ven
- */
-public class AddAnnotationFix extends AddAnnotationPsiFix implements IntentionAction {
-  public AddAnnotationFix(@NotNull String fqn, @NotNull PsiModifierListOwner modifierListOwner, @NotNull String... annotationsToRemove) {
-    this(fqn, modifierListOwner, PsiNameValuePair.EMPTY_ARRAY, annotationsToRemove);
-  }
-
-  public AddAnnotationFix(@NotNull String fqn,
-                          @NotNull PsiModifierListOwner modifierListOwner,
-                          @NotNull PsiNameValuePair[] values,
-                          @NotNull String... annotationsToRemove) {
-    super(fqn, modifierListOwner, values, annotationsToRemove);
-  }
-
-  @Override
-  public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
-    return isAvailable();
-  }
-
-  @Override
-  public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
-    applyFix();
-  }
-
-  @Override
-  public boolean startInWriteAction() {
-    return true;
-  }
-}
diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddJavadocIntention.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddJavadocIntention.java
new file mode 100644
index 0000000..a26e78a
--- /dev/null
+++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddJavadocIntention.java
@@ -0,0 +1,57 @@
+/*
+ * 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.codeInsight.intention.impl;
+
+import com.intellij.codeInsight.editorActions.FixDocCommentAction;
+import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class AddJavadocIntention extends PsiElementBaseIntentionAction {
+  @Override
+  public void invoke(@NotNull final Project project, final Editor editor, @NotNull final PsiElement element) throws IncorrectOperationException {
+    final PsiDocCommentOwner docCommentOwner = (PsiDocCommentOwner)element.getParent();
+    FixDocCommentAction.generateOrFixComment(docCommentOwner, project, editor);
+  }
+
+  @Override
+  public boolean isAvailable(@NotNull final Project project, final Editor editor, @NotNull final PsiElement element) {
+    if (!(element instanceof PsiIdentifier)) {
+      return false;
+    }
+    final PsiElement docCommentOwner = element.getParent();
+    return docCommentOwner instanceof PsiDocCommentOwner &&
+           !(docCommentOwner instanceof PsiAnonymousClass) && ((PsiDocCommentOwner)docCommentOwner).getDocComment() == null;
+  }
+
+  @NotNull
+  @Override
+  public String getFamilyName() {
+    return "Add Javadoc";
+  }
+
+  @NotNull
+  @Override
+  public String getText() {
+    return getFamilyName();
+  }
+}
diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/AssignFieldFromParameterAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/AssignFieldFromParameterAction.java
index 016d144..1edb896 100644
--- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/AssignFieldFromParameterAction.java
+++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/AssignFieldFromParameterAction.java
@@ -99,19 +99,19 @@
     return field;
   }
 
-  public static void addFieldAssignmentStatement(@NotNull Project project,
-                                                 @NotNull PsiField field,
-                                                 @NotNull PsiParameter parameter,
-                                                 @NotNull Editor editor) throws IncorrectOperationException {
+  public static PsiElement addFieldAssignmentStatement(@NotNull Project project,
+                                                       @NotNull PsiField field,
+                                                       @NotNull PsiParameter parameter,
+                                                       @NotNull Editor editor) throws IncorrectOperationException {
     final PsiMethod method = (PsiMethod)parameter.getDeclarationScope();
     final PsiCodeBlock methodBody = method.getBody();
-    if (methodBody == null) return;
+    if (methodBody == null) return null;
     final PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();
     final String fieldName = field.getName();
     final String parameterName = parameter.getName();
     final boolean isMethodStatic = method.hasModifierProperty(PsiModifier.STATIC);
     final PsiClass targetClass = method.getContainingClass();
-    if (targetClass == null) return;
+    if (targetClass == null) return null;
 
     String stmtText = fieldName + " = " + parameterName + ";";
     if (Comparing.strEqual(fieldName, parameterName) || JavaPsiFacade.getInstance(project).getResolveHelper().resolveReferencedVariable(fieldName, methodBody) != field) {
@@ -131,5 +131,6 @@
     }
     editor.getCaretModel().moveToOffset(inserted.getTextRange().getEndOffset());
     editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
+    return inserted;
   }
 }
diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateClassDialog.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateClassDialog.java
index e21f032..a9a6d60 100644
--- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateClassDialog.java
+++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateClassDialog.java
@@ -17,7 +17,7 @@
 
 import com.intellij.CommonBundle;
 import com.intellij.codeInsight.CodeInsightBundle;
-import com.intellij.codeInsight.daemon.impl.quickfix.CreateClassKind;
+import com.intellij.codeInsight.daemon.impl.quickfix.ClassKind;
 import com.intellij.ide.util.PackageUtil;
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
@@ -88,7 +88,7 @@
                            @NotNull String title,
                            @NotNull String targetClassName,
                            @NotNull String targetPackageName,
-                           @NotNull CreateClassKind kind,
+                           @NotNull ClassKind kind,
                            boolean classNameEditable,
                            @Nullable Module defaultModule) {
     super(project, true);
diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateSwitchIntention.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateSwitchIntention.java
new file mode 100644
index 0000000..e599e03
--- /dev/null
+++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateSwitchIntention.java
@@ -0,0 +1,95 @@
+/*
+ * 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.codeInsight.intention.impl;
+
+import com.intellij.codeInsight.FileModificationService;
+import com.intellij.codeInsight.intention.BaseElementAtCaretIntentionAction;
+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.codeStyle.CodeStyleManager;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class CreateSwitchIntention extends BaseElementAtCaretIntentionAction {
+  public static final String TEXT = "Create switch statement";
+
+  @Override
+  public void invoke(@NotNull final Project project, final Editor editor, @NotNull final PsiElement element) throws IncorrectOperationException {
+    if (!FileModificationService.getInstance().preparePsiElementsForWrite(element)) {
+      return;
+    }
+    final PsiExpressionStatement expressionStatement = resolveExpressionStatement(element);
+    final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(project).getElementFactory();
+    PsiSwitchStatement switchStatement = (PsiSwitchStatement)elementFactory
+      .createStatementFromText(String.format("switch (%s) {}", expressionStatement.getExpression().getText()), null);
+    switchStatement = (PsiSwitchStatement)expressionStatement.replace(switchStatement);
+    CodeStyleManager.getInstance(project).reformat(switchStatement);
+
+    final PsiJavaToken lBrace = switchStatement.getBody().getLBrace();
+    editor.getCaretModel().moveToOffset(lBrace.getTextOffset() + lBrace.getTextLength());
+  }
+
+  @Override
+  public boolean isAvailable(@NotNull final Project project, final Editor editor, @NotNull final PsiElement element) {
+    final PsiExpressionStatement expressionStatement = resolveExpressionStatement(element);
+    return expressionStatement != null && isValidTypeForSwitch(expressionStatement.getExpression().getType(), expressionStatement);
+  }
+
+  private static PsiExpressionStatement resolveExpressionStatement(final PsiElement element) {
+    if (element instanceof PsiExpressionStatement) {
+      return (PsiExpressionStatement)element;
+    } else {
+      final PsiStatement psiStatement = PsiTreeUtil.getParentOfType(element, PsiStatement.class);
+      return psiStatement instanceof PsiExpressionStatement ? (PsiExpressionStatement)psiStatement : null;
+    }
+  }
+
+  private static boolean isValidTypeForSwitch(@Nullable final PsiType type, final PsiElement context) {
+    if (type == null) {
+      return false;
+    }
+
+    if (type instanceof PsiClassType) {
+      final PsiClass resolvedClass = ((PsiClassType)type).resolve();
+      if (resolvedClass == null) {
+        return false;
+      }
+      return (PsiUtil.isLanguageLevel5OrHigher(context) && resolvedClass.isEnum())
+             || (PsiUtil.isLanguageLevel7OrHigher(context) && CommonClassNames.JAVA_LANG_STRING.equals(resolvedClass.getQualifiedName()));
+    }
+    return type.equals(PsiType.INT) || type.equals(PsiType.BYTE) || type.equals(PsiType.SHORT) || type.equals(PsiType.CHAR);
+  }
+
+  @NotNull
+  @Override
+  public String getFamilyName() {
+    return TEXT;
+  }
+
+  @NotNull
+  @Override
+  public String getText() {
+    return getFamilyName();
+  }
+}
diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java
index a66a858..e934a9f 100644
--- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java
+++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java
@@ -44,6 +44,7 @@
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.TextRange;
@@ -61,6 +62,7 @@
 import org.jetbrains.annotations.Nullable;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
@@ -333,9 +335,14 @@
 
   @NotNull
   @Override
-  public IntentionAction createShowModulePropertiesFix(@NotNull PsiElement element) {
+  public IntentionAndQuickFixAction createShowModulePropertiesFix(@NotNull PsiElement element) {
     return new ShowModulePropertiesFix(element);
   }
+  @NotNull
+  @Override
+  public IntentionAndQuickFixAction createShowModulePropertiesFix(@NotNull Module module) {
+    return new ShowModulePropertiesFix(module);
+  }
 
   @NotNull
   @Override
@@ -740,6 +747,21 @@
     });
   }
 
+  @NotNull
+  @Override
+  public IntentionAction createAddMissingRequiredAnnotationParametersFix(@NotNull final PsiAnnotation annotation,
+                                                                         @NotNull final PsiMethod[] annotationMethods,
+                                                                         @NotNull final Collection<String> missedElements) {
+    return new AddMissingRequiredAnnotationParametersFix(annotation, annotationMethods, missedElements);
+  }
+
+  @NotNull
+  @Override
+  public IntentionAction createSurroundWithQuotesAnnotationParameterValueFix(@NotNull PsiAnnotationMemberValue value,
+                                                                             @NotNull PsiType expectedType) {
+    return new SurroundWithQuotesAnnotationParameterValueFix(value, expectedType);
+  }
+
   private static boolean timeToOptimizeImports(@NotNull PsiFile file) {
     if (!CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY) return false;
 
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/impl/TextExpression.java b/java/java-impl/src/com/intellij/codeInsight/template/impl/TextExpression.java
deleted file mode 100644
index b9b5578..0000000
--- a/java/java-impl/src/com/intellij/codeInsight/template/impl/TextExpression.java
+++ /dev/null
@@ -1,46 +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.codeInsight.template.impl;
-
-import com.intellij.codeInsight.lookup.LookupElement;
-import com.intellij.codeInsight.template.Expression;
-import com.intellij.codeInsight.template.ExpressionContext;
-import com.intellij.codeInsight.template.Result;
-import com.intellij.codeInsight.template.TextResult;
-
-/**
- * @author Maxim
- */
-public class TextExpression extends Expression {
-  private final String myString;
-
-  public TextExpression(String string) { myString = string; }
-
-  @Override
-  public Result calculateResult(ExpressionContext expressionContext) {
-    return new TextResult(myString);
-  }
-
-  @Override
-  public Result calculateQuickResult(ExpressionContext expressionContext) {
-    return calculateResult(expressionContext);
-  }
-
-  @Override
-  public LookupElement[] calculateLookupItems(ExpressionContext expressionContext) {
-    return LookupElement.EMPTY_ARRAY;
-  }
-}
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/AssertStatementPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/AssertStatementPostfixTemplate.java
index 9081294..0af5d4e 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/AssertStatementPostfixTemplate.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/AssertStatementPostfixTemplate.java
@@ -15,20 +15,22 @@
  */
 package com.intellij.codeInsight.template.postfix.templates;
 
+import com.intellij.psi.PsiElement;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import static com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils.IS_BOOLEAN;
 import static com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils.JAVA_PSI_INFO;
 
-public class AssertStatementPostfixTemplate extends JavaStatementWrapPostfixTemplate {
+public class AssertStatementPostfixTemplate extends StringBasedPostfixTemplate {
 
   public AssertStatementPostfixTemplate() {
-    super("assert", "assert expr;", JAVA_PSI_INFO, IS_BOOLEAN);
+    super("assert", "assert expr", JAVA_PSI_INFO, IS_BOOLEAN);
   }
 
-  @NotNull
+  @Nullable
   @Override
-  protected String getHead() {
-    return "assert ";
+  public String getTemplateString(@NotNull PsiElement element) {
+    return "assert $expr$;$END$";
   }
 }
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ForIndexedPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ForIndexedPostfixTemplate.java
index 38ea87d..922a8bb 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ForIndexedPostfixTemplate.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ForIndexedPostfixTemplate.java
@@ -43,22 +43,20 @@
   }
 
   @Override
-  public void expandWithTemplateManager(TemplateManager manager, PsiElement expression, Editor editor) {
-    PsiExpression expr = (PsiExpression)expression;
-    String bound = getExpressionBound(expr);
-    if (bound == null) {
-      PostfixTemplatesUtils.showErrorHint(expr.getProject(), editor);
-      return;
-    }
-
-    String templateWithMacro = getStringTemplate(expr).replace("$bound$", bound).replace("$type$", suggestIndexType(expr));
-
-    Template template = manager.createTemplate("", "", templateWithMacro);
-
-    template.setToReformat(true);
+  public void setVariables(@NotNull Template template, @NotNull PsiElement element) {
     MacroCallNode index = new MacroCallNode(new SuggestVariableNameMacro());
     template.addVariable("index", index, index, true);
-    manager.startTemplate(editor, template);
+  }
+
+  @Override
+  public final String getTemplateString(@NotNull PsiElement element) {
+    PsiExpression expr = (PsiExpression)element;
+    String bound = getExpressionBound(expr);
+    if (bound == null) {
+      return null;
+    }
+
+    return getStringTemplate(expr).replace("$bound$", bound).replace("$type$", suggestIndexType(expr));
   }
 
   @NotNull
@@ -87,4 +85,9 @@
     }
     return "int";
   }
+
+  @Override
+  protected boolean shouldAddExpressionToContext() {
+    return false;
+  }
 }
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ForeachPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ForeachPostfixTemplate.java
index 56976be..5d98a01 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ForeachPostfixTemplate.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ForeachPostfixTemplate.java
@@ -16,15 +16,13 @@
 package com.intellij.codeInsight.template.postfix.templates;
 
 import com.intellij.codeInsight.template.Template;
-import com.intellij.codeInsight.template.TemplateManager;
 import com.intellij.codeInsight.template.impl.MacroCallNode;
-import com.intellij.codeInsight.template.impl.TextExpression;
 import com.intellij.codeInsight.template.impl.VariableNode;
 import com.intellij.codeInsight.template.macro.IterableComponentTypeMacro;
 import com.intellij.codeInsight.template.macro.SuggestVariableNameMacro;
-import com.intellij.openapi.editor.Editor;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.codeStyle.JavaCodeStyleSettingsFacade;
+import org.jetbrains.annotations.NotNull;
 
 import static com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils.IS_ITERABLE_OR_ARRAY;
 import static com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils.JAVA_PSI_INFO;
@@ -35,18 +33,17 @@
   }
 
   @Override
-  public void expandWithTemplateManager(TemplateManager manager, PsiElement expression, Editor editor) {
-
-    String finalPart = JavaCodeStyleSettingsFacade.getInstance(expression.getProject()).isGenerateFinalLocals() ? "final " : "";
-    Template template = manager.createTemplate("", "", "for (" + finalPart + "$type$ $name$ : $variable$) {\n    $END$\n}");
+  public void setVariables(@NotNull Template template, @NotNull PsiElement element) {
     MacroCallNode type = new MacroCallNode(new IterableComponentTypeMacro());
     MacroCallNode name = new MacroCallNode(new SuggestVariableNameMacro());
-    String variable = "variable";
-    type.addParameter(new VariableNode(variable, null));
+    type.addParameter(new VariableNode("expr", null));
     template.addVariable("type", type, type, false);
     template.addVariable("name", name, name, true);
-    template.addVariable(variable, new TextExpression(expression.getText()), false);
+  }
 
-    manager.startTemplate(editor, template);
+  @Override
+  public String getTemplateString(@NotNull PsiElement element) {
+    String finalPart = JavaCodeStyleSettingsFacade.getInstance(element.getProject()).isGenerateFinalLocals() ? "final " : "";
+    return "for (" + finalPart + "$type$ $name$ : $expr$) {\n    $END$\n}";
   }
 }
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/FormatPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/FormatPostfixTemplate.java
index f312d44..0e61b45 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/FormatPostfixTemplate.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/FormatPostfixTemplate.java
@@ -15,17 +15,17 @@
  */
 package com.intellij.codeInsight.template.postfix.templates;
 
-import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.util.Condition;
 import com.intellij.psi.CommonClassNames;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiExpression;
 import com.intellij.psi.PsiType;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import static com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils.JAVA_PSI_INFO;
 
-public class FormatPostfixTemplate extends JavaStatementWrapPostfixTemplate {
+public class FormatPostfixTemplate extends StringBasedPostfixTemplate {
   private static final Condition<PsiElement> IS_STRING = new Condition<PsiElement>() {
     @Override
     public boolean value(PsiElement expr) {
@@ -39,24 +39,13 @@
 
 
   public FormatPostfixTemplate() {
-    super("format", "String.format(expr);", JAVA_PSI_INFO, IS_STRING);
+    super("format", "String.format(expr)", JAVA_PSI_INFO, IS_STRING);
   }
 
-  @Override
-  protected void afterExpand(@NotNull PsiElement newElement, @NotNull Editor editor) {
-    editor.getCaretModel().moveToOffset(newElement.getTextRange().getEndOffset() - 2);
-    JavaPostfixTemplateProvider.doNotDeleteSemicolon(newElement.getContainingFile());
-  }
 
-  @NotNull
+  @Nullable
   @Override
-  protected String getHead() {
-    return "String.format(";
-  }
-
-  @NotNull
-  @Override
-  protected String getTail() {
-    return ", );";
+  public String getTemplateString(@NotNull PsiElement element) {
+    return "String.format($expr$, $END$);";
   }
 }
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/IntroduceFieldPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/IntroduceFieldPostfixTemplate.java
index 7d05472..40da7fd 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/IntroduceFieldPostfixTemplate.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/IntroduceFieldPostfixTemplate.java
@@ -25,7 +25,7 @@
 
 public class IntroduceFieldPostfixTemplate extends JavaPostfixTemplateWithChooser {
   public IntroduceFieldPostfixTemplate() {
-    super("field", "myField = expr;");
+    super("field", "myField = expr");
   }
 
   @Override
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/IntroduceVariablePostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/IntroduceVariablePostfixTemplate.java
index bde745a..57c03f9 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/IntroduceVariablePostfixTemplate.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/IntroduceVariablePostfixTemplate.java
@@ -31,7 +31,7 @@
 // todo: support for int[].var (parses as .class access!)
 public class IntroduceVariablePostfixTemplate extends JavaPostfixTemplateWithChooser {
   public IntroduceVariablePostfixTemplate() {
-    super("var", "T name = expr;");
+    super("var", "T name = expr");
   }
 
   @Override
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/JavaPostfixTemplateProvider.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/JavaPostfixTemplateProvider.java
index e629b03..148f4bb 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/JavaPostfixTemplateProvider.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/JavaPostfixTemplateProvider.java
@@ -114,7 +114,7 @@
           public void run() {
             ApplicationManager.getApplication().runWriteAction(new Runnable() {
               public void run() {
-                addedSemicolon.delete();
+                  addedSemicolon.delete();
               }
             });
           }
@@ -143,10 +143,6 @@
     });
   }
 
-  public static void doNotDeleteSemicolon(@NotNull PsiFile file) {
-    file.putUserData(ADDED_SEMICOLON, null);
-  }
-  
   private static boolean isSemicolonNeeded(@NotNull PsiFile file, @NotNull Editor editor) {
     return JavaCompletionContributor.semicolonNeeded(editor, file, CompletionInitializationContext.calcStartOffset(editor));
   }
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/JavaStatementWrapPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/JavaStatementWrapPostfixTemplate.java
deleted file mode 100644
index b88a702..0000000
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/JavaStatementWrapPostfixTemplate.java
+++ /dev/null
@@ -1,44 +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.codeInsight.template.postfix.templates;
-
-
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.util.Condition;
-import com.intellij.psi.PsiElement;
-import org.jetbrains.annotations.NotNull;
-
-public abstract class JavaStatementWrapPostfixTemplate extends StatementWrapPostfixTemplate {
-
-  protected JavaStatementWrapPostfixTemplate(@NotNull String name,
-                                             @NotNull String descr,
-                                             @NotNull PostfixTemplatePsiInfo psiInfo,
-                                             @NotNull Condition<PsiElement> typeChecker) {
-    super(name, descr, psiInfo, typeChecker);
-  }
-
-  @Override
-  protected void afterExpand(@NotNull PsiElement newElement, @NotNull Editor editor) {
-    super.afterExpand(newElement, editor);
-    JavaPostfixTemplateProvider.doNotDeleteSemicolon(newElement.getContainingFile());
-  }
-
-  @NotNull
-  @Override
-  protected String getTail() {
-    return ";";
-  }
-}
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ReturnStatementPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ReturnStatementPostfixTemplate.java
index 4f60680..2ce69c0 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ReturnStatementPostfixTemplate.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ReturnStatementPostfixTemplate.java
@@ -15,19 +15,22 @@
  */
 package com.intellij.codeInsight.template.postfix.templates;
 
+import com.intellij.psi.PsiElement;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import static com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils.IS_NON_VOID;
 import static com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils.JAVA_PSI_INFO;
 
-public class ReturnStatementPostfixTemplate extends JavaStatementWrapPostfixTemplate {
+public class ReturnStatementPostfixTemplate extends StringBasedPostfixTemplate {
   public ReturnStatementPostfixTemplate() {
-    super("return", "return expr;", JAVA_PSI_INFO, IS_NON_VOID);
+    super("return", "return expr", JAVA_PSI_INFO, IS_NON_VOID);
   }
 
-  @NotNull
+  @Nullable
   @Override
-  protected String getHead() {
-    return "return ";
+  public String getTemplateString(@NotNull PsiElement element) {
+
+    return "return $expr$;$END$";
   }
 }
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/SoutPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/SoutPostfixTemplate.java
index 1491418..b2074e7 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/SoutPostfixTemplate.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/SoutPostfixTemplate.java
@@ -15,25 +15,22 @@
  */
 package com.intellij.codeInsight.template.postfix.templates;
 
+import com.intellij.psi.PsiElement;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import static com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils.IS_NON_VOID;
 import static com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils.JAVA_PSI_INFO;
 
-public class SoutPostfixTemplate extends JavaStatementWrapPostfixTemplate {
+public class SoutPostfixTemplate extends StringBasedPostfixTemplate {
   public SoutPostfixTemplate() {
-    super("sout", "System.out.println(expr);", JAVA_PSI_INFO, IS_NON_VOID);
+    super("sout", "System.out.println(expr)", JAVA_PSI_INFO, IS_NON_VOID);
   }
 
-  @NotNull
-  @Override
-  protected String getHead() {
-    return "System.out.println(";
-  }
 
-  @NotNull
+  @Nullable
   @Override
-  protected String getTail() {
-    return ");";
+  public String getTemplateString(@NotNull PsiElement element) {
+    return "System.out.println($expr$);$END$";
   }
 }
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/SwitchStatementPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/SwitchStatementPostfixTemplate.java
index 21122d0..a1e9866 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/SwitchStatementPostfixTemplate.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/SwitchStatementPostfixTemplate.java
@@ -15,23 +15,19 @@
  */
 package com.intellij.codeInsight.template.postfix.templates;
 
-import com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.util.Condition;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import static com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils.JAVA_PSI_INFO;
 
-public class SwitchStatementPostfixTemplate extends JavaStatementWrapPostfixTemplate {
+public class SwitchStatementPostfixTemplate extends StringBasedPostfixTemplate {
   private static final Condition<PsiElement> SWITCH_TYPE = new Condition<PsiElement>() {
     @Override
     public boolean value(PsiElement expression) {
-      if (!(expression instanceof PsiExpression)) {
-        return false;
-      }
+      if (!(expression instanceof PsiExpression)) return false;
 
       PsiType type = ((PsiExpression)expression).getType();
 
@@ -44,7 +40,6 @@
       }
 
       if (type.equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
-        if (ApplicationManager.getApplication().isUnitTestMode()) return true; // todo: mock jdk 6 and 7
         PsiFile containingFile = expression.getContainingFile();
         if (containingFile instanceof PsiJavaFile) {
           LanguageLevel level = ((PsiJavaFile)containingFile).getLanguageLevel();
@@ -60,20 +55,9 @@
     super("switch", "switch (expr)", JAVA_PSI_INFO, SWITCH_TYPE);
   }
 
+  @Nullable
   @Override
-  protected void afterExpand(@NotNull PsiElement newStatement, @NotNull Editor editor) {
-    JavaPostfixTemplatesUtils.formatPsiCodeBlock(newStatement, editor);
-  }
-
-  @NotNull
-  @Override
-  protected String getHead() {
-    return "switch (";
-  }
-
-  @NotNull
-  @Override
-  protected String getTail() {
-    return ") {\nst;\n}";
+  public String getTemplateString(@NotNull PsiElement element) {
+    return "switch ($expr$){\n$END$\n}";
   }
 }
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/SynchronizedStatementPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/SynchronizedStatementPostfixTemplate.java
index b2f6fd2..5dbce11 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/SynchronizedStatementPostfixTemplate.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/SynchronizedStatementPostfixTemplate.java
@@ -15,34 +15,22 @@
  */
 package com.intellij.codeInsight.template.postfix.templates;
 
-import com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils;
-import com.intellij.openapi.editor.Editor;
 import com.intellij.psi.PsiElement;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import static com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils.IS_NOT_PRIMITIVE;
 import static com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils.JAVA_PSI_INFO;
 
-public class SynchronizedStatementPostfixTemplate extends JavaStatementWrapPostfixTemplate {
+public class SynchronizedStatementPostfixTemplate extends StringBasedPostfixTemplate {
   public SynchronizedStatementPostfixTemplate() {
     super("synchronized", "synchronized (expr)", JAVA_PSI_INFO, IS_NOT_PRIMITIVE);
   }
 
-  @Override
-  protected void afterExpand(@NotNull PsiElement newStatement, @NotNull Editor editor) {
-    JavaPostfixTemplatesUtils.formatPsiCodeBlock(newStatement, editor);
-  }
 
-  @NotNull
+  @Nullable
   @Override
-  protected String getHead() {
-    return "synchronized (";
+  public String getTemplateString(@NotNull PsiElement element) {
+    return "synchronized ($expr$) {\n$END$\n}";
   }
-
-  @NotNull
-  @Override
-  protected String getTail() {
-    return ") {\nst;\n}";
-  }
-
 }
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ThrowExceptionPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ThrowExceptionPostfixTemplate.java
index b8dbd64..bb30940 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ThrowExceptionPostfixTemplate.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ThrowExceptionPostfixTemplate.java
@@ -16,16 +16,18 @@
 package com.intellij.codeInsight.template.postfix.templates;
 
 import com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils;
+import com.intellij.psi.PsiElement;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
-public class ThrowExceptionPostfixTemplate extends JavaStatementWrapPostfixTemplate {
+public class ThrowExceptionPostfixTemplate extends StringBasedPostfixTemplate {
   public ThrowExceptionPostfixTemplate() {
-    super("throw", "throw expr;", JavaPostfixTemplatesUtils.JAVA_PSI_INFO, JavaPostfixTemplatesUtils.IS_THROWABLE);
+    super("throw", "throw expr", JavaPostfixTemplatesUtils.JAVA_PSI_INFO, JavaPostfixTemplatesUtils.IS_THROWABLE);
   }
 
-  @NotNull
+  @Nullable
   @Override
-  protected String getHead() {
-    return "throw ";
+  public String getTemplateString(@NotNull PsiElement element) {
+    return "throw $expr$;$END$";
   }
 }
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/TryStatementPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/TryStatementPostfixTemplate.java
index 0c58e42..71d1818 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/TryStatementPostfixTemplate.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/TryStatementPostfixTemplate.java
@@ -28,7 +28,7 @@
 public class TryStatementPostfixTemplate extends PostfixTemplate {
 
   protected TryStatementPostfixTemplate() {
-    super("try", "try { exp } catch(Ex e) { e.printStackTrace(); }");
+    super("try", "try { exp } catch(Exception e)");
   }
 
   @Override
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/TryWithResourcesPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/TryWithResourcesPostfixTemplate.java
index b112eec..3b2ffe5 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/TryWithResourcesPostfixTemplate.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/TryWithResourcesPostfixTemplate.java
@@ -38,7 +38,7 @@
 
 public class TryWithResourcesPostfixTemplate extends PostfixTemplate {
   protected TryWithResourcesPostfixTemplate() {
-    super("twr", "try(Type f = new Type()) {} catch (Ex e) {}");
+    super("twr", "try(Type f = new Type()) catch (Exception e)");
   }
 
   @Override
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/WhileStatementPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/WhileStatementPostfixTemplate.java
index ba301df..fbee12a 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/WhileStatementPostfixTemplate.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/WhileStatementPostfixTemplate.java
@@ -15,35 +15,28 @@
  */
 package com.intellij.codeInsight.template.postfix.templates;
 
-import com.intellij.openapi.editor.Editor;
-import com.intellij.psi.*;
+import com.intellij.psi.PsiElement;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import static com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils.IS_BOOLEAN;
 import static com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils.JAVA_PSI_INFO;
 
-public class WhileStatementPostfixTemplate extends TypedPostfixTemplate {
+public class WhileStatementPostfixTemplate extends StringBasedPostfixTemplate {
   public WhileStatementPostfixTemplate() {
     super("while", "while (expr)", JAVA_PSI_INFO, IS_BOOLEAN);
   }
 
-  @Override
-  public void expand(@NotNull PsiElement context, @NotNull Editor editor) {
-    PsiElement expression = myPsiInfo.getTopmostExpression(context);
-    assert expression != null;
 
-    PsiElementFactory factory = JavaPsiFacade.getElementFactory(context.getProject());
-    PsiWhileStatement whileStatement = (PsiWhileStatement)factory.createStatementFromText("while(expr)", context);
-    PsiExpression condition = whileStatement.getCondition();
-    assert condition != null;
-    condition.replace(expression);
-    PsiElement replacedWhileStatement = expression.replace(whileStatement);
-    if (replacedWhileStatement instanceof PsiWhileStatement) {
-      PsiJavaToken parenth = ((PsiWhileStatement)replacedWhileStatement).getRParenth();
-      if (parenth != null) {
-        editor.getCaretModel().moveToOffset(parenth.getTextRange().getEndOffset());
-      }
-    }
+  @Nullable
+  @Override
+  public String getTemplateString(@NotNull PsiElement element) {
+    return "while ($expr$)$END$";
+  }
+
+  @Override
+  protected boolean shouldReformat() {
+    return false;
   }
 }
 
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/util/JavaPostfixTemplatesUtils.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/util/JavaPostfixTemplatesUtils.java
index a6a13f7..e217175 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/util/JavaPostfixTemplatesUtils.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/util/JavaPostfixTemplatesUtils.java
@@ -16,14 +16,10 @@
 package com.intellij.codeInsight.template.postfix.util;
 
 import com.intellij.codeInsight.CodeInsightServicesUtil;
-import com.intellij.codeInsight.CodeInsightUtilCore;
 import com.intellij.codeInsight.template.postfix.templates.PostfixTemplatePsiInfoBase;
 import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.util.TextRange;
 import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.CodeStyleManager;
 import com.intellij.psi.util.InheritanceUtil;
 import com.intellij.psi.util.PsiExpressionTrimRenderer;
 import com.intellij.psi.util.PsiTreeUtil;
@@ -184,20 +180,7 @@
   @Nullable
   public static PsiExpression getTopmostExpression(PsiElement context) {
     PsiExpressionStatement statement = PsiTreeUtil.getNonStrictParentOfType(context, PsiExpressionStatement.class);
-    return statement != null ? PsiTreeUtil.getChildOfType(statement, PsiExpression.class) : null;
-  }
-
-  public static void formatPsiCodeBlock(PsiElement newStatement, Editor editor) {
-    CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(newStatement.getProject());
-    PsiElement statement = newStatement.replace(codeStyleManager.reformat(newStatement));
-
-    PsiCodeBlock type = PsiTreeUtil.getChildOfType(statement, PsiCodeBlock.class);
-    assert type != null;
-    PsiCodeBlock block = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(type);
-    TextRange range = block.getStatements()[0].getTextRange();
-    editor.getDocument().deleteString(range.getStartOffset(), range.getEndOffset());
-
-    editor.getCaretModel().moveToOffset(range.getStartOffset());
+    return statement != null ? statement.getExpression() : null;
   }
 }
 
diff --git a/java/java-impl/src/com/intellij/codeInspection/RedundantSuppressInspection.java b/java/java-impl/src/com/intellij/codeInspection/RedundantSuppressInspection.java
deleted file mode 100644
index 22d61cb..0000000
--- a/java/java-impl/src/com/intellij/codeInspection/RedundantSuppressInspection.java
+++ /dev/null
@@ -1,32 +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.codeInspection;
-
-import com.intellij.codeInspection.ex.GlobalInspectionContextBase;
-import com.intellij.codeInspection.ex.InspectionManagerEx;
-import com.intellij.psi.PsiFile;
-
-/**
- * User: anna
- * Date: 11/27/13
- */
-public class RedundantSuppressInspection extends RedundantSuppressInspectionBase {
-  @Override
-  protected GlobalInspectionContextBase createContext(PsiFile file) {
-    final InspectionManagerEx inspectionManagerEx = ((InspectionManagerEx)InspectionManager.getInstance(file.getProject()));
-    return inspectionManagerEx.createNewGlobalContext(false);
-  }
-}
diff --git a/java/java-impl/src/com/intellij/codeInspection/RemoveAssignmentFix.java b/java/java-impl/src/com/intellij/codeInspection/RemoveAssignmentFix.java
new file mode 100644
index 0000000..b80e3a0
--- /dev/null
+++ b/java/java-impl/src/com/intellij/codeInspection/RemoveAssignmentFix.java
@@ -0,0 +1,65 @@
+/*
+ * 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.codeInspection;
+
+import com.intellij.codeInsight.FileModificationService;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.util.PsiUtil;
+import org.jetbrains.annotations.NotNull;
+
+public class RemoveAssignmentFix extends RemoveInitializerFix {
+  @NotNull
+  @Override
+  public String getName() {
+    return InspectionsBundle.message("inspection.unused.assignment.remove.assignment.quickfix");
+  }
+
+  @Override
+  public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
+    final PsiElement element = descriptor.getPsiElement();
+    final PsiElement parent;
+    if (element instanceof PsiReferenceExpression) {
+      parent = element.getParent();
+    } else {
+      parent = element;
+    }
+    if (!(parent instanceof PsiAssignmentExpression)) return;
+    final PsiExpression rExpression = ((PsiAssignmentExpression)parent).getRExpression();
+    final PsiElement gParent = parent.getParent();
+    if (gParent instanceof PsiExpression && rExpression != null) {
+      if (!FileModificationService.getInstance().prepareFileForWrite(gParent.getContainingFile())) return;
+      if (gParent instanceof PsiParenthesizedExpression) {
+        gParent.replace(rExpression);
+      } else {
+        parent.replace(rExpression);
+      }
+      return;
+    }
+
+    PsiElement resolve = null;
+    if (element instanceof PsiReferenceExpression) {
+      resolve = ((PsiReferenceExpression)element).resolve();
+    } else {
+      final PsiExpression lExpr = PsiUtil.deparenthesizeExpression(((PsiAssignmentExpression)parent).getLExpression());
+      if (lExpr instanceof PsiReferenceExpression) {
+        resolve = ((PsiReferenceExpression)lExpr).resolve();
+      }
+    }
+    if (!(resolve instanceof PsiVariable)) return;
+    sideEffectAwareRemove(project, rExpression, parent, (PsiVariable)resolve);
+  }
+}
diff --git a/java/java-impl/src/com/intellij/codeInspection/RemoveInitializerFix.java b/java/java-impl/src/com/intellij/codeInspection/RemoveInitializerFix.java
new file mode 100644
index 0000000..58755b0
--- /dev/null
+++ b/java/java-impl/src/com/intellij/codeInspection/RemoveInitializerFix.java
@@ -0,0 +1,98 @@
+/*
+ * 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.codeInspection;
+
+import com.intellij.codeInsight.FileModificationService;
+import com.intellij.codeInsight.daemon.impl.quickfix.RemoveUnusedVariableFix;
+import com.intellij.codeInsight.daemon.impl.quickfix.RemoveUnusedVariableUtil;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.fileEditor.FileEditorManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.util.PsiExpressionTrimRenderer;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class RemoveInitializerFix implements LocalQuickFix {
+  private static final Logger LOG = Logger.getInstance("#" + RemoveInitializerFix.class.getName());
+
+  @Override
+  @NotNull
+  public String getName() {
+    return InspectionsBundle.message("inspection.unused.assignment.remove.quickfix");
+  }
+
+  @Override
+  public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
+    final PsiElement psiInitializer = descriptor.getPsiElement();
+    if (!(psiInitializer instanceof PsiExpression)) return;
+    if (!(psiInitializer.getParent() instanceof PsiVariable)) return;
+
+    final PsiVariable variable = (PsiVariable)psiInitializer.getParent();
+    sideEffectAwareRemove(project, psiInitializer, psiInitializer, variable);
+  }
+
+  protected void sideEffectAwareRemove(Project project, PsiElement psiInitializer, PsiElement elementToDelete, PsiVariable variable) {
+    if (!FileModificationService.getInstance().prepareFileForWrite(elementToDelete.getContainingFile())) return;
+
+    final PsiElement declaration = variable.getParent();
+    final List<PsiElement> sideEffects = new ArrayList<PsiElement>();
+    boolean hasSideEffects = RemoveUnusedVariableUtil.checkSideEffects(psiInitializer, variable, sideEffects);
+    int res = RemoveUnusedVariableUtil.DELETE_ALL;
+    if (hasSideEffects) {
+      hasSideEffects = PsiUtil.isStatement(psiInitializer);
+      res = RemoveUnusedVariableFix.showSideEffectsWarning(sideEffects, variable,
+                                                           FileEditorManager.getInstance(project).getSelectedTextEditor(),
+                                                           hasSideEffects, sideEffects.get(0).getText(),
+                                                           variable.getTypeElement().getText() +
+                                                           " " +
+                                                           variable.getName() +
+                                                           ";<br>" +
+                                                           PsiExpressionTrimRenderer
+                                                             .render((PsiExpression)psiInitializer)
+      );
+    }
+    try {
+      if (res == RemoveUnusedVariableUtil.DELETE_ALL) {
+        elementToDelete.delete();
+      }
+      else if (res == RemoveUnusedVariableUtil.MAKE_STATEMENT) {
+        final PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();
+        final PsiStatement statementFromText = factory.createStatementFromText(psiInitializer.getText() + ";", null);
+        final PsiElement parent = elementToDelete.getParent();
+        if (parent instanceof PsiExpressionStatement) {
+          parent.replace(statementFromText);
+        } else {
+          declaration.getParent().addAfter(statementFromText, declaration);
+          elementToDelete.delete();
+        }
+      }
+    }
+    catch (IncorrectOperationException e) {
+      LOG.error(e);
+    }
+  }
+  
+  @Override
+  @NotNull
+  public String getFamilyName() {
+    return getName();
+  }
+}
diff --git a/java/java-impl/src/com/intellij/codeInspection/SuppressManagerImpl.java b/java/java-impl/src/com/intellij/codeInspection/SuppressManagerImpl.java
deleted file mode 100644
index ca3131d..0000000
--- a/java/java-impl/src/com/intellij/codeInspection/SuppressManagerImpl.java
+++ /dev/null
@@ -1,90 +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.
- */
-
-/*
- * User: anna
- * Date: 24-Dec-2007
- */
-package com.intellij.codeInspection;
-
-import com.intellij.codeInsight.daemon.HighlightDisplayKey;
-import com.intellij.psi.PsiDocCommentOwner;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiModifierListOwner;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collection;
-
-public class SuppressManagerImpl extends SuppressManager {
-  @Override
-  @NotNull
-  public SuppressIntentionAction[] createSuppressActions(@NotNull final HighlightDisplayKey displayKey) {
-    SuppressQuickFix[] batchSuppressActions = createBatchSuppressActions(displayKey);
-    return SuppressIntentionActionFromFix.convertBatchToSuppressIntentionActions(batchSuppressActions);
-  }
-
-  @Override
-  public boolean isSuppressedFor(@NotNull final PsiElement element, final String toolId) {
-    return JavaSuppressionUtil.getElementToolSuppressedIn(element, toolId) != null;
-  }
-
-  @Override
-  @Nullable
-  public PsiElement getElementMemberSuppressedIn(@NotNull final PsiDocCommentOwner owner, final String inspectionToolID) {
-    return JavaSuppressionUtil.getElementMemberSuppressedIn(owner, inspectionToolID);
-  }
-
-  @Override
-  @Nullable
-  public PsiElement getAnnotationMemberSuppressedIn(@NotNull final PsiModifierListOwner owner, final String inspectionToolID) {
-    return JavaSuppressionUtil.getAnnotationMemberSuppressedIn(owner, inspectionToolID);
-  }
-
-  @Override
-  @Nullable
-  public PsiElement getDocCommentToolSuppressedIn(@NotNull final PsiDocCommentOwner owner, final String inspectionToolID) {
-    return JavaSuppressionUtil.getDocCommentToolSuppressedIn(owner, inspectionToolID);
-  }
-
-  @Override
-  @NotNull
-  public Collection<String> getInspectionIdsSuppressedInAnnotation(@NotNull final PsiModifierListOwner owner) {
-    return JavaSuppressionUtil.getInspectionIdsSuppressedInAnnotation(owner);
-  }
-
-  @Override
-  @Nullable
-  public String getSuppressedInspectionIdsIn(@NotNull PsiElement element) {
-    return JavaSuppressionUtil.getSuppressedInspectionIdsIn(element);
-  }
-
-  @Override
-  @Nullable
-  public PsiElement getElementToolSuppressedIn(@NotNull final PsiElement place, final String toolId) {
-    return JavaSuppressionUtil.getElementToolSuppressedIn(place, toolId);
-  }
-
-  @Override
-  public boolean canHave15Suppressions(@NotNull final PsiElement file) {
-    return JavaSuppressionUtil.canHave15Suppressions(file);
-  }
-
-  @Override
-  public boolean alreadyHas14Suppressions(@NotNull final PsiDocCommentOwner commentOwner) {
-    return JavaSuppressionUtil.alreadyHas14Suppressions(commentOwner);
-  }
-}
diff --git a/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java b/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java
index e80dd14..73d8848 100644
--- a/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java
@@ -16,11 +16,7 @@
 package com.intellij.codeInspection.dataFlow;
 
 import com.intellij.codeInsight.NullableNotNullDialog;
-import com.intellij.codeInspection.AddAssertStatementFix;
-import com.intellij.codeInspection.InspectionsBundle;
-import com.intellij.codeInspection.LocalQuickFix;
-import com.intellij.codeInspection.SurroundWithIfFix;
-import com.intellij.codeInspection.defUse.DefUseInspection;
+import com.intellij.codeInspection.*;
 import com.intellij.ide.DataManager;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.project.Project;
@@ -54,7 +50,7 @@
     if (toRemove && !onTheFly) {
       return LocalQuickFix.EMPTY_ARRAY;
     }
-    return new LocalQuickFix[]{toRemove ? new DefUseInspection.RemoveAssignmentFix() : createSimplifyToAssignmentFix()};
+    return new LocalQuickFix[]{toRemove ? new RemoveAssignmentFix() : createSimplifyToAssignmentFix()};
   }
 
   @Override
diff --git a/java/java-impl/src/com/intellij/codeInspection/dataFlow/EditContractIntention.java b/java/java-impl/src/com/intellij/codeInspection/dataFlow/EditContractIntention.java
index c962e2e..66c438d 100644
--- a/java/java-impl/src/com/intellij/codeInspection/dataFlow/EditContractIntention.java
+++ b/java/java-impl/src/com/intellij/codeInspection/dataFlow/EditContractIntention.java
@@ -83,7 +83,7 @@
       public String getErrorText(String inputString) {
         if (StringUtil.isEmpty(inputString)) return null;
 
-        return DataFlowInspectionBase.checkContract(method, inputString);
+        return ContractInspection.checkContract(method, inputString);
       }
 
       @Override
diff --git a/java/java-impl/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java b/java/java-impl/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java
deleted file mode 100644
index 2b216dc..0000000
--- a/java/java-impl/src/com/intellij/codeInspection/deadCode/DummyEntryPointsTool.java
+++ /dev/null
@@ -1,64 +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.deadCode;
-
-import com.intellij.analysis.AnalysisScope;
-import com.intellij.codeInspection.GlobalInspectionContext;
-import com.intellij.codeInspection.InspectionManager;
-import com.intellij.codeInspection.InspectionsBundle;
-import com.intellij.codeInspection.ProblemDescriptionsProcessor;
-import com.intellij.codeInspection.ex.JobDescriptor;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author max
- */
-public class DummyEntryPointsTool extends UnusedDeclarationInspection {
-  public DummyEntryPointsTool() {
-  }
-
-  @Override
-  public void runInspection(@NotNull AnalysisScope scope,
-                            @NotNull InspectionManager manager,
-                            @NotNull GlobalInspectionContext globalContext,
-                            @NotNull ProblemDescriptionsProcessor problemDescriptionsProcessor) {
-  }
-
-  @Nullable
-  @Override
-  public JobDescriptor[] getAdditionalJobs() {
-    return JobDescriptor.EMPTY_ARRAY;
-  }
-
-  @Override
-  @NotNull
-  public String getDisplayName() {
-    return InspectionsBundle.message("inspection.dead.code.entry.points.display.name");
-  }
-
-  @Override
-  @NotNull
-  public String getGroupDisplayName() {
-    return "";
-  }
-
-  @Override
-  @NotNull
-  public String getShortName() {
-    return "";
-  }
-}
diff --git a/java/java-impl/src/com/intellij/codeInspection/deadCode/RefEntryPointFilter.java b/java/java-impl/src/com/intellij/codeInspection/deadCode/RefEntryPointFilter.java
deleted file mode 100644
index 03ab979..0000000
--- a/java/java-impl/src/com/intellij/codeInspection/deadCode/RefEntryPointFilter.java
+++ /dev/null
@@ -1,38 +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.
- */
-
-/*
- * Created by IntelliJ IDEA.
- * User: max
- * Date: Dec 2, 2001
- * Time: 12:05:14 AM
- * To change template for new class use
- * Code Style | Class Templates options (Tools | IDE Options).
- */
-package com.intellij.codeInspection.deadCode;
-
-import com.intellij.codeInspection.reference.RefJavaElement;
-import com.intellij.codeInspection.reference.RefParameter;
-import com.intellij.codeInspection.util.RefFilter;
-import org.jetbrains.annotations.NotNull;
-
-public class RefEntryPointFilter extends RefFilter {
-  @Override
-  public int getElementProblemCount(@NotNull RefJavaElement refElement) {
-    if (refElement instanceof RefParameter) return 0;
-    return refElement.isEntry() && !refElement.isSyntheticJSP() ? 1 : 0;
-  }
-}
diff --git a/java/java-impl/src/com/intellij/codeInspection/defUse/DefUseInspection.java b/java/java-impl/src/com/intellij/codeInspection/defUse/DefUseInspection.java
index 5d2ab66..33c52c7 100644
--- a/java/java-impl/src/com/intellij/codeInspection/defUse/DefUseInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/defUse/DefUseInspection.java
@@ -24,26 +24,10 @@
  */
 package com.intellij.codeInspection.defUse;
 
-import com.intellij.codeInsight.FileModificationService;
-import com.intellij.codeInsight.daemon.impl.quickfix.RemoveUnusedVariableFix;
-import com.intellij.codeInsight.daemon.impl.quickfix.RemoveUnusedVariableUtil;
-import com.intellij.codeInspection.InspectionsBundle;
-import com.intellij.codeInspection.LocalQuickFix;
-import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.codeInspection.*;
 import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.fileEditor.FileEditorManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.util.PsiExpressionTrimRenderer;
-import com.intellij.psi.util.PsiUtil;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.List;
 
 public class DefUseInspection extends DefUseInspectionBase {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.defUse.DefUseInspection");
 
   @Override
   protected LocalQuickFix createRemoveInitializerFix() {
@@ -54,99 +38,4 @@
   protected LocalQuickFix createRemoveAssignmentFix() {
     return new RemoveAssignmentFix();
   }
-  
-  public static class RemoveAssignmentFix extends RemoveInitializerFix {
-    @NotNull
-    @Override
-    public String getName() {
-      return InspectionsBundle.message("inspection.unused.assignment.remove.assignment.quickfix");
-    }
-
-    @Override
-    public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
-      final PsiElement left = descriptor.getPsiElement();
-      if (!(left instanceof PsiReferenceExpression)) return;
-      final PsiElement parent = left.getParent();
-      if (!(parent instanceof PsiAssignmentExpression)) return;
-      final PsiExpression rExpression = ((PsiAssignmentExpression)parent).getRExpression();
-      final PsiElement gParent = parent.getParent();
-      if (gParent instanceof PsiExpression && rExpression != null) {
-        if (!FileModificationService.getInstance().prepareFileForWrite(gParent.getContainingFile())) return;
-        if (gParent instanceof PsiParenthesizedExpression) {
-          gParent.replace(rExpression);
-        } else {
-          parent.replace(rExpression);
-        }
-        return;
-      }
-
-      final PsiElement resolve = ((PsiReferenceExpression)left).resolve();
-      if (!(resolve instanceof PsiVariable)) return;
-      sideEffectAwareRemove(project, rExpression, parent, (PsiVariable)resolve);
-    }
-  }
-  private static class RemoveInitializerFix implements LocalQuickFix {
-    @Override
-    @NotNull
-    public String getName() {
-      return InspectionsBundle.message("inspection.unused.assignment.remove.quickfix");
-    }
-
-    @Override
-    public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
-      final PsiElement psiInitializer = descriptor.getPsiElement();
-      if (!(psiInitializer instanceof PsiExpression)) return;
-      if (!(psiInitializer.getParent() instanceof PsiVariable)) return;
-
-      final PsiVariable variable = (PsiVariable)psiInitializer.getParent();
-      sideEffectAwareRemove(project, psiInitializer, psiInitializer, variable);
-    }
-
-    protected void sideEffectAwareRemove(Project project, PsiElement psiInitializer, PsiElement elementToDelete, PsiVariable variable) {
-      if (!FileModificationService.getInstance().prepareFileForWrite(elementToDelete.getContainingFile())) return;
-
-      final PsiElement declaration = variable.getParent();
-      final List<PsiElement> sideEffects = new ArrayList<PsiElement>();
-      boolean hasSideEffects = RemoveUnusedVariableUtil.checkSideEffects(psiInitializer, variable, sideEffects);
-      int res = RemoveUnusedVariableUtil.DELETE_ALL;
-      if (hasSideEffects) {
-        hasSideEffects = PsiUtil.isStatement(psiInitializer);
-        res = RemoveUnusedVariableFix.showSideEffectsWarning(sideEffects, variable,
-                                                             FileEditorManager.getInstance(project).getSelectedTextEditor(),
-                                                             hasSideEffects, sideEffects.get(0).getText(),
-                                                             variable.getTypeElement().getText() +
-                                                             " " +
-                                                             variable.getName() +
-                                                             ";<br>" +
-                                                             PsiExpressionTrimRenderer
-                                                               .render((PsiExpression)psiInitializer)
-        );
-      }
-      try {
-        if (res == RemoveUnusedVariableUtil.DELETE_ALL) {
-          elementToDelete.delete();
-        }
-        else if (res == RemoveUnusedVariableUtil.MAKE_STATEMENT) {
-          final PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();
-          final PsiStatement statementFromText = factory.createStatementFromText(psiInitializer.getText() + ";", null);
-          final PsiElement parent = elementToDelete.getParent();
-          if (parent instanceof PsiExpressionStatement) {
-            parent.replace(statementFromText);
-          } else {
-            declaration.getParent().addAfter(statementFromText, declaration);
-            elementToDelete.delete();
-          }
-        }
-      }
-      catch (IncorrectOperationException e) {
-        LOG.error(e);
-      }
-    }
-    
-    @Override
-    @NotNull
-    public String getFamilyName() {
-      return getName();
-    }
-  }
 }
diff --git a/java/java-impl/src/com/intellij/codeInspection/inconsistentLanguageLevel/InconsistentLanguageLevelInspection.java b/java/java-impl/src/com/intellij/codeInspection/inconsistentLanguageLevel/InconsistentLanguageLevelInspection.java
deleted file mode 100644
index ecd1dca..0000000
--- a/java/java-impl/src/com/intellij/codeInspection/inconsistentLanguageLevel/InconsistentLanguageLevelInspection.java
+++ /dev/null
@@ -1,146 +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.
- */
-
-/*
- * User: anna
- * Date: 03-Nov-2009
- */
-package com.intellij.codeInspection.inconsistentLanguageLevel;
-
-import com.intellij.analysis.AnalysisScope;
-import com.intellij.codeInsight.daemon.GroupNames;
-import com.intellij.codeInspection.*;
-import com.intellij.codeInspection.reference.RefManager;
-import com.intellij.codeInspection.reference.RefModule;
-import com.intellij.codeInspection.unnecessaryModuleDependency.UnnecessaryModuleDependencyInspection;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleUtilCore;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.project.ProjectBundle;
-import com.intellij.openapi.roots.*;
-import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService;
-import com.intellij.pom.java.LanguageLevel;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiElementVisitor;
-import gnu.trove.THashSet;
-import org.jetbrains.annotations.Nls;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Set;
-
-public class InconsistentLanguageLevelInspection extends GlobalInspectionTool {
-  @Override
-  public boolean isGraphNeeded() {
-    return false;
-  }
-
-  @Override
-  public void runInspection(@NotNull AnalysisScope scope,
-                            @NotNull InspectionManager manager,
-                            @NotNull GlobalInspectionContext globalContext,
-                            @NotNull ProblemDescriptionsProcessor problemProcessor) {
-    final Set<Module> modules = new THashSet<Module>();
-    scope.accept(new PsiElementVisitor(){
-      @Override
-      public void visitElement(PsiElement element) {
-        final Module module = ModuleUtilCore.findModuleForPsiElement(element);
-        if (module != null) {
-          modules.add(module);
-        }
-      }
-    });
-
-    LanguageLevel projectLanguageLevel = LanguageLevelProjectExtension.getInstance(manager.getProject()).getLanguageLevel();
-    for (Module module : modules) {
-      LanguageLevel languageLevel = LanguageLevelModuleExtension.getInstance(module).getLanguageLevel();
-      if (languageLevel == null) {
-        languageLevel = projectLanguageLevel;
-      }
-      RefManager refManager = globalContext.getRefManager();
-      final RefModule refModule = refManager.getRefModule(module);
-      for (OrderEntry entry : ModuleRootManager.getInstance(module).getOrderEntries()) {
-        if (!(entry instanceof ModuleOrderEntry)) continue;
-        final Module dependantModule = ((ModuleOrderEntry)entry).getModule();
-        if (dependantModule == null) continue;
-        LanguageLevel dependantLanguageLevel = LanguageLevelModuleExtension.getInstance(dependantModule).getLanguageLevel();
-        if (dependantLanguageLevel == null) {
-          dependantLanguageLevel = projectLanguageLevel;
-        }
-        if (languageLevel.compareTo(dependantLanguageLevel) < 0) {
-          final CommonProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
-            "Inconsistent language level settings: module " + module.getName() + " with language level " + languageLevel +
-            " depends on module " + dependantModule.getName() +" with language level " + dependantLanguageLevel,
-            new UnnecessaryModuleDependencyInspection.RemoveModuleDependencyFix(module, dependantModule),
-            new OpenModuleSettingsFix(module));
-          problemProcessor.addProblemElement(refModule, problemDescriptor);
-        }
-      }
-    }
-  }
-
-  @Override
-  public boolean isEnabledByDefault() {
-    return false;
-  }
-
-  @Override
-  @Nls
-  @NotNull
-  public String getGroupDisplayName() {
-    return GroupNames.MODULARIZATION_GROUP_NAME;
-  }
-
-  @Override
-  @NotNull
-  public String getDisplayName() {
-    return "Inconsistent language level settings";
-  }
-
-  @Override
-  @NonNls
-  @NotNull
-  public String getShortName() {
-    return "InconsistentLanguageLevel";
-  }
-
-  private static class OpenModuleSettingsFix implements QuickFix {
-    private final Module myModule;
-
-    private OpenModuleSettingsFix(Module module) {
-      myModule = module;
-    }
-
-    @Override
-    @NotNull
-    public String getName() {
-      return "Open module " + myModule.getName() + " settings";
-    }
-
-    @Override
-    @NotNull
-    public String getFamilyName() {
-      return getName();
-    }
-
-    @Override
-    public void applyFix(@NotNull Project project, @NotNull CommonProblemDescriptor descriptor) {
-      if (!myModule.isDisposed()) {
-        ProjectSettingsService.getInstance(project).showModuleConfigurationDialog(myModule.getName(), ProjectBundle.message("modules.classpath.title"));
-      }
-    }
-  }
-}
diff --git a/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java b/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java
deleted file mode 100644
index ea4b7da..0000000
--- a/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java
+++ /dev/null
@@ -1,511 +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.reference;
-
-import com.intellij.codeInspection.*;
-import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
-import com.intellij.codeInspection.ex.*;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.Disposer;
-import com.intellij.openapi.util.Ref;
-import com.intellij.openapi.util.UserDataCache;
-import com.intellij.psi.*;
-import com.intellij.psi.javadoc.PsiDocComment;
-import com.intellij.psi.javadoc.PsiDocTag;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.util.IncorrectOperationException;
-import gnu.trove.THashMap;
-import org.jdom.Element;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author anna
- * Date: 20-Dec-2007
- */
-public class RefJavaManagerImpl extends RefJavaManager {
-  private static final Logger LOG = Logger.getInstance("#" + RefJavaManagerImpl.class.getName());
-  private PsiMethod myAppMainPattern;
-  private PsiMethod myAppPremainPattern;
-  private PsiMethod myAppAgentmainPattern;
-  private PsiClass myApplet;
-  private PsiClass myServlet;
-  private RefPackage myDefaultPackage;
-  private THashMap<String, RefPackage> myPackages;
-  private final RefManagerImpl myRefManager;
-  private PsiElementVisitor myProjectIterator;
-  private EntryPointsManager myEntryPointsManager;
-
-  public RefJavaManagerImpl(@NotNull RefManagerImpl manager) {
-    myRefManager = manager;
-    final Project project = manager.getProject();
-    final PsiManager psiManager = PsiManager.getInstance(project);
-    PsiElementFactory factory = JavaPsiFacade.getInstance(psiManager.getProject()).getElementFactory();
-    try {
-      myAppMainPattern = factory.createMethodFromText("void main(String[] args);", null);
-      myAppPremainPattern = factory.createMethodFromText("void premain(String[] args, java.lang.instrument.Instrumentation i);", null);
-      myAppAgentmainPattern = factory.createMethodFromText("void agentmain(String[] args, java.lang.instrument.Instrumentation i);", null);
-    }
-    catch (IncorrectOperationException e) {
-      LOG.error(e);
-    }
-
-    myApplet = JavaPsiFacade.getInstance(psiManager.getProject()).findClass("java.applet.Applet", GlobalSearchScope.allScope(project));
-    myServlet = JavaPsiFacade.getInstance(psiManager.getProject()).findClass("javax.servlet.Servlet", GlobalSearchScope.allScope(project));
-
-  }
-
-  @Override
-  public RefPackage getPackage(String packageName) {
-    if (myPackages == null) {
-      myPackages = new THashMap<String, RefPackage>();
-    }
-
-    RefPackage refPackage = myPackages.get(packageName);
-    if (refPackage == null) {
-      refPackage = new RefPackageImpl(packageName, myRefManager);
-      myPackages.put(packageName, refPackage);
-
-      int dotIndex = packageName.lastIndexOf('.');
-      if (dotIndex >= 0) {
-        ((RefPackageImpl)getPackage(packageName.substring(0, dotIndex))).add(refPackage);
-      }
-      else {
-        ((RefProjectImpl)myRefManager.getRefProject()).add(refPackage);
-      }
-    }
-
-    return refPackage;
-  }
-
-
-  public boolean isEntryPoint(final RefElement element) {
-    UnusedDeclarationInspection tool = getDeadCodeTool(element);
-    return tool != null && tool.isEntryPoint(element);
-  }
-
-  @Nullable
-  private UnusedDeclarationInspection getDeadCodeTool(RefElement element) {
-    PsiFile file = ((RefElementImpl)element).getContainingFile();
-    if (file == null) return null;
-
-    return getDeadCodeTool(file);
-  }
-
-  private static final UserDataCache<Ref<UnusedDeclarationInspection>, PsiFile, RefManagerImpl> DEAD_CODE_TOOL = new UserDataCache<Ref<UnusedDeclarationInspection>, PsiFile, RefManagerImpl>("DEAD_CODE_TOOL") {
-    @Override
-    protected Ref<UnusedDeclarationInspection> compute(PsiFile file, RefManagerImpl refManager) {
-      Tools tools = ((GlobalInspectionContextImpl)refManager.getContext()).getTools().get(UnusedDeclarationInspection.SHORT_NAME);
-      InspectionToolWrapper toolWrapper = tools == null ? null : tools.getEnabledTool(file);
-      InspectionProfileEntry tool = toolWrapper == null ? null : toolWrapper.getTool();
-      return Ref.create(tool instanceof UnusedDeclarationInspection ? (UnusedDeclarationInspection)tool : null);
-    }
-  };
-
-  @Nullable
-  private UnusedDeclarationInspection getDeadCodeTool(PsiElement element) {
-    PsiFile file = element.getContainingFile();
-    return file != null ? DEAD_CODE_TOOL.get(file, myRefManager).get() : null;
-  }
-
-  @Override
-  public RefPackage getDefaultPackage() {
-    if (myDefaultPackage == null) {
-      myDefaultPackage = getPackage(InspectionsBundle.message("inspection.reference.default.package"));
-    }
-    return myDefaultPackage;
-  }
-
-  @Override
-  public PsiMethod getAppMainPattern() {
-    return myAppMainPattern;
-  }
-
-  @Override
-  public PsiMethod getAppPremainPattern() {
-    return myAppPremainPattern;
-  }
-
-  @Override
-  public PsiMethod getAppAgentmainPattern() {
-    return myAppAgentmainPattern;
-  }
-
-  @Override
-  public PsiClass getApplet() {
-    return myApplet;
-  }
-
-  @Override
-  public PsiClass getServlet() {
-    return myServlet;
-  }
-
-  @Override
-  public RefParameter getParameterReference(PsiParameter param, int index) {
-    LOG.assertTrue(myRefManager.isValidPointForReference(), "References may become invalid after process is finished");
-    RefElement ref = myRefManager.getFromRefTable(param);
-
-    if (ref == null) {
-      ref = new RefParameterImpl(param, index, myRefManager);
-      ((RefParameterImpl)ref).initialize();
-      myRefManager.putToRefTable(param, ref);
-    }
-
-    return (RefParameter)ref;
-  }
-
-
-
-  @Override
-  public void iterate(@NotNull final RefVisitor visitor) {
-    if (myPackages != null) {
-      for (RefPackage refPackage : myPackages.values()) {
-        refPackage.accept(visitor);
-      }
-    }
-    for (RefElement refElement : myRefManager.getSortedElements()) {
-      if (refElement instanceof RefClass) {
-        RefClass refClass = (RefClass)refElement;
-        RefMethod refDefaultConstructor = refClass.getDefaultConstructor();
-        if (refDefaultConstructor instanceof RefImplicitConstructor) {
-          refClass.getDefaultConstructor().accept(visitor);
-        }
-      }
-    }
-  }
-
-  @Override
-  public void cleanup() {
-    if (myEntryPointsManager != null) {
-      Disposer.dispose(myEntryPointsManager);
-      myEntryPointsManager = null;
-    }
-    myPackages = null;
-    myApplet = null;
-    myAppMainPattern = null;
-    myAppPremainPattern = null;
-    myAppAgentmainPattern = null;
-    myServlet = null;
-    myDefaultPackage = null;
-    myProjectIterator = null;
-  }
-
-  @Override
-  public void removeReference(final RefElement refElement) {
-    if (refElement instanceof RefMethod) {
-      RefMethod refMethod = (RefMethod)refElement;
-      RefParameter[] params = refMethod.getParameters();
-      for (RefParameter param : params) {
-        myRefManager.removeReference(param);
-      }
-    }
-  }
-
-  @Override
-  @Nullable
-  public RefElement createRefElement(final PsiElement elem) {
-    if (elem instanceof PsiClass) {
-      return new RefClassImpl((PsiClass)elem, myRefManager);
-    }
-    else if (elem instanceof PsiMethod) {
-      final PsiMethod method = (PsiMethod)elem;
-      final RefElement ref = myRefManager.getReference(method.getContainingClass(), true);
-      if (ref instanceof RefClass) {
-        return new RefMethodImpl((RefClass)ref, method, myRefManager);
-      }
-    }
-    else if (elem instanceof PsiField) {
-      final PsiField field = (PsiField)elem;
-      final RefElement ref = myRefManager.getReference(field.getContainingClass(), true);
-      if (ref instanceof RefClass) {
-        return new RefFieldImpl((RefClass)ref, field, myRefManager);
-      }
-    }
-    else if (elem instanceof PsiJavaFile) {
-      return new RefJavaFileImpl((PsiJavaFile)elem, myRefManager);
-    }
-    return null;
-  }
-
-  @Override
-  @Nullable
-  public RefEntity getReference(final String type, final String fqName) {
-    if (METHOD.equals(type)) {
-      return RefMethodImpl.methodFromExternalName(myRefManager, fqName);
-    }
-    else if (CLASS.equals(type)) {
-      return RefClassImpl.classFromExternalName(myRefManager, fqName);
-    }
-    else if (FIELD.equals(type)) {
-      return RefFieldImpl.fieldFromExternalName(myRefManager, fqName);
-    }
-    else if (PARAMETER.equals(type)) {
-      return RefParameterImpl.parameterFromExternalName(myRefManager, fqName);
-    }
-    else if (PACKAGE.equals(type)) {
-      return RefPackageImpl.packageFromFQName(myRefManager, fqName);
-    }
-    return null;
-  }
-
-  @Override
-  @Nullable
-  public String getType(final RefEntity ref) {
-    if (ref instanceof RefMethod) {
-      return METHOD;
-    }
-    else if (ref instanceof RefClass) {
-      return CLASS;
-    }
-    else if (ref instanceof RefField) {
-      return FIELD;
-    }
-    else if (ref instanceof RefParameter) {
-      return PARAMETER;
-    }
-    else if (ref instanceof RefPackage) {
-      return PACKAGE;
-    }
-    return null;
-  }
-
-  @NotNull
-  @Override
-  public RefEntity getRefinedElement(@NotNull final RefEntity ref) {
-    if (ref instanceof RefImplicitConstructor) {
-      return ((RefImplicitConstructor)ref).getOwnerClass();
-    }
-    return ref;
-  }
-
-  @Override
-  public void visitElement(final PsiElement element) {
-    if (myProjectIterator == null) {
-      myProjectIterator = new MyJavaElementVisitor();
-    }
-    element.accept(myProjectIterator);
-  }
-
-  @Override
-  @Nullable
-  public String getGroupName(final RefEntity entity) {
-    if (entity instanceof RefFile && !(entity instanceof RefJavaFileImpl)) return null;
-    return RefJavaUtil.getInstance().getPackageName(entity);
-  }
-
-  @Override
-  public boolean belongsToScope(final PsiElement psiElement) {
-    return !(psiElement instanceof PsiTypeParameter);
-  }
-
-  @Override
-  public void export(@NotNull final RefEntity refEntity, @NotNull final Element element) {
-    if (refEntity instanceof RefElement) {
-      final SmartPsiElementPointer pointer = ((RefElement)refEntity).getPointer();
-      if (pointer != null) {
-        final PsiFile psiFile = pointer.getContainingFile();
-        if (psiFile instanceof PsiJavaFile) {
-          appendPackageElement(element, ((PsiJavaFile)psiFile).getPackageName());
-        }
-      }
-    }
-  }
-
-  @Override
-  public void onEntityInitialized(RefElement refElement, PsiElement psiElement) {
-    if (isEntryPoint(refElement)) {
-      getEntryPointsManager().addEntryPoint(refElement, false);
-    }
-
-    if (psiElement instanceof PsiClass) {
-      PsiClass psiClass = (PsiClass)psiElement;
-
-      EntryPointsManager entryPointsManager = getEntryPointsManager();
-      if (psiClass.isAnnotationType()){
-        entryPointsManager.addEntryPoint(refElement, false);
-        for (PsiMethod psiMethod : psiClass.getMethods()) {
-          entryPointsManager.addEntryPoint(myRefManager.getReference(psiMethod), false);
-        }
-      }
-      else if (psiClass.isEnum()) {
-        entryPointsManager.addEntryPoint(refElement, false);
-      }
-    }
-  }
-
-  private static void appendPackageElement(final Element element, final String packageName) {
-    final Element packageElement = new Element("package");
-    packageElement.addContent(packageName.isEmpty() ? InspectionsBundle.message("inspection.export.results.default") : packageName);
-    element.addContent(packageElement);
-  }
-
-  @Override
-  public EntryPointsManager getEntryPointsManager() {
-    if (myEntryPointsManager == null) {
-      final Project project = myRefManager.getProject();
-      myEntryPointsManager = new EntryPointsManagerImpl(project);
-      ((EntryPointsManagerBase)myEntryPointsManager).addAllPersistentEntries(EntryPointsManagerBase.getInstance(project));
-    }
-    return myEntryPointsManager;
-  }
-
-  private class MyJavaElementVisitor extends JavaElementVisitor {
-    private final RefJavaUtil myRefUtil;
-
-    public MyJavaElementVisitor() {
-      myRefUtil = RefJavaUtil.getInstance();
-    }
-
-    @Override
-    public void visitReferenceExpression(PsiReferenceExpression expression) {
-      visitElement(expression);
-    }
-
-    @Override
-    public void visitReferenceElement(PsiJavaCodeReferenceElement reference) {
-    }
-
-
-    @Override
-    public void visitReferenceParameterList(final PsiReferenceParameterList list) {
-      super.visitReferenceParameterList(list);
-      final PsiMember member = PsiTreeUtil.getParentOfType(list, PsiMember.class);
-
-      if (member instanceof PsiTypeParameter) {
-        final PsiMember owner = ((PsiTypeParameter)member).getOwner();
-        if (owner != null) {
-          for (PsiClassType type : ((PsiTypeParameter)member).getExtendsListTypes()) {
-            myRefUtil.addTypeReference(owner, type, myRefManager);
-          }
-        }
-      }
-
-      final PsiType[] typeArguments = list.getTypeArguments();
-      for (PsiType type : typeArguments) {
-        myRefUtil.addTypeReference(member, type, myRefManager);
-      }
-    }
-
-    @Override
-    public void visitClass(PsiClass aClass) {
-      if (!(aClass instanceof PsiTypeParameter)) {
-        super.visitClass(aClass);
-        RefElement refClass = myRefManager.getReference(aClass);
-        if (refClass != null) {
-          ((RefClassImpl)refClass).buildReferences();
-        }
-      }
-    }
-
-    @Override
-    public void visitMethod(final PsiMethod method) {
-      super.visitMethod(method);
-      final RefElement refElement = myRefManager.getReference(method);
-      if (refElement instanceof RefMethodImpl) {
-        ((RefMethodImpl)refElement).buildReferences();
-      }
-    }
-
-    @Override
-    public void visitField(final PsiField field) {
-      super.visitField(field);
-      final RefElement refElement = myRefManager.getReference(field);
-      if (refElement instanceof RefFieldImpl) {
-        ((RefFieldImpl)refElement).buildReferences();
-      }
-    }
-
-    @Override
-    public void visitDocComment(PsiDocComment comment) {
-      super.visitDocComment(comment);
-      final PsiDocTag[] tags = comment.getTags();
-      for (PsiDocTag tag : tags) {
-        if (Comparing.strEqual(tag.getName(), SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME)) {
-          final PsiElement[] dataElements = tag.getDataElements();
-          if (dataElements != null && dataElements.length > 0) {
-            final PsiModifierListOwner listOwner = PsiTreeUtil.getParentOfType(comment, PsiModifierListOwner.class);
-            if (listOwner != null) {
-              final RefElementImpl element = (RefElementImpl)myRefManager.getReference(listOwner);
-              if (element != null) {
-                String suppression = "";
-                for (PsiElement dataElement : dataElements) {
-                  suppression += "," + dataElement.getText();
-                }
-                element.addSuppression(suppression);
-              }
-            }
-          }
-        }
-      }
-    }
-
-    @Override
-    public void visitAnnotation(PsiAnnotation annotation) {
-      super.visitAnnotation(annotation);
-      if (Comparing.strEqual(annotation.getQualifiedName(), BatchSuppressManager.SUPPRESS_INSPECTIONS_ANNOTATION_NAME)) {
-        final PsiModifierListOwner listOwner = PsiTreeUtil.getParentOfType(annotation, PsiModifierListOwner.class);
-        if (listOwner != null) {
-          final RefElementImpl element = (RefElementImpl)myRefManager.getReference(listOwner);
-          if (element != null) {
-            StringBuilder buf = new StringBuilder();
-            final PsiNameValuePair[] nameValuePairs = annotation.getParameterList().getAttributes();
-            for (PsiNameValuePair nameValuePair : nameValuePairs) {
-              buf.append(",").append(nameValuePair.getText().replaceAll("[{}\"\"]", ""));
-            }
-            if (buf.length() > 0) {
-              element.addSuppression(buf.substring(1));
-            }
-          }
-        }
-      }
-    }
-
-    @Override
-    public void visitVariable(PsiVariable variable) {
-      super.visitVariable(variable);
-      myRefUtil.addTypeReference(variable, variable.getType(), myRefManager);
-    }
-
-    @Override
-    public void visitInstanceOfExpression(PsiInstanceOfExpression expression) {
-      super.visitInstanceOfExpression(expression);
-      final PsiTypeElement typeElement = expression.getCheckType();
-      if (typeElement != null) {
-        myRefUtil.addTypeReference(expression, typeElement.getType(), myRefManager);
-      }
-    }
-
-    @Override
-    public void visitThisExpression(PsiThisExpression expression) {
-      super.visitThisExpression(expression);
-      final PsiJavaCodeReferenceElement qualifier = expression.getQualifier();
-      if (qualifier != null) {
-        myRefUtil.addTypeReference(expression, expression.getType(), myRefManager);
-        RefClass ownerClass = myRefUtil.getOwnerClass(myRefManager, expression);
-        if (ownerClass != null) {
-          RefClassImpl refClass = (RefClassImpl)myRefManager.getReference(qualifier.resolve());
-          if (refClass != null) {
-            refClass.addInstanceReference(ownerClass);
-          }
-        }
-      }
-    }
-  }
-}
diff --git a/java/java-impl/src/com/intellij/codeInspection/sameParameterValue/SameParameterValueInspection.java b/java/java-impl/src/com/intellij/codeInspection/sameParameterValue/SameParameterValueInspection.java
index 12e26f8..baab93d 100644
--- a/java/java-impl/src/com/intellij/codeInspection/sameParameterValue/SameParameterValueInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/sameParameterValue/SameParameterValueInspection.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,10 +15,9 @@
  */
 package com.intellij.codeInspection.sameParameterValue;
 
-import com.intellij.analysis.AnalysisScope;
-import com.intellij.codeInsight.daemon.GroupNames;
-import com.intellij.codeInspection.*;
-import com.intellij.codeInspection.reference.*;
+import com.intellij.codeInspection.InspectionsBundle;
+import com.intellij.codeInspection.LocalQuickFix;
+import com.intellij.codeInspection.ProblemDescriptor;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
@@ -32,7 +31,6 @@
 import com.intellij.refactoring.util.InlineUtil;
 import com.intellij.util.IncorrectOperationException;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -41,102 +39,13 @@
 /**
  * @author max
  */
-public class SameParameterValueInspection extends GlobalJavaBatchInspectionTool {
-  private static final Logger LOG = Logger.getInstance("#" + SameParameterValueInspection.class.getName());
+public class SameParameterValueInspection extends SameParameterValueInspectionBase {
+  private static final Logger LOG = Logger.getInstance("#" + SameParameterValueInspectionBase.class.getName());
 
-  @Override
-  @Nullable
-  public CommonProblemDescriptor[] checkElement(@NotNull RefEntity refEntity,
-                                                @NotNull AnalysisScope scope,
-                                                @NotNull InspectionManager manager,
-                                                @NotNull GlobalInspectionContext globalContext,
-                                                @NotNull ProblemDescriptionsProcessor processor) {
-    List<ProblemDescriptor> problems = null;
-    if (refEntity instanceof RefMethod) {
-      final RefMethod refMethod = (RefMethod)refEntity;
-
-      if (refMethod.hasSuperMethods()) return null;
-
-      if (refMethod.isEntry()) return null;
-
-      RefParameter[] parameters = refMethod.getParameters();
-      for (RefParameter refParameter : parameters) {
-        String value = refParameter.getActualValueIfSame();
-        if (value != null) {
-          if (problems == null) problems = new ArrayList<ProblemDescriptor>(1);
-          final String paramName = refParameter.getName();
-          problems.add(manager.createProblemDescriptor(refParameter.getElement(), InspectionsBundle.message(
-            "inspection.same.parameter.problem.descriptor", "<code>" + paramName + "</code>", "<code>" + value + "</code>"),
-                                                       new InlineParameterValueFix(paramName, value),
-                                                       ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false));
-        }
-      }
-    }
-
-    return problems == null ? null : problems.toArray(new CommonProblemDescriptor[problems.size()]);
-  }
-
-
-  @Override
-  protected boolean queryExternalUsagesRequests(@NotNull final RefManager manager, @NotNull final GlobalJavaInspectionContext globalContext,
-                                                @NotNull final ProblemDescriptionsProcessor processor) {
-    manager.iterate(new RefJavaVisitor() {
-      @Override public void visitElement(@NotNull RefEntity refEntity) {
-        if (refEntity instanceof RefElement && processor.getDescriptions(refEntity) != null) {
-          refEntity.accept(new RefJavaVisitor() {
-            @Override public void visitMethod(@NotNull final RefMethod refMethod) {
-              globalContext.enqueueMethodUsagesProcessor(refMethod, new GlobalJavaInspectionContext.UsagesProcessor() {
-                @Override
-                public boolean process(PsiReference psiReference) {
-                  processor.ignoreElement(refMethod);
-                  return false;
-                }
-              });
-            }
-          });
-        }
-      }
-    });
-
-    return false;
-  }
-
-  @Override
-  @NotNull
-  public String getDisplayName() {
-    return InspectionsBundle.message("inspection.same.parameter.display.name");
-  }
-
-  @Override
-  @NotNull
-  public String getGroupDisplayName() {
-    return GroupNames.DECLARATION_REDUNDANCY;
-  }
-
-  @Override
-  @NotNull
-  public String getShortName() {
-    return "SameParameterValue";
-  }
-
-  @Override
-  @Nullable
-  public QuickFix getQuickFix(final String hint) {
-    if (hint == null) return null;
-    final int spaceIdx = hint.indexOf(' ');
-    if (spaceIdx == -1 || spaceIdx >= hint.length() - 1) return null; //invalid hint
-    final String paramName = hint.substring(0, spaceIdx);
-    final String value = hint.substring(spaceIdx + 1);
+  protected LocalQuickFix createFix(String paramName, String value) {
     return new InlineParameterValueFix(paramName, value);
   }
 
-  @Override
-  @Nullable
-  public String getHint(@NotNull final QuickFix fix) {
-    final InlineParameterValueFix valueFix = (InlineParameterValueFix)fix;
-    return valueFix.getParamName() + " " + valueFix.getValue();
-  }
-
   public static class InlineParameterValueFix implements LocalQuickFix {
     private final String myValue;
     private final String myParameterName;
@@ -147,6 +56,11 @@
     }
 
     @Override
+    public String toString() {
+      return getParamName() + " " + getValue();
+    }
+
+    @Override
     @NotNull
     public String getName() {
       return InspectionsBundle.message("inspection.same.parameter.fix.name", myParameterName, myValue);
diff --git a/java/java-impl/src/com/intellij/codeInspection/sillyAssignment/SillyAssignmentInspection.java b/java/java-impl/src/com/intellij/codeInspection/sillyAssignment/SillyAssignmentInspection.java
new file mode 100644
index 0000000..70edc6b
--- /dev/null
+++ b/java/java-impl/src/com/intellij/codeInspection/sillyAssignment/SillyAssignmentInspection.java
@@ -0,0 +1,31 @@
+/*
+ * 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.sillyAssignment;
+
+import com.intellij.codeInspection.LocalQuickFix;
+import com.intellij.codeInspection.RemoveAssignmentFix;
+
+/**
+ * User: anna
+ * Date: 15-Nov-2005
+ */
+public class SillyAssignmentInspection extends SillyAssignmentInspectionBase {
+
+  @Override
+  protected LocalQuickFix createRemoveAssignmentFix() {
+    return new RemoveAssignmentFix();
+  }
+}
diff --git a/java/java-impl/src/com/intellij/codeInspection/util/IgnorableRefFilter.java b/java/java-impl/src/com/intellij/codeInspection/util/IgnorableRefFilter.java
deleted file mode 100644
index 2a36345..0000000
--- a/java/java-impl/src/com/intellij/codeInspection/util/IgnorableRefFilter.java
+++ /dev/null
@@ -1,22 +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.util;
-
-import com.intellij.codeInspection.reference.RefElement;
-
-public abstract class IgnorableRefFilter extends RefFilter {
-  public abstract void addIgnoreList(RefElement refElement);
-}
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/ide/actions/CreateClassAction.java b/java/java-impl/src/com/intellij/ide/actions/CreateClassAction.java
index 570efa1..13c48c2 100644
--- a/java/java-impl/src/com/intellij/ide/actions/CreateClassAction.java
+++ b/java/java-impl/src/com/intellij/ide/actions/CreateClassAction.java
@@ -84,6 +84,11 @@
   }
 
   @Override
+  protected String removeExtension(String templateName, String className) {
+    return StringUtil.trimEnd(className, ".java");
+  }
+
+  @Override
   protected String getErrorTitle() {
     return IdeBundle.message("title.cannot.create.class");
   }
diff --git a/java/java-impl/src/com/intellij/psi/NonClasspathClassFinder.java b/java/java-impl/src/com/intellij/psi/NonClasspathClassFinder.java
deleted file mode 100644
index 7e98b36..0000000
--- a/java/java-impl/src/com/intellij/psi/NonClasspathClassFinder.java
+++ /dev/null
@@ -1,276 +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;
-
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.extensions.Extensions;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.impl.file.PsiPackageImpl;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.NonClasspathDirectoryScope;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.Processor;
-import com.intellij.util.containers.ContainerUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.*;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * @author peter
- */
-public abstract class NonClasspathClassFinder extends PsiElementFinder {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.psi.NonClasspathClassFinder");
-  private final AtomicLong myLastStamp = new AtomicLong();
-  protected final Project myProject;
-  private volatile List<VirtualFile> myCache;
-  private final PsiManager myManager;
-  private final String[] myFileExtensions;
-
-  public NonClasspathClassFinder(Project project, String... fileExtensions) {
-    myProject = project;
-    myManager = PsiManager.getInstance(myProject);
-    myFileExtensions = ArrayUtil.append(fileExtensions, "class");
-  }
-
-  protected List<VirtualFile> getClassRoots(@Nullable GlobalSearchScope scope) {
-    return getClassRoots();
-  }
-
-  protected List<VirtualFile> getClassRoots() {
-    List<VirtualFile> cache = myCache;
-    long stamp = myManager.getModificationTracker().getModificationCount();
-    if (myLastStamp.get() != stamp) {
-      cache = null;
-    }
-
-    if (cache != null && !cache.isEmpty()) {
-      for (VirtualFile file : cache) {
-        if (!file.isValid()) {
-          cache = null;
-          break;
-        }
-      }
-    }
-
-    if (cache == null) {
-      myCache = cache = calcClassRoots();
-      myLastStamp.set(stamp);
-    }
-    return cache;
-  }
-
-  @Override
-  public PsiClass findClass(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
-    final List<VirtualFile> classRoots = getClassRoots(scope);
-    if (classRoots.isEmpty()) {
-      return null;
-    }
-
-    final String relPath = qualifiedName.replace('.', '/');
-    for (final VirtualFile classRoot : classRoots) {
-      if (scope.contains(classRoot)) {
-        VirtualFile virtualFile = findFileByRelativePath(classRoot, relPath, myFileExtensions);
-        if (virtualFile != null) {
-          if (!virtualFile.isValid()) {
-            LOG.error(
-              "Invalid child of valid parent: " + virtualFile.getPath() + "; " + classRoot.isValid() + " path=" + classRoot.getPath());
-            return null;
-          }
-          final PsiFile file = myManager.findFile(virtualFile);
-          if (file instanceof PsiClassOwner) {
-            final PsiClass[] classes = ((PsiClassOwner)file).getClasses();
-            if (classes.length == 1) {
-              return classes[0];
-            }
-          }
-        }
-      }
-    }
-    return null;
-  }
-
-  protected abstract List<VirtualFile> calcClassRoots();
-
-  @NotNull
-  @Override
-  public PsiClass[] getClasses(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
-    final List<VirtualFile> classRoots = getClassRoots(scope);
-    if (classRoots.isEmpty()) {
-      return PsiClass.EMPTY_ARRAY;
-    }
-
-    List<PsiClass> result = new ArrayList<PsiClass>();
-    for (final VirtualFile classRoot : classRoots) {
-      if (scope.contains(classRoot)) {
-        final String pkgName = psiPackage.getQualifiedName();
-        final VirtualFile dir = classRoot.findFileByRelativePath(pkgName.replace('.', '/'));
-        if (dir != null && dir.isDirectory()) {
-          for (final VirtualFile file : dir.getChildren()) {
-            if (!file.isDirectory()) {
-              final PsiFile psi = myManager.findFile(file);
-              if (psi instanceof PsiClassOwner) {
-                ContainerUtil.addAll(result, ((PsiClassOwner)psi).getClasses());
-              }
-            }
-          }
-        }
-      }
-    }
-    return result.toArray(new PsiClass[result.size()]);
-  }
-
-
-  @NotNull
-  @Override
-  public Set<String> getClassNames(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
-    final List<VirtualFile> classRoots = getClassRoots(scope);
-    if (classRoots.isEmpty()) {
-      return Collections.emptySet();
-    }
-
-    final Set<String> result = new HashSet<String>();
-    for (final VirtualFile classRoot : classRoots) {
-      if (scope.contains(classRoot)) {
-        final String pkgName = psiPackage.getQualifiedName();
-        final VirtualFile dir = classRoot.findFileByRelativePath(pkgName.replace('.', '/'));
-        if (dir != null && dir.isDirectory()) {
-          for (final VirtualFile file : dir.getChildren()) {
-            if (!file.isDirectory() && ArrayUtil.contains(file.getExtension(), myFileExtensions)) {
-              result.add(file.getNameWithoutExtension());
-            }
-          }
-        }
-      }
-    }
-    return result;
-  }
-
-  @Override
-  public PsiPackage findPackage(@NotNull String qualifiedName) {
-    final List<VirtualFile> classRoots = getClassRoots();
-    if (classRoots.isEmpty()) {
-      return null;
-    }
-
-    for (final VirtualFile classRoot : classRoots) {
-      final VirtualFile dir = classRoot.findFileByRelativePath(qualifiedName.replace('.', '/'));
-      if (dir != null && dir.isDirectory()) {
-        return createPackage(qualifiedName);
-      }
-    }
-    return null;
-  }
-
-  private PsiPackageImpl createPackage(String qualifiedName) {
-    return new PsiPackageImpl(myManager, qualifiedName);
-  }
-
-  @Override
-  public boolean processPackageDirectories(@NotNull PsiPackage psiPackage,
-                                           @NotNull GlobalSearchScope scope,
-                                           @NotNull Processor<PsiDirectory> consumer,
-                                           boolean includeLibrarySources) {
-    final List<VirtualFile> classRoots = getClassRoots(scope);
-    if (classRoots.isEmpty()) {
-      return true;
-    }
-
-    final String qname = psiPackage.getQualifiedName();
-    final PsiManager psiManager = psiPackage.getManager();
-    for (final VirtualFile classRoot : classRoots) {
-      if (scope.contains(classRoot)) {
-        final VirtualFile dir = classRoot.findFileByRelativePath(qname.replace('.', '/'));
-        if (dir != null && dir.isDirectory()) {
-          final PsiDirectory psiDirectory = ApplicationManager.getApplication().runReadAction(new Computable<PsiDirectory>() {
-            @Override
-            @Nullable
-            public PsiDirectory compute() {
-              return dir.isValid() ? psiManager.findDirectory(dir) : null;
-            }
-          });
-          if (psiDirectory != null && !consumer.process(psiDirectory)) {
-            return false;
-          }
-        }
-      }
-    }
-    return true;
-  }
-
-  @NotNull
-  @Override
-  public PsiPackage[] getSubPackages(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
-    final List<VirtualFile> classRoots = getClassRoots(scope);
-    if (classRoots.isEmpty()) {
-      return super.getSubPackages(psiPackage, scope);
-    }
-
-    List<PsiPackage> result = new ArrayList<PsiPackage>();
-    for (final VirtualFile classRoot : classRoots) {
-      if (scope.contains(classRoot)) {
-        final String pkgName = psiPackage.getQualifiedName();
-        final VirtualFile dir = classRoot.findFileByRelativePath(pkgName.replace('.', '/'));
-        if (dir != null && dir.isDirectory()) {
-          for (final VirtualFile file : dir.getChildren()) {
-            if (file.isDirectory()) {
-              result.add(createPackage(pkgName + "." + file.getName()));
-            }
-          }
-        }
-      }
-    }
-    return result.toArray(new PsiPackage[result.size()]);
-  }
-
-  @NotNull
-  @Override
-  public PsiClass[] findClasses(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
-    final PsiClass psiClass = findClass(qualifiedName, scope);
-    return psiClass == null ? PsiClass.EMPTY_ARRAY : new PsiClass[]{psiClass};
-  }
-
-  @NotNull
-  public static GlobalSearchScope addNonClasspathScope(Project project, GlobalSearchScope base) {
-    GlobalSearchScope scope = base;
-    for (PsiElementFinder finder : Extensions.getExtensions(EP_NAME, project)) {
-      if (finder instanceof NonClasspathClassFinder) {
-        scope = scope.uniteWith(NonClasspathDirectoryScope.compose(((NonClasspathClassFinder)finder).getClassRoots()));
-      }
-    }
-    return scope;
-  }
-
-  public PsiManager getPsiManager() {
-    return myManager;
-  }
-
-  @Nullable
-  private static VirtualFile findFileByRelativePath(@NotNull VirtualFile root,
-                                                    @NotNull String relPath,
-                                                    @NotNull String[] extensions) {
-    VirtualFile file = null;
-    for (String extension : extensions) {
-      file = root.findFileByRelativePath(relPath + '.' + extension);
-      if (file != null) break;
-    }
-    return file;
-  }
-}
diff --git a/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/JavaArrangementVisitor.java b/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/JavaArrangementVisitor.java
index d4e9c79..3651fa1 100644
--- a/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/JavaArrangementVisitor.java
+++ b/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/JavaArrangementVisitor.java
@@ -70,7 +70,7 @@
   @NotNull private final  ArrangementSectionDetector mySectionDetector;
   @Nullable private final Document                      myDocument;
 
-  @Nullable private Set<PsiField> classFields;
+  @NotNull private HashMap<PsiClass, Set<PsiField>> myCachedClassFields = ContainerUtil.newHashMap();
 
   @NotNull private Set<PsiComment> myProcessedSectionsComments = ContainerUtil.newHashSet();
 
@@ -172,7 +172,7 @@
       @Override
       public void run() {
         PsiExpressionList list = aClass.getArgumentList();
-        if (list != null) {
+        if (list != null && list.getTextLength() > 0) {
           JavaElementArrangementEntry listEntry = createNewEntry(list, list.getTextRange(), ANON_CLASS_PARAMETER_LIST, aClass.getName(), true);
           processEntry(listEntry, null, list);
         }
@@ -266,15 +266,18 @@
       return referencedElements;
     }
 
+    Set<PsiField> classFields = myCachedClassFields.get(containingClass);
     if (classFields == null) {
       classFields = ContainerUtil.map2Set(containingClass.getFields(), new Function.Self<PsiField, PsiField>());
+      myCachedClassFields.put(containingClass, classFields);
     }
 
+    final Set<PsiField> containingClassFields = classFields;
     fieldInitializer.accept(new JavaRecursiveElementVisitor() {
       @Override
       public void visitReferenceExpression(PsiReferenceExpression expression) {
         PsiElement ref = expression.resolve();
-        if (ref instanceof PsiField && classFields.contains(ref)) {
+        if (ref instanceof PsiField && containingClassFields.contains(ref)) {
           referencedElements.add((PsiField)ref);
         }
       }
diff --git a/java/java-impl/src/com/intellij/psi/filters/getters/MembersGetter.java b/java/java-impl/src/com/intellij/psi/filters/getters/MembersGetter.java
index 9e13bdc..14f4e7e 100644
--- a/java/java-impl/src/com/intellij/psi/filters/getters/MembersGetter.java
+++ b/java/java-impl/src/com/intellij/psi/filters/getters/MembersGetter.java
@@ -90,11 +90,11 @@
 
   public void processMembers(final Consumer<LookupElement> results, @Nullable final PsiClass where,
                              final boolean acceptMethods, final boolean searchInheritors) {
-    if (where == null || CommonClassNames.JAVA_LANG_STRING.equals(where.getQualifiedName())) return;
+    if (where == null || isPrimitiveClass(where)) return;
 
     final boolean searchFactoryMethods = searchInheritors &&
                                    !CommonClassNames.JAVA_LANG_OBJECT.equals(where.getQualifiedName()) &&
-                                   !CommonClassNames.JAVA_LANG_STRING.equals(where.getQualifiedName());
+                                   !isPrimitiveClass(where);
 
     final Project project = myPlace.getProject();
     final GlobalSearchScope scope = myPlace.getResolveScope();
@@ -127,6 +127,12 @@
     }
   }
 
+  private static boolean isPrimitiveClass(PsiClass where) {
+    String qname = where.getQualifiedName();
+    if (qname == null || !qname.startsWith("java.lang.")) return false;
+    return CommonClassNames.JAVA_LANG_STRING.equals(qname) || InheritanceUtil.isInheritor(where, CommonClassNames.JAVA_LANG_NUMBER);
+  }
+
   private void doProcessMembers(boolean acceptMethods,
                                 Consumer<LookupElement> results,
                                 boolean isExpectedTypeMember, Collection<? extends PsiElement> declarations) {
diff --git a/java/java-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelperImpl.java b/java/java-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelperImpl.java
index 58476c6..8ea592f 100644
--- a/java/java-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelperImpl.java
+++ b/java/java-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelperImpl.java
@@ -23,6 +23,7 @@
 import com.intellij.openapi.components.ServiceManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.fileTypes.StdFileTypes;
+import com.intellij.openapi.module.EffectiveLanguageLevelUtil;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.progress.ProcessCanceledException;
 import com.intellij.openapi.project.Project;
@@ -39,6 +40,7 @@
 import com.intellij.psi.impl.source.codeStyle.ImportHelper;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.containers.ContainerUtil;
 import gnu.trove.THashSet;
@@ -137,9 +139,35 @@
     return clsFile;
   }
 
-  @Nullable
+  @NotNull
   @Override
-  public LanguageLevel getClassesLanguageLevel(VirtualFile virtualFile) {
+  public LanguageLevel getEffectiveLanguageLevel(@Nullable VirtualFile virtualFile) {
+    if (virtualFile == null) return PsiUtil.getLanguageLevel(myProject);
+
+    final VirtualFile folder = virtualFile.getParent();
+    if (folder != null) {
+      final LanguageLevel level = folder.getUserData(LanguageLevel.KEY);
+      if (level != null) return level;
+    }
+
+    final ProjectFileIndex index = ProjectRootManager.getInstance(myProject).getFileIndex();
+    Module module = index.getModuleForFile(virtualFile);
+    if (module != null && index.isInSourceContent(virtualFile)) {
+      return EffectiveLanguageLevelUtil.getEffectiveLanguageLevel(module);
+    }
+
+    LanguageLevel classesLanguageLevel = getClassesLanguageLevel(virtualFile);
+    return classesLanguageLevel != null ? classesLanguageLevel : PsiUtil.getLanguageLevel(myProject);
+  }
+
+  /**
+   * For files under a library source root, returns the language level configured for the corresponding classes root.
+   *
+   * @param virtualFile virtual file for which language level is requested.
+   * @return language level for classes root or null if file is not under a library source root or no matching classes root is found.
+   */
+  @Nullable
+  private LanguageLevel getClassesLanguageLevel(VirtualFile virtualFile) {
     final ProjectFileIndex index = ProjectRootManager.getInstance(myProject).getFileIndex();
     final VirtualFile sourceRoot = index.getSourceRootForFile(virtualFile);
     final VirtualFile folder = virtualFile.getParent();
diff --git a/java/java-impl/src/com/intellij/psi/impl/file/JavaDirectoryServiceImpl.java b/java/java-impl/src/com/intellij/psi/impl/file/JavaDirectoryServiceImpl.java
index 5464c6c..005629c 100644
--- a/java/java-impl/src/com/intellij/psi/impl/file/JavaDirectoryServiceImpl.java
+++ b/java/java-impl/src/com/intellij/psi/impl/file/JavaDirectoryServiceImpl.java
@@ -27,17 +27,13 @@
 import com.intellij.ide.fileTemplates.ui.CreateFromTemplateDialog;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.module.LanguageLevelUtil;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.LanguageLevelProjectExtension;
 import com.intellij.openapi.roots.ProjectFileIndex;
 import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.util.Key;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
+import com.intellij.psi.impl.JavaPsiImplementationHelper;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.IncorrectOperationException;
 import org.jetbrains.annotations.NotNull;
@@ -162,7 +158,7 @@
   }
 
   private static String getIncorrectTemplateMessage(String templateName) {
-    return PsiBundle.message("psi.error.incorroect.class.template.message",
+    return PsiBundle.message("psi.error.incorrect.class.template.message",
                              FileTemplateManager.getInstance().internalTemplateToSubject(templateName), templateName);
   }
 
@@ -177,7 +173,7 @@
     String fileName = name + "." + StdFileTypes.JAVA.getDefaultExtension();
     directory.checkCreateFile(fileName);
 
-    PsiNameHelper helper = JavaPsiFacade.getInstance(directory.getProject()).getNameHelper();
+    PsiNameHelper helper = PsiNameHelper.getInstance(directory.getProject());
     PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(directory);
     String qualifiedName = aPackage == null ? null : aPackage.getQualifiedName();
     if (!StringUtil.isEmpty(qualifiedName) && !helper.isQualifiedName(qualifiedName)) {
@@ -192,28 +188,9 @@
     return file.equals(sourceRoot);
   }
 
-  private static final Key<LanguageLevel> LANG_LEVEL_IN_DIRECTORY = new Key<LanguageLevel>("LANG_LEVEL_IN_DIRECTORY");
   @Override
   public LanguageLevel getLanguageLevel(@NotNull PsiDirectory dir) {
-    synchronized (PsiLock.LOCK) {
-      LanguageLevel level = dir.getUserData(LANG_LEVEL_IN_DIRECTORY);
-      if (level == null) {
-        level = getLanguageLevelInner(dir);
-        dir.putUserData(LANG_LEVEL_IN_DIRECTORY, level);
-      }
-      return level;
-    }
-  }
-
-  private static LanguageLevel getLanguageLevelInner(@NotNull PsiDirectory dir) {
-    final VirtualFile virtualFile = dir.getVirtualFile();
-    final Project project = dir.getProject();
-    final Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(virtualFile);
-    if (module != null) {
-      return LanguageLevelUtil.getEffectiveLanguageLevel(module);
-    }
-
-    return LanguageLevelProjectExtension.getInstance(project).getLanguageLevel();
+    return JavaPsiImplementationHelper.getInstance(dir.getProject()).getEffectiveLanguageLevel(dir.getVirtualFile());
   }
 
 }
diff --git a/java/java-impl/src/com/intellij/psi/impl/search/AnnotatedPackagesSearcher.java b/java/java-impl/src/com/intellij/psi/impl/search/AnnotatedPackagesSearcher.java
deleted file mode 100644
index 8e52d77..0000000
--- a/java/java-impl/src/com/intellij/psi/impl/search/AnnotatedPackagesSearcher.java
+++ /dev/null
@@ -1,135 +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.
- */
-
-/*
- * @author max
- */
-package com.intellij.psi.impl.search;
-
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.*;
-import com.intellij.psi.impl.PsiManagerImpl;
-import com.intellij.psi.impl.java.stubs.index.JavaAnnotationIndex;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.PsiSearchHelper;
-import com.intellij.psi.search.SearchScope;
-import com.intellij.psi.search.searches.AnnotatedPackagesSearch;
-import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.util.Processor;
-import com.intellij.util.QueryExecutor;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Collection;
-
-public class AnnotatedPackagesSearcher implements QueryExecutor<PsiPackage, AnnotatedPackagesSearch.Parameters> {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.search.AnnotatedPackagesSearcher");
-
-  @Override
-  public boolean execute(@NotNull final AnnotatedPackagesSearch.Parameters p, @NotNull final Processor<PsiPackage> consumer) {
-    final PsiClass annClass = p.getAnnotationClass();
-    assert annClass.isAnnotationType() : "Annotation type should be passed to annotated packages search";
-
-    final String annotationFQN = annClass.getQualifiedName();
-    assert annotationFQN != null;
-
-    final PsiManagerImpl psiManager = (PsiManagerImpl)annClass.getManager();
-    final SearchScope useScope = p.getScope();
-
-    final String annotationShortName = annClass.getName();
-    assert annotationShortName != null;
-
-    final GlobalSearchScope scope = useScope instanceof GlobalSearchScope ? (GlobalSearchScope)useScope : null;
-
-    final Collection<PsiAnnotation> annotations = JavaAnnotationIndex.getInstance().get(annotationShortName, psiManager.getProject(), scope);
-    for (PsiAnnotation annotation : annotations) {
-      PsiModifierList modlist = (PsiModifierList)annotation.getParent();
-      final PsiElement owner = modlist.getParent();
-      if (!(owner instanceof PsiClass)) continue;
-      PsiClass candidate = (PsiClass)owner;
-      if (!"package-info".equals(candidate.getName())) continue;
-
-      LOG.assertTrue(candidate.isValid());
-
-      final PsiJavaCodeReferenceElement ref = annotation.getNameReferenceElement();
-      if (ref == null) continue;
-
-      if (!psiManager.areElementsEquivalent(ref.resolve(), annClass)) continue;
-      if (useScope instanceof GlobalSearchScope &&
-          !((GlobalSearchScope)useScope).contains(candidate.getContainingFile().getVirtualFile())) {
-        continue;
-      }
-      final String qname = candidate.getQualifiedName();
-      if (qname != null && !consumer.process(JavaPsiFacade.getInstance(psiManager.getProject()).findPackage(
-        qname.substring(0, qname.lastIndexOf('.'))))) {
-        return false;
-      }
-    }
-
-    PsiSearchHelper helper = PsiSearchHelper.SERVICE.getInstance(psiManager.getProject());
-    final GlobalSearchScope infoFilesFilter = new PackageInfoFilesOnly();
-
-    GlobalSearchScope infoFiles =
-      useScope instanceof GlobalSearchScope ? ((GlobalSearchScope)useScope).intersectWith(infoFilesFilter) : infoFilesFilter;
-
-    final boolean[] wantmore = {true};
-    helper.processAllFilesWithWord(annotationShortName, infoFiles, new Processor<PsiFile>() {
-      @Override
-      public boolean process(final PsiFile psiFile) {
-        PsiPackageStatement stmt = PsiTreeUtil.getChildOfType(psiFile, PsiPackageStatement.class);
-        if (stmt == null) return true;
-
-        final PsiModifierList annotations = stmt.getAnnotationList();
-        if (annotations == null) return true;
-        final PsiAnnotation ann = annotations.findAnnotation(annotationFQN);
-        if (ann == null) return true;
-
-        final PsiJavaCodeReferenceElement ref = ann.getNameReferenceElement();
-        if (ref == null) return true;
-
-        if (!psiManager.areElementsEquivalent(ref.resolve(), annClass)) return true;
-
-        wantmore[0] = consumer.process(JavaPsiFacade.getInstance(psiManager.getProject()).findPackage(stmt.getPackageName()));
-        return wantmore[0];
-      }
-    }, true);
-
-    return wantmore[0];
-  }
-
-  private static class PackageInfoFilesOnly extends GlobalSearchScope {
-    @Override
-    public int compare(@NotNull final VirtualFile file1, @NotNull final VirtualFile file2) {
-      return 0;
-    }
-
-    @Override
-    public boolean contains(@NotNull final VirtualFile file) {
-      return "package-info.java".equals(file.getName());
-    }
-
-    @Override
-    public boolean isSearchInLibraries() {
-      return false;
-    }
-
-    @Override
-    public boolean isSearchInModuleContent(@NotNull final Module aModule) {
-      return true;
-    }
-  }
-}
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/psi/impl/search/VariableInIncompleteCodeSearcher.java b/java/java-impl/src/com/intellij/psi/impl/search/VariableInIncompleteCodeSearcher.java
deleted file mode 100644
index fc0ca69..0000000
--- a/java/java-impl/src/com/intellij/psi/impl/search/VariableInIncompleteCodeSearcher.java
+++ /dev/null
@@ -1,71 +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.psi.impl.search;
-
-import com.intellij.lang.java.JavaLanguage;
-import com.intellij.openapi.application.QueryExecutorBase;
-import com.intellij.psi.*;
-import com.intellij.psi.search.LocalSearchScope;
-import com.intellij.psi.search.PsiElementProcessor;
-import com.intellij.psi.search.SearchScope;
-import com.intellij.psi.search.searches.ReferencesSearch;
-import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.util.Processor;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Looks for references to local variable or method parameter in invalid (incomplete) code.
- */
-public class VariableInIncompleteCodeSearcher extends QueryExecutorBase<PsiReference, ReferencesSearch.SearchParameters> {
-  public VariableInIncompleteCodeSearcher() {
-    super(true);
-  }
-
-  @Override
-  public void processQuery(@NotNull final ReferencesSearch.SearchParameters p, @NotNull final Processor<PsiReference> consumer) {
-    final PsiElement refElement = p.getElementToSearch();
-    if (!refElement.isValid() || !(refElement instanceof PsiLocalVariable || refElement instanceof PsiParameter)) return;
-
-    final String name = ((PsiVariable)refElement).getName();
-    if (name == null) return;
-
-    final SearchScope scope = p.getEffectiveSearchScope();
-    if (!(scope instanceof LocalSearchScope)) return;
-
-    PsiElement[] elements = ((LocalSearchScope)scope).getScope();
-    if (elements == null || elements.length == 0) return;
-
-    PsiElementProcessor processor = new PsiElementProcessor() {
-      @Override
-      public boolean execute(@NotNull final PsiElement element) {
-        if (element instanceof PsiJavaCodeReferenceElement) {
-          final PsiJavaCodeReferenceElement ref = (PsiJavaCodeReferenceElement)element;
-          if (!ref.isQualified() && name.equals(ref.getText()) &&
-              ref.resolve() == null && ref.advancedResolve(true).getElement() == refElement) {
-            consumer.process(ref);
-          }
-        }
-        return true;
-      }
-    };
-
-    for (PsiElement element : elements) {
-      if (element.getLanguage().isKindOf(JavaLanguage.INSTANCE)) {
-        PsiTreeUtil.processElements(element, processor);
-      }
-    }
-  }
-}
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/GenericReferenceProvider.java b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/GenericReferenceProvider.java
deleted file mode 100644
index 216dcdd..0000000
--- a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/GenericReferenceProvider.java
+++ /dev/null
@@ -1,44 +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.source.resolve.reference.impl.providers;
-
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiReferenceProvider;
-import com.intellij.psi.scope.PsiScopeProcessor;
-import com.intellij.psi.scope.util.PsiScopesUtil;
-
-/**
- * Created by IntelliJ IDEA.
- * User: ik
- * Date: 27.03.2003
- * Time: 17:23:43
- * To change this template use Options | File Templates.
- */
-public abstract class GenericReferenceProvider extends PsiReferenceProvider {
-  private boolean mySoft = false;
-
-  public void handleEmptyContext(PsiScopeProcessor processor, PsiElement position) {
-    PsiScopesUtil.treeWalkUp(processor, position, null);
-  }
-
-  public void setSoft(boolean softFlag) {
-    mySoft = softFlag;
-  }
-
-  public boolean isSoft() {
-    return mySoft;
-  }
-}
diff --git a/java/java-impl/src/com/intellij/refactoring/OptimizeImportsRefactoringHelper.java b/java/java-impl/src/com/intellij/refactoring/OptimizeImportsRefactoringHelper.java
index cd8613d..a13d3d0 100644
--- a/java/java-impl/src/com/intellij/refactoring/OptimizeImportsRefactoringHelper.java
+++ b/java/java-impl/src/com/intellij/refactoring/OptimizeImportsRefactoringHelper.java
@@ -26,13 +26,16 @@
 import com.intellij.psi.codeStyle.JavaCodeStyleManager;
 import com.intellij.usageView.UsageInfo;
 import com.intellij.util.IncorrectOperationException;
+import com.intellij.util.SequentialModalProgressTask;
+import com.intellij.util.SequentialTask;
 import com.intellij.util.containers.HashSet;
 
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.Set;
 
 public class OptimizeImportsRefactoringHelper implements RefactoringHelper<Set<PsiJavaFile>> {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.OptimizeImportsRefactoringHelper");
+  private static final String REMOVING_REDUNDANT_IMPORTS_TITLE = "Removing redundant imports";
 
   @Override
   public Set<PsiJavaFile> prepareOperation(final UsageInfo[] usages) {
@@ -90,36 +93,75 @@
       }
     };
 
-    if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(findRedundantImports, "Removing redundant imports", false, project)) return;
+    if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(findRedundantImports, REMOVING_REDUNDANT_IMPORTS_TITLE, false, project)) return;
 
     ApplicationManager.getApplication().runWriteAction(new Runnable() {
       @Override
       public void run() {
-        try {
-          for (final SmartPsiElementPointer<PsiImportStatementBase> pointer : redundants) {
-            final PsiImportStatementBase importStatement = pointer.getElement();
-            if (importStatement != null && importStatement.isValid()) {
-              final PsiJavaCodeReferenceElement ref = importStatement.getImportReference();
-              //Do not remove non-resolving refs
-              if (ref == null) {
-                continue;
-              }
-              final PsiElement resolve = ref.resolve();
-              if (resolve == null) {
-                continue;
-              }
-
-              if (resolve instanceof PsiPackage && ((PsiPackage)resolve).getDirectories(ref.getResolveScope()).length == 0) {
-                continue;
-              }
-              importStatement.delete();
-            }
-          }
-        }
-        catch (IncorrectOperationException e) {
-          LOG.error(e);
-        }
+        final SequentialModalProgressTask progressTask = new SequentialModalProgressTask(project, REMOVING_REDUNDANT_IMPORTS_TITLE, false);
+        progressTask.setMinIterationTime(200);
+        progressTask.setTask(new OptimizeImportsTask(progressTask, redundants));
+        ProgressManager.getInstance().run(progressTask);
       }
     });
   }
 }
+
+
+class OptimizeImportsTask implements SequentialTask {
+  private static final Logger LOG = Logger.getInstance("#" + OptimizeImportsTask.class.getName());
+
+  private final Iterator<SmartPsiElementPointer<PsiImportStatementBase>> myPointers;
+  private final SequentialModalProgressTask myTask;
+  private final int myTotal;
+  private int myCount;
+
+  public OptimizeImportsTask(SequentialModalProgressTask progressTask, Set<SmartPsiElementPointer<PsiImportStatementBase>> pointers) {
+    myTask = progressTask;
+    myTotal = pointers.size();
+    myPointers = pointers.iterator();
+  }
+
+  @Override
+  public void prepare() {
+  }
+
+  @Override
+  public boolean isDone() {
+    return !myPointers.hasNext();
+  }
+
+  @Override
+  public boolean iteration() {
+    final ProgressIndicator indicator = myTask.getIndicator();
+    if (indicator != null) {
+      indicator.setFraction(((double)myCount ++) / myTotal);
+    }
+
+    final SmartPsiElementPointer<PsiImportStatementBase> pointer = myPointers.next();
+
+    final PsiImportStatementBase importStatement = pointer.getElement();
+    if (importStatement != null && importStatement.isValid()) {
+      final PsiJavaCodeReferenceElement ref = importStatement.getImportReference();
+      //Do not remove non-resolving refs
+      if (ref != null) {
+        final PsiElement resolve = ref.resolve();
+        if (resolve != null &&
+            (!(resolve instanceof PsiPackage) || ((PsiPackage)resolve).getDirectories(ref.getResolveScope()).length != 0)) {
+          try {
+            importStatement.delete();
+          }
+          catch (IncorrectOperationException e) {
+            LOG.error(e);
+          }
+        }
+      }
+    }
+
+    return isDone();
+  }
+
+  @Override
+  public void stop() {
+  }
+}
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaMethodSignatureEditor.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaMethodSignatureEditor.java
deleted file mode 100644
index 5d2ef50..0000000
--- a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaMethodSignatureEditor.java
+++ /dev/null
@@ -1,108 +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.refactoring.changeSignature;
-
-import com.intellij.openapi.util.TextRange;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.psi.*;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Konstantin Bulenkov
- */
-public class JavaMethodSignatureEditor extends MethodSignatureEditor<PsiMethod> {
-  public JavaMethodSignatureEditor(@NotNull PsiMethod method) {
-    super(method, PsiMethod.class);
-  }
-
-  @Override
-  public TextRange getSignatureTextRange() {
-    final PsiMethod method = getMethod();
-    final TextRange methodTextRange = method.getTextRange();
-    final TextRange paramsRange = method.getParameterList().getTextRange();
-    return TextRange.create(methodTextRange.getStartOffset(), paramsRange.getEndOffset());
-  }
-
-  @Override
-  protected void indexParameters(PsiMethod method, @NotNull ParameterIndexer indexer) {
-    final PsiParameter[] parameters = method.getParameterList().getParameters();
-    for (int i = 0; i < parameters.length; i++) {
-      indexer.setIndex(parameters[i], i);
-    }
-  }
-
-  @Override
-  protected String formatMethod() {
-
-    @NonNls StringBuilder buffer = new StringBuilder();
-    PsiMethod method = getMethod();
-    PsiModifierList modifierList = method.getModifierList();
-    String modifiers = modifierList.getText();
-
-    buffer.append(modifiers);
-    if (modifiers.length() > 0 &&
-        !StringUtil.endsWithChar(modifiers, '\n') &&
-        !StringUtil.endsWithChar(modifiers, '\r') &&
-        !StringUtil.endsWithChar(modifiers, ' ')) {
-      buffer.append(" ");
-    }
-
-    if (!method.isConstructor()) {
-      final PsiType returnType = method.getReturnType();
-      if (returnType != null) {
-        buffer.append(returnType.getPresentableText());
-      }
-      buffer.append(" ");
-    }
-    buffer.append(method.getName());
-    buffer.append("(");
-
-    final String indent = "    ";
-    PsiParameter[] items = method.getParameterList().getParameters();
-    for (int i = 0; i < items.length; i++) {
-      PsiParameter item = items[i];
-      if (i > 0) {
-        buffer.append(",");
-      }
-      buffer.append("\n");
-      buffer.append(indent);
-      buffer.append(item.getTypeElement().getType().getPresentableText());
-      buffer.append(" ");
-      buffer.append(item.getName());
-    }
-    if (items.length != 0) {
-      buffer.append("\n");
-    }
-    buffer.append(")");
-
-    PsiClassType[] thrownExceptionsFragments = method.getThrowsList().getReferencedTypes();
-    if (thrownExceptionsFragments.length > 0) {
-      buffer.append("\n");
-      buffer.append("throws\n");
-      for (int i = 0; i < thrownExceptionsFragments.length; i++) {
-        String text = thrownExceptionsFragments[i].getPresentableText();
-        buffer.append(indent);
-        buffer.append(text);
-        if (i < thrownExceptionsFragments.length - 1) {
-          buffer.append(",");
-          buffer.append("\n");
-        }
-      }
-    }
-    return buffer.toString();
-  }
-}
diff --git a/java/java-impl/src/com/intellij/refactoring/encapsulateFields/JavaEncapsulateFieldHelper.java b/java/java-impl/src/com/intellij/refactoring/encapsulateFields/JavaEncapsulateFieldHelper.java
index 19a6fb1..e9d5974 100644
--- a/java/java-impl/src/com/intellij/refactoring/encapsulateFields/JavaEncapsulateFieldHelper.java
+++ b/java/java-impl/src/com/intellij/refactoring/encapsulateFields/JavaEncapsulateFieldHelper.java
@@ -236,19 +236,10 @@
                                                           PsiReferenceExpression expr,
                                                           PsiClass aClass,
                                                           PsiMethod setter) throws IncorrectOperationException {
-    PsiElementFactory factory = JavaPsiFacade.getInstance(expr.getProject()).getElementFactory();
     final String setterName = fieldDescriptor.getSetterName();
     @NonNls String text = setterName + "(a)";
-    PsiExpression qualifier = expr.getQualifierExpression();
-    if (qualifier != null){
-      text = "q." + text;
-    }
-    PsiMethodCallExpression methodCall = (PsiMethodCallExpression)factory.createExpressionFromText(text, expr);
-
+    PsiMethodCallExpression methodCall = prepareMethodCall(expr,  text);
     methodCall.getArgumentList().getExpressions()[0].replace(setterArgument);
-    if (qualifier != null){
-      methodCall.getMethodExpression().getQualifierExpression().replace(qualifier);
-    }
     methodCall = checkMethodResolvable(methodCall, setter, expr, aClass);
     if (methodCall == null) {
       VisibilityUtil.escalateVisibility(fieldDescriptor.getField(), expr);
@@ -261,19 +252,9 @@
                                                           PsiReferenceExpression expr,
                                                           PsiClass aClass,
                                                           PsiMethod getter) throws IncorrectOperationException {
-    PsiElementFactory factory = JavaPsiFacade.getInstance(expr.getProject()).getElementFactory();
     final String getterName = fieldDescriptor.getGetterName();
     @NonNls String text = getterName + "()";
-    PsiExpression qualifier = expr.getQualifierExpression();
-    if (qualifier != null) {
-      text = "q." + text;
-    }
-    PsiMethodCallExpression methodCall = (PsiMethodCallExpression)factory.createExpressionFromText(text, expr);
-
-    if (qualifier != null) {
-      methodCall.getMethodExpression().getQualifierExpression().replace(qualifier);
-    }
-
+    PsiMethodCallExpression methodCall = prepareMethodCall(expr, text);
     methodCall = checkMethodResolvable(methodCall, getter, expr, aClass);
     if (methodCall == null) {
       VisibilityUtil.escalateVisibility(fieldDescriptor.getField(), expr);
@@ -281,6 +262,18 @@
     return methodCall;
   }
 
+  private static PsiMethodCallExpression prepareMethodCall(PsiReferenceExpression expr, String text) {
+    PsiExpression qualifier = expr.getQualifierExpression();
+    if (qualifier != null) {
+      final PsiElement referenceNameElement = expr.getReferenceNameElement();
+      if (referenceNameElement != null) {
+        text = expr.getText().substring(0, referenceNameElement.getStartOffsetInParent()) + text;
+      }
+    }
+    final PsiElementFactory factory = JavaPsiFacade.getInstance(expr.getProject()).getElementFactory();
+    return (PsiMethodCallExpression)factory.createExpressionFromText(text, expr);
+  }
+
   @Nullable
   private static PsiMethodCallExpression checkMethodResolvable(PsiMethodCallExpression methodCall,
                                                                PsiMethod targetMethod,
diff --git a/java/java-impl/src/com/intellij/refactoring/makeStatic/MakeMethodStaticProcessor.java b/java/java-impl/src/com/intellij/refactoring/makeStatic/MakeMethodStaticProcessor.java
index bd8ed35..de5efa5 100644
--- a/java/java-impl/src/com/intellij/refactoring/makeStatic/MakeMethodStaticProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/makeStatic/MakeMethodStaticProcessor.java
@@ -112,6 +112,7 @@
     final PsiModifierList modifierList = myMember.getModifierList();
     modifierList.setModifierProperty(PsiModifier.STATIC, true);
     modifierList.setModifierProperty(PsiModifier.FINAL, false);
+    modifierList.setModifierProperty(PsiModifier.DEFAULT, false);
   }
 
   protected void changeInternalUsage(InternalUsageInfo usage, PsiElementFactory factory)
diff --git a/java/java-impl/src/com/intellij/refactoring/makeStatic/Settings.java b/java/java-impl/src/com/intellij/refactoring/makeStatic/Settings.java
index 53c4335..c08de38 100644
--- a/java/java-impl/src/com/intellij/refactoring/makeStatic/Settings.java
+++ b/java/java-impl/src/com/intellij/refactoring/makeStatic/Settings.java
@@ -55,8 +55,7 @@
   }
 
 
-  public Settings(boolean replaceUsages, String classParameterName,
-                  VariableData[] variableDatum) {
+  public Settings(boolean replaceUsages, @Nullable String classParameterName, @Nullable VariableData[] variableDatum) {
     myReplaceUsages = replaceUsages;
     myMakeClassParameter = classParameterName != null;
     myClassParameterName = classParameterName;
diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/JavaMoveDirectoryWithClassesHelper.java b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/JavaMoveDirectoryWithClassesHelper.java
index 41e0a2b..88f8151 100644
--- a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/JavaMoveDirectoryWithClassesHelper.java
+++ b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/JavaMoveDirectoryWithClassesHelper.java
@@ -3,6 +3,7 @@
 import com.intellij.codeInsight.ChangeContextUtil;
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.*;
+import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.search.searches.ReferencesSearch;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.refactoring.listeners.RefactoringElementListener;
@@ -47,7 +48,7 @@
           }
         }
         if (remainsNothing) {
-          for (PsiReference reference : ReferencesSearch.search(aPackage)) {
+          for (PsiReference reference : ReferencesSearch.search(aPackage, GlobalSearchScope.projectScope(project))) {
             final PsiElement element = reference.getElement();
             final PsiImportStatementBase statementBase = PsiTreeUtil.getParentOfType(element, PsiImportStatementBase.class);
             if (statementBase != null && statementBase.isOnDemand()) {
diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/JavaMoveFilesOrDirectoriesHandler.java b/java/java-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/JavaMoveFilesOrDirectoriesHandler.java
index 0b92f99..c7d1316 100644
--- a/java/java-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/JavaMoveFilesOrDirectoriesHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/JavaMoveFilesOrDirectoriesHandler.java
@@ -37,14 +37,6 @@
 
 public class JavaMoveFilesOrDirectoriesHandler extends MoveFilesOrDirectoriesHandler {
   @Override
-  public boolean canMove(PsiElement[] elements, PsiElement targetContainer) {
-    final PsiElement[] srcElements = adjustForMove(null, elements, targetContainer);
-    assert srcElements != null;
-
-    return super.canMove(srcElements, targetContainer);
-  }
-
-  @Override
   public PsiElement adjustTargetForMove(DataContext dataContext, PsiElement targetContainer) {
     if (targetContainer instanceof PsiPackage) {
       final Module module = LangDataKeys.TARGET_MODULE.getData(dataContext);
@@ -60,6 +52,11 @@
 
   @Override
   public PsiElement[] adjustForMove(Project project, PsiElement[] sourceElements, PsiElement targetElement) {
+    sourceElements = super.adjustForMove(project, sourceElements, targetElement);
+    if (sourceElements == null) {
+      return null;
+    }
+
     Set<PsiElement> result = new LinkedHashSet<PsiElement>();
     for (PsiElement sourceElement : sourceElements) {
       result.add(sourceElement instanceof PsiClass ? sourceElement.getContainingFile() : sourceElement);
@@ -70,6 +67,10 @@
   @Override
   public void doMove(final Project project, PsiElement[] elements, PsiElement targetContainer, MoveCallback callback) {
 
+    elements = super.adjustForMove(project, elements, targetContainer);
+    if (elements == null) {
+      return;
+    }
     MoveFilesOrDirectoriesUtil
       .doMove(project, elements, new PsiElement[]{targetContainer}, callback, new Function<PsiElement[], PsiElement[]>() {
         @Override
@@ -89,7 +90,7 @@
                       adjustedElements.add(containingFile);
                       continue;
                     }
-                  } 
+                  }
                 }
                 adjustedElements.add(element);
               }
diff --git a/java/java-impl/src/com/intellij/refactoring/rename/FieldHidesLocalUsageInfo.java b/java/java-impl/src/com/intellij/refactoring/rename/FieldHidesLocalUsageInfo.java
new file mode 100644
index 0000000..c56d2ba
--- /dev/null
+++ b/java/java-impl/src/com/intellij/refactoring/rename/FieldHidesLocalUsageInfo.java
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+/*
+ * Created by IntelliJ IDEA.
+ * User: dsl
+ * Date: 05.06.2002
+ * Time: 12:43:27
+ * To change template for new class use 
+ * Code Style | Class Templates options (Tools | IDE Options).
+ */
+package com.intellij.refactoring.rename;
+
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiMethod;
+import com.intellij.refactoring.RefactoringBundle;
+import com.intellij.refactoring.util.CommonRefactoringUtil;
+import com.intellij.refactoring.util.RefactoringUIUtil;
+import com.intellij.usageView.UsageViewUtil;
+
+public class FieldHidesLocalUsageInfo extends UnresolvableCollisionUsageInfo {
+  public FieldHidesLocalUsageInfo(PsiElement element, PsiElement referencedElement) {
+    super(element, referencedElement);
+  }
+
+  public String getDescription() {
+    String descr = RefactoringBundle.message("local.will.be.hidden.renamed",
+                                             RefactoringUIUtil.getDescription(getElement(), true));
+    return CommonRefactoringUtil.capitalize(descr);
+  }
+}
diff --git a/java/java-impl/src/com/intellij/refactoring/rename/RenameJavaVariableProcessor.java b/java/java-impl/src/com/intellij/refactoring/rename/RenameJavaVariableProcessor.java
index 85f26f1..7362320 100644
--- a/java/java-impl/src/com/intellij/refactoring/rename/RenameJavaVariableProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/rename/RenameJavaVariableProcessor.java
@@ -24,9 +24,11 @@
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.JavaCodeStyleManager;
 import com.intellij.psi.codeStyle.VariableKind;
+import com.intellij.psi.controlFlow.ControlFlowUtil;
 import com.intellij.psi.search.searches.ClassInheritorsSearch;
 import com.intellij.psi.search.searches.OverridingMethodsSearch;
 import com.intellij.psi.util.PropertyUtil;
+import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.refactoring.HelpID;
 import com.intellij.refactoring.JavaRefactoringSettings;
@@ -350,6 +352,18 @@
       PsiField conflictingField = inheritor.findFieldByName(newName, false);
       if (conflictingField != null) {
         result.add(new SubmemberHidesMemberUsageInfo(conflictingField, field));
+      } 
+      else { //local class
+        final PsiMember member = PsiTreeUtil.getParentOfType(inheritor, PsiMember.class);
+        if (member != null) {
+          final ArrayList<PsiVariable> variables = new ArrayList<PsiVariable>();
+          ControlFlowUtil.collectOuterLocals(variables, inheritor, inheritor, member);
+          for (PsiVariable variable : variables) {
+            if (newName.equals(variable.getName())) {
+              result.add(new FieldHidesLocalUsageInfo(variable, field));
+            }
+          }
+        }
       }
     }
   }
diff --git a/java/java-impl/src/com/intellij/refactoring/typeMigration/ChangeTypeSignatureHandler.java b/java/java-impl/src/com/intellij/refactoring/typeMigration/ChangeTypeSignatureHandler.java
index e75b825..ad5bea3 100644
--- a/java/java-impl/src/com/intellij/refactoring/typeMigration/ChangeTypeSignatureHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/typeMigration/ChangeTypeSignatureHandler.java
@@ -74,6 +74,9 @@
   protected static boolean isClassArgument(PsiElement element) {
     if (element instanceof PsiReferenceParameterList) {
       final PsiMember member = PsiTreeUtil.getParentOfType(element, PsiMember.class);
+      if (member instanceof PsiAnonymousClass) {
+        return ((PsiAnonymousClass)member).getBaseClassReference().getParameterList() == element;
+      }
       if (member instanceof PsiClass) {
         final PsiReferenceList implementsList = ((PsiClass)member).getImplementsList();
         final PsiReferenceList extendsList = ((PsiClass)member).getExtendsList();
diff --git a/java/java-impl/src/com/intellij/testIntegration/BaseGenerateTestSupportMethodAction.java b/java/java-impl/src/com/intellij/testIntegration/BaseGenerateTestSupportMethodAction.java
index cf363e5..40a97cf 100644
--- a/java/java-impl/src/com/intellij/testIntegration/BaseGenerateTestSupportMethodAction.java
+++ b/java/java-impl/src/com/intellij/testIntegration/BaseGenerateTestSupportMethodAction.java
@@ -24,6 +24,7 @@
 import com.intellij.codeInsight.hint.HintManager;
 import com.intellij.ide.fileTemplates.FileTemplateDescriptor;
 import com.intellij.ide.fileTemplates.impl.AllFileTemplatesConfigurable;
+import com.intellij.ide.util.EditSourceUtil;
 import com.intellij.openapi.actionSystem.*;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.command.WriteCommandAction;
@@ -199,6 +200,26 @@
 
 
     private void doGenerate(final Editor editor, final PsiFile file, final PsiClass targetClass, final TestFramework framework) {
+      if (framework instanceof JavaTestFramework && ((JavaTestFramework)framework).isSingleConfig()) {
+        PsiElement alreadyExist = null;
+        switch (myMethodKind) {
+          case SET_UP:
+            alreadyExist = framework.findSetUpMethod(targetClass);
+            break;
+          case TEAR_DOWN:
+            alreadyExist = framework.findTearDownMethod(targetClass);
+            break;
+          default:
+            break;
+        }
+
+        if (alreadyExist instanceof PsiMethod) {
+          editor.getCaretModel().moveToOffset(alreadyExist.getNavigationElement().getTextOffset());
+          HintManager.getInstance().showErrorHint(editor, "Method " + ((PsiMethod)alreadyExist).getName() + " already exists");
+          return;
+        }
+      }
+
       if (!CommonRefactoringUtil.checkReadOnlyStatus(file)) return;
 
       WriteCommandAction.runWriteCommandAction(file.getProject(), new Runnable() {
diff --git a/java/java-impl/src/com/intellij/testIntegration/JavaTestFinder.java b/java/java-impl/src/com/intellij/testIntegration/JavaTestFinder.java
index 5bf0790..92fe17a 100644
--- a/java/java-impl/src/com/intellij/testIntegration/JavaTestFinder.java
+++ b/java/java-impl/src/com/intellij/testIntegration/JavaTestFinder.java
@@ -25,6 +25,8 @@
 import com.intellij.psi.PsiNamedElement;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.search.PsiShortNamesCache;
+import com.intellij.util.CommonProcessors;
+import com.intellij.util.Processor;
 import com.intellij.util.containers.HashSet;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -80,22 +82,29 @@
     PsiClass klass = findSourceElement(element);
     if (klass == null) return Collections.emptySet();
 
+    List<Pair<? extends PsiNamedElement, Integer>> classesWithProximities = new ArrayList<Pair<? extends PsiNamedElement, Integer>>();
+    final CommonProcessors.CollectProcessor<Pair<? extends PsiNamedElement, Integer>> processor =
+      new CommonProcessors.CollectProcessor<Pair<? extends PsiNamedElement, Integer>>(classesWithProximities);
+    collectTests(klass, processor);
+
+    return TestFinderHelper.getSortedElements(classesWithProximities, true);
+  }
+
+  private static boolean collectTests(PsiClass klass, Processor<Pair<? extends PsiNamedElement, Integer>> processor) {
     GlobalSearchScope scope;
-    Module module = getModule(element);
+    Module module = getModule(klass);
     if (module != null) {
       scope = GlobalSearchScope.moduleWithDependentsScope(module);
     }
     else {
-      scope = GlobalSearchScope.projectScope(element.getProject());
+      scope = GlobalSearchScope.projectScope(klass.getProject());
     }
 
-    PsiShortNamesCache cache = PsiShortNamesCache.getInstance(element.getProject());
+    PsiShortNamesCache cache = PsiShortNamesCache.getInstance(klass.getProject());
 
     String klassName = klass.getName();
     Pattern pattern = Pattern.compile(".*" + klassName + ".*");
 
-    List<Pair<? extends PsiNamedElement, Integer>> classesWithProximities = new ArrayList<Pair<? extends PsiNamedElement, Integer>>();
-
     HashSet<String> names = new HashSet<String>();
     cache.getAllClassNames(names);
     final TestFrameworks frameworks = TestFrameworks.getInstance();
@@ -103,14 +112,14 @@
       if (pattern.matcher(eachName).matches()) {
         for (PsiClass eachClass : cache.getClassesByName(eachName, scope)) {
           if (frameworks.isTestClass(eachClass) || frameworks.isPotentialTestClass(eachClass)) {
-            classesWithProximities.add(
-              Pair.create(eachClass, TestFinderHelper.calcTestNameProximity(klassName, eachName)));
+            if (!processor.process(Pair.create(eachClass, TestFinderHelper.calcTestNameProximity(klassName, eachName)))) {
+              return true;
+            }
           }
         }
       }
     }
-
-    return TestFinderHelper.getSortedElements(classesWithProximities, true);
+    return false;
   }
 
   @Nullable
@@ -122,4 +131,13 @@
   public boolean isTest(@NotNull PsiElement element) {
     return TestIntegrationUtils.isTest(element);
   }
+
+  public static boolean hasTestsForClass(PsiClass aClass) {
+    return collectTests(aClass, new CommonProcessors.FindProcessor<Pair<? extends PsiNamedElement, Integer>>() {
+      @Override
+      protected boolean accept(Pair<? extends PsiNamedElement, Integer> pair) {
+        return true;
+      }
+    });
+  }
 }
diff --git a/java/java-impl/src/com/intellij/testIntegration/JavaTestFramework.java b/java/java-impl/src/com/intellij/testIntegration/JavaTestFramework.java
index 6dfb541..1277dc5 100644
--- a/java/java-impl/src/com/intellij/testIntegration/JavaTestFramework.java
+++ b/java/java-impl/src/com/intellij/testIntegration/JavaTestFramework.java
@@ -124,4 +124,8 @@
   public void setupLibrary(Module module) {
     OrderEntryFix.addJarToRoots(getLibraryPath(), module, null);
   }
+
+  public boolean isSingleConfig() {
+    return false;
+  }
 }
diff --git a/java/java-impl/src/com/intellij/testIntegration/TestIntegrationUtils.java b/java/java-impl/src/com/intellij/testIntegration/TestIntegrationUtils.java
index a4a5cb5..9ac0cb0 100644
--- a/java/java-impl/src/com/intellij/testIntegration/TestIntegrationUtils.java
+++ b/java/java-impl/src/com/intellij/testIntegration/TestIntegrationUtils.java
@@ -146,7 +146,14 @@
                                            final PsiMethod method,
                                            @Nullable String name,
                                            boolean automatic, Set<String> existingNames) {
-    Template template = createTestMethodTemplate(methodKind, framework, targetClass, name, automatic, existingNames);
+    runTestMethodTemplate(editor, targetClass, method, automatic,
+                          createTestMethodTemplate(methodKind, framework, targetClass, name, automatic, existingNames));
+  }
+
+  public static void runTestMethodTemplate(final Editor editor,
+                                           final PsiClass targetClass,
+                                           final PsiMethod method,
+                                           boolean automatic, final Template template) {
 
     final TextRange range = method.getTextRange();
     editor.getDocument().replaceString(range.getStartOffset(), range.getEndOffset(), "");
diff --git a/java/java-impl/src/com/intellij/testIntegration/createTest/GenerateMissedTestsAction.java b/java/java-impl/src/com/intellij/testIntegration/createTest/GenerateMissedTestsAction.java
new file mode 100644
index 0000000..882fb72
--- /dev/null
+++ b/java/java-impl/src/com/intellij/testIntegration/createTest/GenerateMissedTestsAction.java
@@ -0,0 +1,121 @@
+/*
+ * 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.testIntegration.createTest;
+
+import com.intellij.codeInsight.CodeInsightUtil;
+import com.intellij.codeInsight.TestFrameworks;
+import com.intellij.codeInsight.hint.HintManager;
+import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction;
+import com.intellij.ide.util.PsiClassListCellRenderer;
+import com.intellij.openapi.command.WriteCommandAction;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.extensions.Extensions;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.popup.JBPopupFactory;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiModifier;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.testIntegration.TestFinderHelper;
+import com.intellij.testIntegration.TestFramework;
+import com.intellij.ui.components.JBList;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+public class GenerateMissedTestsAction extends PsiElementBaseIntentionAction {
+
+  @NotNull
+  public String getText() {
+    return "Generate missed test methods";
+  }
+
+  @NotNull
+  public String getFamilyName() {
+    return getText();
+  }
+
+  public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) {
+    if (Extensions.getExtensions(TestFramework.EXTENSION_NAME).length == 0) return false;
+
+    final PsiElement parent = element.getParent();
+    if (!(parent instanceof PsiMethod)) return false;
+
+    if (!((PsiMethod)parent).hasModifierProperty(PsiModifier.PUBLIC) || 
+        ((PsiMethod)parent).hasModifierProperty(PsiModifier.ABSTRACT)) {
+      return false;
+    }
+
+    return PsiTreeUtil.getParentOfType(element, PsiClass.class) != null;
+  }
+
+  @Override
+  public void invoke(final @NotNull Project project, final Editor editor, @NotNull PsiElement element) throws IncorrectOperationException {
+    final PsiClass srcClass = PsiTreeUtil.getParentOfType(element, PsiClass.class);
+
+    if (srcClass == null) return;
+
+    final List<PsiElement> testClasses = TestFinderHelper.findTestsForClass(srcClass);
+    
+    if (testClasses.isEmpty()) {
+      HintManager.getInstance().showErrorHint(editor, "No tests found.");
+      return;
+    }
+    
+    if (testClasses.size() == 1) {
+      generateMissedTests((PsiClass)testClasses.get(0), srcClass);
+      return;
+    }
+
+    final JBList list = new JBList(testClasses);
+    list.setCellRenderer(new PsiClassListCellRenderer());
+    JBPopupFactory.getInstance().createListPopupBuilder(list)
+      .setItemChoosenCallback(new Runnable() {
+      @Override
+      public void run() {
+        generateMissedTests((PsiClass)list.getSelectedValue(), srcClass);
+      }
+    })
+      .setTitle("Choose Test")
+      .createPopup().showInBestPositionFor(editor);
+  }
+
+  private static void generateMissedTests(final PsiClass testClass, PsiClass srcClass) {
+    if (testClass != null) {
+      final TestFramework framework = TestFrameworks.detectFramework(testClass);
+      if (framework != null) {
+        final Project project = testClass.getProject();
+        final Editor editor = CodeInsightUtil.positionCursor(project, testClass.getContainingFile(), testClass.getLBrace());
+        final MissedTestsDialog dialog = new MissedTestsDialog(project, srcClass, testClass, framework);
+        dialog.show();
+        if (dialog.isOK()) {
+          WriteCommandAction.runWriteCommandAction(project, new Runnable() {
+            @Override
+            public void run() {
+              JavaTestGenerator.addTestMethods(editor, testClass, framework, dialog.getSelectedMethods(), false, false);
+            }
+          });
+        }
+      }
+    }
+  }
+
+  public boolean startInWriteAction() {
+    return false;
+  }
+}
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/testIntegration/createTest/JavaTestGenerator.java b/java/java-impl/src/com/intellij/testIntegration/createTest/JavaTestGenerator.java
index 1720194..abde923 100644
--- a/java/java-impl/src/com/intellij/testIntegration/createTest/JavaTestGenerator.java
+++ b/java/java-impl/src/com/intellij/testIntegration/createTest/JavaTestGenerator.java
@@ -156,12 +156,12 @@
     return JavaPsiFacade.getInstance(project).findClass(fqName, scope);
   }
 
-  private static void addTestMethods(Editor editor,
-                                     PsiClass targetClass,
-                                     final TestFramework descriptor,
-                                     Collection<MemberInfo> methods,
-                                     boolean generateBefore,
-                                     boolean generateAfter) throws IncorrectOperationException {
+  public static void addTestMethods(Editor editor,
+                                    PsiClass targetClass,
+                                    final TestFramework descriptor,
+                                    Collection<MemberInfo> methods,
+                                    boolean generateBefore,
+                                    boolean generateAfter) throws IncorrectOperationException {
     final Set<String> existingNames = new HashSet<String>();
     if (generateBefore && descriptor.findSetUpMethod(targetClass) == null) {
       generateMethod(TestIntegrationUtils.MethodKind.SET_UP, descriptor, targetClass, editor, null, existingNames);
@@ -170,8 +170,7 @@
       generateMethod(TestIntegrationUtils.MethodKind.TEAR_DOWN, descriptor, targetClass, editor, null, existingNames);
     }
 
-    final Template template = TestIntegrationUtils .createTestMethodTemplate(TestIntegrationUtils.MethodKind.TEST, descriptor, targetClass,
-                                                                             null, true, existingNames);
+    final Template template = TestIntegrationUtils.createTestMethodTemplate(TestIntegrationUtils.MethodKind.TEST, descriptor, targetClass, null, true, existingNames);
     final String prefix = JavaPsiFacade.getElementFactory(targetClass.getProject()).createMethodFromText(template.getTemplateText(), targetClass).getName();
     existingNames.addAll(ContainerUtil.map(targetClass.getMethods(), new Function<PsiMethod, String>() {
       @Override
diff --git a/java/java-impl/src/com/intellij/testIntegration/createTest/MissedTestsDialog.java b/java/java-impl/src/com/intellij/testIntegration/createTest/MissedTestsDialog.java
new file mode 100644
index 0000000..b34d28e
--- /dev/null
+++ b/java/java-impl/src/com/intellij/testIntegration/createTest/MissedTestsDialog.java
@@ -0,0 +1,120 @@
+/*
+ * 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.testIntegration.createTest;
+
+import com.intellij.codeInsight.CodeInsightBundle;
+import com.intellij.codeInsight.template.Template;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.DialogWrapper;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.JavaPsiFacade;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiMember;
+import com.intellij.psi.PsiMethod;
+import com.intellij.refactoring.ui.MemberSelectionPanel;
+import com.intellij.refactoring.ui.MemberSelectionTable;
+import com.intellij.refactoring.util.classMembers.MemberInfo;
+import com.intellij.testIntegration.TestFramework;
+import com.intellij.testIntegration.TestIntegrationUtils;
+import com.intellij.ui.ScrollPaneFactory;
+import com.intellij.ui.SeparatorFactory;
+import com.intellij.ui.components.JBCheckBox;
+import com.intellij.util.Function;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.*;
+import java.util.List;
+
+public class MissedTestsDialog extends DialogWrapper {
+  private final PsiClass mySourceClass;
+  private final PsiClass myTestClass;
+  private TestFramework myDescriptor;
+  private MemberSelectionTable myTable;
+  private JBCheckBox myIncludeInheritedCb = new JBCheckBox(CodeInsightBundle.message("intention.create.test.dialog.show.inherited"));
+
+  public MissedTestsDialog(@Nullable Project project, PsiClass sourceClass, PsiClass testClass, TestFramework descriptor) {
+    super(project, true);
+    mySourceClass = sourceClass;
+    myTestClass = testClass;
+    myDescriptor = descriptor;
+    setTitle("Create Missed Tests");
+    init();
+  }
+
+  public Collection<MemberInfo> getSelectedMethods() {
+    return myTable.getSelectedMemberInfos();
+  }
+
+  @Nullable
+  @Override
+  protected JComponent createCenterPanel() {
+    final List<MemberInfo> info = TestIntegrationUtils.extractClassMethods(mySourceClass, false);
+
+    disableMethodsWithTests(info);
+
+    final JPanel panel = new JPanel(new BorderLayout());
+    myTable = new MemberSelectionTable(info, null);
+    panel.add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER);
+    panel.add(myIncludeInheritedCb, BorderLayout.NORTH);
+    myIncludeInheritedCb.addActionListener(new ActionListener() {
+      @Override
+      public void actionPerformed(ActionEvent e) {
+        updateMethodsTable();
+      }
+    });
+    return panel;
+  }
+
+  private void disableMethodsWithTests(List<MemberInfo> info) {
+    final Set<String> existingNames = new HashSet<String>();
+    final Template template = TestIntegrationUtils
+      .createTestMethodTemplate(TestIntegrationUtils.MethodKind.TEST, myDescriptor, myTestClass, null, true, existingNames);
+    final String prefix = JavaPsiFacade.getElementFactory(myTestClass.getProject()).createMethodFromText(template.getTemplateText(), myTestClass).getName();
+
+    existingNames.addAll(ContainerUtil.map(myTestClass.getMethods(), new Function<PsiMethod, String>() {
+      @Override
+      public String fun(PsiMethod method) {
+        return StringUtil.decapitalize(StringUtil.trimStart(method.getName(), prefix));
+      }
+    }));
+
+
+    for (MemberInfo memberInfo : info) {
+      final PsiMember member = memberInfo.getMember();
+      memberInfo.setChecked(!(member instanceof PsiMethod && existingNames.contains(member.getName())));
+    }
+  }
+
+  private void updateMethodsTable() {
+    List<MemberInfo> infos = TestIntegrationUtils.extractClassMethods(mySourceClass, myIncludeInheritedCb.isSelected());
+
+    Set<PsiMember> selectedMethods = new HashSet<PsiMember>();
+    for (MemberInfo each : myTable.getSelectedMemberInfos()) {
+      selectedMethods.add(each.getMember());
+    }
+
+    for (MemberInfo each : infos) {
+      each.setChecked(selectedMethods.contains(each.getMember()));
+    }
+
+    myTable.setMemberInfos(infos);
+  }
+}
diff --git a/java/java-indexing-api/src/com/intellij/psi/search/searches/AnnotatedMembersSearch.java b/java/java-indexing-api/src/com/intellij/psi/search/searches/AnnotatedMembersSearch.java
new file mode 100644
index 0000000..14e37a5
--- /dev/null
+++ b/java/java-indexing-api/src/com/intellij/psi/search/searches/AnnotatedMembersSearch.java
@@ -0,0 +1,39 @@
+/*
+ * 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.psi.search.searches;
+
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiMember;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.SearchScope;
+import com.intellij.util.Query;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author max
+ */
+public class AnnotatedMembersSearch {
+
+  private AnnotatedMembersSearch() {}
+
+  public static Query<PsiMember> search(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
+    return AnnotatedElementsSearch.searchPsiMembers(annotationClass, scope);
+  }
+
+  public static Query<PsiMember> search(@NotNull PsiClass annotationClass) {
+    return search(annotationClass, GlobalSearchScope.allScope(annotationClass.getProject()));
+  }
+}
diff --git a/java/java-indexing-api/src/com/intellij/psi/search/searches/AnnotatedPackagesSearch.java b/java/java-indexing-api/src/com/intellij/psi/search/searches/AnnotatedPackagesSearch.java
new file mode 100644
index 0000000..17e3fa0
--- /dev/null
+++ b/java/java-indexing-api/src/com/intellij/psi/search/searches/AnnotatedPackagesSearch.java
@@ -0,0 +1,58 @@
+/*
+ * 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.psi.search.searches;
+
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiPackage;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.SearchScope;
+import com.intellij.util.Query;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author max
+ */
+public class AnnotatedPackagesSearch extends ExtensibleQueryFactory<PsiPackage, AnnotatedPackagesSearch.Parameters> {
+  public static final AnnotatedPackagesSearch INSTANCE = new AnnotatedPackagesSearch();
+
+  public static class Parameters {
+    private final PsiClass myAnnotationClass;
+    private final SearchScope myScope;
+
+    public Parameters(final PsiClass annotationClass, final SearchScope scope) {
+      myAnnotationClass = annotationClass;
+      myScope = scope;
+    }
+
+    public PsiClass getAnnotationClass() {
+      return myAnnotationClass;
+    }
+
+    public SearchScope getScope() {
+      return myScope;
+    }
+  }
+
+  private AnnotatedPackagesSearch() {}
+
+  public static Query<PsiPackage> search(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
+    return INSTANCE.createQuery(new Parameters(annotationClass, scope));
+  }
+
+  public static Query<PsiPackage> search(@NotNull PsiClass annotationClass) {
+    return search(annotationClass, GlobalSearchScope.allScope(annotationClass.getProject()));
+  }
+}
\ No newline at end of file
diff --git a/java/java-indexing-api/src/com/intellij/psi/search/searches/AnnotationTargetsSearch.java b/java/java-indexing-api/src/com/intellij/psi/search/searches/AnnotationTargetsSearch.java
new file mode 100644
index 0000000..c177985
--- /dev/null
+++ b/java/java-indexing-api/src/com/intellij/psi/search/searches/AnnotationTargetsSearch.java
@@ -0,0 +1,63 @@
+/*
+ * 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.psi.search.searches;
+
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiMember;
+import com.intellij.psi.PsiModifierListOwner;
+import com.intellij.psi.PsiPackage;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.SearchScope;
+import com.intellij.util.MergeQuery;
+import com.intellij.util.Query;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author max
+ */
+public class AnnotationTargetsSearch {
+  public static AnnotationTargetsSearch INSTANCE = new AnnotationTargetsSearch();
+
+  public static class Parameters {
+    private final PsiClass myAnnotationClass;
+    private final SearchScope myScope;
+
+    public Parameters(final PsiClass annotationClass, final SearchScope scope) {
+      myAnnotationClass = annotationClass;
+      myScope = scope;
+    }
+
+    public PsiClass getAnnotationClass() {
+      return myAnnotationClass;
+    }
+
+    public SearchScope getScope() {
+      return myScope;
+    }
+  }
+
+  private AnnotationTargetsSearch() {}
+
+  public static Query<PsiModifierListOwner> search(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
+    final Query<PsiMember> members = AnnotatedMembersSearch.search(annotationClass, scope);
+    final Query<PsiPackage> packages = AnnotatedPackagesSearch.search(annotationClass, scope);
+    return new MergeQuery<PsiModifierListOwner>(members, packages);
+  }
+
+  public static Query<PsiModifierListOwner> search(@NotNull PsiClass annotationClass) {
+    return search(annotationClass, GlobalSearchScope.allScope(annotationClass.getProject()));
+  }
+}
\ No newline at end of file
diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/search/AnnotatedElementsSearcher.java b/java/java-indexing-impl/src/com/intellij/psi/impl/search/AnnotatedElementsSearcher.java
index cc0ac6d..dec2dcc 100644
--- a/java/java-indexing-impl/src/com/intellij/psi/impl/search/AnnotatedElementsSearcher.java
+++ b/java/java-indexing-impl/src/com/intellij/psi/impl/search/AnnotatedElementsSearcher.java
@@ -1,7 +1,21 @@
+/*
+ * 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.psi.impl.search;
 
 import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.Computable;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.PsiManagerImpl;
@@ -23,8 +37,6 @@
  * @author max
  */
 public class AnnotatedElementsSearcher implements QueryExecutor<PsiModifierListOwner, AnnotatedElementsSearch.Parameters> {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.search.AnnotatedMembersSearcher");
-
   @Override
   public boolean execute(@NotNull final AnnotatedElementsSearch.Parameters p, @NotNull final Processor<PsiModifierListOwner> consumer) {
     final PsiClass annClass = p.getAnnotationClass();
diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/search/AnnotatedPackagesSearcher.java b/java/java-indexing-impl/src/com/intellij/psi/impl/search/AnnotatedPackagesSearcher.java
new file mode 100644
index 0000000..4437b3f
--- /dev/null
+++ b/java/java-indexing-impl/src/com/intellij/psi/impl/search/AnnotatedPackagesSearcher.java
@@ -0,0 +1,135 @@
+/*
+ * 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 max
+ */
+package com.intellij.psi.impl.search;
+
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.*;
+import com.intellij.psi.impl.PsiManagerImpl;
+import com.intellij.psi.impl.java.stubs.index.JavaAnnotationIndex;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.PsiSearchHelper;
+import com.intellij.psi.search.SearchScope;
+import com.intellij.psi.search.searches.AnnotatedPackagesSearch;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.util.Processor;
+import com.intellij.util.QueryExecutor;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collection;
+
+public class AnnotatedPackagesSearcher implements QueryExecutor<PsiPackage, AnnotatedPackagesSearch.Parameters> {
+  private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.search.AnnotatedPackagesSearcher");
+
+  @Override
+  public boolean execute(@NotNull final AnnotatedPackagesSearch.Parameters p, @NotNull final Processor<PsiPackage> consumer) {
+    final PsiClass annClass = p.getAnnotationClass();
+    assert annClass.isAnnotationType() : "Annotation type should be passed to annotated packages search";
+
+    final String annotationFQN = annClass.getQualifiedName();
+    assert annotationFQN != null;
+
+    final PsiManagerImpl psiManager = (PsiManagerImpl)annClass.getManager();
+    final SearchScope useScope = p.getScope();
+
+    final String annotationShortName = annClass.getName();
+    assert annotationShortName != null;
+
+    final GlobalSearchScope scope = useScope instanceof GlobalSearchScope ? (GlobalSearchScope)useScope : null;
+
+    final Collection<PsiAnnotation> annotations = JavaAnnotationIndex.getInstance().get(annotationShortName, psiManager.getProject(), scope);
+    for (PsiAnnotation annotation : annotations) {
+      PsiModifierList modlist = (PsiModifierList)annotation.getParent();
+      final PsiElement owner = modlist.getParent();
+      if (!(owner instanceof PsiClass)) continue;
+      PsiClass candidate = (PsiClass)owner;
+      if (!"package-info".equals(candidate.getName())) continue;
+
+      LOG.assertTrue(candidate.isValid());
+
+      final PsiJavaCodeReferenceElement ref = annotation.getNameReferenceElement();
+      if (ref == null) continue;
+
+      if (!psiManager.areElementsEquivalent(ref.resolve(), annClass)) continue;
+      if (useScope instanceof GlobalSearchScope &&
+          !((GlobalSearchScope)useScope).contains(candidate.getContainingFile().getVirtualFile())) {
+        continue;
+      }
+      final String qname = candidate.getQualifiedName();
+      if (qname != null && !consumer.process(JavaPsiFacade.getInstance(psiManager.getProject()).findPackage(
+        qname.substring(0, qname.lastIndexOf('.'))))) {
+        return false;
+      }
+    }
+
+    PsiSearchHelper helper = PsiSearchHelper.SERVICE.getInstance(psiManager.getProject());
+    final GlobalSearchScope infoFilesFilter = new PackageInfoFilesOnly();
+
+    GlobalSearchScope infoFiles =
+      useScope instanceof GlobalSearchScope ? ((GlobalSearchScope)useScope).intersectWith(infoFilesFilter) : infoFilesFilter;
+
+    final boolean[] wantmore = {true};
+    helper.processAllFilesWithWord(annotationShortName, infoFiles, new Processor<PsiFile>() {
+      @Override
+      public boolean process(final PsiFile psiFile) {
+        PsiPackageStatement stmt = PsiTreeUtil.getChildOfType(psiFile, PsiPackageStatement.class);
+        if (stmt == null) return true;
+
+        final PsiModifierList annotations = stmt.getAnnotationList();
+        if (annotations == null) return true;
+        final PsiAnnotation ann = annotations.findAnnotation(annotationFQN);
+        if (ann == null) return true;
+
+        final PsiJavaCodeReferenceElement ref = ann.getNameReferenceElement();
+        if (ref == null) return true;
+
+        if (!psiManager.areElementsEquivalent(ref.resolve(), annClass)) return true;
+
+        wantmore[0] = consumer.process(JavaPsiFacade.getInstance(psiManager.getProject()).findPackage(stmt.getPackageName()));
+        return wantmore[0];
+      }
+    }, true);
+
+    return wantmore[0];
+  }
+
+  private static class PackageInfoFilesOnly extends GlobalSearchScope {
+    @Override
+    public int compare(@NotNull final VirtualFile file1, @NotNull final VirtualFile file2) {
+      return 0;
+    }
+
+    @Override
+    public boolean contains(@NotNull final VirtualFile file) {
+      return "package-info.java".equals(file.getName());
+    }
+
+    @Override
+    public boolean isSearchInLibraries() {
+      return false;
+    }
+
+    @Override
+    public boolean isSearchInModuleContent(@NotNull final Module aModule) {
+      return true;
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/search/VariableInIncompleteCodeSearcher.java b/java/java-indexing-impl/src/com/intellij/psi/impl/search/VariableInIncompleteCodeSearcher.java
new file mode 100644
index 0000000..abedbcb
--- /dev/null
+++ b/java/java-indexing-impl/src/com/intellij/psi/impl/search/VariableInIncompleteCodeSearcher.java
@@ -0,0 +1,71 @@
+/*
+ * 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.psi.impl.search;
+
+import com.intellij.lang.java.JavaLanguage;
+import com.intellij.openapi.application.QueryExecutorBase;
+import com.intellij.psi.*;
+import com.intellij.psi.search.LocalSearchScope;
+import com.intellij.psi.search.PsiElementProcessor;
+import com.intellij.psi.search.SearchScope;
+import com.intellij.psi.search.searches.ReferencesSearch;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.util.Processor;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Looks for references to local variable or method parameter in invalid (incomplete) code.
+ */
+public class VariableInIncompleteCodeSearcher extends QueryExecutorBase<PsiReference, ReferencesSearch.SearchParameters> {
+  public VariableInIncompleteCodeSearcher() {
+    super(true);
+  }
+
+  @Override
+  public void processQuery(@NotNull final ReferencesSearch.SearchParameters p, @NotNull final Processor<PsiReference> consumer) {
+    final PsiElement refElement = p.getElementToSearch();
+    if (!refElement.isValid() || !(refElement instanceof PsiLocalVariable || refElement instanceof PsiParameter)) return;
+
+    final String name = ((PsiVariable)refElement).getName();
+    if (name == null) return;
+
+    final SearchScope scope = p.getEffectiveSearchScope();
+    if (!(scope instanceof LocalSearchScope)) return;
+
+    PsiElement[] elements = ((LocalSearchScope)scope).getScope();
+    if (elements.length == 0) return;
+
+    PsiElementProcessor processor = new PsiElementProcessor() {
+      @Override
+      public boolean execute(@NotNull final PsiElement element) {
+        if (element instanceof PsiJavaCodeReferenceElement) {
+          final PsiJavaCodeReferenceElement ref = (PsiJavaCodeReferenceElement)element;
+          if (!ref.isQualified() && name.equals(ref.getText()) &&
+              ref.resolve() == null && ref.advancedResolve(true).getElement() == refElement) {
+            consumer.process(ref);
+          }
+        }
+        return true;
+      }
+    };
+
+    for (PsiElement element : elements) {
+      if (element.getLanguage().isKindOf(JavaLanguage.INSTANCE)) {
+        PsiTreeUtil.processElements(element, processor);
+      }
+    }
+  }
+}
diff --git a/java/java-psi-api/src/com/intellij/codeInsight/TestFrameworks.java b/java/java-psi-api/src/com/intellij/codeInsight/TestFrameworks.java
index 272edbc..8ade447 100644
--- a/java/java-psi-api/src/com/intellij/codeInsight/TestFrameworks.java
+++ b/java/java-psi-api/src/com/intellij/codeInsight/TestFrameworks.java
@@ -16,8 +16,10 @@
 package com.intellij.codeInsight;
 
 import com.intellij.openapi.components.ServiceManager;
+import com.intellij.openapi.extensions.Extensions;
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiMethod;
+import com.intellij.testIntegration.TestFramework;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -47,4 +49,14 @@
   public boolean isTestOrConfig(PsiClass psiClass) {
     return isTestClass(psiClass) || hasConfigMethods(psiClass);
   }
+  
+  @Nullable
+  public static TestFramework detectFramework(PsiClass psiClass) {
+    for (TestFramework framework : Extensions.getExtensions(TestFramework.EXTENSION_NAME)) {
+      if (framework.isTestClass(psiClass)) {
+        return framework;
+      }
+    }
+    return null;
+  }
 }
diff --git a/java/java-psi-api/src/com/intellij/ide/util/ClassFilter.java b/java/java-psi-api/src/com/intellij/ide/util/ClassFilter.java
new file mode 100644
index 0000000..534bb92
--- /dev/null
+++ b/java/java-psi-api/src/com/intellij/ide/util/ClassFilter.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.ide.util;
+
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.util.PsiUtil;
+
+/**
+* @author traff
+*/
+public interface ClassFilter {
+  ClassFilter INSTANTIABLE = new ClassFilter() {
+    public boolean isAccepted(PsiClass aClass) {
+      return PsiUtil.isInstantiatable(aClass);
+    }
+  };
+
+  boolean isAccepted(PsiClass aClass);
+  ClassFilter ALL = new ClassFilter() {
+    public boolean isAccepted(PsiClass aClass) {
+      return true;
+    }
+  };
+
+  interface ClassFilterWithScope extends ClassFilter {
+    GlobalSearchScope getScope();
+  }
+}
diff --git a/java/java-psi-api/src/com/intellij/psi/CommonReferenceProviderTypes.java b/java/java-psi-api/src/com/intellij/psi/CommonReferenceProviderTypes.java
new file mode 100644
index 0000000..234c15a
--- /dev/null
+++ b/java/java-psi-api/src/com/intellij/psi/CommonReferenceProviderTypes.java
@@ -0,0 +1,43 @@
+/*
+ * 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.psi;
+
+import com.intellij.openapi.components.ServiceManager;
+import com.intellij.openapi.project.Project;
+
+/**
+ * @author peter
+ */
+public abstract class CommonReferenceProviderTypes {
+
+  /**
+   * @deprecated
+   * @see #getInstance()
+   */
+  public static CommonReferenceProviderTypes getInstance(final Project project) {
+    return getInstance();
+  }
+
+  public static CommonReferenceProviderTypes getInstance() {
+    return ServiceManager.getService(CommonReferenceProviderTypes.class);
+  }
+
+  public static final ReferenceProviderType PROPERTIES_FILE_KEY_PROVIDER = new ReferenceProviderType("Properties File Key Provider");
+  public static final ReferenceProviderType URI_PROVIDER = new ReferenceProviderType("Uri references provider");
+  public static final ReferenceProviderType SCHEMA_PROVIDER = new ReferenceProviderType("Schema references provider");
+
+  public abstract PsiReferenceProvider getClassReferenceProvider();
+}
diff --git a/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java b/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java
index dd9deee..7cabc11 100644
--- a/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java
@@ -155,7 +155,7 @@
                                                         PsiManager manager,
                                                         PsiClass nestedLayer, 
                                                         PsiTypeParameter parameter) {
-    Couple<PsiType> types = Couple.newOne(type1, type2);
+    Couple<PsiType> types = Couple.of(type1, type2);
     if (compared.contains(types)) {
       if (nestedLayer != null) {
         PsiSubstitutor subst = PsiSubstitutor.EMPTY;
diff --git a/java/java-psi-api/src/com/intellij/psi/JavaCodeFragmentFactory.java b/java/java-psi-api/src/com/intellij/psi/JavaCodeFragmentFactory.java
new file mode 100644
index 0000000..e6c4362
--- /dev/null
+++ b/java/java-psi-api/src/com/intellij/psi/JavaCodeFragmentFactory.java
@@ -0,0 +1,121 @@
+/*
+ * 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.psi;
+
+import com.intellij.openapi.components.ServiceManager;
+import com.intellij.openapi.project.Project;
+import org.intellij.lang.annotations.MagicConstant;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public abstract class JavaCodeFragmentFactory {
+  public static JavaCodeFragmentFactory getInstance(Project project) {
+    return ServiceManager.getService(project, JavaCodeFragmentFactory.class);
+  }
+  
+  /**
+   * Creates a Java expression code fragment from the text of the expression.
+   *
+   * @param text         the text of the expression to create.
+   * @param context      the context for resolving references from the code fragment.
+   * @param expectedType expected type of the expression (does not have any effect on creation
+   *                     but can be accessed as {@link PsiExpressionCodeFragment#getExpectedType()}).
+   * @param isPhysical   whether the code fragment is created as a physical element
+   *                     (see {@link PsiElement#isPhysical()}).
+   * @return the created code fragment.
+   */
+  @NotNull
+  public abstract PsiExpressionCodeFragment createExpressionCodeFragment(@NotNull String text,
+                                                                         @Nullable PsiElement context,
+                                                                         @Nullable final PsiType expectedType,
+                                                                         boolean isPhysical);
+
+  /**
+   * Creates a Java code fragment from the text of a Java code block.
+   *
+   * @param text       the text of the code block to create.
+   * @param context    the context for resolving references from the code fragment.
+   * @param isPhysical whether the code fragment is created as a physical element
+   *                   (see {@link PsiElement#isPhysical()}).
+   * @return the created code fragment.
+   */
+  @NotNull
+  public abstract JavaCodeFragment createCodeBlockCodeFragment(@NotNull String text, @Nullable PsiElement context, boolean isPhysical);
+
+  /**
+   * Flag for {@linkplain #createTypeCodeFragment(String, PsiElement, boolean, int)} - allows void type.
+   */
+  public static final int ALLOW_VOID = 0x01;
+  /**
+   * Flag for {@linkplain #createTypeCodeFragment(String, PsiElement, boolean, int)} - allows type with ellipsis.
+   */
+  public static final int ALLOW_ELLIPSIS = 0x02;
+  /**
+   * Flag for {@linkplain #createTypeCodeFragment(String, PsiElement, boolean, int)} - allows disjunctive type.
+   */
+  public static final int ALLOW_DISJUNCTION = 0x04;
+
+  /**
+   * Creates a Java type code fragment from the text of the name of a Java type (the name
+   * of a primitive type, array type or class), with <code>void</code> and ellipsis
+   * not treated as a valid type.
+   *
+   * @param text       the text of the Java type to create.
+   * @param context    the context for resolving references from the code fragment.
+   * @param isPhysical whether the code fragment is created as a physical element
+   *                   (see {@link PsiElement#isPhysical()}).
+   * @return the created code fragment.
+   */
+  @NotNull
+  public abstract PsiTypeCodeFragment createTypeCodeFragment(@NotNull String text, @Nullable PsiElement context, boolean isPhysical);
+
+  /**
+   * Creates a Java type code fragment from the text of the name of a Java type (the name
+   * of a primitive type, array type or class).<br>
+   * {@code void}, ellipsis and disjunctive types are optionally treated as valid ones.
+   *
+   * @param text       the text of the Java type to create.
+   * @param context    the context for resolving references from the code fragment.
+   * @param isPhysical whether the code fragment is created as a physical element
+   *                   (see {@link PsiElement#isPhysical()}).
+   * @param flags      types allowed to present in text.
+   * @return the created code fragment.
+   */
+  @NotNull
+  public abstract PsiTypeCodeFragment createTypeCodeFragment(@NotNull String text,
+                                                             @Nullable PsiElement context,
+                                                             boolean isPhysical,
+                                                             @MagicConstant(flags = {ALLOW_VOID, ALLOW_ELLIPSIS, ALLOW_DISJUNCTION}) int flags);
+
+  /**
+   * Creates a Java reference code fragment from the text of a Java reference to a
+   * package or class.
+   *
+   * @param text              the text of the reference to create.
+   * @param context           the context for resolving the reference.
+   * @param isPhysical        whether the code fragment is created as a physical element
+   *                          (see {@link PsiElement#isPhysical()}).
+   * @param isClassesAccepted if true then classes as well as packages are accepted as
+   *                          reference target, otherwise only packages are
+   * @return the created reference fragment.
+   */
+  @NotNull
+  public abstract PsiJavaCodeReferenceCodeFragment createReferenceCodeFragment(@NotNull String text,
+                                                                               @Nullable PsiElement context,
+                                                                               boolean isPhysical,
+                                                                               boolean isClassesAccepted);
+
+}
diff --git a/java/java-psi-api/src/com/intellij/psi/LambdaHighlightingUtil.java b/java/java-psi-api/src/com/intellij/psi/LambdaHighlightingUtil.java
index 503328a..0bfaacf 100644
--- a/java/java-psi-api/src/com/intellij/psi/LambdaHighlightingUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/LambdaHighlightingUtil.java
@@ -17,7 +17,9 @@
 
 import com.intellij.openapi.util.Computable;
 import com.intellij.psi.util.MethodSignature;
+import com.intellij.psi.util.PsiTypesUtil;
 import com.intellij.psi.util.PsiUtil;
+import com.intellij.psi.util.TypeConversionUtil;
 import com.intellij.util.IncorrectOperationException;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -45,6 +47,34 @@
     return "Multiple non-overriding abstract methods found";
   }
 
+  @Nullable
+  public static PsiElement checkParametersCompatible(PsiLambdaExpression expression,
+                                                     PsiParameter[] methodParameters,
+                                                     PsiSubstitutor substitutor) {
+    final PsiParameter[] lambdaParameters = expression.getParameterList().getParameters();
+    if (lambdaParameters.length != methodParameters.length) {
+      return expression;
+    }
+    else {
+      boolean hasFormalParameterTypes = expression.hasFormalParameterTypes();
+      for (int i = 0; i < lambdaParameters.length; i++) {
+        PsiParameter lambdaParameter = lambdaParameters[i];
+        PsiType lambdaParameterType = lambdaParameter.getType();
+        PsiType substitutedParamType = substitutor.substitute(methodParameters[i].getType());
+        if (hasFormalParameterTypes) {
+          if (!PsiTypesUtil.compareTypes(lambdaParameterType, substitutedParamType, true)) {
+            return lambdaParameter;
+          }
+        } else {
+          if (!TypeConversionUtil.isAssignable(substitutedParamType, lambdaParameterType)) {
+            return lambdaParameter;
+          }
+        }
+      }
+    }
+    return null;
+  }
+
   public static String checkReturnTypeCompatible(PsiLambdaExpression lambdaExpression, PsiType functionalInterfaceReturnType) {
     if (functionalInterfaceReturnType == PsiType.VOID) {
       final PsiElement body = lambdaExpression.getBody();
diff --git a/java/java-psi-api/src/com/intellij/psi/LanguageAnnotationSupport.java b/java/java-psi-api/src/com/intellij/psi/LanguageAnnotationSupport.java
new file mode 100644
index 0000000..ed0bef7
--- /dev/null
+++ b/java/java-psi-api/src/com/intellij/psi/LanguageAnnotationSupport.java
@@ -0,0 +1,29 @@
+/*
+ * 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.psi;
+
+import com.intellij.lang.LanguageExtension;
+
+/**
+ * @author Serega.Vasiliev
+ */
+public class LanguageAnnotationSupport extends LanguageExtension<PsiAnnotationSupport> {
+  public static final LanguageAnnotationSupport INSTANCE = new LanguageAnnotationSupport();
+
+  private LanguageAnnotationSupport() {
+    super("com.intellij.annotationSupport");
+  }
+}
diff --git a/java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceUtil.java b/java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceUtil.java
index fa891fd..4c0e4be 100644
--- a/java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceUtil.java
@@ -68,12 +68,11 @@
 
   public static boolean isCorrectAssignment(PsiType[] signatureParameterTypes2,
                                             PsiType[] parameterTypes,
-                                            PsiSubstitutor substitutor,
                                             boolean varargs,
                                             int offset) {
     final int min = Math.min(signatureParameterTypes2.length, parameterTypes.length - offset);
     for (int i = 0; i < min; i++) {
-      final PsiType type1 = substitutor.substitute(parameterTypes[i + offset]);
+      final PsiType type1 = parameterTypes[i + offset];
       final PsiType type2 = signatureParameterTypes2[i];
       if (varargs && i == signatureParameterTypes2.length - 1) {
         if (!TypeConversionUtil.isAssignable(type2, type1) && !TypeConversionUtil.isAssignable(((PsiArrayType)type2).getComponentType(), type1)) {
diff --git a/java/java-psi-api/src/com/intellij/psi/codeStyle/ReferenceAdjuster.java b/java/java-psi-api/src/com/intellij/psi/codeStyle/ReferenceAdjuster.java
index ff1656f..6185608 100644
--- a/java/java-psi-api/src/com/intellij/psi/codeStyle/ReferenceAdjuster.java
+++ b/java/java-psi-api/src/com/intellij/psi/codeStyle/ReferenceAdjuster.java
@@ -32,7 +32,7 @@
   void processRange(@NotNull ASTNode element, int startOffset, int endOffset, Project project);
 
   class Extension extends LanguageExtension<ReferenceAdjuster> {
-    private static final Extension INSTANCE = new Extension();
+    public static final Extension INSTANCE = new Extension();
 
     public Extension() {
       super("com.intellij.codeStyle.ReferenceAdjuster");
diff --git a/java/java-psi-api/src/com/intellij/psi/util/ClassKind.java b/java/java-psi-api/src/com/intellij/psi/util/ClassKind.java
new file mode 100644
index 0000000..d7429eb
--- /dev/null
+++ b/java/java-psi-api/src/com/intellij/psi/util/ClassKind.java
@@ -0,0 +1,23 @@
+/*
+ * 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.psi.util;
+
+/**
+ * @author peter
+ */
+public enum ClassKind {
+  CLASS, INTERFACE, ENUM, ANNOTATION
+}
diff --git a/java/java-psi-api/src/com/intellij/psi/util/ImportsUtil.java b/java/java-psi-api/src/com/intellij/psi/util/ImportsUtil.java
new file mode 100644
index 0000000..17bcc0f
--- /dev/null
+++ b/java/java-psi-api/src/com/intellij/psi/util/ImportsUtil.java
@@ -0,0 +1,82 @@
+/*
+ * 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.psi.util;
+
+import com.intellij.psi.*;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * User: anna
+ * Date: 9/1/11
+ */
+public class ImportsUtil {
+  private ImportsUtil() {
+  }
+
+  public static List<PsiJavaCodeReferenceElement> collectReferencesThrough(PsiFile file,
+                                                                           @Nullable final PsiJavaCodeReferenceElement refExpr,
+                                                                           final PsiImportStaticStatement staticImport) {
+    final List<PsiJavaCodeReferenceElement> expressionToExpand = new ArrayList<PsiJavaCodeReferenceElement>();
+    file.accept(new JavaRecursiveElementWalkingVisitor() {
+      @Override
+      public void visitReferenceElement(PsiJavaCodeReferenceElement expression) {
+        if (refExpr == null || refExpr != expression) {
+          final PsiElement resolveScope = expression.advancedResolve(true).getCurrentFileResolveScope();
+          if (resolveScope == staticImport) {
+            expressionToExpand.add(expression);
+          }
+        }
+        super.visitElement(expression);
+      }
+    });
+    return expressionToExpand;
+  }
+
+  public static void replaceAllAndDeleteImport(List<PsiJavaCodeReferenceElement> expressionToExpand,
+                                               @Nullable PsiJavaCodeReferenceElement refExpr,
+                                                PsiImportStaticStatement staticImport) {
+    if (refExpr != null) {
+      expressionToExpand.add(refExpr);
+    }
+    Collections.sort(expressionToExpand, new Comparator<PsiJavaCodeReferenceElement>() {
+      @Override
+      public int compare(PsiJavaCodeReferenceElement o1, PsiJavaCodeReferenceElement o2) {
+        return o2.getTextOffset() - o1.getTextOffset();
+      }
+    });
+    for (PsiJavaCodeReferenceElement expression : expressionToExpand) {
+      expand(expression, staticImport);
+    }
+    staticImport.delete();
+  }
+
+  public static void expand(@NotNull PsiJavaCodeReferenceElement refExpr, PsiImportStaticStatement staticImport) {
+    final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(refExpr.getProject());
+    final PsiReferenceExpression referenceExpression = elementFactory.createReferenceExpression(staticImport.resolveTargetClass());
+    if (refExpr instanceof PsiReferenceExpression) {
+      ((PsiReferenceExpression)refExpr).setQualifierExpression(referenceExpression);
+    }
+    else {
+      refExpr.replace(elementFactory.createReferenceFromText(referenceExpression.getText() + "." + refExpr.getText(), refExpr));
+    }
+  }
+}
diff --git a/java/java-psi-api/src/com/intellij/psi/util/PropertyUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PropertyUtil.java
index 4edae81..5a50bc8 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/PropertyUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/PropertyUtil.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.
@@ -88,7 +88,9 @@
 
     if (!(methodName.startsWith("set") && methodName.length() > "set".length())) return false;
     if (Character.isLowerCase(methodName.charAt("set".length()))
-      && (methodName.length() == "set".length() + 1 || Character.isLowerCase(methodName.charAt("set".length() + 1)))) return false;
+        && (methodName.length() == "set".length() + 1 || Character.isLowerCase(methodName.charAt("set".length() + 1)))) {
+      return false;
+    }
 
     if (method.getParameterList().getParametersCount() != 1) {
       return false;
@@ -103,7 +105,8 @@
     return Comparing.equal(PsiUtil.resolveClassInType(TypeConversionUtil.erasure(returnType)), method.getContainingClass());
   }
 
-  @Nullable public static String getPropertyName(@NotNull PsiMethod method) {
+  @Nullable
+  public static String getPropertyName(@NotNull PsiMethod method) {
     if (isSimplePropertyGetter(method)) {
       return getPropertyNameByGetter(method);
     }
@@ -130,7 +133,9 @@
   }
 
   @NotNull
-  public static Map<String, PsiMethod> getAllProperties(@NotNull final PsiClass psiClass, final boolean acceptSetters, final boolean acceptGetters) {
+  public static Map<String, PsiMethod> getAllProperties(@NotNull final PsiClass psiClass,
+                                                        final boolean acceptSetters,
+                                                        final boolean acceptGetters) {
     return getAllProperties(psiClass, acceptSetters, acceptGetters, true);
   }
 
@@ -149,7 +154,7 @@
 
     for (PsiMethod method : methods) {
       if (filterMethods(method)) continue;
-      if (acceptSetters && isSimplePropertySetter(method)||
+      if (acceptSetters && isSimplePropertySetter(method) ||
           acceptGetters && isSimplePropertyGetter(method)) {
         map.put(getPropertyName(method), method);
       }
@@ -159,7 +164,7 @@
 
 
   private static boolean filterMethods(final PsiMethod method) {
-    if(method.hasModifierProperty(PsiModifier.STATIC) || !method.hasModifierProperty(PsiModifier.PUBLIC)) return true;
+    if (method.hasModifierProperty(PsiModifier.STATIC) || !method.hasModifierProperty(PsiModifier.PUBLIC)) return true;
 
     PsiClass psiClass = method.getContainingClass();
     if (psiClass == null) return false;
@@ -196,6 +201,7 @@
     }
     return list;
   }
+
   @NotNull
   public static List<PsiMethod> getAccessors(@NotNull final PsiClass psiClass, final String propertyName) {
     return ContainerUtil.concat(getGetters(psiClass, propertyName), getSetters(psiClass, propertyName));
@@ -246,7 +252,8 @@
     return isSimplePropertyGetter(method) || isSimplePropertySetter(method);
   }
 
-  @Nullable public static PsiMethod findPropertySetter(PsiClass aClass,
+  @Nullable
+  public static PsiMethod findPropertySetter(PsiClass aClass,
                                              String propertyName,
                                              boolean isStatic,
                                              boolean checkSuperClasses) {
@@ -288,7 +295,8 @@
     return null;
   }
 
-  @Nullable public static PsiField findPropertyField(PsiClass aClass, String propertyName, boolean isStatic) {
+  @Nullable
+  public static PsiField findPropertyField(PsiClass aClass, String propertyName, boolean isStatic) {
     PsiField[] fields = aClass.getAllFields();
 
     for (PsiField field : fields) {
@@ -299,7 +307,8 @@
     return null;
   }
 
-  @Nullable public static String getPropertyName(@NonNls String methodName) {
+  @Nullable
+  public static String getPropertyName(@NonNls String methodName) {
     return StringUtil.getPropertyName(methodName);
   }
 
@@ -332,7 +341,7 @@
   @NonNls
   public static String[] suggestGetterNames(String propertyName) {
     final String str = StringUtil.capitalizeWithJavaBeanConvention(StringUtil.sanitizeJavaIdentifier(propertyName));
-    return new String[] { IS_PREFIX + str, "get" + str };
+    return new String[]{IS_PREFIX + str, "get" + str};
   }
 
   public static String suggestSetterName(@NonNls String propertyName) {
@@ -388,7 +397,7 @@
   }
 
   /**
-   * Consider using {@link com.intellij.codeInsight.generation.GenerateMembersUtil#generateGetterPrototype(com.intellij.psi.PsiField)} 
+   * Consider using {@link com.intellij.codeInsight.generation.GenerateMembersUtil#generateGetterPrototype(com.intellij.psi.PsiField)}
    * to add @Override annotation
    */
   @Nullable
@@ -451,7 +460,9 @@
     String propertyName = codeStyleManager.variableNameToPropertyName(name, kind);
     String setName = suggestSetterName(field);
     try {
-      PsiMethod setMethod = factory.createMethodFromText(factory.createMethod(setName, returnSelf ? factory.createType(containingClass) : PsiType.VOID).getText(), field);
+      PsiMethod setMethod = factory
+        .createMethodFromText(factory.createMethod(setName, returnSelf ? factory.createType(containingClass) : PsiType.VOID).getText(),
+                              field);
       String parameterName = codeStyleManager.propertyNameToVariableName(propertyName, VariableKind.PARAMETER);
       PsiParameter param = factory.createParameter(parameterName, field.getType());
 
@@ -494,7 +505,9 @@
     }
   }
 
-  private static void annotateWithNullableStuff(final PsiModifierListOwner field, final PsiElementFactory factory, final PsiModifierListOwner listOwner)
+  private static void annotateWithNullableStuff(final PsiModifierListOwner field,
+                                                final PsiElementFactory factory,
+                                                final PsiModifierListOwner listOwner)
     throws IncorrectOperationException {
     final NullableNotNullManager manager = NullableNotNullManager.getInstance(field.getProject());
     final String notNull = manager.getNotNull(field);
@@ -550,7 +563,9 @@
     else if (member instanceof PsiField) {
       return member.getName();
     }
-    else return null;
+    else {
+      return null;
+    }
   }
 
   @Nullable
@@ -608,8 +623,8 @@
       final PsiType returnType = psiMethod.getReturnType();
       if (returnType == null) return null;
       final PsiCodeBlock body = psiMethod.getBody();
-      final PsiStatement[] statements = body == null? null : body.getStatements();
-      final PsiStatement statement = statements == null || statements.length != 1? null : statements[0];
+      final PsiStatement[] statements = body == null ? null : body.getStatements();
+      final PsiStatement statement = statements == null || statements.length != 1 ? null : statements[0];
       final PsiElement target;
       if (PsiType.VOID.equals(returnType)) {
         final PsiExpression expression =
@@ -623,259 +638,264 @@
       if (resolved instanceof PsiField) {
         final PsiField field = (PsiField)resolved;
         if (psiMember.getContainingClass() == field.getContainingClass() ||
-               psiMember.getContainingClass().isInheritor(field.getContainingClass(), true)) return field;
+            psiMember.getContainingClass().isInheritor(field.getContainingClass(), true)) {
+          return field;
+        }
       }
     }
     return null;
   }
 
   public static PsiMethod findSetterForField(PsiField field) {
-      final PsiClass containingClass = field.getContainingClass();
-      final String propertyName = suggestPropertyName(field);
-      final boolean isStatic = field.hasModifierProperty(PsiModifier.STATIC);
-      return findPropertySetter(containingClass, propertyName, isStatic, true);
+    final PsiClass containingClass = field.getContainingClass();
+    final String propertyName = suggestPropertyName(field);
+    final boolean isStatic = field.hasModifierProperty(PsiModifier.STATIC);
+    return findPropertySetter(containingClass, propertyName, isStatic, true);
   }
 
   public static PsiMethod findGetterForField(PsiField field) {
-      final PsiClass containingClass = field.getContainingClass();
-      final String propertyName = suggestPropertyName(field);
-      final boolean isStatic = field.hasModifierProperty(PsiModifier.STATIC);
-      return findPropertyGetter(containingClass, propertyName, isStatic, true);
+    final PsiClass containingClass = field.getContainingClass();
+    final String propertyName = suggestPropertyName(field);
+    final boolean isStatic = field.hasModifierProperty(PsiModifier.STATIC);
+    return findPropertyGetter(containingClass, propertyName, isStatic, true);
   }
 
   /**
- * If the name of the method looks like a getter and the body consists of a single return statement,
- * returns the returned expression. Otherwise, returns null.
- *
- * @param method the method to check
- * @return the return value, or null if it doesn't match the condotions.
- */
-@Nullable
-public static PsiExpression getGetterReturnExpression(PsiMethod method) {
-  return method != null && hasGetterSignature(method) ? getSingleReturnValue(method) : null;
-}
+   * If the name of the method looks like a getter and the body consists of a single return statement,
+   * returns the returned expression. Otherwise, returns null.
+   *
+   * @param method the method to check
+   * @return the return value, or null if it doesn't match the condotions.
+   */
+  @Nullable
+  public static PsiExpression getGetterReturnExpression(PsiMethod method) {
+    return method != null && hasGetterSignature(method) ? getSingleReturnValue(method) : null;
+  }
 
   private static boolean hasGetterSignature(@NotNull PsiMethod method) {
-  return isSimplePropertyGetter(method) && !method.hasModifierProperty(PsiModifier.SYNCHRONIZED);
-}
-
-  @Nullable
-public static PsiExpression getSingleReturnValue(@NotNull PsiMethod method) {
-  final PsiCodeBlock body = method.getBody();
-  if (body == null) {
-    return null;
+    return isSimplePropertyGetter(method) && !method.hasModifierProperty(PsiModifier.SYNCHRONIZED);
   }
-  final PsiStatement[] statements = body.getStatements();
-  final PsiStatement statement = statements.length != 1 ? null : statements[0];
-  return statement instanceof PsiReturnStatement ? ((PsiReturnStatement)statement).getReturnValue() : null;
-}
 
   @Nullable
-public static PsiField getFieldOfGetter(PsiMethod method) {
-  PsiField field = getSimplyReturnedField(method, getGetterReturnExpression(method));
-  if (field != null) {
-    final PsiType returnType = method.getReturnType();
-    if (returnType != null && field.getType().equalsToText(returnType.getCanonicalText())) {
-      return field;
+  public static PsiExpression getSingleReturnValue(@NotNull PsiMethod method) {
+    final PsiCodeBlock body = method.getBody();
+    if (body == null) {
+      return null;
     }
+    final PsiStatement[] statements = body.getStatements();
+    final PsiStatement statement = statements.length != 1 ? null : statements[0];
+    return statement instanceof PsiReturnStatement ? ((PsiReturnStatement)statement).getReturnValue() : null;
   }
-  return null;
-}
 
   @Nullable
-public static PsiField getSimplyReturnedField(PsiMethod method, @Nullable PsiExpression value) {
-  if (!(value instanceof PsiReferenceExpression)) {
+  public static PsiField getFieldOfGetter(PsiMethod method) {
+    PsiField field = getSimplyReturnedField(method, getGetterReturnExpression(method));
+    if (field != null) {
+      final PsiType returnType = method.getReturnType();
+      if (returnType != null && field.getType().equalsToText(returnType.getCanonicalText())) {
+        return field;
+      }
+    }
     return null;
   }
 
-  final PsiReferenceExpression reference = (PsiReferenceExpression)value;
-  if (hasSubstantialQualifier(reference)) {
-    return null;
-  }
+  @Nullable
+  public static PsiField getSimplyReturnedField(PsiMethod method, @Nullable PsiExpression value) {
+    if (!(value instanceof PsiReferenceExpression)) {
+      return null;
+    }
 
-  final PsiElement referent = reference.resolve();
-  if (!(referent instanceof PsiField)) {
-    return null;
-  }
+    final PsiReferenceExpression reference = (PsiReferenceExpression)value;
+    if (hasSubstantialQualifier(reference)) {
+      return null;
+    }
 
-  final PsiField field = (PsiField)referent;
-  return InheritanceUtil.isInheritorOrSelf(method.getContainingClass(), field.getContainingClass(), true) ? field : null;
-}
+    final PsiElement referent = reference.resolve();
+    if (!(referent instanceof PsiField)) {
+      return null;
+    }
+
+    final PsiField field = (PsiField)referent;
+    return InheritanceUtil.isInheritorOrSelf(method.getContainingClass(), field.getContainingClass(), true) ? field : null;
+  }
 
   private static boolean hasSubstantialQualifier(PsiReferenceExpression reference) {
-  final PsiExpression qualifier = reference.getQualifierExpression();
-  if (qualifier == null) return false;
+    final PsiExpression qualifier = reference.getQualifierExpression();
+    if (qualifier == null) return false;
 
-  if (qualifier instanceof PsiThisExpression || qualifier instanceof PsiSuperExpression) {
-    return false;
-  }
+    if (qualifier instanceof PsiThisExpression || qualifier instanceof PsiSuperExpression) {
+      return false;
+    }
 
-  if (qualifier instanceof PsiReferenceExpression) {
-    return !(((PsiReferenceExpression)qualifier).resolve() instanceof PsiClass);
+    if (qualifier instanceof PsiReferenceExpression) {
+      return !(((PsiReferenceExpression)qualifier).resolve() instanceof PsiClass);
+    }
+    return true;
   }
-  return true;
-}
 
   public static boolean isSimpleGetter(PsiMethod method) {
-  return getFieldOfGetter(method) != null;
-}
+    return getFieldOfGetter(method) != null;
+  }
 
   @Nullable
-public static PsiField getFieldOfSetter(PsiMethod method) {
-  if (method == null) {
-    return null;
-  }
-  final PsiParameterList parameterList = method.getParameterList();
-  if (parameterList.getParametersCount() != 1) {
-    return null;
-  }
-  @NonNls final String name = method.getName();
-  if (!name.startsWith("set")) {
-    return null;
-  }
-  if (method.hasModifierProperty(PsiModifier.SYNCHRONIZED)) {
-    return null;
-  }
-  final PsiCodeBlock body = method.getBody();
-  if (body == null) {
-    return null;
-  }
-  final PsiStatement[] statements = body.getStatements();
-  if (statements.length != 1) {
-    return null;
-  }
-  final PsiStatement statement = statements[0];
-  if (!(statement instanceof PsiExpressionStatement)) {
-    return null;
-  }
-  final PsiExpressionStatement possibleAssignmentStatement = (PsiExpressionStatement)statement;
-  final PsiExpression possibleAssignment = possibleAssignmentStatement.getExpression();
-  if (!(possibleAssignment instanceof PsiAssignmentExpression)) {
-    return null;
-  }
-  final PsiAssignmentExpression assignment = (PsiAssignmentExpression)possibleAssignment;
-  if (!JavaTokenType.EQ.equals(assignment.getOperationTokenType())) {
-    return null;
-  }
-  final PsiExpression lhs = assignment.getLExpression();
-  if (!(lhs instanceof PsiReferenceExpression)) {
-    return null;
-  }
-  final PsiReferenceExpression reference = (PsiReferenceExpression)lhs;
-  final PsiExpression qualifier = reference.getQualifierExpression();
-  if (qualifier instanceof PsiReferenceExpression) {
-    final PsiReferenceExpression referenceExpression = (PsiReferenceExpression)qualifier;
-    final PsiElement target = referenceExpression.resolve();
-    if (!(target instanceof PsiClass)) {
+  public static PsiField getFieldOfSetter(PsiMethod method) {
+    if (method == null) {
+      return null;
+    }
+    final PsiParameterList parameterList = method.getParameterList();
+    if (parameterList.getParametersCount() != 1) {
+      return null;
+    }
+    @NonNls final String name = method.getName();
+    if (!name.startsWith("set")) {
+      return null;
+    }
+    if (method.hasModifierProperty(PsiModifier.SYNCHRONIZED)) {
+      return null;
+    }
+    final PsiCodeBlock body = method.getBody();
+    if (body == null) {
+      return null;
+    }
+    final PsiStatement[] statements = body.getStatements();
+    if (statements.length != 1) {
+      return null;
+    }
+    final PsiStatement statement = statements[0];
+    if (!(statement instanceof PsiExpressionStatement)) {
+      return null;
+    }
+    final PsiExpressionStatement possibleAssignmentStatement = (PsiExpressionStatement)statement;
+    final PsiExpression possibleAssignment = possibleAssignmentStatement.getExpression();
+    if (!(possibleAssignment instanceof PsiAssignmentExpression)) {
+      return null;
+    }
+    final PsiAssignmentExpression assignment = (PsiAssignmentExpression)possibleAssignment;
+    if (!JavaTokenType.EQ.equals(assignment.getOperationTokenType())) {
+      return null;
+    }
+    final PsiExpression lhs = assignment.getLExpression();
+    if (!(lhs instanceof PsiReferenceExpression)) {
+      return null;
+    }
+    final PsiReferenceExpression reference = (PsiReferenceExpression)lhs;
+    final PsiExpression qualifier = reference.getQualifierExpression();
+    if (qualifier instanceof PsiReferenceExpression) {
+      final PsiReferenceExpression referenceExpression = (PsiReferenceExpression)qualifier;
+      final PsiElement target = referenceExpression.resolve();
+      if (!(target instanceof PsiClass)) {
+        return null;
+      }
+    }
+    else if (qualifier != null && !(qualifier instanceof PsiThisExpression) && !(qualifier instanceof PsiSuperExpression)) {
+      return null;
+    }
+    final PsiElement referent = reference.resolve();
+    if (referent == null) {
+      return null;
+    }
+    if (!(referent instanceof PsiField)) {
+      return null;
+    }
+    final PsiField field = (PsiField)referent;
+    final PsiClass fieldContainingClass = field.getContainingClass();
+    final PsiClass methodContainingClass = method.getContainingClass();
+    if (!InheritanceUtil.isInheritorOrSelf(methodContainingClass, fieldContainingClass, true)) {
+      return null;
+    }
+    final PsiExpression rhs = assignment.getRExpression();
+    if (!(rhs instanceof PsiReferenceExpression)) {
+      return null;
+    }
+    final PsiReferenceExpression rReference = (PsiReferenceExpression)rhs;
+    final PsiExpression rQualifier = rReference.getQualifierExpression();
+    if (rQualifier != null) {
+      return null;
+    }
+    final PsiElement rReferent = rReference.resolve();
+    if (rReferent == null) {
+      return null;
+    }
+    if (!(rReferent instanceof PsiParameter)) {
+      return null;
+    }
+    final PsiType fieldType = field.getType();
+    final PsiType parameterType = ((PsiVariable)rReferent).getType();
+    if (fieldType.equalsToText(parameterType.getCanonicalText())) {
+      return field;
+    }
+    else {
       return null;
     }
   }
-  else if (qualifier != null && !(qualifier instanceof PsiThisExpression) && !(qualifier instanceof PsiSuperExpression)) {
-    return null;
-  }
-  final PsiElement referent = reference.resolve();
-  if (referent == null) {
-    return null;
-  }
-  if (!(referent instanceof PsiField)) {
-    return null;
-  }
-  final PsiField field = (PsiField)referent;
-  final PsiClass fieldContainingClass = field.getContainingClass();
-  final PsiClass methodContainingClass = method.getContainingClass();
-  if (!InheritanceUtil.isInheritorOrSelf(methodContainingClass, fieldContainingClass, true)) {
-    return null;
-  }
-  final PsiExpression rhs = assignment.getRExpression();
-  if (!(rhs instanceof PsiReferenceExpression)) {
-    return null;
-  }
-  final PsiReferenceExpression rReference = (PsiReferenceExpression)rhs;
-  final PsiExpression rQualifier = rReference.getQualifierExpression();
-  if (rQualifier != null) {
-    return null;
-  }
-  final PsiElement rReferent = rReference.resolve();
-  if (rReferent == null) {
-    return null;
-  }
-  if (!(rReferent instanceof PsiParameter)) {
-    return null;
-  }
-  final PsiType fieldType = field.getType();
-  final PsiType parameterType = ((PsiVariable)rReferent).getType();
-  if (fieldType.equalsToText(parameterType.getCanonicalText())) {
-    return field;
-  }
-  else {
-    return null;
-  }
-}
 
   public static boolean isSimpleSetter(PsiMethod method) {
-  return getFieldOfSetter(method) != null;
-}
+    return getFieldOfSetter(method) != null;
+  }
 
   @Nullable
-public static PsiMethod getReversePropertyMethod(PsiMethod propertyMethod) {
-  if (propertyMethod == null) {
-    return null;
-  }
-  final PsiClass aClass = propertyMethod.getContainingClass();
-  if (aClass == null) {
-    return null;
-  }
-  final String methodName = propertyMethod.getName();
-  final String prefix;
-  if (methodName.startsWith("get")) {
-    prefix = "get";
-  }
-  else if (methodName.startsWith(IS_PREFIX)) {
-    prefix = IS_PREFIX;
-  }
-  else if (methodName.startsWith("set")) {
-    prefix = "set";
-  }
-  else {
-    return null;
-  }
-  final String name = methodName.substring(prefix.length());
-  final PsiField field;
-  if (prefix.equals("set")) {
-    field = getFieldOfSetter(propertyMethod);
-  }
-  else {
-    field = getFieldOfGetter(propertyMethod);
-  }
-  if (field == null) {
-    return null;
-  }
-  if (prefix.equals("set")) {
-    final PsiMethod result = findPropertyMethod(aClass, "get", name, field);
-    if (result != null) {
-      return result;
+  public static PsiMethod getReversePropertyMethod(PsiMethod propertyMethod) {
+    if (propertyMethod == null) {
+      return null;
     }
-    return findPropertyMethod(aClass, IS_PREFIX, name, field);
-  }
-  else {
-    return findPropertyMethod(aClass, "set", name, field);
-  }
-}
-
-  private static PsiMethod findPropertyMethod(@NotNull PsiClass aClass, @NotNull String prefix, @NotNull String propertyName, @NotNull PsiField field1) {
-  final PsiMethod[] methods = aClass.findMethodsByName(prefix + propertyName, true);
-  for (PsiMethod method : methods) {
-    final PsiField field2;
-    if (prefix.equals("set")) {
-      field2 = getFieldOfSetter(method);
+    final PsiClass aClass = propertyMethod.getContainingClass();
+    if (aClass == null) {
+      return null;
+    }
+    final String methodName = propertyMethod.getName();
+    final String prefix;
+    if (methodName.startsWith("get")) {
+      prefix = "get";
+    }
+    else if (methodName.startsWith(IS_PREFIX)) {
+      prefix = IS_PREFIX;
+    }
+    else if (methodName.startsWith("set")) {
+      prefix = "set";
     }
     else {
-      field2 = getFieldOfGetter(method);
+      return null;
     }
-    if (field1.equals(field2)) {
-      return method;
+    final String name = methodName.substring(prefix.length());
+    final PsiField field;
+    if (prefix.equals("set")) {
+      field = getFieldOfSetter(propertyMethod);
+    }
+    else {
+      field = getFieldOfGetter(propertyMethod);
+    }
+    if (field == null) {
+      return null;
+    }
+    if (prefix.equals("set")) {
+      final PsiMethod result = findPropertyMethod(aClass, "get", name, field);
+      if (result != null) {
+        return result;
+      }
+      return findPropertyMethod(aClass, IS_PREFIX, name, field);
+    }
+    else {
+      return findPropertyMethod(aClass, "set", name, field);
     }
   }
-  return null;
-}
+
+  private static PsiMethod findPropertyMethod(@NotNull PsiClass aClass,
+                                              @NotNull String prefix,
+                                              @NotNull String propertyName,
+                                              @NotNull PsiField field1) {
+    final PsiMethod[] methods = aClass.findMethodsByName(prefix + propertyName, true);
+    for (PsiMethod method : methods) {
+      final PsiField field2;
+      if (prefix.equals("set")) {
+        field2 = getFieldOfSetter(method);
+      }
+      else {
+        field2 = getFieldOfGetter(method);
+      }
+      if (field1.equals(field2)) {
+        return method;
+      }
+    }
+    return null;
+  }
 }
diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiConcatenationUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PsiConcatenationUtil.java
new file mode 100644
index 0000000..feeb280
--- /dev/null
+++ b/java/java-psi-api/src/com/intellij/psi/util/PsiConcatenationUtil.java
@@ -0,0 +1,134 @@
+/*
+ * 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.psi.util;
+
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.util.IncorrectOperationException;
+
+import java.util.List;
+
+/**
+ * User: cdr
+ */
+public class PsiConcatenationUtil {
+
+  public static void buildFormatString(PsiExpression expression, StringBuilder formatString,
+                                       List<PsiExpression> formatParameters, boolean printfFormat) {
+    if (expression instanceof PsiLiteralExpression) {
+      final PsiLiteralExpression literalExpression = (PsiLiteralExpression) expression;
+      final String text = String.valueOf(literalExpression.getValue());
+      final String formatText;
+      if (printfFormat) {
+        formatText = StringUtil.escapeStringCharacters(text).replace("%", "%%").replace("\\'", "'");
+      }
+      else {
+        formatText = StringUtil.escapeStringCharacters(text).replace("'", "''").replaceAll("((\\{|})+)", "'$1'");
+      }
+      formatString.append(formatText);
+    } else if (expression instanceof PsiPolyadicExpression) {
+      final PsiType type = expression.getType();
+      if (type != null && type.equalsToText("java.lang.String")) {
+        final PsiPolyadicExpression binaryExpression = (PsiPolyadicExpression) expression;
+        PsiExpression[] operands = binaryExpression.getOperands();
+        PsiType left = operands[0].getType();
+        boolean stringStarted = left != null && left.equalsToText("java.lang.String");
+        if (stringStarted) {
+          buildFormatString(operands[0], formatString, formatParameters, printfFormat);
+        }
+        for (int i = 1; i < operands.length; i++) {
+          PsiExpression op = operands[i];
+          PsiType optype = op.getType();
+          PsiType r = TypeConversionUtil.calcTypeForBinaryExpression(left, optype, binaryExpression.getOperationTokenType(), true);
+          if (r != null && r.equalsToText("java.lang.String") && !stringStarted) {
+            stringStarted = true;
+            PsiElement element = binaryExpression.getTokenBeforeOperand(op);
+            if (element.getPrevSibling() instanceof PsiWhiteSpace) element = element.getPrevSibling();
+            String text = binaryExpression.getText().substring(0, element.getStartOffsetInParent());
+            PsiExpression subExpression = JavaPsiFacade.getInstance(binaryExpression.getProject()).getElementFactory()
+              .createExpressionFromText(text, binaryExpression);
+            addFormatParameter(subExpression, formatString, formatParameters, printfFormat);
+          }
+          if (stringStarted) {
+            if (optype != null && (optype.equalsToText("java.lang.String") || optype == PsiType.CHAR)) {
+              buildFormatString(op, formatString, formatParameters, printfFormat);
+            }
+            else {
+              addFormatParameter(op, formatString, formatParameters, printfFormat);
+            }
+          }
+          left = r;
+        }
+      }
+      else {
+        addFormatParameter(expression, formatString, formatParameters, printfFormat);
+      }
+    }
+    else {
+      addFormatParameter(expression, formatString, formatParameters, printfFormat);
+    }
+  }
+
+  private static void addFormatParameter(PsiExpression expression,
+                                         StringBuilder formatString,
+                                         List<PsiExpression> formatParameters, boolean printfFormat) {
+    final PsiType type = expression.getType();
+    if (!printfFormat) {
+      formatString.append("{").append(formatParameters.size()).append("}");
+    }
+    else if (type != null &&
+             (type.equalsToText("long") ||
+              type.equalsToText("int") ||
+              type.equalsToText("java.lang.Long") ||
+              type.equalsToText("java.lang.Integer"))) {
+      formatString.append("%d");
+    }
+    else {
+      formatString.append("%s");
+    }
+    formatParameters.add(getBoxedArgument(expression));
+  }
+
+  private static PsiExpression getBoxedArgument(PsiExpression arg) throws IncorrectOperationException {
+    arg = PsiUtil.deparenthesizeExpression(arg);
+    assert arg != null;
+    if (PsiUtil.isLanguageLevel5OrHigher(arg)) {
+      return arg;
+    }
+    final PsiType type = arg.getType();
+    if (!(type instanceof PsiPrimitiveType) || type.equals(PsiType.NULL)) {
+      return arg;
+    }
+    final PsiPrimitiveType primitiveType = (PsiPrimitiveType)type;
+    final String boxedQName = primitiveType.getBoxedTypeName();
+    if (boxedQName == null) {
+      return arg;
+    }
+    final GlobalSearchScope resolveScope = arg.getResolveScope();
+    final PsiElementFactory factory = JavaPsiFacade.getElementFactory(arg.getProject());
+    final PsiJavaCodeReferenceElement ref = factory.createReferenceElementByFQClassName(boxedQName, resolveScope);
+    final PsiNewExpression newExpr = (PsiNewExpression)factory.createExpressionFromText("new A(b)", null);
+    final PsiElement classRef = newExpr.getClassReference();
+    assert classRef != null;
+    classRef.replace(ref);
+    final PsiExpressionList argumentList = newExpr.getArgumentList();
+    assert argumentList != null;
+    argumentList.getExpressions()[0].replace(arg);
+    return newExpr;
+  }
+
+}
diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java
index c5e084d..1a7e71c 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -117,7 +117,7 @@
   }
 
   @Nullable
-  public static PsiClass getPsiClass(final PsiType psiType) {
+  public static PsiClass getPsiClass(@Nullable PsiType psiType) {
     return psiType instanceof PsiClassType? ((PsiClassType)psiType).resolve() : null;
   }
 
diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java
index 59040ec..c63a137 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java
@@ -569,8 +569,10 @@
     if (typeParameters1.length != typeParameters2.length) return false;
     for (int i = 0; i < typeParameters1.length; i++) {
       final PsiType substituted2 = s2.substitute(typeParameters2[i]);
+      final PsiType substituted1 = s1.substitute(typeParameters1[i]);
       if (!Comparing.equal(s1.substituteWithBoundsPromotion(typeParameters1[i]), substituted2) &&
-          !Comparing.equal(s1.substitute(typeParameters1[i]), substituted2)) return false;
+          !Comparing.equal(s2.substituteWithBoundsPromotion(typeParameters2[i]), substituted1) &&
+          !Comparing.equal(substituted1, substituted2)) return false;
     }
     if (aClass.hasModifierProperty(PsiModifier.STATIC)) return true;
     final PsiClass containingClass1 = aClass.getContainingClass();
@@ -813,7 +815,7 @@
 
   @Nullable
   public static PsiMember findEnclosingConstructorOrInitializer(PsiElement expression) {
-    PsiMember parent = PsiTreeUtil.getParentOfType(expression, PsiClassInitializer.class, PsiMethod.class);
+    PsiMember parent = PsiTreeUtil.getParentOfType(expression, PsiClassInitializer.class, PsiEnumConstantInitializer.class, PsiMethod.class);
     if (parent instanceof PsiMethod && !((PsiMethod)parent).isConstructor()) return null;
     return parent;
   }
diff --git a/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java b/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java
index e153344..5a793b9 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java
@@ -96,6 +96,13 @@
    * @return true if fromType can be casted to toType
    */
   public static boolean areTypesConvertible(@NotNull PsiType fromType, @NotNull PsiType toType) {
+    return areTypesConvertible(fromType, toType, null);
+  }
+
+  /**
+   * @return true if fromType can be casted to toType
+   */
+  public static boolean areTypesConvertible(@NotNull PsiType fromType, @NotNull PsiType toType, @Nullable LanguageLevel languageLevel) {
     if (fromType == toType) return true;
     final boolean fromIsPrimitive = isPrimitiveAndNotNull(fromType);
     final boolean toIsPrimitive = isPrimitiveAndNotNull(toType);
@@ -119,13 +126,19 @@
         return boxedType != null && areTypesConvertible(boxedType, toType);
       }
       if (!fromIsPrimitive) {
-        if (fromType instanceof PsiClassType && ((PsiClassType)fromType).getLanguageLevel().isAtLeast(LanguageLevel.JDK_1_7)) {
-          final PsiClassType classType = (PsiClassType)fromType;
-          final PsiClass psiClass = classType.resolve();
-          if (psiClass == null || psiClass instanceof PsiTypeParameter) return false;
-          final PsiClassType boxedType = ((PsiPrimitiveType)toType).getBoxedType(psiClass.getManager(), psiClass.getResolveScope());
-          if (boxedType != null && isAssignable(fromType, boxedType)) {
-            return true;
+        if (fromType instanceof PsiClassType) {
+          if (languageLevel == null) {
+            languageLevel = ((PsiClassType)fromType).getLanguageLevel();
+          }
+
+          if (languageLevel.isAtLeast(LanguageLevel.JDK_1_7)) {
+            final PsiClassType classType = (PsiClassType)fromType;
+            final PsiClass psiClass = classType.resolve();
+            if (psiClass == null || psiClass instanceof PsiTypeParameter) return false;
+            final PsiClassType boxedType = ((PsiPrimitiveType)toType).getBoxedType(psiClass.getManager(), psiClass.getResolveScope());
+            if (boxedType != null && isAssignable(fromType, boxedType)) {
+              return true;
+            }
           }
         }
         return fromTypeRank == toTypeRank ||
diff --git a/java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java b/java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java
index 9ff3475..81dda58 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java
@@ -90,10 +90,13 @@
       if (type2 instanceof PsiArrayType) {
         return proveArrayTypeDistinct(((PsiWildcardType)type1).getManager().getProject(), (PsiArrayType)type2, type1);
       }
-    }
-    if (type1 instanceof PsiCapturedWildcardType) return provablyDistinct(((PsiCapturedWildcardType)type1).getWildcard(), type2, level);
+    } else {
 
-    if (type2 instanceof PsiWildcardType || type2 instanceof PsiCapturedWildcardType) return provablyDistinct(type2, type1, level);
+      if (type2 instanceof PsiWildcardType) return provablyDistinct(type2, type1, level);
+
+      if (type1 instanceof PsiCapturedWildcardType) return provablyDistinct(((PsiCapturedWildcardType)type1).getWildcard(), type2, level);
+      if (type2 instanceof PsiCapturedWildcardType) return provablyDistinct(type2, type1, level);
+    }
 
 
     final PsiClassType.ClassResolveResult classResolveResult1 = PsiUtil.resolveGenericsClassInType(type1);
diff --git a/java/openapi/src/com/intellij/psi/util/package.html b/java/java-psi-api/src/com/intellij/psi/util/package.html
similarity index 100%
rename from java/openapi/src/com/intellij/psi/util/package.html
rename to java/java-psi-api/src/com/intellij/psi/util/package.html
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/proc/VariablesProcessor.java b/java/java-psi-impl/src/com/intellij/codeInsight/completion/proc/VariablesProcessor.java
similarity index 100%
rename from java/java-impl/src/com/intellij/codeInsight/completion/proc/VariablesProcessor.java
rename to java/java-psi-impl/src/com/intellij/codeInsight/completion/proc/VariablesProcessor.java
diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java b/java/java-psi-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java
new file mode 100644
index 0000000..43ab3c1
--- /dev/null
+++ b/java/java-psi-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java
@@ -0,0 +1,66 @@
+/*
+ * 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.codeInsight.completion.scope;
+
+import com.intellij.psi.*;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: ik
+ * Date: 20.01.2003
+ * Time: 16:17:14
+ * To change this template use Options | File Templates.
+ */
+public class CompletionElement{
+  private final Object myElement;
+  private final PsiSubstitutor mySubstitutor;
+
+  public CompletionElement(Object element, PsiSubstitutor substitutor) {
+    myElement = element;
+    mySubstitutor = substitutor;
+  }
+
+  public PsiSubstitutor getSubstitutor(){
+    return mySubstitutor;
+  }
+
+  public Object getElement(){
+    return myElement;
+  }
+
+  @Nullable
+  Object getUniqueId(){
+    if(myElement instanceof PsiClass){
+      return ((PsiClass)myElement).getQualifiedName();
+    }
+    if(myElement instanceof PsiPackage){
+      return ((PsiPackage)myElement).getQualifiedName();
+    }
+    if(myElement instanceof PsiMethod){
+      return ((PsiMethod)myElement).getSignature(mySubstitutor);
+    }
+    if (myElement instanceof PsiVariable) {
+      return getVariableUniqueId((PsiVariable)myElement);
+    }
+
+    return null;
+  }
+
+  public static String getVariableUniqueId(final PsiVariable variable) {
+    return "#" + variable.getName();
+  }
+}
diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java b/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java
index 7a296ff..15d40f1 100644
--- a/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java
+++ b/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java
@@ -1,3 +1,18 @@
+/*
+ * 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.codeInsight.folding.impl;
 
 import com.intellij.codeInsight.daemon.impl.CollectHighlightsUtil;
@@ -109,6 +124,9 @@
 
   @Nullable
   public TextRange getRangeToFold(PsiElement element) {
+    if (element instanceof SyntheticElement) {
+      return null;
+    }
     if (element instanceof PsiMethod) {
       PsiCodeBlock body = ((PsiMethod)element).getBody();
       if (body == null) return null;
diff --git a/java/java-psi-impl/src/com/intellij/core/CoreJavaPsiImplementationHelper.java b/java/java-psi-impl/src/com/intellij/core/CoreJavaPsiImplementationHelper.java
index 21b6151..fc931ab 100644
--- a/java/java-psi-impl/src/com/intellij/core/CoreJavaPsiImplementationHelper.java
+++ b/java/java-psi-impl/src/com/intellij/core/CoreJavaPsiImplementationHelper.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.
@@ -16,16 +16,25 @@
 package com.intellij.core;
 
 import com.intellij.lang.ASTNode;
+import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.JavaPsiImplementationHelper;
+import com.intellij.psi.util.PsiUtil;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 /**
  * @author yole
  */
 public class CoreJavaPsiImplementationHelper extends JavaPsiImplementationHelper {
+  private final Project myProject;
+
+  public CoreJavaPsiImplementationHelper(@NotNull Project project) {
+    myProject = project;
+  }
+
   @Override
   public PsiClass getOriginalClass(PsiClass psiClass) {
     return psiClass;
@@ -37,9 +46,10 @@
     return clsFile;
   }
 
+  @NotNull
   @Override
-  public LanguageLevel getClassesLanguageLevel(VirtualFile virtualFile) {
-    return null;
+  public LanguageLevel getEffectiveLanguageLevel(@Nullable VirtualFile virtualFile) {
+    return PsiUtil.getLanguageLevel(myProject);
   }
 
   @Override
@@ -56,4 +66,9 @@
   public void setupCatchBlock(@NotNull String exceptionName, @NotNull PsiType exceptionType, PsiElement context, @NotNull PsiCatchSection element) {
     throw new UnsupportedOperationException("TODO");
   }
+
+  @NotNull
+  public Project getProject() {
+    return myProject;
+  }
 }
diff --git a/java/java-psi-impl/src/com/intellij/core/JavaCoreApplicationEnvironment.java b/java/java-psi-impl/src/com/intellij/core/JavaCoreApplicationEnvironment.java
index 8e7fcdb..b71bdef 100644
--- a/java/java-psi-impl/src/com/intellij/core/JavaCoreApplicationEnvironment.java
+++ b/java/java-psi-impl/src/com/intellij/core/JavaCoreApplicationEnvironment.java
@@ -15,12 +15,18 @@
  */
 package com.intellij.core;
 
+import com.intellij.codeInsight.ContainerProvider;
+import com.intellij.codeInsight.JavaContainerProvider;
+import com.intellij.codeInsight.folding.JavaCodeFoldingSettings;
+import com.intellij.codeInsight.folding.impl.JavaCodeFoldingSettingsBase;
+import com.intellij.codeInsight.folding.impl.JavaFoldingBuilderBase;
 import com.intellij.codeInsight.runner.JavaMainMethodProvider;
 import com.intellij.ide.highlighter.ArchiveFileType;
 import com.intellij.ide.highlighter.JavaClassFileType;
 import com.intellij.ide.highlighter.JavaFileType;
 import com.intellij.lang.LanguageASTFactory;
 import com.intellij.lang.LanguageParserDefinitions;
+import com.intellij.lang.folding.LanguageFolding;
 import com.intellij.lang.java.JavaLanguage;
 import com.intellij.lang.java.JavaParserDefinition;
 import com.intellij.navigation.ItemPresentationProviders;
@@ -29,9 +35,8 @@
 import com.intellij.openapi.fileTypes.PlainTextFileType;
 import com.intellij.openapi.fileTypes.PlainTextLanguage;
 import com.intellij.openapi.fileTypes.PlainTextParserDefinition;
+import com.intellij.openapi.project.Project;
 import com.intellij.openapi.projectRoots.JavaVersionService;
-import com.intellij.openapi.util.ClassExtension;
-import com.intellij.openapi.util.Disposer;
 import com.intellij.psi.*;
 import com.intellij.psi.augment.PsiAugmentProvider;
 import com.intellij.psi.impl.EmptySubstitutorImpl;
@@ -72,6 +77,9 @@
     registerExtensionPoint(Extensions.getRootArea(), PsiAugmentProvider.EP_NAME, PsiAugmentProvider.class);
     registerExtensionPoint(Extensions.getRootArea(), JavaMainMethodProvider.EP_NAME, JavaMainMethodProvider.class);
 
+    registerExtensionPoint(Extensions.getRootArea(), ContainerProvider.EP_NAME, ContainerProvider.class);
+    addExtension(ContainerProvider.EP_NAME, new JavaContainerProvider());
+
     myApplication.registerService(PsiPackageImplementationHelper.class, new CorePsiPackageImplementationHelper());
 
     myApplication.registerService(EmptySubstitutor.class, new EmptySubstitutorImpl());
@@ -84,19 +92,22 @@
     addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiField.class, new FieldPresentationProvider());
     addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiLocalVariable.class, new VariablePresentationProvider());
     addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiParameter.class, new VariablePresentationProvider());
+
+    registerApplicationService(JavaCodeFoldingSettings.class, new JavaCodeFoldingSettingsBase());
+    addExplicitExtension(LanguageFolding.INSTANCE, JavaLanguage.INSTANCE, new JavaFoldingBuilderBase() {
+      @Override
+      protected boolean shouldShowExplicitLambdaType(PsiAnonymousClass anonymousClass, PsiNewExpression expression) {
+        return false;
+      }
+
+      @Override
+      protected boolean isBelowRightMargin(Project project, int lineLength) {
+        return false;
+      }
+    });
   }
 
   protected CoreJavaDirectoryService createJavaDirectoryService() {
     return new CoreJavaDirectoryService();
   }
-
-  public <T> void addExplicitExtension(final ClassExtension<T> instance, final Class clazz, final T object) {
-    instance.addExplicitExtension(clazz, object);
-    Disposer.register(getParentDisposable(), new Disposable() {
-      @Override
-      public void dispose() {
-        instance.removeExplicitExtension(clazz, object);
-      }
-    });
-  }
 }
diff --git a/java/java-psi-impl/src/com/intellij/core/JavaCoreProjectEnvironment.java b/java/java-psi-impl/src/com/intellij/core/JavaCoreProjectEnvironment.java
index bc55d33..448a947 100644
--- a/java/java-psi-impl/src/com/intellij/core/JavaCoreProjectEnvironment.java
+++ b/java/java-psi-impl/src/com/intellij/core/JavaCoreProjectEnvironment.java
@@ -63,7 +63,7 @@
   }
 
   protected CoreJavaPsiImplementationHelper createJavaPsiImplementationHelper() {
-    return new CoreJavaPsiImplementationHelper();
+    return new CoreJavaPsiImplementationHelper(myProject);
   }
 
   protected JavaFileManager createCoreFileManager() {
diff --git a/java/java-psi-impl/src/com/intellij/psi/NonClasspathClassFinder.java b/java/java-psi-impl/src/com/intellij/psi/NonClasspathClassFinder.java
new file mode 100644
index 0000000..2d11fc9
--- /dev/null
+++ b/java/java-psi-impl/src/com/intellij/psi/NonClasspathClassFinder.java
@@ -0,0 +1,276 @@
+/*
+ * 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.psi;
+
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.extensions.Extensions;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Computable;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.impl.file.PsiPackageImpl;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.NonClasspathDirectoryScope;
+import com.intellij.util.ArrayUtil;
+import com.intellij.util.Processor;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.*;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * @author peter
+ */
+public abstract class NonClasspathClassFinder extends PsiElementFinder {
+  private static final Logger LOG = Logger.getInstance("#com.intellij.psi.NonClasspathClassFinder");
+  private final AtomicLong myLastStamp = new AtomicLong();
+  protected final Project myProject;
+  private volatile List<VirtualFile> myCache;
+  private final PsiManager myManager;
+  private final String[] myFileExtensions;
+
+  public NonClasspathClassFinder(Project project, String... fileExtensions) {
+    myProject = project;
+    myManager = PsiManager.getInstance(myProject);
+    myFileExtensions = ArrayUtil.append(fileExtensions, "class");
+  }
+
+  protected List<VirtualFile> getClassRoots(@Nullable GlobalSearchScope scope) {
+    return getClassRoots();
+  }
+
+  protected List<VirtualFile> getClassRoots() {
+    List<VirtualFile> cache = myCache;
+    long stamp = myManager.getModificationTracker().getModificationCount();
+    if (myLastStamp.get() != stamp) {
+      cache = null;
+    }
+
+    if (cache != null && !cache.isEmpty()) {
+      for (VirtualFile file : cache) {
+        if (!file.isValid()) {
+          cache = null;
+          break;
+        }
+      }
+    }
+
+    if (cache == null) {
+      myCache = cache = calcClassRoots();
+      myLastStamp.set(stamp);
+    }
+    return cache;
+  }
+
+  @Override
+  public PsiClass findClass(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
+    final List<VirtualFile> classRoots = getClassRoots(scope);
+    if (classRoots.isEmpty()) {
+      return null;
+    }
+
+    final String relPath = qualifiedName.replace('.', '/');
+    for (final VirtualFile classRoot : classRoots) {
+      if (scope.contains(classRoot)) {
+        VirtualFile virtualFile = findFileByRelativePath(classRoot, relPath, myFileExtensions);
+        if (virtualFile != null) {
+          if (!virtualFile.isValid()) {
+            LOG.error(
+              "Invalid child of valid parent: " + virtualFile.getPath() + "; " + classRoot.isValid() + " path=" + classRoot.getPath());
+            return null;
+          }
+          final PsiFile file = myManager.findFile(virtualFile);
+          if (file instanceof PsiClassOwner) {
+            final PsiClass[] classes = ((PsiClassOwner)file).getClasses();
+            if (classes.length == 1) {
+              return classes[0];
+            }
+          }
+        }
+      }
+    }
+    return null;
+  }
+
+  protected abstract List<VirtualFile> calcClassRoots();
+
+  @NotNull
+  @Override
+  public PsiClass[] getClasses(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
+    final List<VirtualFile> classRoots = getClassRoots(scope);
+    if (classRoots.isEmpty()) {
+      return PsiClass.EMPTY_ARRAY;
+    }
+
+    List<PsiClass> result = new ArrayList<PsiClass>();
+    for (final VirtualFile classRoot : classRoots) {
+      if (scope.contains(classRoot)) {
+        final String pkgName = psiPackage.getQualifiedName();
+        final VirtualFile dir = classRoot.findFileByRelativePath(pkgName.replace('.', '/'));
+        if (dir != null && dir.isDirectory()) {
+          for (final VirtualFile file : dir.getChildren()) {
+            if (!file.isDirectory()) {
+              final PsiFile psi = myManager.findFile(file);
+              if (psi instanceof PsiClassOwner) {
+                ContainerUtil.addAll(result, ((PsiClassOwner)psi).getClasses());
+              }
+            }
+          }
+        }
+      }
+    }
+    return result.toArray(new PsiClass[result.size()]);
+  }
+
+
+  @NotNull
+  @Override
+  public Set<String> getClassNames(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
+    final List<VirtualFile> classRoots = getClassRoots(scope);
+    if (classRoots.isEmpty()) {
+      return Collections.emptySet();
+    }
+
+    final Set<String> result = new HashSet<String>();
+    for (final VirtualFile classRoot : classRoots) {
+      if (scope.contains(classRoot)) {
+        final String pkgName = psiPackage.getQualifiedName();
+        final VirtualFile dir = classRoot.findFileByRelativePath(pkgName.replace('.', '/'));
+        if (dir != null && dir.isDirectory()) {
+          for (final VirtualFile file : dir.getChildren()) {
+            if (!file.isDirectory() && ArrayUtil.contains(file.getExtension(), myFileExtensions)) {
+              result.add(file.getNameWithoutExtension());
+            }
+          }
+        }
+      }
+    }
+    return result;
+  }
+
+  @Override
+  public PsiPackage findPackage(@NotNull String qualifiedName) {
+    final List<VirtualFile> classRoots = getClassRoots();
+    if (classRoots.isEmpty()) {
+      return null;
+    }
+
+    for (final VirtualFile classRoot : classRoots) {
+      final VirtualFile dir = classRoot.findFileByRelativePath(qualifiedName.replace('.', '/'));
+      if (dir != null && dir.isDirectory()) {
+        return createPackage(qualifiedName);
+      }
+    }
+    return null;
+  }
+
+  private PsiPackageImpl createPackage(String qualifiedName) {
+    return new PsiPackageImpl(myManager, qualifiedName);
+  }
+
+  @Override
+  public boolean processPackageDirectories(@NotNull PsiPackage psiPackage,
+                                           @NotNull GlobalSearchScope scope,
+                                           @NotNull Processor<PsiDirectory> consumer,
+                                           boolean includeLibrarySources) {
+    final List<VirtualFile> classRoots = getClassRoots(scope);
+    if (classRoots.isEmpty()) {
+      return true;
+    }
+
+    final String qname = psiPackage.getQualifiedName();
+    final PsiManager psiManager = psiPackage.getManager();
+    for (final VirtualFile classRoot : classRoots) {
+      if (scope.contains(classRoot)) {
+        final VirtualFile dir = classRoot.findFileByRelativePath(qname.replace('.', '/'));
+        if (dir != null && dir.isDirectory()) {
+          final PsiDirectory psiDirectory = ApplicationManager.getApplication().runReadAction(new Computable<PsiDirectory>() {
+            @Override
+            @Nullable
+            public PsiDirectory compute() {
+              return dir.isValid() ? psiManager.findDirectory(dir) : null;
+            }
+          });
+          if (psiDirectory != null && !consumer.process(psiDirectory)) {
+            return false;
+          }
+        }
+      }
+    }
+    return true;
+  }
+
+  @NotNull
+  @Override
+  public PsiPackage[] getSubPackages(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
+    final List<VirtualFile> classRoots = getClassRoots(scope);
+    if (classRoots.isEmpty()) {
+      return super.getSubPackages(psiPackage, scope);
+    }
+
+    List<PsiPackage> result = new ArrayList<PsiPackage>();
+    for (final VirtualFile classRoot : classRoots) {
+      if (scope.contains(classRoot)) {
+        final String pkgName = psiPackage.getQualifiedName();
+        final VirtualFile dir = classRoot.findFileByRelativePath(pkgName.replace('.', '/'));
+        if (dir != null && dir.isDirectory()) {
+          for (final VirtualFile file : dir.getChildren()) {
+            if (file.isDirectory()) {
+              result.add(createPackage(pkgName + "." + file.getName()));
+            }
+          }
+        }
+      }
+    }
+    return result.toArray(new PsiPackage[result.size()]);
+  }
+
+  @NotNull
+  @Override
+  public PsiClass[] findClasses(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
+    final PsiClass psiClass = findClass(qualifiedName, scope);
+    return psiClass == null ? PsiClass.EMPTY_ARRAY : new PsiClass[]{psiClass};
+  }
+
+  @NotNull
+  public static GlobalSearchScope addNonClasspathScope(Project project, GlobalSearchScope base) {
+    GlobalSearchScope scope = base;
+    for (PsiElementFinder finder : Extensions.getExtensions(EP_NAME, project)) {
+      if (finder instanceof NonClasspathClassFinder) {
+        scope = scope.uniteWith(NonClasspathDirectoryScope.compose(((NonClasspathClassFinder)finder).getClassRoots()));
+      }
+    }
+    return scope;
+  }
+
+  public PsiManager getPsiManager() {
+    return myManager;
+  }
+
+  @Nullable
+  private static VirtualFile findFileByRelativePath(@NotNull VirtualFile root,
+                                                    @NotNull String relPath,
+                                                    @NotNull String[] extensions) {
+    VirtualFile file = null;
+    for (String extension : extensions) {
+      file = root.findFileByRelativePath(relPath + '.' + extension);
+      if (file != null) break;
+    }
+    return file;
+  }
+}
diff --git a/java/java-psi-impl/src/com/intellij/psi/controlFlow/AllVariablesControlFlowPolicy.java b/java/java-psi-impl/src/com/intellij/psi/controlFlow/AllVariablesControlFlowPolicy.java
index 944e9c6..5f90c5b 100644
--- a/java/java-psi-impl/src/com/intellij/psi/controlFlow/AllVariablesControlFlowPolicy.java
+++ b/java/java-psi-impl/src/com/intellij/psi/controlFlow/AllVariablesControlFlowPolicy.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -25,23 +25,24 @@
 package com.intellij.psi.controlFlow;
 
 import com.intellij.psi.*;
+import org.jetbrains.annotations.NotNull;
 
 public class AllVariablesControlFlowPolicy implements ControlFlowPolicy {
   private static final AllVariablesControlFlowPolicy INSTANCE = new AllVariablesControlFlowPolicy();
 
   @Override
-  public PsiVariable getUsedVariable(PsiReferenceExpression refExpr) {
+  public PsiVariable getUsedVariable(@NotNull PsiReferenceExpression refExpr) {
       PsiElement resolved = refExpr.resolve();
       return resolved instanceof PsiVariable ? (PsiVariable)resolved : null;
   }
 
   @Override
-  public boolean isParameterAccepted(PsiParameter psiParameter) {
+  public boolean isParameterAccepted(@NotNull PsiParameter psiParameter) {
     return true;
   }
 
   @Override
-  public boolean isLocalVariableAccepted(PsiLocalVariable psiVariable) {
+  public boolean isLocalVariableAccepted(@NotNull PsiLocalVariable psiVariable) {
     return true;
   }
 
diff --git a/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowPolicy.java b/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowPolicy.java
index c33927a..98948eb 100644
--- a/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowPolicy.java
+++ b/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowPolicy.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.
@@ -19,13 +19,14 @@
 import com.intellij.psi.PsiParameter;
 import com.intellij.psi.PsiReferenceExpression;
 import com.intellij.psi.PsiVariable;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 public interface ControlFlowPolicy {
   @Nullable
-  PsiVariable getUsedVariable(PsiReferenceExpression refExpr);
+  PsiVariable getUsedVariable(@NotNull PsiReferenceExpression refExpr);
 
-  boolean isParameterAccepted(PsiParameter psiParameter);
+  boolean isParameterAccepted(@NotNull PsiParameter psiParameter);
 
-  boolean isLocalVariableAccepted(PsiLocalVariable psiVariable);
+  boolean isLocalVariableAccepted(@NotNull PsiLocalVariable psiVariable);
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java b/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java
index 0e6ed16..fe7274e 100644
--- a/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java
@@ -378,7 +378,8 @@
     return PsiTreeUtil.getParentOfType(element, PsiStatement.class, false);
   }
 
-  public static PsiElement findCodeFragment(PsiElement element) {
+  @NotNull
+  public static PsiElement findCodeFragment(@NotNull PsiElement element) {
     PsiElement codeFragment = element;
     PsiElement parent = codeFragment.getParent();
     while (parent != null) {
diff --git a/java/java-psi-impl/src/com/intellij/psi/controlFlow/DefUseUtil.java b/java/java-psi-impl/src/com/intellij/psi/controlFlow/DefUseUtil.java
index cfe3620..8cddc9e 100644
--- a/java/java-psi-impl/src/com/intellij/psi/controlFlow/DefUseUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/controlFlow/DefUseUtil.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.
@@ -462,7 +462,7 @@
 
   private static final ControlFlowPolicy ourPolicy = new ControlFlowPolicy() {
     @Override
-    public PsiVariable getUsedVariable(PsiReferenceExpression refExpr) {
+    public PsiVariable getUsedVariable(@NotNull PsiReferenceExpression refExpr) {
       if (refExpr.isQualified()) return null;
 
       PsiElement refElement = refExpr.resolve();
@@ -474,12 +474,12 @@
     }
 
     @Override
-    public boolean isParameterAccepted(PsiParameter psiParameter) {
+    public boolean isParameterAccepted(@NotNull PsiParameter psiParameter) {
       return true;
     }
 
     @Override
-    public boolean isLocalVariableAccepted(PsiLocalVariable psiVariable) {
+    public boolean isLocalVariableAccepted(@NotNull PsiLocalVariable psiVariable) {
       return true;
     }
   };
diff --git a/java/java-psi-impl/src/com/intellij/psi/controlFlow/LocalsControlFlowPolicy.java b/java/java-psi-impl/src/com/intellij/psi/controlFlow/LocalsControlFlowPolicy.java
index b5c0f8e..5418b86 100644
--- a/java/java-psi-impl/src/com/intellij/psi/controlFlow/LocalsControlFlowPolicy.java
+++ b/java/java-psi-impl/src/com/intellij/psi/controlFlow/LocalsControlFlowPolicy.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.
@@ -16,17 +16,18 @@
 package com.intellij.psi.controlFlow;
 
 import com.intellij.psi.*;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 public class LocalsControlFlowPolicy implements ControlFlowPolicy {
   private final PsiElement myCodeFragment;
 
-  public LocalsControlFlowPolicy(PsiElement codeFragment) {
+  public LocalsControlFlowPolicy(@NotNull PsiElement codeFragment) {
     myCodeFragment = codeFragment;
   }
 
   @Override
-  public PsiVariable getUsedVariable(PsiReferenceExpression refExpr) {
+  public PsiVariable getUsedVariable(@NotNull PsiReferenceExpression refExpr) {
     if (refExpr.isQualified()) return null;
 
     PsiElement refElement = refExpr.resolve();
@@ -34,8 +35,8 @@
   }
 
   @Nullable
-  private PsiVariable checkCodeFragment(PsiElement refElement) {
-    PsiElement codeFragment = ControlFlowUtil.findCodeFragment(refElement);
+  private PsiVariable checkCodeFragment(@NotNull PsiElement refElement) {
+    PsiElement codeFragment;
     if (refElement instanceof PsiParameter) {
       final PsiElement declarationScope = ((PsiParameter)refElement).getDeclarationScope();
       if (declarationScope instanceof PsiMethod) {
@@ -44,6 +45,12 @@
       else if (declarationScope instanceof PsiLambdaExpression) {
         codeFragment = ((PsiLambdaExpression)declarationScope).getBody();
       }
+      else {
+        codeFragment = ControlFlowUtil.findCodeFragment(refElement);
+      }
+    }
+    else {
+      codeFragment = ControlFlowUtil.findCodeFragment(refElement);
     }
     if (codeFragment == null) return null;
     if (myCodeFragment.getContainingFile() == codeFragment.getContainingFile() &&  // in order for jsp includes to work
@@ -54,12 +61,27 @@
   }
 
   @Override
-  public boolean isParameterAccepted(PsiParameter psiParameter) {
+  public boolean isParameterAccepted(@NotNull PsiParameter psiParameter) {
     return checkCodeFragment(psiParameter) != null;
   }
 
   @Override
-  public boolean isLocalVariableAccepted(PsiLocalVariable psiVariable) {
+  public boolean isLocalVariableAccepted(@NotNull PsiLocalVariable psiVariable) {
     return checkCodeFragment(psiVariable) != null;
   }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+    if (o == null || getClass() != o.getClass()) return false;
+
+    LocalsControlFlowPolicy policy = (LocalsControlFlowPolicy)o;
+
+    return myCodeFragment.equals(policy.myCodeFragment);
+  }
+
+  @Override
+  public int hashCode() {
+    return myCodeFragment.hashCode();
+  }
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/controlFlow/LocalsOrMyInstanceFieldsControlFlowPolicy.java b/java/java-psi-impl/src/com/intellij/psi/controlFlow/LocalsOrMyInstanceFieldsControlFlowPolicy.java
index e544aae..e71d13c 100644
--- a/java/java-psi-impl/src/com/intellij/psi/controlFlow/LocalsOrMyInstanceFieldsControlFlowPolicy.java
+++ b/java/java-psi-impl/src/com/intellij/psi/controlFlow/LocalsOrMyInstanceFieldsControlFlowPolicy.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.
@@ -25,6 +25,7 @@
 package com.intellij.psi.controlFlow;
 
 import com.intellij.psi.*;
+import org.jetbrains.annotations.NotNull;
 
 public class LocalsOrMyInstanceFieldsControlFlowPolicy implements ControlFlowPolicy {
   private static final LocalsOrMyInstanceFieldsControlFlowPolicy INSTANCE = new LocalsOrMyInstanceFieldsControlFlowPolicy();
@@ -33,7 +34,7 @@
   }
 
   @Override
-  public PsiVariable getUsedVariable(PsiReferenceExpression refExpr) {
+  public PsiVariable getUsedVariable(@NotNull PsiReferenceExpression refExpr) {
     PsiExpression qualifier = refExpr.getQualifierExpression();
     if (qualifier == null || qualifier instanceof PsiThisExpression) {
       PsiElement resolved = refExpr.resolve();
@@ -45,12 +46,12 @@
   }
 
   @Override
-  public boolean isParameterAccepted(PsiParameter psiParameter) {
+  public boolean isParameterAccepted(@NotNull PsiParameter psiParameter) {
     return true;
   }
 
   @Override
-  public boolean isLocalVariableAccepted(PsiLocalVariable psiVariable) {
+  public boolean isLocalVariableAccepted(@NotNull PsiLocalVariable psiVariable) {
     return true;
   }
 
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelper.java b/java/java-psi-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelper.java
index 6a677a9..0fe17f5 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelper.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelper.java
@@ -37,14 +37,8 @@
   @NotNull
   public abstract PsiElement getClsFileNavigationElement(PsiJavaFile clsFile);
 
-  /**
-   * For files under a library source root, returns the language level configured for the corresponding classes root.
-   *
-   * @param virtualFile virtual file for which language level is requested.
-   * @return language level for classes root or null if file is not under a library source root or no matching classes root is found.
-   */
-  @Nullable
-  public abstract LanguageLevel getClassesLanguageLevel(VirtualFile virtualFile);
+  @NotNull
+  public abstract LanguageLevel getEffectiveLanguageLevel(@Nullable VirtualFile virtualFile);
 
   public abstract ASTNode getDefaultImportAnchor(PsiImportList list, PsiImportStatementBase statement);
 
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java
index 748d907..107bff5 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java
@@ -25,6 +25,7 @@
 import com.intellij.psi.*;
 import com.intellij.psi.filters.OrFilter;
 import com.intellij.psi.impl.compiled.ClsElementImpl;
+import com.intellij.psi.impl.source.ClassInnerStuffCache;
 import com.intellij.psi.impl.source.PsiImmediateClassType;
 import com.intellij.psi.infos.MethodCandidateInfo;
 import com.intellij.psi.scope.ElementClassFilter;
@@ -56,18 +57,15 @@
 
 /**
  * @author ik
- * Date: 24.10.2003
+ * @since 24.10.2003
  */
 public class PsiClassImplUtil {
   private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.PsiClassImplUtil");
   private static final Key<ParameterizedCachedValue<MembersMap, PsiClass>> MAP_IN_CLASS_KEY = Key.create("MAP_KEY");
+  private static final String VALUES_METHOD = "values";
+  private static final String VALUE_OF_METHOD = "valueOf";
 
-  private PsiClassImplUtil() {
-  }
-
-  public static void cacheEverything(PsiClass aClass) {
-    getValues(aClass).getValue(aClass);
-  }
+  private PsiClassImplUtil() { }
 
   @NotNull
   public static PsiField[] getAllFields(@NotNull PsiClass aClass) {
@@ -126,7 +124,7 @@
     for (final PsiMethod method : methodsByName) {
       final PsiClass superClass = method.getContainingClass();
       final PsiSubstitutor substitutor;
-      if (checkBases && !aClass.equals(superClass)) {
+      if (checkBases && !aClass.equals(superClass) && superClass != null) {
         substitutor = TypeConversionUtil.getSuperClassSubstitutor(superClass, aClass, PsiSubstitutor.EMPTY);
       }
       else {
@@ -425,6 +423,25 @@
     }
   }
 
+  public static boolean processDeclarationsInEnum(@NotNull PsiScopeProcessor processor,
+                                                  @NotNull ResolveState state,
+                                                  @NotNull ClassInnerStuffCache innerStuffCache) {
+    ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
+    if (classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.METHOD)) {
+      NameHint nameHint = processor.getHint(NameHint.KEY);
+      if ((nameHint == null || VALUES_METHOD.equals(nameHint.getName(state)))) {
+        PsiMethod method = innerStuffCache.getValuesMethod();
+        if (method != null && !processor.execute(method, ResolveState.initial())) return false;
+      }
+      if ((nameHint == null || VALUE_OF_METHOD.equals(nameHint.getName(state)))) {
+        PsiMethod method = innerStuffCache.getValueOfMethod();
+        if (method != null && !processor.execute(method, ResolveState.initial())) return false;
+      }
+    }
+
+    return true;
+  }
+
   public static boolean processDeclarationsInClass(@NotNull PsiClass aClass,
                                                    @NotNull final PsiScopeProcessor processor,
                                                    @NotNull ResolveState state,
@@ -560,7 +577,7 @@
             if (candidateMethod.isConstructor() != ((MethodResolverProcessor)processor).isConstructor()) continue;
           }
           final PsiClass containingClass = candidateMethod.getContainingClass();
-          if (visited != null && visited.contains(candidateMethod.getContainingClass())) {
+          if (containingClass == null || visited != null && visited.contains(containingClass)) {
             continue;
           }
 
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java
index 2e66663..e5080d3 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java
@@ -80,14 +80,14 @@
 
   @NotNull
   public static PsiMethod[] getConstructors(@NotNull PsiClass aClass) {
-    final List<PsiMethod> constructorsList = new SmartList<PsiMethod>();
-
-    final PsiMethod[] methods = aClass.getMethods();
-    for (final PsiMethod method : methods) {
-      if (method.isConstructor()) constructorsList.add(method);
+    List<PsiMethod> result = null;
+    for (PsiMethod method : aClass.getMethods()) {
+      if (method.isConstructor()) {
+        if (result == null) result = ContainerUtil.newSmartList();
+        result.add(method);
+      }
     }
-
-    return constructorsList.toArray(new PsiMethod[constructorsList.size()]);
+    return result == null ? PsiMethod.EMPTY_ARRAY : result.toArray(new PsiMethod[result.size()]);
   }
 
   @Nullable
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java
index 994bc1e..e2065ce 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java
@@ -158,16 +158,10 @@
         }
         if (newBound instanceof PsiCapturedWildcardType) {
           final PsiWildcardType wildcard = ((PsiCapturedWildcardType)newBound).getWildcard();
-          if (wildcardType.isExtends() != wildcard.isExtends()) {
-            if (wildcard.isBounded()) {
-              return wildcardType.isExtends() ? PsiWildcardType.createExtends(wildcardType.getManager(), newBound)
-                                              : PsiWildcardType.createSuper(wildcardType.getManager(), newBound);
-            }
-            else {
-              return newBound;
-            }
+          if (wildcardType.isExtends() != wildcard.isExtends() && wildcard.isBounded()) {
+            return wildcardType.isExtends() ? PsiWildcardType.createExtends(wildcardType.getManager(), newBound)
+                                            : PsiWildcardType.createSuper(wildcardType.getManager(), newBound);
           }
-          if (!wildcard.isBounded()) return PsiWildcardType.createUnbounded(wildcardType.getManager());
           return newBound;
         }
 
@@ -377,7 +371,12 @@
               !TypeConversionUtil.erasure(substitutedBoundType).isAssignableFrom(TypeConversionUtil.erasure(originalBound)) &&
               !TypeConversionUtil.erasure(substitutedBoundType).isAssignableFrom(originalBound)) { //erasure is essential to avoid infinite recursion
             if (wildcardType.isExtends()) {
-              final PsiType glb = GenericsUtil.getGreatestLowerBound(wildcardType.getBound(), substitutedBoundType);
+              final PsiType bound = wildcardType.getBound();
+              if (bound instanceof PsiArrayType && substitutedBoundType instanceof PsiArrayType &&
+                  !bound.isAssignableFrom(substitutedBoundType) && !substitutedBoundType.isAssignableFrom(bound)) {
+                continue;
+              }
+              final PsiType glb = GenericsUtil.getGreatestLowerBound(bound, substitutedBoundType);
               if (glb != null) {
                 substituted = PsiWildcardType.createExtends(manager, glb);
               }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClassFileStubBuilder.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClassFileStubBuilder.java
index 4f91aea..2871b48 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClassFileStubBuilder.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClassFileStubBuilder.java
@@ -40,7 +40,7 @@
 public class ClassFileStubBuilder implements BinaryFileStubBuilder {
   private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.compiled.ClassFileStubBuilder");
 
-  public static final int STUB_VERSION = 10;
+  public static final int STUB_VERSION = 12;
 
   @Override
   public boolean acceptsFile(@NotNull VirtualFile file) {
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassImpl.java
index 2005641..c6d9962 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -448,8 +448,12 @@
                                      @NotNull ResolveState state,
                                      PsiElement lastParent,
                                      @NotNull PsiElement place) {
-    LanguageLevel languageLevel = processor instanceof MethodsProcessor ? ((MethodsProcessor)processor).getLanguageLevel() : PsiUtil.getLanguageLevel(place);
-    return PsiClassImplUtil.processDeclarationsInClass(this, processor, state, null, lastParent, place, languageLevel, false);
+    if (isEnum()) {
+      if (!PsiClassImplUtil.processDeclarationsInEnum(processor, state, myInnersCache)) return false;
+    }
+
+    LanguageLevel level = processor instanceof MethodsProcessor ? ((MethodsProcessor)processor).getLanguageLevel() : PsiUtil.getLanguageLevel(place);
+    return PsiClassImplUtil.processDeclarationsInClass(this, processor, state, null, lastParent, place, level, false);
   }
 
   @Override
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsElementImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsElementImpl.java
index 8808cc7..a2ce5b3 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsElementImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsElementImpl.java
@@ -228,7 +228,7 @@
 
     StringBuilder buffer = new StringBuilder();
     appendMirrorText(0, buffer);
-    LOG.error("Mirror wasn't set for " + this + " in " + getContainingFile() + ", expected text '" + buffer + "'");
+    LOG.warn("Mirror wasn't set for " + this + " in " + getContainingFile() + ", expected text '" + buffer + "'");
     return buffer.toString();
   }
 
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsParameterImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsParameterImpl.java
index 13da952..b4b3385 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsParameterImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsParameterImpl.java
@@ -66,30 +66,39 @@
     String name = myName;
 
     if (name == null) {
-      if (DumbService.getInstance(getProject()).isDumb()) {
-        return null;
-      }
-
-      ClsMethodImpl method = (ClsMethodImpl)getDeclarationScope();
-      PsiMethod sourceMethod = method.getSourceMirrorMethod();
-      if (sourceMethod != null) {
-        assert sourceMethod != method : method;
-        name = sourceMethod.getParameterList().getParameters()[getIndex()].getName();
+      PsiParameterStubImpl parameterStub = (PsiParameterStubImpl)getStub();
+      if (!parameterStub.isAutoGeneratedName()) {
+        name = parameterStub.getName();
       }
 
       if (name == null) {
-        PsiParameterStubImpl parameterStub = (PsiParameterStubImpl)getStub();
-        name = !parameterStub.isAutoGeneratedName() ? parameterStub.getName() : getMirrorName();
+        if (DumbService.getInstance(getProject()).isDumb()) {
+          return null;
+        }
+
+        ClsMethodImpl method = (ClsMethodImpl)getDeclarationScope();
+        PsiMethod sourceMethod = method.getSourceMirrorMethod();
+        if (sourceMethod != null) {
+          assert sourceMethod != method : method;
+          name = sourceMethod.getParameterList().getParameters()[getIndex()].getName();
+        }
+        else {
+          name = getMirrorName();
+        }
       }
 
-      if (name != null) {
-        myName = name;
-      }
+      myName = name;
     }
 
     return name;
   }
 
+  public boolean isAutoGeneratedName() {
+    return ((PsiParameterStubImpl)getStub()).isAutoGeneratedName() &&
+           !DumbService.getInstance(getProject()).isDumb() &&
+           ((ClsMethodImpl)getDeclarationScope()).getSourceMirrorMethod() == null;
+  }
+
   @Override
   public PsiElement setName(@NotNull String name) throws IncorrectOperationException {
     throw new IncorrectOperationException(CAN_NOT_MODIFY_MESSAGE);
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/SignatureParsing.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/SignatureParsing.java
index 6033e54..46cceff 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/SignatureParsing.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/SignatureParsing.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -39,18 +39,16 @@
 
 @SuppressWarnings({"HardCodedStringLiteral"})
 public class SignatureParsing {
-  private SignatureParsing() {
-  }
+  private SignatureParsing() { }
 
-  public static PsiTypeParameterListStub parseTypeParametersDeclaration(CharacterIterator signatureIterator, StubElement parentStub)
-      throws ClsFormatException {
+  public static PsiTypeParameterListStub parseTypeParametersDeclaration(CharacterIterator iterator, StubElement parentStub) throws ClsFormatException {
     PsiTypeParameterListStub list = new PsiTypeParameterListStubImpl(parentStub);
-    if (signatureIterator.current() == '<') {
-      signatureIterator.next();
-      while (signatureIterator.current() != '>') {
-        parseTypeParameter(signatureIterator, list);
+    if (iterator.current() == '<') {
+      iterator.next();
+      while (iterator.current() != '>') {
+        parseTypeParameter(iterator, list);
       }
-      signatureIterator.next();
+      iterator.next();
     }
 
     return list;
@@ -69,18 +67,24 @@
     //todo parse annotations on type param
     PsiTypeParameterStub parameterStub = new PsiTypeParameterStubImpl(parent, StringRef.fromString(name.toString()));
 
-    List<String> bounds = ContainerUtil.newSmartList();
+    // postpone list allocation till a second bound is seen; ignore sole Object bound
+    List<String> bounds = null;
+    boolean jlo = false;
     while (iterator.current() == ':') {
       iterator.next();
       String bound = parseTopLevelClassRefSignature(iterator);
-      if (bound != null) {
-        bounds.add(bound);
+      if (bound == null) continue;
+      if (bounds == null) {
+        if (CommonClassNames.JAVA_LANG_OBJECT.equals(bound)) {
+          jlo = true;
+          continue;
+        }
+        bounds = ContainerUtil.newSmartList();
+        if (jlo) {
+          bounds.add(CommonClassNames.JAVA_LANG_OBJECT);
+        }
       }
-    }
-
-    int size = bounds.size();
-    if (size > 0 && CommonClassNames.JAVA_LANG_OBJECT.equals(bounds.get(size - 1))) {
-      bounds.remove(size - 1);
+      bounds.add(bound);
     }
 
     StubBuildingVisitor.newReferenceList(JavaStubElementTypes.EXTENDS_BOUND_LIST, parameterStub, ArrayUtil.toStringArray(bounds));
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java
index 041e51d..d2a6627 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java
@@ -95,7 +95,7 @@
       shortName = PsiNameHelper.getShortClassName(fqn);
     }
 
-    int flags = myAccess == 0 ? access : myAccess;
+    int flags = myAccess | access;
     boolean isDeprecated = (flags & Opcodes.ACC_DEPRECATED) != 0;
     boolean isInterface = (flags & Opcodes.ACC_INTERFACE) != 0;
     boolean isEnum = (flags & Opcodes.ACC_ENUM) != 0;
@@ -408,6 +408,13 @@
 
     if (SYNTHETIC_CLASS_INIT_METHOD.equals(name)) return null;
 
+    // skip semi-synthetic enum methods
+    boolean isEnum = myResult.isEnum();
+    if (isEnum) {
+      if ("values".equals(name) && desc.startsWith("()")) return null;
+      if ("valueOf".equals(name) && desc.startsWith("(Ljava/lang/String;)")) return null;
+    }
+
     boolean isDeprecated = (access & Opcodes.ACC_DEPRECATED) != 0;
     boolean isConstructor = SYNTHETIC_INIT_METHOD.equals(name);
     boolean isVarargs = (access & Opcodes.ACC_VARARGS) != 0;
@@ -417,31 +424,34 @@
 
     final byte flags = PsiMethodStubImpl.packFlags(isConstructor, isAnnotationMethod, isVarargs, isDeprecated, false);
 
-    final String canonicalMethodName = isConstructor ? myResult.getName() : name;
-    final List<String> args = new ArrayList<String>();
-    final List<String> throwables = exceptions != null ? new ArrayList<String>() : null;
+    String canonicalMethodName = isConstructor ? myResult.getName() : name;
+    List<String> args = new ArrayList<String>();
+    List<String> throwables = exceptions != null ? new ArrayList<String>() : null;
 
     final PsiMethodStubImpl stub = new PsiMethodStubImpl(myResult, StringRef.fromString(canonicalMethodName), flags, null);
 
     final PsiModifierListStub modList = new PsiModifierListStubImpl(stub, packMethodFlags(access, myResult.isInterface()));
 
+    String returnType = null;
     boolean parsedViaGenericSignature = false;
-    String returnType;
-    if (signature == null) {
-      returnType = parseMethodViaDescription(desc, stub, args);
-    }
-    else {
+    if (signature != null) {
       try {
         returnType = parseMethodViaGenericSignature(signature, stub, args, throwables);
         parsedViaGenericSignature = true;
       }
-      catch (ClsFormatException e) {
-        returnType = parseMethodViaDescription(desc, stub, args);
-      }
+      catch (ClsFormatException ignored) { }
+    }
+    if (returnType == null) {
+      returnType = parseMethodViaDescription(desc, stub, args);
     }
 
     stub.setReturnType(TypeInfo.fromString(returnType));
 
+    if (isEnum && isConstructor && signature == null && args.size() >= 2 && JAVA_LANG_STRING.equals(args.get(0)) && "int".equals(args.get(1))) {
+      // exclude synthetic enum constructor parameters
+      args = args.subList(2, args.size());
+    }
+
     final boolean isNonStaticInnerClassConstructor =
       isConstructor && !(myParent instanceof PsiFileStub) && (myModList.getModifiersMask() & Opcodes.ACC_STATIC) == 0;
     final boolean shouldSkipFirstParamForNonStaticInnerClassConstructor = !parsedViaGenericSignature && isNonStaticInnerClassConstructor;
@@ -465,8 +475,8 @@
     String[] thrownTypes = buildThrowsList(exceptions, throwables, parsedViaGenericSignature);
     newReferenceList(JavaStubElementTypes.THROWS_LIST, stub, thrownTypes);
 
-    final int localVarIgnoreCount = (access & Opcodes.ACC_STATIC) != 0 ? 0 : isConstructor && myResult.isEnum() ? 3 : 1;
-    final int paramIgnoreCount = isConstructor && myResult.isEnum() ? 2 : isNonStaticInnerClassConstructor ? 1 : 0;
+    int localVarIgnoreCount = (access & Opcodes.ACC_STATIC) != 0 ? 0 : isConstructor && isEnum ? 3 : 1;
+    int paramIgnoreCount = isConstructor && isEnum ? 2 : isNonStaticInnerClassConstructor ? 1 : 0;
     return new AnnotationParamCollectingVisitor(stub, modList, localVarIgnoreCount, paramIgnoreCount, paramCount, paramStubs);
   }
 
@@ -505,8 +515,7 @@
   private static String parseMethodViaGenericSignature(final String signature,
                                                        final PsiMethodStubImpl stub,
                                                        final List<String> args,
-                                                       final List<String> throwables)
-    throws ClsFormatException {
+                                                       final List<String> throwables) throws ClsFormatException {
     StringCharacterIterator iterator = new StringCharacterIterator(signature);
     SignatureParsing.parseTypeParametersDeclaration(iterator, stub);
 
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiParameterStubImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiParameterStubImpl.java
index 8c418e1..f3fadf6 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiParameterStubImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiParameterStubImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/ClassInnerStuffCache.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/ClassInnerStuffCache.java
index 88f0ce8..429c276 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/ClassInnerStuffCache.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/ClassInnerStuffCache.java
@@ -16,212 +16,182 @@
 package com.intellij.psi.impl.source;
 
 import com.intellij.openapi.util.SimpleModificationTracker;
-import com.intellij.psi.ExternallyDefinedPsiElement;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiField;
-import com.intellij.psi.PsiMethod;
+import com.intellij.psi.*;
 import com.intellij.psi.augment.PsiAugmentProvider;
 import com.intellij.psi.impl.PsiClassImplUtil;
 import com.intellij.psi.impl.PsiImplUtil;
-import com.intellij.psi.util.CachedValue;
+import com.intellij.psi.impl.light.LightMethod;
 import com.intellij.psi.util.CachedValueProvider;
 import com.intellij.psi.util.CachedValuesManager;
-import com.intellij.psi.util.PsiModificationTracker;
 import com.intellij.util.ArrayUtil;
+import com.intellij.util.containers.ContainerUtil;
 import gnu.trove.THashMap;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
+import static com.intellij.psi.util.PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT;
+
 public class ClassInnerStuffCache {
   private final PsiExtensibleClass myClass;
-  private final SimpleModificationTracker myTreeChangeTracker;
+  private final SimpleModificationTracker myTracker;
 
-  private CachedValue<PsiMethod[]> myConstructorsCache;
-  private CachedValue<PsiField[]> myFieldsCache;
-  private CachedValue<PsiMethod[]> myMethodsCache;
-  private CachedValue<PsiClass[]> myInnerClassesCache;
-  private CachedValue<Map<String, PsiField>> myFieldsMapCache;
-  private CachedValue<Map<String, List<PsiMethod>>> myMethodsMapCache;
-  private CachedValue<Map<String, PsiClass>> myInnerClassesMapCache;
-
-  public ClassInnerStuffCache(final PsiExtensibleClass aClass) {
+  public ClassInnerStuffCache(@NotNull PsiExtensibleClass aClass) {
     myClass = aClass;
-    myTreeChangeTracker = new SimpleModificationTracker();
+    myTracker = new SimpleModificationTracker();
   }
 
   @NotNull
   public PsiMethod[] getConstructors() {
-    CachedValue<PsiMethod[]> cache = myConstructorsCache;
-    if (cache == null) {
-      final CachedValuesManager manager = CachedValuesManager.getManager(myClass.getProject());
-      final Object[] dependencies = {PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTreeChangeTracker};
-
-      myConstructorsCache = cache = manager.createCachedValue(new CachedValueProvider<PsiMethod[]>() {
-        @Override
-        public Result<PsiMethod[]> compute() {
-          return Result.create(PsiImplUtil.getConstructors(myClass), dependencies);
-        }
-      }, false);
-    }
-
-    final PsiMethod[] constructors = cache.getValue();
-    return constructors != null ? constructors : PsiMethod.EMPTY_ARRAY;
+    return CachedValuesManager.getCachedValue(myClass, new CachedValueProvider<PsiMethod[]>() {
+      @Nullable
+      @Override
+      public Result<PsiMethod[]> compute() {
+        return Result.create(PsiImplUtil.getConstructors(myClass), OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTracker);
+      }
+    });
   }
 
   @NotNull
   public PsiField[] getFields() {
-    CachedValue<PsiField[]> cache = myFieldsCache;
-    if (cache == null) {
-      final CachedValuesManager manager = CachedValuesManager.getManager(myClass.getProject());
-      final Object[] dependencies = {PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTreeChangeTracker};
-
-      myFieldsCache = cache = manager.createCachedValue(new CachedValueProvider<PsiField[]>() {
-        @Override
-        public Result<PsiField[]> compute() {
-          return Result.create(getAllFields(), dependencies);
-        }
-      }, false);
-    }
-    final PsiField[] fields = cache.getValue();
-    return fields != null ? fields : PsiField.EMPTY_ARRAY;
+    return CachedValuesManager.getCachedValue(myClass, new CachedValueProvider<PsiField[]>() {
+      @Nullable
+      @Override
+      public Result<PsiField[]> compute() {
+        return Result.create(getAllFields(), OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTracker);
+      }
+    });
   }
 
   @NotNull
   public PsiMethod[] getMethods() {
-    CachedValue<PsiMethod[]> cache = myMethodsCache;
-    if (cache == null) {
-      final CachedValuesManager manager = CachedValuesManager.getManager(myClass.getProject());
-      final Object[] dependencies = {PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTreeChangeTracker};
-
-      myMethodsCache = cache = manager.createCachedValue(new CachedValueProvider<PsiMethod[]>() {
-        @Override
-        public Result<PsiMethod[]> compute() {
-          return Result.create(getAllMethods(), dependencies);
-        }
-      }, false);
-    }
-    final PsiMethod[] methods = cache.getValue();
-    return methods != null ? methods : PsiMethod.EMPTY_ARRAY;
+    return CachedValuesManager.getCachedValue(myClass, new CachedValueProvider<PsiMethod[]>() {
+      @Nullable
+      @Override
+      public Result<PsiMethod[]> compute() {
+        return Result.create(getAllMethods(), OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTracker);
+      }
+    });
   }
 
   @NotNull
   public PsiClass[] getInnerClasses() {
-    CachedValue<PsiClass[]> cache = myInnerClassesCache;
-    if (cache == null) {
-      final CachedValuesManager manager = CachedValuesManager.getManager(myClass.getProject());
-      final Object[] dependencies = {PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTreeChangeTracker};
-
-      myInnerClassesCache = cache = manager.createCachedValue(new CachedValueProvider<PsiClass[]>() {
-        @Override
-        public Result<PsiClass[]> compute() {
-          return Result.create(getAllInnerClasses(), dependencies);
-        }
-      }, false);
-    }
-    final PsiClass[] classes = cache.getValue();
-    return classes != null ? classes : PsiClass.EMPTY_ARRAY;
+    return CachedValuesManager.getCachedValue(myClass, new CachedValueProvider<PsiClass[]>() {
+      @Nullable
+      @Override
+      public Result<PsiClass[]> compute() {
+        return Result.create(getAllInnerClasses(), OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTracker);
+      }
+    });
   }
 
   @Nullable
-  public PsiField findFieldByName(final String name, final boolean checkBases) {
-    if (!checkBases) {
-      CachedValue<Map<String, PsiField>> cache = myFieldsMapCache;
-      if (cache == null) {
-        final CachedValuesManager manager = CachedValuesManager.getManager(myClass.getProject());
-        final Object[] dependencies = {PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTreeChangeTracker};
-
-        myFieldsMapCache = cache = manager.createCachedValue(new CachedValueProvider<Map<String, PsiField>>() {
-          @Override
-          public Result<Map<String, PsiField>> compute() {
-            return Result.create(getFieldsMap(), dependencies);
-          }
-        }, false);
-      }
-      final Map<String, PsiField> cachedFields = cache.getValue();
-      return cachedFields != null ? cachedFields.get(name) : null;
+  public PsiField findFieldByName(String name, boolean checkBases) {
+    if (checkBases) {
+      return PsiClassImplUtil.findFieldByName(myClass, name, true);
     }
-    return PsiClassImplUtil.findFieldByName(myClass, name, checkBases);
+    else {
+      return CachedValuesManager.getCachedValue(myClass, new CachedValueProvider<Map<String, PsiField>>() {
+        @Nullable
+        @Override
+        public Result<Map<String, PsiField>> compute() {
+          return Result.create(getFieldsMap(), OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTracker);
+        }
+      }).get(name);
+    }
   }
 
   @NotNull
-  public PsiMethod[] findMethodsByName(final String name, final boolean checkBases) {
-    if (!checkBases) {
-      CachedValue<Map<String, List<PsiMethod>>> cache = myMethodsMapCache;
-      if (cache == null) {
-        final CachedValuesManager manager = CachedValuesManager.getManager(myClass.getProject());
-        final Object[] dependencies = {PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTreeChangeTracker};
-
-        myMethodsMapCache = cache = manager.createCachedValue(new CachedValueProvider<Map<String, List<PsiMethod>>>() {
-          @Override
-          public Result<Map<String, List<PsiMethod>>> compute() {
-            return Result.create(getMethodsMap(), dependencies);
-          }
-        }, false);
-      }
-      final Map<String, List<PsiMethod>> cachedMethods = cache.getValue();
-      if (cachedMethods != null) {
-        final List<PsiMethod> methods = cachedMethods.get(name);
-        if (methods != null && !methods.isEmpty()) {
-          return methods.toArray(new PsiMethod[methods.size()]);
-        }
-      }
-      return PsiMethod.EMPTY_ARRAY;
+  public PsiMethod[] findMethodsByName(String name, boolean checkBases) {
+    if (checkBases) {
+      return PsiClassImplUtil.findMethodsByName(myClass, name, true);
     }
-    return PsiClassImplUtil.findMethodsByName(myClass, name, checkBases);
+    else {
+      PsiMethod[] methods = CachedValuesManager.getCachedValue(myClass, new CachedValueProvider<Map<String, PsiMethod[]>>() {
+        @Nullable
+        @Override
+        public Result<Map<String, PsiMethod[]>> compute() {
+          return Result.create(getMethodsMap(), OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTracker);
+        }
+      }).get(name);
+      return methods != null ? methods : PsiMethod.EMPTY_ARRAY;
+    }
   }
 
   @Nullable
   public PsiClass findInnerClassByName(final String name, final boolean checkBases) {
-    if (!checkBases) {
-      CachedValue<Map<String, PsiClass>> cache = myInnerClassesMapCache;
-      if (cache == null) {
-        final CachedValuesManager manager = CachedValuesManager.getManager(myClass.getProject());
-        final Object[] dependencies = {PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTreeChangeTracker};
-
-        myInnerClassesMapCache = cache = manager.createCachedValue(new CachedValueProvider<Map<String, PsiClass>>() {
-          @Override
-          public Result<Map<String, PsiClass>> compute() {
-            return Result.create(getInnerClassesMap(), dependencies);
-          }
-        }, false);
-      }
-
-      final Map<String, PsiClass> inners = cache.getValue();
-      return inners != null ? inners.get(name) : null;
+    if (checkBases) {
+      return PsiClassImplUtil.findInnerByName(myClass, name, true);
     }
-    return PsiClassImplUtil.findInnerByName(myClass, name, checkBases);
+    else {
+      return CachedValuesManager.getCachedValue(myClass, new CachedValueProvider<Map<String, PsiClass>>() {
+        @Nullable
+        @Override
+        public Result<Map<String, PsiClass>> compute() {
+          return Result.create(getInnerClassesMap(), OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTracker);
+        }
+      }).get(name);
+    }
+  }
+
+  @Nullable
+  public PsiMethod getValuesMethod() {
+    return !myClass.isEnum() || myClass.getName() == null ? null : CachedValuesManager.getCachedValue(myClass, new CachedValueProvider<PsiMethod>() {
+      @Nullable
+      @Override
+      public Result<PsiMethod> compute() {
+        PsiElementFactory factory = JavaPsiFacade.getInstance(myClass.getProject()).getElementFactory();
+        String text = "public static " + myClass.getName() + "[] values() { }";
+        PsiMethod physicalMethod = factory.createMethodFromText(text, myClass);
+        PsiMethod method = new LightMethod(myClass.getManager(), physicalMethod, myClass);
+        return new Result<PsiMethod>(method, OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTracker);
+      }
+    });
+  }
+
+  @Nullable
+  public PsiMethod getValueOfMethod() {
+    return !myClass.isEnum() || myClass.getName() == null ? null : CachedValuesManager.getCachedValue(myClass, new CachedValueProvider<PsiMethod>() {
+      @Nullable
+      @Override
+      public Result<PsiMethod> compute() {
+        PsiElementFactory factory = JavaPsiFacade.getInstance(myClass.getProject()).getElementFactory();
+        String text = "public static " + myClass.getName() + " valueOf(java.lang.String name) throws java.lang.IllegalArgumentException { }";
+        PsiMethod physicalMethod = factory.createMethodFromText(text, myClass);
+        PsiMethod method = new LightMethod(myClass.getManager(), physicalMethod, myClass);
+        return new Result<PsiMethod>(method, OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, myTracker);
+      }
+    });
   }
 
   private PsiField[] getAllFields() {
-    final List<PsiField> own = myClass.getOwnFields();
-    final List<PsiField> ext = PsiAugmentProvider.collectAugments(myClass, PsiField.class);
+    List<PsiField> own = myClass.getOwnFields();
+    List<PsiField> ext = PsiAugmentProvider.collectAugments(myClass, PsiField.class);
     return ArrayUtil.mergeCollections(own, ext, PsiField.ARRAY_FACTORY);
   }
 
   private PsiMethod[] getAllMethods() {
-    final List<PsiMethod> own = myClass.getOwnMethods();
-    final List<PsiMethod> ext = PsiAugmentProvider.collectAugments(myClass, PsiMethod.class);
+    List<PsiMethod> own = myClass.getOwnMethods();
+    List<PsiMethod> ext = PsiAugmentProvider.collectAugments(myClass, PsiMethod.class);
     return ArrayUtil.mergeCollections(own, ext, PsiMethod.ARRAY_FACTORY);
   }
 
   private PsiClass[] getAllInnerClasses() {
-    final List<PsiClass> own = myClass.getOwnInnerClasses();
-    final List<PsiClass> ext = PsiAugmentProvider.collectAugments(myClass, PsiClass.class);
+    List<PsiClass> own = myClass.getOwnInnerClasses();
+    List<PsiClass> ext = PsiAugmentProvider.collectAugments(myClass, PsiClass.class);
     return ArrayUtil.mergeCollections(own, ext, PsiClass.ARRAY_FACTORY);
   }
 
-  @Nullable
   private Map<String, PsiField> getFieldsMap() {
-    final PsiField[] fields = getFields();
-    if (fields.length == 0) return null;
+    PsiField[] fields = getFields();
+    if (fields.length == 0) return Collections.emptyMap();
 
-    final Map<String, PsiField> cachedFields = new THashMap<String, PsiField>();
-    for (final PsiField field : fields) {
-      final String name = field.getName();
+    Map<String, PsiField> cachedFields = new THashMap<String, PsiField>();
+    for (PsiField field : fields) {
+      String name = field.getName();
       if (!(field instanceof ExternallyDefinedPsiElement) || !cachedFields.containsKey(name)) {
         cachedFields.put(name, field);
       }
@@ -229,30 +199,34 @@
     return cachedFields;
   }
 
-  @Nullable
-  private Map<String, List<PsiMethod>> getMethodsMap() {
-    final PsiMethod[] methods = getMethods();
-    if (methods.length == 0) return null;
+  private Map<String, PsiMethod[]> getMethodsMap() {
+    PsiMethod[] methods = getMethods();
+    if (methods.length == 0) return Collections.emptyMap();
 
-    final Map<String, List<PsiMethod>> cachedMethods = new THashMap<String, List<PsiMethod>>();
-    for (final PsiMethod method : methods) {
-      List<PsiMethod> list = cachedMethods.get(method.getName());
+    Map<String, List<PsiMethod>> collectedMethods = ContainerUtil.newHashMap();
+    for (PsiMethod method : methods) {
+      List<PsiMethod> list = collectedMethods.get(method.getName());
       if (list == null) {
-        cachedMethods.put(method.getName(), list = new ArrayList<PsiMethod>(1));
+        collectedMethods.put(method.getName(), list = ContainerUtil.newSmartList());
       }
       list.add(method);
     }
+
+    Map<String, PsiMethod[]> cachedMethods = ContainerUtil.newTroveMap();
+    for (Map.Entry<String, List<PsiMethod>> entry : collectedMethods.entrySet()) {
+      List<PsiMethod> list = entry.getValue();
+      cachedMethods.put(entry.getKey(), list.toArray(new PsiMethod[list.size()]));
+    }
     return cachedMethods;
   }
 
-  @Nullable
   private Map<String, PsiClass> getInnerClassesMap() {
-    final PsiClass[] classes = getInnerClasses();
-    if (classes.length == 0) return null;
+    PsiClass[] classes = getInnerClasses();
+    if (classes.length == 0) return Collections.emptyMap();
 
-    final Map<String, PsiClass> cachedInners = new THashMap<String, PsiClass>();
-    for (final PsiClass psiClass : classes) {
-      final String name = psiClass.getName();
+    Map<String, PsiClass> cachedInners = new THashMap<String, PsiClass>();
+    for (PsiClass psiClass : classes) {
+      String name = psiClass.getName();
       if (!(psiClass instanceof ExternallyDefinedPsiElement) || !cachedInners.containsKey(name)) {
         cachedInners.put(name, psiClass);
       }
@@ -261,7 +235,6 @@
   }
 
   public void dropCaches() {
-    myTreeChangeTracker.incModificationCount();
+    myTracker.incModificationCount();
   }
-
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiClassImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiClassImpl.java
index f66f419..0ede3a3 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiClassImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiClassImpl.java
@@ -23,17 +23,15 @@
 import com.intellij.openapi.ui.Queryable;
 import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.UserDataHolder;
+import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.*;
 import com.intellij.psi.impl.java.stubs.JavaStubElementTypes;
 import com.intellij.psi.impl.java.stubs.PsiClassStub;
-import com.intellij.psi.impl.light.LightMethod;
 import com.intellij.psi.impl.source.tree.ChildRole;
 import com.intellij.psi.impl.source.tree.CompositeElement;
 import com.intellij.psi.impl.source.tree.SharedImplUtil;
 import com.intellij.psi.javadoc.PsiDocComment;
-import com.intellij.psi.scope.ElementClassHint;
-import com.intellij.psi.scope.NameHint;
 import com.intellij.psi.scope.PsiScopeProcessor;
 import com.intellij.psi.search.SearchScope;
 import com.intellij.psi.stubs.IStubElementType;
@@ -42,7 +40,6 @@
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -56,12 +53,7 @@
   private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.PsiClassImpl");
 
   private final ClassInnerStuffCache myInnersCache = new ClassInnerStuffCache(this);
-
-  private volatile PsiMethod myValuesMethod;
-  private volatile PsiMethod myValueOfMethod;
   private volatile String myCachedName;
-  @NonNls private static final String VALUES_METHOD = "values";
-  @NonNls private static final String VALUE_OF_METHOD = "valueOf";
 
   public PsiClassImpl(final PsiClassStub stub) {
     this(stub, JavaStubElementTypes.CLASS);
@@ -102,8 +94,6 @@
   private void dropCaches() {
     myInnersCache.dropCaches();
     myCachedName = null;
-    myValueOfMethod = null;
-    myValuesMethod = null;
   }
 
   @Override
@@ -494,30 +484,11 @@
   @Override
   public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
     if (isEnum()) {
-      String myName = getName();
-      if (myName != null) {
-        try {
-          final NameHint nameHint = processor.getHint(NameHint.KEY);
-          final ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
-          String nameToSearch = nameHint == null ? null : nameHint.getName(state);
-          if ((nameToSearch == null || VALUES_METHOD.equals(nameToSearch)) &&
-              (classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.METHOD))) {
-            PsiMethod method = getValuesMethod();
-            if (method != null && !processor.execute(method, ResolveState.initial())) return false;
-          }
-          if ((nameToSearch == null || VALUE_OF_METHOD.equals(nameToSearch)) &&
-              (classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.METHOD))) {
-            PsiMethod method = getValueOfMethod();
-            if (method != null && !processor.execute(method, ResolveState.initial())) return false;
-          }
-        }
-        catch (IncorrectOperationException e) {
-          LOG.error(e);
-        }
-      }
+      if (!PsiClassImplUtil.processDeclarationsInEnum(processor, state, myInnersCache)) return false;
     }
 
-    return PsiClassImplUtil.processDeclarationsInClass(this, processor, state, null, lastParent, place, PsiUtil.getLanguageLevel(place), false);
+    LanguageLevel level = PsiUtil.getLanguageLevel(place);
+    return PsiClassImplUtil.processDeclarationsInClass(this, processor, state, null, lastParent, place, level, false);
   }
 
   @Override
@@ -706,23 +677,6 @@
 
   @Nullable
   public PsiMethod getValuesMethod() {
-    PsiMethod method = myValuesMethod;
-    if (method == null && isEnum() && getName() != null) {
-      PsiElementFactory elementFactory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
-      final PsiMethod valuesMethod = elementFactory.createMethodFromText("public static " + getName() + "[] values() {}", this);
-      myValuesMethod = method = new LightMethod(getManager(), valuesMethod, this);
-    }
-    return method;
-  }
-
-  @Nullable
-  public PsiMethod getValueOfMethod() {
-    PsiMethod method = myValueOfMethod;
-    if (method == null && isEnum() && getName() != null) {
-      PsiElementFactory elementFactory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
-      final PsiMethod valuesMethod = elementFactory.createMethodFromText("public static " + getName() + " valueOf(String name) throws java.lang.IllegalArgumentException {}", this);
-      myValueOfMethod = method = new LightMethod(getManager(), valuesMethod, this);
-    }
-    return method;
+    return myInnersCache.getValuesMethod();
   }
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileBaseImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileBaseImpl.java
index cbe3e2b..403465e 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileBaseImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileBaseImpl.java
@@ -275,10 +275,8 @@
                                      @NotNull PsiElement place) {
     assert isValid();
 
-    // TODO den remove
-    boolean allowCaching = true;
-
-    if (allowCaching && processor instanceof ClassResolverProcessor && isPhysical() &&
+    if (processor instanceof ClassResolverProcessor &&
+        isPhysical() &&
         (getUserData(PsiFileEx.BATCH_REFERENCE_PROCESSING) == Boolean.TRUE || myResolveCache.hasUpToDateValue())) {
       final ClassResolverProcessor hint = (ClassResolverProcessor)processor;
       String name = hint.getName(state);
@@ -466,18 +464,7 @@
       return LanguageLevelProjectExtension.getInstance(project).getLanguageLevel();
     }
 
-    final VirtualFile folder = virtualFile.getParent();
-    if (folder != null) {
-      final LanguageLevel level = folder.getUserData(LanguageLevel.KEY);
-      if (level != null) return level;
-    }
-
-    final LanguageLevel classesLanguageLevel = JavaPsiImplementationHelper.getInstance(project).getClassesLanguageLevel(virtualFile);
-    if (classesLanguageLevel != null) {
-      return classesLanguageLevel;
-    }
-
-    return PsiUtil.getLanguageLevel(project);
+    return JavaPsiImplementationHelper.getInstance(project).getEffectiveLanguageLevel(virtualFile);
   }
 
   private static class MyCacheBuilder implements CachedValueProvider<MostlySingularMultiMap<String, SymbolCollectingProcessor.ResultWithContext>> {
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiOldInferenceHelper.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiOldInferenceHelper.java
index 84e3b27..fd672a0 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiOldInferenceHelper.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiOldInferenceHelper.java
@@ -249,7 +249,7 @@
                 }
                 break OtherParameters;
               }
-              else if (currentConstraintType == ConstraintType.SUPERTYPE) {
+              else if (currentConstraintType == ConstraintType.SUPERTYPE && !JavaVersionService.getInstance().isAtLeast(parent, JavaSdkVersion.JDK_1_7)) {
                 if (PsiType.NULL.equals(substitutionFromBounds)) {
                   substitutionFromBounds = currentSubstitution;
                 }
@@ -286,7 +286,8 @@
         Pair<PsiType, ConstraintType> otherConstraint =
           inferMethodTypeParameterFromParent(typeParameter, partialSubstitutor, parent, policy);
         if (otherConstraint != null) {
-          if (otherConstraint.getSecond() == ConstraintType.EQUALS || otherConstraint.getSecond() == ConstraintType.SUPERTYPE) {
+          if (otherConstraint.getSecond() == ConstraintType.EQUALS || otherConstraint.getSecond() == ConstraintType.SUPERTYPE || 
+              compareSubtypes(constraint.getFirst(), otherConstraint.getFirst())) {
             constraint = otherConstraint;
           }
         }
@@ -307,6 +308,10 @@
     return partialSubstitutor;
   }
 
+  private static boolean compareSubtypes(final PsiType type, final PsiType parentType) {
+    return type != null && parentType != null && TypeConversionUtil.isAssignable(type, parentType);
+  }
+
   @Override
   @NotNull
   public PsiSubstitutor inferTypeArguments(@NotNull PsiTypeParameter[] typeParameters,
@@ -739,7 +744,8 @@
         if (guess != null &&
             !guess.equals(PsiType.NULL) &&
             constraint.getSecond() == ConstraintType.SUPERTYPE &&
-            guess instanceof PsiIntersectionType) {
+            guess instanceof PsiIntersectionType &&
+            !JavaVersionService.getInstance().isAtLeast(parent, JavaSdkVersion.JDK_1_7)) {
           for (PsiType conjuct : ((PsiIntersectionType)guess).getConjuncts()) {
             if (!conjuct.isAssignableFrom(expectedType)) {
               return FAILED_INFERENCE;
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeCompatibilityConstraint.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeCompatibilityConstraint.java
index f01c82c..4901229 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeCompatibilityConstraint.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeCompatibilityConstraint.java
@@ -75,6 +75,8 @@
         if (sSubstitutor != null && PsiUtil.isRawSubstitutor(tClass, sSubstitutor)) {
           return true;
         }
+        //comment in 18.2.2. Type Compatibility Constraints
+        if (tClass instanceof PsiTypeParameter && ((PsiClassType)s).isRaw()) return true;
       }
     } 
     else if (t instanceof PsiArrayType && t.getArrayDimensions() == s.getArrayDimensions()) {
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeEqualityConstraint.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeEqualityConstraint.java
index fa3df66..62f1ff1 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeEqualityConstraint.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeEqualityConstraint.java
@@ -73,7 +73,7 @@
 
     if (session.isProperType(myT) && session.isProperType(myS)) {
       if (myT == null) return myS == null || myS.equalsToText(CommonClassNames.JAVA_LANG_OBJECT);
-      if (myS == null) return myT.equalsToText(CommonClassNames.JAVA_LANG_OBJECT);
+      if (myS == null) return true;
       return Comparing.equal(myT, myS);
     }
     InferenceVariable inferenceVariable = session.getInferenceVariable(myS);
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PsiDocTagValueManipulator.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PsiDocTagValueManipulator.java
similarity index 100%
rename from java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PsiDocTagValueManipulator.java
rename to java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PsiDocTagValueManipulator.java
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/StringLiteralManipulator.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/StringLiteralManipulator.java
similarity index 100%
rename from java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/StringLiteralManipulator.java
rename to java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/StringLiteralManipulator.java
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/GenericReferenceProvider.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/GenericReferenceProvider.java
new file mode 100644
index 0000000..dcbac43
--- /dev/null
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/GenericReferenceProvider.java
@@ -0,0 +1,44 @@
+/*
+ * 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.psi.impl.source.resolve.reference.impl.providers;
+
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiReferenceProvider;
+import com.intellij.psi.scope.PsiScopeProcessor;
+import com.intellij.psi.scope.util.PsiScopesUtil;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: ik
+ * Date: 27.03.2003
+ * Time: 17:23:43
+ * To change this template use Options | File Templates.
+ */
+public abstract class GenericReferenceProvider extends PsiReferenceProvider {
+  private boolean mySoft = false;
+
+  public void handleEmptyContext(PsiScopeProcessor processor, PsiElement position) {
+    PsiScopesUtil.treeWalkUp(processor, position, null);
+  }
+
+  public void setSoft(boolean softFlag) {
+    mySoft = softFlag;
+  }
+
+  public boolean isSoft() {
+    return mySoft;
+  }
+}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodReferenceResolver.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodReferenceResolver.java
index ca40ef1..9e31f7b 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodReferenceResolver.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodReferenceResolver.java
@@ -248,13 +248,13 @@
         if (varargs && (!psiMethod.isVarArgs() || myFunctionalMethodVarArgs)) continue;
 
         if ((varargs || parameterTypes.length == signatureParameterTypes2.length) &&
-            PsiMethodReferenceUtil.isCorrectAssignment(signatureParameterTypes2, parameterTypes, substitutor, varargs, 0)) {
+            PsiMethodReferenceUtil.isCorrectAssignment(signatureParameterTypes2, parameterTypes, varargs, 0)) {
           firstCandidates.add(conflict);
         }
 
         if (hasReceiver &&
             (varargs || parameterTypes.length == signatureParameterTypes2.length + 1) &&
-            PsiMethodReferenceUtil.isCorrectAssignment(signatureParameterTypes2, parameterTypes, substitutor, varargs, 1)) {
+            PsiMethodReferenceUtil.isCorrectAssignment(signatureParameterTypes2, parameterTypes, varargs, 1)) {
           secondCandidates.add(conflict);
         }
       }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiCodeBlockImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiCodeBlockImpl.java
index 5c8e425..141a23f 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiCodeBlockImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiCodeBlockImpl.java
@@ -129,7 +129,7 @@
       myVariablesSet = set2 = localsSet.isEmpty() ? Collections.<String>emptySet() : localsSet;
       myConflict = wasConflict = conflict.get();
     }
-    return wasConflict ? null : Couple.newOne(set1, set2);
+    return wasConflict ? null : Couple.of(set1, set2);
   }
 
   @Override
diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java
index df053c5..aa18e6e 100644
--- a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java
+++ b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -148,18 +148,16 @@
       ProgressManager.checkCanceled();
       final CandidateInfo conflict = iterator.next();
       final PsiMethod method = (PsiMethod)conflict.getElement();
-      if (method != null) {
-        final PsiParameter[] methodParameters = method.getParameterList().getParameters();
-        if (methodParameters.length == 0) continue;
-        final PsiParameter param = i < methodParameters.length ? methodParameters[i] : methodParameters[methodParameters.length - 1];
-        final PsiType paramType = param.getType();
-        // http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.12.2.1
-        // A lambda expression or a method reference expression is potentially compatible with a type variable if the type variable is a type parameter of the candidate method.
-        final PsiClass paramClass = PsiUtil.resolveClassInType(paramType);
-        if (paramClass instanceof PsiTypeParameter && ((PsiTypeParameter)paramClass).getOwner() == method) continue;
-        if (!lambdaExpression.isAcceptable(((MethodCandidateInfo)conflict).getSubstitutor(false).substitute(paramType), lambdaExpression.hasFormalParameterTypes())) {
-          iterator.remove();
-        }
+      final PsiParameter[] methodParameters = method.getParameterList().getParameters();
+      if (methodParameters.length == 0) continue;
+      final PsiParameter param = i < methodParameters.length ? methodParameters[i] : methodParameters[methodParameters.length - 1];
+      final PsiType paramType = param.getType();
+      // http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.12.2.1
+      // A lambda expression or a method reference expression is potentially compatible with a type variable if the type variable is a type parameter of the candidate method.
+      final PsiClass paramClass = PsiUtil.resolveClassInType(paramType);
+      if (paramClass instanceof PsiTypeParameter && ((PsiTypeParameter)paramClass).getOwner() == method) continue;
+      if (!lambdaExpression.isAcceptable(((MethodCandidateInfo)conflict).getSubstitutor(false).substitute(paramType), lambdaExpression.hasFormalParameterTypes())) {
+        iterator.remove();
       }
     }
   }
@@ -240,7 +238,6 @@
       ProgressManager.checkCanceled();
       CandidateInfo info = conflicts.get(i);
       PsiMethod method = (PsiMethod)info.getElement();
-      assert method != null;
 
       if (!method.hasModifierProperty(PsiModifier.STATIC) && superMethods.contains(method)) {
         conflicts.remove(i);
@@ -258,7 +255,6 @@
         continue;
       }
       PsiMethod existingMethod = (PsiMethod)existing.getElement();
-      assert existingMethod != null;
       PsiClass existingClass = existingMethod.getContainingClass();
       if (class1 != null && existingClass != null && 
           class1.isInterface() && CommonClassNames.JAVA_LANG_OBJECT.equals(existingClass.getQualifiedName())) { //prefer interface methods to methods from Object
@@ -696,7 +692,10 @@
                                  PsiMethod method2, 
                                  PsiSubstitutor siteSubstitutor1) {
     if (languageLevel.isAtLeast(LanguageLevel.JDK_1_8) && method2 != null && method1.getTypeParameters().length > 0 && myArgumentsList instanceof PsiExpressionList) {
-      return InferenceSession.isMoreSpecific(method2, method1, siteSubstitutor1, ((PsiExpressionList)myArgumentsList).getExpressions(), myArgumentsList, varargsPosition);
+      final PsiElement parent = myArgumentsList.getParent();
+      if (parent instanceof PsiCallExpression && ((PsiCallExpression)parent).getTypeArguments().length == 0) {
+        return InferenceSession.isMoreSpecific(method2, method1, siteSubstitutor1, ((PsiExpressionList)myArgumentsList).getExpressions(), myArgumentsList, varargsPosition);
+      }
     }
     final int applicabilityLevel = PsiUtil.getApplicabilityLevel(method1, methodSubstitutor1, types2AtSite, languageLevel, false, varargsPosition);
     return applicabilityLevel > MethodCandidateInfo.ApplicabilityLevel.NOT_APPLICABLE;
@@ -765,7 +764,7 @@
       for (CandidateInfo conflict : conflicts) {
         ProgressManager.checkCanceled();
         PsiMethod method = (PsiMethod)conflict.getElement();
-        if (method != objectVararg && method != null && method.isVarArgs()) {
+        if (method != objectVararg && method.isVarArgs()) {
           final int paramsCount = method.getParameterList().getParametersCount();
           final PsiType type = method.getParameterList().getParameters()[paramsCount - 1].getType();
           final PsiType componentType = ((PsiArrayType)type).getComponentType();
@@ -781,7 +780,7 @@
   @Nullable
   private static PsiType getFunctionalType(int functionalTypeIdx, CandidateInfo candidateInfo) {
     final PsiMethod psiMethod = (PsiMethod)candidateInfo.getElement();
-    LOG.assertTrue(psiMethod != null);
+    LOG.assertTrue(true);
     final PsiParameter[] methodParameters = psiMethod.getParameterList().getParameters();
     if (methodParameters.length == 0) return null;
     final PsiParameter param = functionalTypeIdx < methodParameters.length ? methodParameters[functionalTypeIdx] : methodParameters[methodParameters.length - 1];
diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaVariableConflictResolver.java b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaVariableConflictResolver.java
index f5e1384..3a34be7 100644
--- a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaVariableConflictResolver.java
+++ b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaVariableConflictResolver.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.
@@ -50,7 +50,6 @@
       for (int i = 1; i < uncheckedResult.length; i++) {
         final CandidateInfo candidate = uncheckedResult[i];
         final PsiElement otherElement = candidate.getElement();
-        if (otherElement == null) continue;
 
         if (!(otherElement instanceof PsiField)) {
           if (otherElement instanceof PsiLocalVariable) {
diff --git a/java/java-psi-impl/src/messages/JavaErrorMessages.properties b/java/java-psi-impl/src/messages/JavaErrorMessages.properties
index d8caec0..cfc556c 100644
--- a/java/java-psi-impl/src/messages/JavaErrorMessages.properties
+++ b/java/java-psi-impl/src/messages/JavaErrorMessages.properties
@@ -219,6 +219,7 @@
 not.a.statement=Not a statement
 invalid.statement=Invalid statement
 incompatible.types=Incompatible types. Found: ''{1}'', required: ''{0}''
+inaccessible.type=''{0}'' is inaccessible here
 incompatible.call.types=Wrong {0, choice, 1#1st|2#2nd|3#3rd|4#{0,number}th} argument type. Found: ''{2}'', required: ''{1}''
 valid.switch.selector.types=byte, char, short or int
 valid.switch.17.selector.types=char, byte, short, int, Character, Byte, Short, Integer, String, or an enum
diff --git a/java/java-tests/java-tests.iml b/java/java-tests/java-tests.iml
index 294b5de..248b1d3 100644
--- a/java/java-tests/java-tests.iml
+++ b/java/java-tests/java-tests.iml
@@ -14,7 +14,7 @@
     <orderEntry type="module" module-name="execution-impl" />
     <orderEntry type="module" module-name="platform-api" />
     <orderEntry type="library" name="Velocity" level="project" />
-    <orderEntry type="module" module-name="java-i18n" />
+    <orderEntry type="module" module-name="java-i18n" exported="" />
     <orderEntry type="module" module-name="compiler-impl" />
     <orderEntry type="library" name="asm4" level="project" />
     <orderEntry type="module" module-name="instrumentation-util" />
diff --git a/java/java-tests/testData/codeInsight/addJavadoc/afterClass.java b/java/java-tests/testData/codeInsight/addJavadoc/afterClass.java
new file mode 100644
index 0000000..c8afa98
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/addJavadoc/afterClass.java
@@ -0,0 +1,8 @@
+// "Add Javadoc" "true"
+
+/**
+ * 
+ */
+class Foo {
+
+}
diff --git a/java/java-tests/testData/codeInsight/addJavadoc/afterField.java b/java/java-tests/testData/codeInsight/addJavadoc/afterField.java
new file mode 100644
index 0000000..96c5371
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/addJavadoc/afterField.java
@@ -0,0 +1,10 @@
+// "Add Javadoc" "true"
+
+class A {
+
+    /**
+     * 
+     */
+  private int myFoo;
+
+}
diff --git a/java/java-tests/testData/codeInsight/addJavadoc/afterMethod.java b/java/java-tests/testData/codeInsight/addJavadoc/afterMethod.java
new file mode 100644
index 0000000..d5d2108
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/addJavadoc/afterMethod.java
@@ -0,0 +1,10 @@
+// "Add Javadoc" "true"
+
+class A {
+    /**
+     * 
+     */
+  public void foo() {
+
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/addJavadoc/afterMethod2.java b/java/java-tests/testData/codeInsight/addJavadoc/afterMethod2.java
new file mode 100644
index 0000000..a86a2f9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/addJavadoc/afterMethod2.java
@@ -0,0 +1,12 @@
+// "Add Javadoc" "true"
+
+class A {
+    /**
+     * @param s
+     * @return
+     * @throws Exception
+     */
+  public int foo(final String s) throws Exception {
+
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/addJavadoc/beforeClass.java b/java/java-tests/testData/codeInsight/addJavadoc/beforeClass.java
new file mode 100644
index 0000000..c6c2849
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/addJavadoc/beforeClass.java
@@ -0,0 +1,5 @@
+// "Add Javadoc" "true"
+
+class Fo<caret>o {
+
+}
diff --git a/java/java-tests/testData/codeInsight/addJavadoc/beforeClass2.java b/java/java-tests/testData/codeInsight/addJavadoc/beforeClass2.java
new file mode 100644
index 0000000..0d1d456
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/addJavadoc/beforeClass2.java
@@ -0,0 +1,13 @@
+// "Add Javadoc" "false"
+
+class A {
+
+  void m() {
+
+    Object o<caret> = new Object() {
+
+    }
+
+  }
+
+}
diff --git a/java/java-tests/testData/codeInsight/addJavadoc/beforeField.java b/java/java-tests/testData/codeInsight/addJavadoc/beforeField.java
new file mode 100644
index 0000000..cf27dad
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/addJavadoc/beforeField.java
@@ -0,0 +1,7 @@
+// "Add Javadoc" "true"
+
+class A {
+
+  private int myFo<caret>o;
+
+}
diff --git a/java/java-tests/testData/codeInsight/addJavadoc/beforeMethod.java b/java/java-tests/testData/codeInsight/addJavadoc/beforeMethod.java
new file mode 100644
index 0000000..c428f80
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/addJavadoc/beforeMethod.java
@@ -0,0 +1,7 @@
+// "Add Javadoc" "true"
+
+class A {
+  public void f<caret>oo() {
+
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/addJavadoc/beforeMethod2.java b/java/java-tests/testData/codeInsight/addJavadoc/beforeMethod2.java
new file mode 100644
index 0000000..0fb8790
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/addJavadoc/beforeMethod2.java
@@ -0,0 +1,7 @@
+// "Add Javadoc" "true"
+
+class A {
+  public int f<caret>oo(final String s) throws Exception {
+
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/className/template/after1.java b/java/java-tests/testData/codeInsight/completion/className/template/after1.java
new file mode 100644
index 0000000..26e269f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/className/template/after1.java
@@ -0,0 +1,12 @@
+import pack.Foo;
+class Test {
+  {
+    m(new Foo<String>() {
+        @Override
+        public void foo(String s) {
+            
+        }
+    })
+  }
+  <T> void m(Foo<T> foo){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/className/template/after2.java b/java/java-tests/testData/codeInsight/completion/className/template/after2.java
new file mode 100644
index 0000000..3cc7fd5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/className/template/after2.java
@@ -0,0 +1,12 @@
+import pack.Foo;
+class Test {
+  {
+    m(new Foo<String>() {
+        @Override
+        public void foo(String s) {
+            
+        }
+    })
+  }
+  void m(Foo<String> foo){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/className/template/before1.java b/java/java-tests/testData/codeInsight/completion/className/template/before1.java
new file mode 100644
index 0000000..db664b2
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/className/template/before1.java
@@ -0,0 +1,7 @@
+import pack.Foo;
+class Test {
+  {
+    m(new <caret>)
+  }
+  <T> void m(Foo<T> foo){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/className/template/before2.java b/java/java-tests/testData/codeInsight/completion/className/template/before2.java
new file mode 100644
index 0000000..bf1ca0b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/className/template/before2.java
@@ -0,0 +1,7 @@
+import pack.Foo;
+class Test {
+  {
+    m(new <caret>)
+  }
+  void m(Foo<String> foo){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/normalSorting/NoBooleansInMultiplication.java b/java/java-tests/testData/codeInsight/completion/normalSorting/NoBooleansInMultiplication.java
new file mode 100644
index 0000000..befcf40
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/normalSorting/NoBooleansInMultiplication.java
@@ -0,0 +1,7 @@
+public class Foo {
+  
+  int foo(Object fact) {
+    return 42 * fa<caret>x
+  }
+}
+
diff --git a/java/java-tests/testData/codeInsight/completion/normalSorting/NoNumberValueOf.java b/java/java-tests/testData/codeInsight/completion/normalSorting/NoNumberValueOf.java
new file mode 100644
index 0000000..d53e3c2
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/normalSorting/NoNumberValueOf.java
@@ -0,0 +1,7 @@
+public class Foo {
+  
+  void foo(Object value) {
+    Integer i = val<caret>x
+  }
+}
+
diff --git a/java/java-tests/testData/codeInsight/createSwitch/enum.java b/java/java-tests/testData/codeInsight/createSwitch/enum.java
new file mode 100644
index 0000000..23d180d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/createSwitch/enum.java
@@ -0,0 +1,11 @@
+class X {
+
+  enum MyEnum {
+    a,b,c
+  }
+
+  void m(MyEnum e) {
+     e<caret>
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/createSwitch/enum2.java b/java/java-tests/testData/codeInsight/createSwitch/enum2.java
new file mode 100644
index 0000000..8464e62
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/createSwitch/enum2.java
@@ -0,0 +1,11 @@
+class X {
+
+  enum MyEnum {
+    a,b,c
+  }
+
+  void m(MyEnum e) {
+    <caret>e
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/createSwitch/enum2_after.java b/java/java-tests/testData/codeInsight/createSwitch/enum2_after.java
new file mode 100644
index 0000000..61803f4
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/createSwitch/enum2_after.java
@@ -0,0 +1,12 @@
+class X {
+
+  enum MyEnum {
+    a,b,c
+  }
+
+  void m(MyEnum e) {
+      switch (e) {<caret>
+      }
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/createSwitch/enum_after.java b/java/java-tests/testData/codeInsight/createSwitch/enum_after.java
new file mode 100644
index 0000000..61803f4
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/createSwitch/enum_after.java
@@ -0,0 +1,12 @@
+class X {
+
+  enum MyEnum {
+    a,b,c
+  }
+
+  void m(MyEnum e) {
+      switch (e) {<caret>
+      }
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/createSwitch/notAvailable.java b/java/java-tests/testData/codeInsight/createSwitch/notAvailable.java
new file mode 100644
index 0000000..2cdae54
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/createSwitch/notAvailable.java
@@ -0,0 +1,13 @@
+class X {
+
+  void m() {
+
+      int foo = 10;
+      m2(fo<caret>o);
+
+  }
+
+  void m2(int i) {
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/createSwitch/notAvailable2.java b/java/java-tests/testData/codeInsight/createSwitch/notAvailable2.java
new file mode 100644
index 0000000..112e2d4
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/createSwitch/notAvailable2.java
@@ -0,0 +1,13 @@
+class X {
+
+  void m() {
+
+    int foo = 10;
+    int bar = fo<caret>o + 10;
+
+  }
+
+  void m2(int i) {
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/createSwitch/primitive.java b/java/java-tests/testData/codeInsight/createSwitch/primitive.java
new file mode 100644
index 0000000..332325c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/createSwitch/primitive.java
@@ -0,0 +1,10 @@
+class X {
+
+  void m() {
+
+      int foo = 10;
+      fo<caret>o
+
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/createSwitch/primitive_after.java b/java/java-tests/testData/codeInsight/createSwitch/primitive_after.java
new file mode 100644
index 0000000..0f04c94
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/createSwitch/primitive_after.java
@@ -0,0 +1,11 @@
+class X {
+
+  void m() {
+
+      int foo = 10;
+      switch (foo) {<caret>
+      }
+
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/createSwitch/string.java b/java/java-tests/testData/codeInsight/createSwitch/string.java
new file mode 100644
index 0000000..aca5f90
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/createSwitch/string.java
@@ -0,0 +1,10 @@
+class X {
+
+  void m() {
+
+      String s = getStr();
+      s<caret>
+
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/createSwitch/string_after.java b/java/java-tests/testData/codeInsight/createSwitch/string_after.java
new file mode 100644
index 0000000..3acf5d1
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/createSwitch/string_after.java
@@ -0,0 +1,11 @@
+class X {
+
+  void m() {
+
+      String s = getStr();
+      switch (s) {<caret>
+      }
+
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/FinalFieldInit.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/FinalFieldInit.java
index a7450bd..16f89fd 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/FinalFieldInit.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/FinalFieldInit.java
@@ -236,9 +236,19 @@
         }
     
         final Object baz = new Object() {
-            final int qux = <error descr="Variable 'bar' might not have been initialized">bar</error>.hashCode() + 1;
+            final int qux = bar.<error descr="Cannot resolve method 'hashCode()'">hashCode</error>() + 1;
         };
     }
+
+    static class Outer {
+        final String a;
+        class Inner {
+            String b = a;
+        }
+        Outer() {
+            a = "";
+        }
+    }
 }
 
 class StaticInitializerUsedInAnotherStaticField {
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/UnsupportedFeatures.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/UnsupportedFeatures.java
index 326c24b..87891d0 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/UnsupportedFeatures.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/UnsupportedFeatures.java
@@ -1,19 +1,3 @@
-/*
- * 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.
- */
-
 import java.io.*;
 import java.util.*;
 
@@ -34,16 +18,7 @@
     <error descr="Incompatible types. Found: 'boolean', required: 'java.lang.Boolean'">Boolean b = true;</error>
     <error descr="Incompatible types. Found: 'java.lang.Boolean', required: 'boolean'">boolean b1 = Boolean.TRUE;</error>
 
-    try { Reader r = new FileReader("/dev/null"); }
-    catch (<error descr="Multi-catches are not supported at this language level">FileNotFoundException | IOException e</error>) { e.printStackTrace(); }
-
-    try <error descr="Try-with-resources are not supported at this language level">(Reader r = new FileReader("/dev/null"))</error> { }
-
-    I i1 = <error descr="Method references are not supported at this language level">UnsupportedFeatures::m</error>;
-    I i2 = <error descr="Lambda expressions are not supported at this language level">() -> { }</error>;
-  }
-
-  interface I {
-    <error descr="Extension methods are not supported at this language level">default void m() { }</error>
+    java.lang.annotation.ElementType t = null;
+    switch (<error descr="Incompatible types. Found: 'java.lang.annotation.ElementType', required: 'byte, char, short or int'">t</error>) { }
   }
 }
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/EnumSynthetics.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/EnumSynthetics.java
new file mode 100644
index 0000000..fa25bbf
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/EnumSynthetics.java
@@ -0,0 +1,8 @@
+import java.lang.annotation.ElementType;
+
+class EnumSynthetics {
+  void m() {
+    //ElementType[] values = ElementType.values();
+    ElementType type = ElementType.valueOf("TYPE");
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/IDEA61415.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/IDEA61415.java
new file mode 100644
index 0000000..8f86c8e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/IDEA61415.java
@@ -0,0 +1,10 @@
+class Test {
+  Runnable r = new Runnable() {
+    <error descr="Modifier 'private' not allowed here">private</error> class Foo {}
+    @Override
+    public void run() {
+
+    }
+  };
+}
+
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/IDEA65473.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/IDEA65473.java
new file mode 100644
index 0000000..13e19fe
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/IDEA65473.java
@@ -0,0 +1,13 @@
+
+class FirstClass {
+  public FirstClass(int i) {
+  }
+
+  public FirstClass() {
+    this(Point.FOO);
+  }
+
+  public class Point {
+    public static final int FOO = 0;
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/UnsupportedFeatures7.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/UnsupportedFeatures7.java
index ac3eb04..168b31b 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/UnsupportedFeatures7.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/UnsupportedFeatures7.java
@@ -41,6 +41,10 @@
 
     I i1 = <error descr="Method references are not supported at this language level">UnsupportedFeatures::m</error>;
     I i2 = <error descr="Lambda expressions are not supported at this language level">() -> { }</error>;
+
+    switch (<error descr="Incompatible types. Found: 'java.lang.String', required: 'byte, char, short or int'">list.get(0)</error>) {
+      case "foo": break;
+    }
   }
 
   interface I {
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/SwitchByInaccessibleEnum.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/SwitchByInaccessibleEnum.java
index 7cdd90f..70f2fa1 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/SwitchByInaccessibleEnum.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/SwitchByInaccessibleEnum.java
@@ -13,7 +13,7 @@
 class D {
     public static void f(A a) {
         A.B b = a.getB();
-        switch (<error descr="A.B.C is inaccessible here">b.c</error>) {
+        switch (<error descr="'A.B.C' is inaccessible here">b.c</error>) {
             case SOME:
                 break;
         }
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/CastObjectToIntJdk14.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/CastObjectToIntJdk14.java
new file mode 100644
index 0000000..4dc0dae
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/CastObjectToIntJdk14.java
@@ -0,0 +1,7 @@
+class Test {
+
+  Object getObj() {return null;}
+  {
+    int a = (int) getObj();
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA112117.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA112117.java
new file mode 100644
index 0000000..57b1c73
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA112117.java
@@ -0,0 +1,15 @@
+import java.io.Serializable;
+import java.util.Set;
+
+class IdeaGenericsFail {
+
+  public IdeaGenericsFail(Set<Klass<? extends Serializable>> map) {
+  }
+
+  public static class Klass<T extends Serializable> {
+  }
+
+  public static void main(final Set<Klass<?>> map) {
+    new IdeaGenericsFail(map);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA118533.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA118533.java
new file mode 100644
index 0000000..56a1400
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA118533.java
@@ -0,0 +1,11 @@
+abstract class Test {
+
+  interface InputFormat<K, V> {
+  }
+
+  @SuppressWarnings("unchecked")
+  private static Class<? extends InputFormat<?, ?>> getInputFormatClass(final Class<? extends InputFormat> aClass)
+    throws ClassNotFoundException {
+    return (Class<? extends InputFormat<?, ?>>) aClass;
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA118536.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA118536.java
new file mode 100644
index 0000000..b747456
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA118536.java
@@ -0,0 +1,10 @@
+import java.util.Comparator;
+
+class MyTest {
+  void foo(final Ordering<Comparable> natural){
+    compound(natural);
+  }
+  <U extends String> Ordering<U> compound(Comparator<? super U> secondaryComparator) { return null; }
+}
+abstract class Ordering <T> implements Comparator<T> {}
+
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA119757.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA119757.java
new file mode 100644
index 0000000..d3e018e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA119757.java
@@ -0,0 +1,16 @@
+import java.util.List;
+
+class Foo<T extends V,V> {
+  Foo(List<? extends T> l) {
+  }
+}
+class Bar {
+  void foo(Foo<String,String> foo) {}
+
+  void bar(List<String> l) {
+    foo<error descr="'foo(Foo<java.lang.String,java.lang.String>)' in 'Bar' cannot be applied to '(Foo<java.lang.String,java.lang.Object>)'">(new Foo<>(l))</error>;
+    foo<error descr="'foo(Foo<java.lang.String,java.lang.String>)' in 'Bar' cannot be applied to '(Foo<java.lang.String,java.lang.Object>)'">(f(l))</error>;
+  }
+
+  <T1 extends V1, V1> Foo<T1, V1> f(List<? extends T1> l) {return null;}
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA125423.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA125423.java
new file mode 100644
index 0000000..d2515ee
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA125423.java
@@ -0,0 +1,15 @@
+class FooBar<T> {
+  void foo(final FooBar<?> fooBar){
+    fooBar.supertype<error descr="'supertype(java.lang.Class<capture<?>>)' in 'FooBar' cannot be applied to '(java.lang.Class<java.lang.Iterable>)'">(Iterable.class)</error>;
+  }
+
+  void foo1(final FooBar<? super T> fooBar){
+    fooBar.supertype<error descr="'supertype(java.lang.Class<capture<? super T>>)' in 'FooBar' cannot be applied to '(java.lang.Class<java.lang.Iterable>)'">(Iterable.class)</error>;
+  }
+
+  void foo2(final FooBar<? extends T> fooBar){
+    fooBar.supertype<error descr="'supertype(java.lang.Class<? super capture<? extends T>>)' in 'FooBar' cannot be applied to '(java.lang.Class<java.lang.Iterable>)'">(Iterable.class)</error>;
+  }
+
+  void supertype(Class<? super T> superclass) {}
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA125744.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA125744.java
new file mode 100644
index 0000000..3858070
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA125744.java
@@ -0,0 +1,14 @@
+class A {}
+interface B {}
+
+class MyTest {
+  public <M extends A & B> M getInvokedMember() {
+    return null;
+  }
+}
+
+class Bar {
+  void f(MyTest myTest) {
+    B member = myTest.getInvokedMember();
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA125800.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA125800.java
new file mode 100644
index 0000000..1ec56b8
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA125800.java
@@ -0,0 +1,10 @@
+import java.util.List;
+
+abstract class Test {
+  abstract <T extends List<String> & Runnable> T list();
+
+  public void test()
+  {
+    for (String s : list()) {}
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA125816.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA125816.java
new file mode 100644
index 0000000..e17d850
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA125816.java
@@ -0,0 +1,8 @@
+public enum State {
+  STATE1 {
+    State s = <error descr="It is illegal to access static member 'STATE2' from enum constructor or instance initializer">STATE2</error>;
+  },
+  STATE2 {
+    State s = <error descr="It is illegal to access static member 'STATE1' from enum constructor or instance initializer">STATE1</error>;
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA24496.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA24496.java
new file mode 100644
index 0000000..454e43d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA24496.java
@@ -0,0 +1,17 @@
+import java.util.List;
+import java.util.ArrayList;
+
+class GenericsError {
+
+  public <T> List<List<T>> method(List<T> list) {
+    List<List<T>> retVal = new ArrayList<List<T>>();
+    retVal.add(list);
+    return retVal;
+  }
+
+  public List<List<?>> otherMethod() {
+    List<?> list = null;
+    <error descr="Incompatible types. Found: 'java.util.List<java.util.List<capture<?>>>', required: 'java.util.List<java.util.List<?>>'">List<List<?>> result = method(list);</error>
+    return result;
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57290.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57290.java
new file mode 100644
index 0000000..1898d59
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57290.java
@@ -0,0 +1,11 @@
+
+class A<T,S> {
+  class B{}
+}
+
+class C {
+  void foo(A<?,?>.B x){
+    bar<error descr="'bar(A<capture<?>,capture<?>>.B)' in 'C' cannot be applied to '(A<capture<?>,capture<?>>.B)'">(x)</error>;
+  }
+  <T> void bar(A<T,T>.B x){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57338.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57338.java
new file mode 100644
index 0000000..06e25b1
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57338.java
@@ -0,0 +1,17 @@
+abstract class A {
+  abstract <T> void foo();
+}
+
+abstract class B extends A {
+  void foo()
+  {
+    this.<Integer>foo();
+  }
+}
+
+abstract class C {
+  void foo()
+  {
+    this.<error descr="Method 'foo()' does not have type parameters"><Integer></error>foo();
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57388.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57388.java
new file mode 100644
index 0000000..9a5502a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57388.java
@@ -0,0 +1,7 @@
+
+class B<T extends Cloneable> {}
+class A<T> {
+  A<B<? extends Cloneable>> foo(A<B<?>> x){
+    return x;
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA58692.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA58692.java
new file mode 100644
index 0000000..6571375
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA58692.java
@@ -0,0 +1,20 @@
+class ExposeAnotherProblem {
+
+  class OneClass<T> {
+    public T get(){
+      return null;
+    }
+  }
+
+  class AnotherClass<T> {}
+
+
+  static <T, R extends OneClass<T>> R method1(AnotherClass<T> param) {
+    return null;
+  }
+
+  <E> E method2(AnotherClass<E> param){
+    return method1(param).get();
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67578.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67578.java
new file mode 100644
index 0000000..d2e602c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67578.java
@@ -0,0 +1,8 @@
+class X<T> { }
+
+class A<T, S extends X<T>>  {}
+
+class C {
+  void foo(A<?, X<?>> a){ <error descr="Inferred type 'X<?>' for type parameter 'S' is not within its bound; should extend 'X<capture<?>>'">bar(a)</error>; }
+  <T, S extends X<T>> void bar(A<T, S> a){  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67600.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67600.java
new file mode 100644
index 0000000..6f0e625
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67600.java
@@ -0,0 +1,24 @@
+abstract class A<T, S extends T>
+{
+  abstract S bar();
+  void foo(A<Runnable[], ? extends Cloneable[]> a){
+    <error descr="Incompatible types. Found: 'java.lang.Cloneable[]', required: 'java.lang.Runnable[]'">Runnable[] x = a.bar();</error>
+  }
+}
+
+abstract class AB<T, S extends T>
+{
+  abstract S bar();
+  void foo(AB<Runnable, ? extends Cloneable> a){
+    Runnable x = a.bar();
+  }
+}
+
+abstract class AC<T, S>
+{
+  abstract S bar();
+  void foo(AC<Runnable[], ? extends Cloneable[]> a){
+    <error descr="Incompatible types. Found: 'java.lang.Cloneable[]', required: 'java.lang.Runnable[]'">Runnable[] x = a.bar();</error>
+  }
+}
+
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/RawTypeFromParent.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/RawTypeFromParent.java
new file mode 100644
index 0000000..49c8f5b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/RawTypeFromParent.java
@@ -0,0 +1,18 @@
+import java.util.ArrayList;
+import java.util.List;
+
+class Foo<T> {
+
+  public void test(Foo parent) {
+    List<Foo> elements = getElements(parent);
+
+
+    for (<error descr="Incompatible types. Found: 'java.lang.Object', required: 'Foo'">Foo foo : getElements(parent)</error>) {
+      System.out.println(foo);
+    }
+  }
+
+  public static <E extends Foo<E>> List<E> getElements(E parent) {
+    return new ArrayList<>();
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA125855.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA125855.java
new file mode 100644
index 0000000..3021604
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA125855.java
@@ -0,0 +1,18 @@
+
+import java.util.Collection;
+import java.util.List;
+
+class Test {
+
+  private static <E> void <warning descr="Private method 'x(java.util.Collection<E>)' is never used">x</warning>(Collection<E> collection) {
+    System.out.println(collection);
+  }
+
+  private static <E> void x(List<E> list) {
+    System.out.println(list);
+  }
+
+  public static void main(List list) {
+    Test.<Object[]>x(list);
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA118362.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA118362.java
new file mode 100644
index 0000000..111a23a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA118362.java
@@ -0,0 +1,20 @@
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.stream.Collectors;
+
+class Test {
+  private static final String[] decimalStrings = {"1.1", "+1.25"};
+
+  {
+    Arrays.stream(decimalStrings).map(BigDecimal::new).reduce(BigDecimal::add).ifPresent(bd -> System.out.print("Sum is " + bd));
+  }
+
+  void foo(final ArrayList<Pair> points) {
+    points.stream().filter(p -> p.x > 0).collect(Collectors.toCollection(ArrayList::new));
+  }
+}
+
+class Pair {
+  int x;
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA126056.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA126056.java
new file mode 100644
index 0000000..6cd13fd
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA126056.java
@@ -0,0 +1,27 @@
+import java.util.ArrayList;
+import java.util.List;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+
+class StreamTest {
+  public class Foo {}
+
+  List<? super Foo> all = new ArrayList<>();
+
+  void foo(final Predicate<Object> predicate, final Stream<? super Foo> stream){
+    long the_count= stream.filter((a) -> predicate.test(a)).count();
+  }
+
+  void foo1(final Predicate<Object> predicate, final Stream<? extends Foo> stream){
+    long the_count= stream.filter((a) -> predicate.test(a)).count();
+  }
+
+  void foo2(final Predicate<Object> predicate, final Stream<Foo> stream){
+    long the_count= stream.filter((a) -> predicate.test(a)).count();
+  }
+  
+}
+
+
+
+
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA126062.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA126062.java
new file mode 100644
index 0000000..c8b023a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA126062.java
@@ -0,0 +1,12 @@
+import java.util.function.Consumer;
+class Pipeline<I, O> implements Consumer<I> {
+  @Override public final void accept(I input) {}
+
+  public <K> void then(Pipeline<O, K> pipeline, final Observable<O> observable) {
+    observable.subscribe(pipeline::accept);
+  }
+}
+
+interface Observable<T> {
+  void subscribe(Consumer<T> x);
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/afterFewParameters.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/afterFewParameters.java
new file mode 100644
index 0000000..889b0a1
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/afterFewParameters.java
@@ -0,0 +1,15 @@
+// "Add missing annotation parameters - value3, value2, value1" "true"
+class Test {
+
+  @MyAnnotation(value3 = , value2 = , value1 = )
+  void m() {
+
+  }
+
+  @interface MyAnnotation {
+    String value3();
+    String value2();
+    String value1();
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/afterFewParameters2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/afterFewParameters2.java
new file mode 100644
index 0000000..67886a6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/afterFewParameters2.java
@@ -0,0 +1,16 @@
+// "Add missing annotation parameters - value4, value1" "true"
+class Test {
+
+  @MyAnnotation(value4 = , value3 = "", value2 = "", value1 = )
+  void m() {
+
+  }
+
+  @interface MyAnnotation {
+    String value4();
+    String value3();
+    String value2();
+    String value1();
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/afterFewParametersWithoutOrder.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/afterFewParametersWithoutOrder.java
new file mode 100644
index 0000000..414eb2b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/afterFewParametersWithoutOrder.java
@@ -0,0 +1,16 @@
+// "Add missing annotation parameters - value4, value1" "true"
+class Test {
+
+  @MyAnnotation(value2 = "", value3 = "", value4 = , value1 = )
+  void m() {
+
+  }
+
+  @interface MyAnnotation {
+    String value4();
+    String value3();
+    String value2();
+    String value1();
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/afterSingleParameter.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/afterSingleParameter.java
new file mode 100644
index 0000000..14f71e5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/afterSingleParameter.java
@@ -0,0 +1,13 @@
+// "Add missing annotation parameter 'value'" "true"
+class Test {
+
+  @MyAnnotation()
+  void m() {
+
+  }
+
+  @interface MyAnnotation {
+    String value();
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/afterValueTyping.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/afterValueTyping.java
new file mode 100644
index 0000000..d6efb38
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/afterValueTyping.java
@@ -0,0 +1,14 @@
+class Test {
+
+  @MyAnnotation(value3 = "value33", value2 = "value22", value1 = "value11")
+  void m() {
+
+  }
+
+  @interface MyAnnotation {
+    String value3();
+    String value2();
+    String value1();
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeFewParameters.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeFewParameters.java
new file mode 100644
index 0000000..d8e6b5a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeFewParameters.java
@@ -0,0 +1,15 @@
+// "Add missing annotation parameters - value3, value2, value1" "true"
+class Test {
+
+  @MyAnnotati<caret>on
+  void m() {
+
+  }
+
+  @interface MyAnnotation {
+    String value3();
+    String value2();
+    String value1();
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeFewParameters2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeFewParameters2.java
new file mode 100644
index 0000000..bb0ad03
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeFewParameters2.java
@@ -0,0 +1,16 @@
+// "Add missing annotation parameters - value4, value1" "true"
+class Test {
+
+  @MyAnnotati<caret>on(value3 = "", value2 = "")
+  void m() {
+
+  }
+
+  @interface MyAnnotation {
+    String value4();
+    String value3();
+    String value2();
+    String value1();
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeFewParametersWithoutOrder.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeFewParametersWithoutOrder.java
new file mode 100644
index 0000000..4f21060
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeFewParametersWithoutOrder.java
@@ -0,0 +1,16 @@
+// "Add missing annotation parameters - value4, value1" "true"
+class Test {
+
+  @MyAnnotati<caret>on(value2 = "", value3 = "")
+  void m() {
+
+  }
+
+  @interface MyAnnotation {
+    String value4();
+    String value3();
+    String value2();
+    String value1();
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeParameterWithDefaultValue.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeParameterWithDefaultValue.java
new file mode 100644
index 0000000..15862bc
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeParameterWithDefaultValue.java
@@ -0,0 +1,13 @@
+// "Add missing annotation parameter 'value'" "false"
+class Test {
+
+  @MyAnnotati<caret>on
+  void m() {
+
+  }
+
+  @interface MyAnnotation {
+    String value() default "";
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeSingleParameter.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeSingleParameter.java
new file mode 100644
index 0000000..a627372
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeSingleParameter.java
@@ -0,0 +1,13 @@
+// "Add missing annotation parameter 'value'" "true"
+class Test {
+
+  @MyAnnotati<caret>on
+  void m() {
+
+  }
+
+  @interface MyAnnotation {
+    String value();
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeValueTyping.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeValueTyping.java
new file mode 100644
index 0000000..139f523
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters/beforeValueTyping.java
@@ -0,0 +1,14 @@
+class Test {
+
+  @MyAnnotati<caret>on
+  void m() {
+
+  }
+
+  @interface MyAnnotation {
+    String value3();
+    String value2();
+    String value1();
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeRaw.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeRaw.java
new file mode 100644
index 0000000..e9389d7
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeRaw.java
@@ -0,0 +1,24 @@
+// "Replace with lambda" "false"
+class DbTableBinder {
+
+  public Binder build() {
+    return new Bin<caret>der<DbTable>() {
+      public void bind(A q, DbTable dbTable) {
+        q.bind("name", dbTable.name);
+      }
+    };
+  }
+}
+
+class DbTable {
+  String name;
+}
+
+interface Binder <ArgType> {
+  void bind(A<?> sqlStatement, ArgType argType);
+}
+
+interface A<P> {
+  void bind(String s, String p);
+}
+
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createConstructorParameterFromField/afterSameParameterSimpleNames.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createConstructorParameterFromField/afterSameParameterSimpleNames.java
index 3f64bdc..3b65e88 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createConstructorParameterFromField/afterSameParameterSimpleNames.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createConstructorParameterFromField/afterSameParameterSimpleNames.java
@@ -3,7 +3,7 @@
   private final int _field;
   private final int field;
   A(int field, int field1) {
-      _field = field;
+      this._field = field;
       this.field = field1;
   }
 
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/removeUnusedVariable/afterIfNoBlock.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/removeUnusedVariable/afterIfNoBlock.java
new file mode 100644
index 0000000..19fcc59
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/removeUnusedVariable/afterIfNoBlock.java
@@ -0,0 +1,9 @@
+// "Remove variable 'foo'" "true"
+class a {
+  private int refactorTest(int i) {
+      int bar = 0;
+    if (i >0) ;
+    return bar;
+  }
+}
+
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/removeUnusedVariable/beforeIfNoBlock.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/removeUnusedVariable/beforeIfNoBlock.java
new file mode 100644
index 0000000..5648eae
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/removeUnusedVariable/beforeIfNoBlock.java
@@ -0,0 +1,10 @@
+// "Remove variable 'foo'" "true"
+class a {
+  private int refactorTest(int i) {
+    int f<caret>oo = 0;
+    int bar = 0;
+    if (i >0) foo++;
+    return bar;
+  }
+}
+
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/afterSillyAssignment.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/afterSillyAssignment.java
new file mode 100644
index 0000000..8b0859f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/afterSillyAssignment.java
@@ -0,0 +1,7 @@
+// "Remove redundant assignment" "true"
+class A {
+  {
+    String ss = "";
+
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/beforeSillyAssignment.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/beforeSillyAssignment.java
new file mode 100644
index 0000000..8114774
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/beforeSillyAssignment.java
@@ -0,0 +1,8 @@
+// "Remove redundant assignment" "true"
+class A {
+  {
+    String ss = "";
+
+    s<caret>s = ss;
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/afterFewParameters.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/afterFewParameters.java
new file mode 100644
index 0000000..868cf5e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/afterFewParameters.java
@@ -0,0 +1,14 @@
+// "Wrap 4th parameter using 'Arrays.asList'" "true"
+import java.util.Arrays;
+import java.util.List;
+
+public class Test {
+
+  void list(int i, int j, int k, List<String> l, String s) {
+
+  }
+
+  void m(String[] a) {
+    list(1, 2, 3, Arrays.asList(a), "asd");
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/afterSingleParameter.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/afterSingleParameter.java
new file mode 100644
index 0000000..9544df9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/afterSingleParameter.java
@@ -0,0 +1,14 @@
+// "Wrap using 'Arrays.asList'" "true"
+import java.util.Arrays;
+import java.util.List;
+
+public class Test {
+
+  void list(List<String> l) {
+
+  }
+
+  void m(String[] a) {
+    list(Arrays.asList(a));
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/beforeFewParameters.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/beforeFewParameters.java
new file mode 100644
index 0000000..92ed429
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/beforeFewParameters.java
@@ -0,0 +1,13 @@
+// "Wrap 4th parameter using 'Arrays.asList'" "true"
+import java.util.List;
+
+public class Test {
+
+  void list(int i, int j, int k, List<String> l, String s) {
+
+  }
+
+  void m(String[] a) {
+    list(1, 2, 3, a<caret>, "asd");
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/beforeNotConvertible.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/beforeNotConvertible.java
new file mode 100644
index 0000000..8a8e015
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/beforeNotConvertible.java
@@ -0,0 +1,13 @@
+// "Wrap using 'Arrays.asList'" "false"
+import java.util.LinkedList;
+
+public class Test {
+
+  void list(LinkedList<String> l) {
+
+  }
+
+  void m(String[] a) {
+    list(a<caret>);
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/beforeNotConvertible2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/beforeNotConvertible2.java
new file mode 100644
index 0000000..c27ca44
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/beforeNotConvertible2.java
@@ -0,0 +1,13 @@
+// "Wrap using 'Arrays.asList'" "false"
+import java.util.LinkedList;
+
+public class Test {
+
+  void list(LinkedList<String> l) {
+
+  }
+
+  void m(Long[] a) {
+    list(a<caret>);
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/beforeSingleParameter.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/beforeSingleParameter.java
new file mode 100644
index 0000000..fcc4467
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList/beforeSingleParameter.java
@@ -0,0 +1,13 @@
+// "Wrap using 'Arrays.asList'" "false"
+import java.util.List;
+
+public class Test {
+
+  void list(List<String> l) {
+
+  }
+
+  void m(String[] a) {
+    list(a<caret>);
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/afterBoolean.java b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/afterBoolean.java
new file mode 100644
index 0000000..9b101a0
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/afterBoolean.java
@@ -0,0 +1,13 @@
+// "Surround annotation parameter value with quotes" "true"
+class X {
+
+  @interface MyAnnotation {
+    String value();
+  }
+
+  @MyAnnotation("true")
+  void m() {
+
+  }
+
+}
diff --git a/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/afterChar.java b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/afterChar.java
new file mode 100644
index 0000000..7e49315
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/afterChar.java
@@ -0,0 +1,13 @@
+// "Surround annotation parameter value with quotes" "true"
+class X {
+
+  @interface MyAnnotation {
+    String value();
+  }
+
+  @MyAnnotation(value= "x")
+  void m() {
+
+  }
+
+}
diff --git a/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/afterChar2.java b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/afterChar2.java
new file mode 100644
index 0000000..6167c38
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/afterChar2.java
@@ -0,0 +1,13 @@
+// "Surround annotation parameter value with quotes" "true"
+class X {
+
+  @interface MyAnnotation {
+    String value();
+  }
+
+  @MyAnnotation(value= "\n")
+  void m() {
+
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/afterLong.java b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/afterLong.java
new file mode 100644
index 0000000..b434e47
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/afterLong.java
@@ -0,0 +1,15 @@
+// "Surround annotation parameter value with quotes" "true"
+class X {
+
+  @interface MyAnnotation {
+    int value0();
+    String value();
+    long value1();
+  }
+
+  @MyAnnotation(value0 = 1, value= "1000L", value1 = 10L)
+  void m() {
+
+  }
+
+}
diff --git a/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeBoolean.java b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeBoolean.java
new file mode 100644
index 0000000..04bba23
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeBoolean.java
@@ -0,0 +1,13 @@
+// "Surround annotation parameter value with quotes" "true"
+class X {
+
+  @interface MyAnnotation {
+    String value();
+  }
+
+  @MyAnnotation(tr<caret>ue)
+  void m() {
+
+  }
+
+}
diff --git a/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeChar.java b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeChar.java
new file mode 100644
index 0000000..92dc9c5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeChar.java
@@ -0,0 +1,13 @@
+// "Surround annotation parameter value with quotes" "true"
+class X {
+
+  @interface MyAnnotation {
+    String value();
+  }
+
+  @MyAnnotation(value='<caret>x')
+  void m() {
+
+  }
+
+}
diff --git a/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeChar2.java b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeChar2.java
new file mode 100644
index 0000000..1f988b4
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeChar2.java
@@ -0,0 +1,13 @@
+// "Surround annotation parameter value with quotes" "true"
+class X {
+
+  @interface MyAnnotation {
+    String value();
+  }
+
+  @MyAnnotation(value='<caret>\n')
+  void m() {
+
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeLong.java b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeLong.java
new file mode 100644
index 0000000..9e8ee15
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeLong.java
@@ -0,0 +1,15 @@
+// "Surround annotation parameter value with quotes" "true"
+class X {
+
+  @interface MyAnnotation {
+    int value0();
+    String value();
+    long value1();
+  }
+
+  @MyAnnotation(value0 = 1, value=1<caret>000L, value1 = 10L)
+  void m() {
+
+  }
+
+}
diff --git a/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeNotAvailable.java b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeNotAvailable.java
new file mode 100644
index 0000000..a03677e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeNotAvailable.java
@@ -0,0 +1,10 @@
+// "Surround annotation parameter value with quotes" "false"
+class X {
+
+  void m() {
+
+    String s = 123<caret>45;
+
+  }
+
+}
diff --git a/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeNotAvailable2.java b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeNotAvailable2.java
new file mode 100644
index 0000000..c5d5fd8
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeNotAvailable2.java
@@ -0,0 +1,13 @@
+// "Surround annotation parameter value with quotes" "false"
+class X {
+
+  @interface MyAnnotation {
+    int value();
+  }
+
+  @MyAnnotation(tr<caret>ue)
+  void m() {
+
+  }
+
+}
diff --git a/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeNotAvailable3.java b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeNotAvailable3.java
new file mode 100644
index 0000000..c04ce8f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/surroundWithQuotesStringAnnotationParameterValue/beforeNotAvailable3.java
@@ -0,0 +1,13 @@
+// "Surround annotation parameter value with quotes" "false"
+class X {
+
+  @interface MyAnnotation {
+    String c();
+  }
+
+  @MyAnnotation(tr<caret>ue)
+  void m() {
+
+  }
+
+}
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/beforeAssignment.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/beforeAssignment.java
new file mode 100644
index 0000000..451aca1
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/beforeAssignment.java
@@ -0,0 +1,7 @@
+public class Foo {
+    void m(boolean b) {
+
+        b.assert<caret>
+        value = null;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/beforeAssignment_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/beforeAssignment_after.java
new file mode 100644
index 0000000..e5ecf06
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/beforeAssignment_after.java
@@ -0,0 +1,7 @@
+public class Foo {
+    void m(boolean b) {
+
+        assert b;<caret>
+        value = null;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/simpleWithSemicolon.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/simpleWithSemicolon.java
new file mode 100644
index 0000000..7d92853
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/simpleWithSemicolon.java
@@ -0,0 +1,9 @@
+public class Foo {
+    void m() {
+        is();.assert<caret>
+    }
+
+    boolean is() {
+      return false;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/assert/simpleWithSemicolon_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/simpleWithSemicolon_after.java
new file mode 100644
index 0000000..11e8bde
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/assert/simpleWithSemicolon_after.java
@@ -0,0 +1,9 @@
+public class Foo {
+    void m() {
+        assert is();<caret>
+    }
+  
+    boolean is() {
+      return false;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/if/beforeAssignment.java b/java/java-tests/testData/codeInsight/template/postfix/templates/if/beforeAssignment.java
new file mode 100644
index 0000000..30ce3f4
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/if/beforeAssignment.java
@@ -0,0 +1,7 @@
+public class Foo {
+    void m(boolean b) {
+
+        b.if<caret>
+        value = null;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/if/beforeAssignment_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/if/beforeAssignment_after.java
new file mode 100644
index 0000000..342bfe0
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/if/beforeAssignment_after.java
@@ -0,0 +1,9 @@
+public class Foo {
+    void m(boolean b) {
+
+        if (b) {
+            <caret>
+        }
+        value = null;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/if/simpleWithSemicolon.java b/java/java-tests/testData/codeInsight/template/postfix/templates/if/simpleWithSemicolon.java
new file mode 100644
index 0000000..4d67eaa
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/if/simpleWithSemicolon.java
@@ -0,0 +1,9 @@
+public class Foo {
+    void m() {
+        is();.if<caret>
+    }
+
+    boolean is() {
+      return false;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/if/simpleWithSemicolon_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/if/simpleWithSemicolon_after.java
new file mode 100644
index 0000000..a05e92e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/if/simpleWithSemicolon_after.java
@@ -0,0 +1,11 @@
+public class Foo {
+    void m() {
+        if (is()) {
+            <caret>
+        }
+    }
+  
+    boolean is() {
+      return false;
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/throw/beforeAssignment.java b/java/java-tests/testData/codeInsight/template/postfix/templates/throw/beforeAssignment.java
new file mode 100644
index 0000000..689f16d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/throw/beforeAssignment.java
@@ -0,0 +1,9 @@
+import java.lang.Exception;
+
+public class Foo {
+    void m(Exception e) {
+
+        e.throw<caret>
+        value = null
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/throw/beforeAssignment_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/throw/beforeAssignment_after.java
new file mode 100644
index 0000000..e6dbc1d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/throw/beforeAssignment_after.java
@@ -0,0 +1,9 @@
+import java.lang.Exception;
+
+public class Foo {
+    void m(Exception e) {
+
+        throw e;<caret>
+        value = null
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/throw/notThrowable_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/throw/notThrowable_after.java
index 900e720..9ffb895 100644
--- a/java/java-tests/testData/codeInsight/template/postfix/templates/throw/notThrowable_after.java
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/throw/notThrowable_after.java
@@ -1,5 +1,5 @@
 public class Foo {
     void m(Object o) {
-        throw o;<caret>
+        o.throw <caret>
     }
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/throw/simpleWithSemicolon.java b/java/java-tests/testData/codeInsight/template/postfix/templates/throw/simpleWithSemicolon.java
new file mode 100644
index 0000000..7526794
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/throw/simpleWithSemicolon.java
@@ -0,0 +1,7 @@
+import java.lang.RuntimeException;
+
+public class Foo {
+    void m() {
+        new RuntimeException("error");.throw<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/throw/simpleWithSemicolon_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/throw/simpleWithSemicolon_after.java
new file mode 100644
index 0000000..a0219e4
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/throw/simpleWithSemicolon_after.java
@@ -0,0 +1,7 @@
+import java.lang.RuntimeException;
+
+public class Foo {
+    void m() {
+        throw new RuntimeException("error");
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/blockMarkerComments/Class.java b/java/java-tests/testData/inspection/blockMarkerComments/Class.java
new file mode 100644
index 0000000..fdb519f
--- /dev/null
+++ b/java/java-tests/testData/inspection/blockMarkerComments/Class.java
@@ -0,0 +1,25 @@
+import java.lang.Object;
+
+class A {
+
+  class Nested {
+
+  } <warning descr="Redundant block marker">//end class marker</warning>
+  //end not a marker
+
+  void m1() {
+    Object o = new Object() {
+
+    }; //end anonymous class this is very long comment and it's not marker
+    //end not a marker
+  }
+
+  void m() {
+    Object o;
+    o = new Object() {
+
+    }; <warning descr="Redundant block marker">//end marker</warning>
+  }
+
+} <warning descr="Redundant block marker">//end marker</warning>
+//end not a marker
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/blockMarkerComments/If.java b/java/java-tests/testData/inspection/blockMarkerComments/If.java
new file mode 100644
index 0000000..d432503
--- /dev/null
+++ b/java/java-tests/testData/inspection/blockMarkerComments/If.java
@@ -0,0 +1,32 @@
+class Foo {
+
+  void m() {
+
+    if (true) {
+
+    } else {
+
+    } <warning descr="Redundant block marker">//endif</warning>
+
+    if (true) {
+
+    } <warning descr="Redundant block marker">// end if</warning>
+
+    if (true) {
+
+    } else {
+
+    } //it's not block comment (it's not starts wigh "end")
+
+    if (true) {
+
+    }
+    // it's not block comment (it's located under if block)
+
+    if (true) { // it's not block comment
+
+
+    }
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/blockMarkerComments/Loop.java b/java/java-tests/testData/inspection/blockMarkerComments/Loop.java
new file mode 100644
index 0000000..c6e3e21
--- /dev/null
+++ b/java/java-tests/testData/inspection/blockMarkerComments/Loop.java
@@ -0,0 +1,31 @@
+class Foo {
+
+  void m() {
+    for (int i = 0; i > -1; i--) {
+
+    } <warning descr="Redundant block marker">//end</warning>
+  }
+
+  void m1() {
+    while (true) {
+
+    }
+    //end while
+    // (not block marker)
+  }
+
+  void m2() {
+    while (true) {
+
+    } <warning descr="Redundant block marker">// endwhile</warning>
+  }
+
+  void m3() {
+    do {
+
+    } while (true);
+    //end
+    //not a block marker
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/blockMarkerComments/Method.java b/java/java-tests/testData/inspection/blockMarkerComments/Method.java
new file mode 100644
index 0000000..887496d
--- /dev/null
+++ b/java/java-tests/testData/inspection/blockMarkerComments/Method.java
@@ -0,0 +1,12 @@
+class Foo {
+
+  void m() {
+
+  } <warning descr="Redundant block marker">// end method</warning>
+
+  void m1() {
+
+  }
+  //end not a block marker
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/blockMarkerComments/RemoveBlockMarker.java b/java/java-tests/testData/inspection/blockMarkerComments/RemoveBlockMarker.java
new file mode 100644
index 0000000..086ab50
--- /dev/null
+++ b/java/java-tests/testData/inspection/blockMarkerComments/RemoveBlockMarker.java
@@ -0,0 +1,7 @@
+class A {
+
+  void m() {
+    
+  } //en<caret>d method
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/blockMarkerComments/RemoveBlockMarker_after.java b/java/java-tests/testData/inspection/blockMarkerComments/RemoveBlockMarker_after.java
new file mode 100644
index 0000000..dfa5256
--- /dev/null
+++ b/java/java-tests/testData/inspection/blockMarkerComments/RemoveBlockMarker_after.java
@@ -0,0 +1,7 @@
+class A {
+
+  void m() {
+
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/blockMarkerComments/TryCatch.java b/java/java-tests/testData/inspection/blockMarkerComments/TryCatch.java
new file mode 100644
index 0000000..a692bc7
--- /dev/null
+++ b/java/java-tests/testData/inspection/blockMarkerComments/TryCatch.java
@@ -0,0 +1,45 @@
+import java.lang.Exception;
+
+class Foo {
+
+  void m() {
+
+    try {
+
+    } catch (Exception e) {
+
+    } <warning descr="Redundant block marker">//end try-catch</warning>
+
+    try {
+
+    } catch (Exception e) {
+
+    } <warning descr="Redundant block marker">// endtrycatchblockmarker</warning>
+
+    try {
+
+    } catch (Exception e) {
+
+    } <warning descr="Redundant block marker">// endtrycatchblockmarker</warning>
+
+    try {
+
+    } catch (Exception e) {
+
+    } finally {
+
+    } <warning descr="Redundant block marker">// end finally</warning>
+
+    try {
+
+    } catch (Exception e) {
+
+    } finally {
+
+    }
+    // end
+    // not a block marker
+
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/contractCheck/DelegationToInstanceMethod.java b/java/java-tests/testData/inspection/dataFlow/contractCheck/DelegationToInstanceMethod.java
new file mode 100644
index 0000000..af1679d
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/contractCheck/DelegationToInstanceMethod.java
@@ -0,0 +1,12 @@
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+class Foo {
+  @Contract("!null,true->!null")
+  String delegationToInstance(@NotNull Foo f, boolean createIfNeeded) { return f.getString(createIfNeeded); }
+
+  @Contract("true->!null")
+  String getString(boolean createIfNeeded) { return createIfNeeded ? "" : null; }
+
+}
diff --git a/java/java-tests/testData/inspection/dataFlow/contractCheck/DelegationWithUnknownArgument.java b/java/java-tests/testData/inspection/dataFlow/contractCheck/DelegationWithUnknownArgument.java
new file mode 100644
index 0000000..98c0c29
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/contractCheck/DelegationWithUnknownArgument.java
@@ -0,0 +1,32 @@
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+abstract class Foo {
+  abstract String getString();
+
+  @Contract("null -> null;!null -> !null")
+  public static String delegate(@Nullable String s) {
+    return s == null ? null : s.substring(1);
+  }
+
+  @Contract("null -> null;!null -> !null")
+  public static String callee(@Nullable Foo element) {
+    return element == null ? null : delegate(element.getString());
+  }
+
+
+  @Contract("!null -> !null")
+  @Nullable public static String delegate2(@Nullable String s) {
+    return s == null ? null : s.substring(1);
+  }
+
+  @Contract("!null -> !null")
+  @Nullable public static String callee2(@Nullable Object element) {
+    if (element instanceof Foo) return delegate2(((Foo)element).getString());
+    if (element != null) return element.toString();
+    return null;
+  }
+
+
+}
diff --git a/java/java-tests/testData/inspection/dataFlow/contractCheck/EqualsUnknownValue.java b/java/java-tests/testData/inspection/dataFlow/contractCheck/EqualsUnknownValue.java
new file mode 100644
index 0000000..33c0526
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/contractCheck/EqualsUnknownValue.java
@@ -0,0 +1,25 @@
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+abstract class Foo {
+  public static final String CONSTANT = getSomeString();
+
+  static native String getSomeString();
+
+  @Contract("null -> false")
+  static boolean isConstant(@Nullable String s) {
+    return s == CONSTANT;
+  }
+
+  @Contract("null -> false")
+  static boolean isSomeString(@Nullable String s) {
+    return s == getSomeString();
+  }
+
+  @Contract("null,_ -> false")
+  static boolean isParameter(@Nullable String s, String param) {
+    return s == param;
+  }
+
+}
diff --git a/java/java-tests/testData/inspection/dataFlow/contractCheck/FailDelegation.java b/java/java-tests/testData/inspection/dataFlow/contractCheck/FailDelegation.java
new file mode 100644
index 0000000..9f18a6d
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/contractCheck/FailDelegation.java
@@ -0,0 +1,17 @@
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+class Foo {
+  @Contract("!null,true->!null")
+  String delegationToInstance(@NotNull Foo f, boolean createIfNeeded) {
+    return <warning descr="Contract clause '!null, true -> !null' is violated: exception might be thrown instead of returning !null">f.getString(createIfNeeded)</warning>;
+  }
+
+  @Contract("true->fail")
+  String getString(boolean fail) {
+    if (fail) throw new RuntimeException();
+    return "a";
+  }
+
+}
diff --git a/java/java-tests/testData/inspection/dataFlow/contractCheck/MissingFail.java b/java/java-tests/testData/inspection/dataFlow/contractCheck/MissingFail.java
new file mode 100644
index 0000000..875fe78
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/contractCheck/MissingFail.java
@@ -0,0 +1,11 @@
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+class Foo {
+
+  @Contract("true->fail")
+  void <warning descr="Contract clause 'true -> fail' is violated: no exception is thrown">assertFalse</warning>(boolean fail) {
+  }
+
+}
diff --git a/java/java-tests/testData/inspection/dataFlow/contractCheck/NotNullStringLiteral.java b/java/java-tests/testData/inspection/dataFlow/contractCheck/NotNullStringLiteral.java
new file mode 100644
index 0000000..a493436
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/contractCheck/NotNullStringLiteral.java
@@ -0,0 +1,11 @@
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.Nullable;
+
+class Foo {
+  @Nullable
+  @Contract ( "_ -> null")
+  String foo(String s) {
+    return <warning descr="Contract clause '_ -> null' is violated">"42"</warning>;
+  }
+
+}
diff --git a/java/java-tests/testData/inspection/dataFlow/contractCheck/PlainDelegation.java b/java/java-tests/testData/inspection/dataFlow/contractCheck/PlainDelegation.java
new file mode 100644
index 0000000..80fb846
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/contractCheck/PlainDelegation.java
@@ -0,0 +1,16 @@
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+class Foo {
+  @Contract("null->false")
+  boolean plainDelegation(Object x) {
+    return <warning descr="Contract clause 'null -> false' is violated">bar(2, x)</warning>;
+  }
+
+  @Contract("_,null->true")
+  boolean bar(int i, @Nullable Object foo) {
+    return foo == null;
+  }
+
+}
diff --git a/java/java-tests/testData/inspection/dataFlow/contractCheck/SignatureIssues.java b/java/java-tests/testData/inspection/dataFlow/contractCheck/SignatureIssues.java
new file mode 100644
index 0000000..84c7751
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/contractCheck/SignatureIssues.java
@@ -0,0 +1,14 @@
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.Nullable;
+
+class Foo {
+  @Contract(<warning descr="A contract clause must be in form arg1, ..., argN -> return-value">"a"</warning>)
+  void malformedContract() {}
+
+  @Contract(<warning descr="Method takes 2 parameters, while contract clause number 1 expects 1">"null -> _"</warning>)
+  void wrongParameterCount(Object a, boolean b) {}
+
+  @Contract(pure=<warning descr="Pure methods must return something, void is not allowed as a return type">true</warning>)
+  void voidPureMethod() {}
+
+}
diff --git a/java/java-tests/testData/inspection/dataFlow/contractCheck/TrueInsteadOfFail.java b/java/java-tests/testData/inspection/dataFlow/contractCheck/TrueInsteadOfFail.java
new file mode 100644
index 0000000..e37328e
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/contractCheck/TrueInsteadOfFail.java
@@ -0,0 +1,13 @@
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.Nullable;
+
+class Foo {
+  @Contract("null,_->true")
+  boolean bar(@Nullable Object foo, int i) {
+    if (foo == null) {
+      <warning descr="Contract clause 'null, _ -> true' is violated: exception might be thrown instead of returning true">throw new RuntimeException();</warning>
+    }
+    return i == 2;
+  }
+
+}
diff --git a/java/java-tests/testData/inspection/dataFlow/contractCheck/TrueInsteadOfFalse.java b/java/java-tests/testData/inspection/dataFlow/contractCheck/TrueInsteadOfFalse.java
new file mode 100644
index 0000000..1454968
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/contractCheck/TrueInsteadOfFalse.java
@@ -0,0 +1,10 @@
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.Nullable;
+
+class Foo {
+  @Contract("null->true")
+  boolean bar(@Nullable Object foo) {
+    return <warning descr="Contract clause 'null -> true' is violated">foo != null && foo.hashCode() == 3</warning>;
+  }
+
+}
diff --git a/java/java-tests/testData/inspection/dataFlow/contractCheck/WrongFail.java b/java/java-tests/testData/inspection/dataFlow/contractCheck/WrongFail.java
new file mode 100644
index 0000000..1e2061e
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/contractCheck/WrongFail.java
@@ -0,0 +1,10 @@
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.Nullable;
+
+class Foo {
+  @Contract("_,null->fail")
+  boolean bar(int i, @Nullable Object foo) {
+    return <warning descr="Contract clause '_, null -> fail' is violated">foo == null</warning>;
+  }
+
+}
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ContractAnnotation.java b/java/java-tests/testData/inspection/dataFlow/fixture/ContractAnnotation.java
index 4890d54..a3b1775 100644
--- a/java/java-tests/testData/inspection/dataFlow/fixture/ContractAnnotation.java
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/ContractAnnotation.java
@@ -41,12 +41,4 @@
   
   Object call() {return new Object();}
   
-  @Contract(<warning descr="A contract clause must be in form arg1, ..., argN -> return-value">"a"</warning>)
-  void malformedContract() {}
-
-  @Contract(<warning descr="Method takes 2 parameters, while contract clause number 1 expects 1">"null -> _"</warning>)
-  void wrongParameterCount(Object a, boolean b) {}
-  
-  @Contract(pure=<warning descr="Pure methods must return something, void is not allowed as a return type">true</warning>)
-  void voidPureMethod() {}
 }
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ContractInLoopNotTooComplex.java b/java/java-tests/testData/inspection/dataFlow/fixture/ContractInLoopNotTooComplex.java
index 14dfd20..7348d03 100644
--- a/java/java-tests/testData/inspection/dataFlow/fixture/ContractInLoopNotTooComplex.java
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/ContractInLoopNotTooComplex.java
@@ -2,15 +2,16 @@
 
 class Foo {
 
-  public void main(String[] args) {
+  public void main(String s) {
     for (int i = 0; i < 10; i++) {
-      assertTrue("str", true);
+      assertTrue("str", s != null);
+      s.hashCode();
     }
   }
 
   @Contract("_, false->fail")
   void assertTrue(String msg, boolean value) {
-
+    if (!value) throw new RuntimeException();
   }
 
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ContractInapplicableComparison.java b/java/java-tests/testData/inspection/dataFlow/fixture/ContractInapplicableComparison.java
new file mode 100644
index 0000000..92a6301
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/ContractInapplicableComparison.java
@@ -0,0 +1,16 @@
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.Nullable;
+
+class Foo {
+  void foo() {
+    Object o1 = bar(goo());
+    if (o1 == null) {
+      System.out.println();
+    }
+  }
+
+  @Nullable Object goo() { return null;}
+
+  @Nullable @Contract("null->null") static Object bar(@Nullable Object foo) { return foo; }
+
+}
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ContractSeveralClauses.java b/java/java-tests/testData/inspection/dataFlow/fixture/ContractSeveralClauses.java
index a654b99..ac878ec 100644
--- a/java/java-tests/testData/inspection/dataFlow/fixture/ContractSeveralClauses.java
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/ContractSeveralClauses.java
@@ -16,12 +16,12 @@
     }
 
     @Contract("null,_->null;!null,_->!null")
-    String escapeStr(String s, Object o) {
-        return s;
+    String escapeStr(@Nullable String s, Object o) {
+        return <warning descr="Expression 's' might evaluate to null but is returned by the method which is not declared as @Nullable">s</warning>;
     }
 
     @Contract("null->null;!null->!null")
-    String escapeStr(String s) {
-        return s;
+    String escapeStr(@Nullable String s) {
+        return <warning descr="Expression 's' might evaluate to null but is returned by the method which is not declared as @Nullable">s</warning>;
     }
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ContractVarargs.java b/java/java-tests/testData/inspection/dataFlow/fixture/ContractVarargs.java
index e65bc87..7d987c7 100644
--- a/java/java-tests/testData/inspection/dataFlow/fixture/ContractVarargs.java
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/ContractVarargs.java
@@ -2,6 +2,8 @@
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import java.lang.RuntimeException;
+
 class Contracts {
 
   public void simpleFail(@Nullable String message) {
@@ -11,12 +13,12 @@
 
   @Contract("_->fail")
   private void notBlank(@Nullable Object message) {
-
+    throw new RuntimeException();
   }
 
   @Contract("_,_,_->fail")
   private void notBlank(@Nullable Object o, String message, Object... args) {
-
+    throw new RuntimeException();
   }
 
   public void varargFail(@Nullable String message) {
@@ -32,6 +34,10 @@
     notBlank(message, "Message should not be blank", new Object(), new Object());
     log(message);
   }
+  public void vararg3(@Nullable String message) {
+    notBlank(message, "Message should not be blank", new Object(), new Object(), new Object(), new Object(), new Object());
+    log(message);
+  }
 
   public void log(@NotNull String message) {
     System.out.println(message);
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ContractWithNotNull.java b/java/java-tests/testData/inspection/dataFlow/fixture/ContractWithNotNull.java
new file mode 100644
index 0000000..31a5f46
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/ContractWithNotNull.java
@@ -0,0 +1,16 @@
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+
+class Foo {
+
+  @Contract("_,null->null;_,!null->!null")
+  static Object f(@NotNull Object o1, Object o2) {
+    return o2;
+  }
+
+  static Object g(Object o1) {
+    return f(<warning descr="Passing 'null' argument to parameter annotated as @NotNull">null</warning>, o1);
+  }
+
+}
+
diff --git a/java/java-tests/testData/inspection/deprecation/methodsOfDeprecatedClass/expected.xml b/java/java-tests/testData/inspection/deprecation/methodsOfDeprecatedClass/expected.xml
new file mode 100644
index 0000000..e621cdc
--- /dev/null
+++ b/java/java-tests/testData/inspection/deprecation/methodsOfDeprecatedClass/expected.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+  <problem>
+    <file>Test.java</file>
+    <line>11</line>
+    <problem_class severity="WARNING" attribute_key="DEPRECATED_ATTRIBUTES">Deprecated API usage</problem_class>
+    <description>'Test' is deprecated</description>
+  </problem>
+
+  <problem>
+    <file>Test.java</file>
+    <line>12</line>
+    <problem_class severity="WARNING" attribute_key="DEPRECATED_ATTRIBUTES">Deprecated API usage</problem_class>
+    <description>'Test' is deprecated</description>
+  </problem>
+</problems>
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/deprecation/methodsOfDeprecatedClass/src/Test.java b/java/java-tests/testData/inspection/deprecation/methodsOfDeprecatedClass/src/Test.java
new file mode 100644
index 0000000..c9a13d8
--- /dev/null
+++ b/java/java-tests/testData/inspection/deprecation/methodsOfDeprecatedClass/src/Test.java
@@ -0,0 +1,14 @@
+@Deprecated
+class Test {
+  protected Test() {
+
+  }
+
+  public void foo(){}
+}
+
+class D {
+  static void foo(Test t) {
+    t.foo();
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/suspiciousCalls/RemoveAllCall.java b/java/java-tests/testData/inspection/suspiciousCalls/RemoveAllCall.java
new file mode 100644
index 0000000..7c839c0
--- /dev/null
+++ b/java/java-tests/testData/inspection/suspiciousCalls/RemoveAllCall.java
@@ -0,0 +1,16 @@
+import java.util.*;
+
+
+class Simple {
+  public static void main(String[] args) {
+    class O {}
+
+    Map<O, String> someData = new HashMap<O, String>();
+    Set<String> set = new HashSet<String>();
+    Set<O> setO = new HashSet<O>();
+
+    set.removeAll(<warning descr="'Set<String>' may not contain objects of type 'O'">someData.keySet()</warning>);
+    setO.removeAll(someData.keySet());
+
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/suspiciousCalls/SetList.java b/java/java-tests/testData/inspection/suspiciousCalls/SetList.java
new file mode 100644
index 0000000..19f0b0f
--- /dev/null
+++ b/java/java-tests/testData/inspection/suspiciousCalls/SetList.java
@@ -0,0 +1,8 @@
+import java.util.List;
+import java.util.Set;
+
+class Clazz {
+    void foo(List<String> l, Set<String> s) {
+      l.removeAll(s);
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/unusedLibrary/junit.jar b/java/java-tests/testData/inspection/unusedLibrary/junit.jar
new file mode 100644
index 0000000..bfb318b
--- /dev/null
+++ b/java/java-tests/testData/inspection/unusedLibrary/junit.jar
Binary files differ
diff --git a/java/java-tests/testData/inspection/unusedLibrary/simple/expected.xml b/java/java-tests/testData/inspection/unusedLibrary/simple/expected.xml
new file mode 100644
index 0000000..8184735
--- /dev/null
+++ b/java/java-tests/testData/inspection/unusedLibrary/simple/expected.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+  <problem>
+    <file>testSimple_0.iml</file>
+    <problem_class>Unused library</problem_class>
+    <description>Unused library 'JUnit'</description>
+  </problem>
+
+</problems>
+
diff --git a/java/java-tests/testData/inspection/unusedLibrary/simple/src/Test.java b/java/java-tests/testData/inspection/unusedLibrary/simple/src/Test.java
new file mode 100644
index 0000000..96d83e0
--- /dev/null
+++ b/java/java-tests/testData/inspection/unusedLibrary/simple/src/Test.java
@@ -0,0 +1,2 @@
+class Test {
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/unusedLibrary/usedJunit/expected.xml b/java/java-tests/testData/inspection/unusedLibrary/usedJunit/expected.xml
new file mode 100644
index 0000000..ec272ab
--- /dev/null
+++ b/java/java-tests/testData/inspection/unusedLibrary/usedJunit/expected.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems/>
+
diff --git a/java/java-tests/testData/inspection/unusedLibrary/usedJunit/src/MyTest.java b/java/java-tests/testData/inspection/unusedLibrary/usedJunit/src/MyTest.java
new file mode 100644
index 0000000..dceefa7
--- /dev/null
+++ b/java/java-tests/testData/inspection/unusedLibrary/usedJunit/src/MyTest.java
@@ -0,0 +1,2 @@
+import junit.framework.TestCase;
+public class MyTest extends TestCase {}
diff --git a/java/java-tests/testData/psi/cls/mirror/Bounds.txt b/java/java-tests/testData/psi/cls/mirror/Bounds.txt
index 2350274..ca9e009 100644
--- a/java/java-tests/testData/psi/cls/mirror/Bounds.txt
+++ b/java/java-tests/testData/psi/cls/mirror/Bounds.txt
@@ -7,7 +7,7 @@
 class Bounds {
     Bounds() { /* compiled code */ }
 
-    public static <T extends java.lang.Object & java.lang.Comparable<? super T>> T max(java.util.Collection<? extends T> collection) { /* compiled code */ }
+    public static <T extends java.lang.Object & java.lang.Comparable<? super T> & java.io.Serializable> T max(java.util.Collection<? extends T> collection) { /* compiled code */ }
 
     public static <T> T max(java.util.Collection<? extends T> collection, java.util.Comparator<? super T> comparator) { /* compiled code */ }
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/psi/cls/mirror/Deprecated.txt b/java/java-tests/testData/psi/cls/mirror/Deprecated.txt
index efa33fb..58fbb81 100644
--- a/java/java-tests/testData/psi/cls/mirror/Deprecated.txt
+++ b/java/java-tests/testData/psi/cls/mirror/Deprecated.txt
@@ -4,19 +4,42 @@
 
 package pkg;
 
-/**
- * @deprecated
- */
 class Deprecated {
     /**
      * @deprecated
      */
-    int f;
+    int byComment;
+    /**
+     * @deprecated
+     */
+    @java.lang.Deprecated
+    int byAnno;
 
     Deprecated() { /* compiled code */ }
 
     /**
      * @deprecated
      */
-    void m() { /* compiled code */ }
+    void byComment() { /* compiled code */ }
+
+    /**
+     * @deprecated
+     */
+    @java.lang.Deprecated
+    void byAnno() { /* compiled code */ }
+
+    /**
+     * @deprecated
+     */
+    @java.lang.Deprecated
+    static class ByAnno {
+        ByAnno() { /* compiled code */ }
+    }
+
+    /**
+     * @deprecated
+     */
+    static class ByComment {
+        ByComment() { /* compiled code */ }
+    }
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/psi/cls/mirror/EmptyEnum.txt b/java/java-tests/testData/psi/cls/mirror/EmptyEnum.txt
index 808cc55..4ee8f64 100644
--- a/java/java-tests/testData/psi/cls/mirror/EmptyEnum.txt
+++ b/java/java-tests/testData/psi/cls/mirror/EmptyEnum.txt
@@ -7,9 +7,5 @@
 enum EmptyEnum {
     ;
 
-    public static pkg.EmptyEnum[] values() { /* compiled code */ }
-
-    public static pkg.EmptyEnum valueOf(java.lang.String s) { /* compiled code */ }
-
     private EmptyEnum() { /* compiled code */ }
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/psi/cls/mirror/EnumWithFields.txt b/java/java-tests/testData/psi/cls/mirror/EnumWithFields.txt
index 8823f10..caff9a6 100644
--- a/java/java-tests/testData/psi/cls/mirror/EnumWithFields.txt
+++ b/java/java-tests/testData/psi/cls/mirror/EnumWithFields.txt
@@ -10,9 +10,5 @@
     private boolean f1;
     static boolean f2;
 
-    public static pkg.EnumWithFields[] values() { /* compiled code */ }
-
-    public static pkg.EnumWithFields valueOf(java.lang.String s) { /* compiled code */ }
-
     private EnumWithFields() { /* compiled code */ }
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/psi/cls/mirror/GrEnum.txt b/java/java-tests/testData/psi/cls/mirror/GrEnum.txt
new file mode 100644
index 0000000..f0c865f
--- /dev/null
+++ b/java/java-tests/testData/psi/cls/mirror/GrEnum.txt
@@ -0,0 +1,15 @@
+
+  // IntelliJ API Decompiler stub source generated from a class file
+  // Implementation of methods is not available
+
+package pkg;
+
+public enum GrEnum implements groovy.lang.GroovyObject {
+    E1, E2;
+
+    public final java.lang.String name;
+    public static final pkg.GrEnum MIN_VALUE;
+    public static final pkg.GrEnum MAX_VALUE;
+
+    public GrEnum(java.lang.String _name) { /* compiled code */ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/psi/cls/mirror/SimpleEnum.txt b/java/java-tests/testData/psi/cls/mirror/SimpleEnum.txt
index 654770a..6ed2d93 100644
--- a/java/java-tests/testData/psi/cls/mirror/SimpleEnum.txt
+++ b/java/java-tests/testData/psi/cls/mirror/SimpleEnum.txt
@@ -7,9 +7,5 @@
 public enum SimpleEnum {
     E1, E2;
 
-    public static pkg.SimpleEnum[] values() { /* compiled code */ }
-
-    public static pkg.SimpleEnum valueOf(java.lang.String s) { /* compiled code */ }
-
     private SimpleEnum() { /* compiled code */ }
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/psi/cls/mirror/pkg/Bounds.class b/java/java-tests/testData/psi/cls/mirror/pkg/Bounds.class
index ce57f18..1f3aea9 100644
--- a/java/java-tests/testData/psi/cls/mirror/pkg/Bounds.class
+++ b/java/java-tests/testData/psi/cls/mirror/pkg/Bounds.class
Binary files differ
diff --git a/java/java-tests/testData/psi/cls/mirror/pkg/Deprecated$ByAnno.class b/java/java-tests/testData/psi/cls/mirror/pkg/Deprecated$ByAnno.class
new file mode 100644
index 0000000..34beffe
--- /dev/null
+++ b/java/java-tests/testData/psi/cls/mirror/pkg/Deprecated$ByAnno.class
Binary files differ
diff --git a/java/java-tests/testData/psi/cls/mirror/pkg/Deprecated$ByComment.class b/java/java-tests/testData/psi/cls/mirror/pkg/Deprecated$ByComment.class
new file mode 100644
index 0000000..e2a4f3f
--- /dev/null
+++ b/java/java-tests/testData/psi/cls/mirror/pkg/Deprecated$ByComment.class
Binary files differ
diff --git a/java/java-tests/testData/psi/cls/mirror/pkg/Deprecated.class b/java/java-tests/testData/psi/cls/mirror/pkg/Deprecated.class
index 89e87d5..4322170 100644
--- a/java/java-tests/testData/psi/cls/mirror/pkg/Deprecated.class
+++ b/java/java-tests/testData/psi/cls/mirror/pkg/Deprecated.class
Binary files differ
diff --git a/java/java-tests/testData/psi/cls/mirror/pkg/GrEnum.class b/java/java-tests/testData/psi/cls/mirror/pkg/GrEnum.class
new file mode 100644
index 0000000..7443ea3
--- /dev/null
+++ b/java/java-tests/testData/psi/cls/mirror/pkg/GrEnum.class
Binary files differ
diff --git a/java/java-tests/testData/psi/cls/mirror/src/pkg/Bounds.java b/java/java-tests/testData/psi/cls/mirror/src/pkg/Bounds.java
index bacda1c..012b153 100644
--- a/java/java-tests/testData/psi/cls/mirror/src/pkg/Bounds.java
+++ b/java/java-tests/testData/psi/cls/mirror/src/pkg/Bounds.java
@@ -1,10 +1,11 @@
 package pkg;
 
+import java.io.Serializable;
 import java.util.Collection;
 import java.util.Comparator;
 
 class Bounds {
-  public static <T extends Object & Comparable<? super T>> T max(Collection<? extends T> coll) {
+  public static <T extends Object & Comparable<? super T> & Serializable> T max(Collection<? extends T> coll) {
     return null;
   }
 
diff --git a/java/java-tests/testData/psi/cls/mirror/src/pkg/Deprecated.java b/java/java-tests/testData/psi/cls/mirror/src/pkg/Deprecated.java
index e93e057..440731e 100644
--- a/java/java-tests/testData/psi/cls/mirror/src/pkg/Deprecated.java
+++ b/java/java-tests/testData/psi/cls/mirror/src/pkg/Deprecated.java
@@ -1,10 +1,23 @@
 package pkg;
 
-/** @deprecated don't use */
 class Deprecated {
-  /** @deprecated don't use */
-  int f;
 
   /** @deprecated don't use */
-  void m() { }
+  int byComment;
+
+  @java.lang.Deprecated
+  int byAnno;
+
+  /** @deprecated don't use */
+  void byComment() { }
+
+  @java.lang.Deprecated
+  void byAnno() { }
+
+  /** @deprecated don't use */
+  static class ByComment { }
+
+  @java.lang.Deprecated
+  static class ByAnno { }
+
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/psi/cls/mirror/src/pkg/GrEnum.groovy b/java/java-tests/testData/psi/cls/mirror/src/pkg/GrEnum.groovy
new file mode 100644
index 0000000..a190349
--- /dev/null
+++ b/java/java-tests/testData/psi/cls/mirror/src/pkg/GrEnum.groovy
@@ -0,0 +1,11 @@
+package pkg
+
+enum GrEnum {
+  E1("e1"), E2("e2")
+
+  public final String name
+
+  GrEnum(String _name) {
+    name = _name
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/psi/cls/stubBuilder/AnnotatedEnumConstructor.txt b/java/java-tests/testData/psi/cls/stubBuilder/AnnotatedEnumConstructor.txt
index 2ed8f00..89cd6e7 100644
--- a/java/java-tests/testData/psi/cls/stubBuilder/AnnotatedEnumConstructor.txt
+++ b/java/java-tests/testData/psi/cls/stubBuilder/AnnotatedEnumConstructor.txt
@@ -10,18 +10,6 @@
       PsiModifierListStub[mask=25]
     PsiFieldStub[enumconst C:AnnotatedEnumConstructor]
       PsiModifierListStub[mask=25]
-    PsiMethodStub[values:AnnotatedEnumConstructor[]]
-      PsiModifierListStub[mask=9]
-      PsiTypeParameterListStub
-      PsiParameterListStub
-      PsiRefListStub[THROWS_LIST:]
-    PsiMethodStub[valueOf:AnnotatedEnumConstructor]
-      PsiModifierListStub[mask=9]
-      PsiTypeParameterListStub
-      PsiParameterListStub
-        PsiParameterStub[name:java.lang.String]
-          PsiModifierListStub[mask=0]
-      PsiRefListStub[THROWS_LIST:]
     PsiMethodStub[cons varargs AnnotatedEnumConstructor:void]
       PsiModifierListStub[mask=2]
       PsiTypeParameterListStub
diff --git a/java/java-tests/testData/psi/cls/stubBuilder/TimeUnit.txt b/java/java-tests/testData/psi/cls/stubBuilder/TimeUnit.txt
index ffbba35..800f747 100644
--- a/java/java-tests/testData/psi/cls/stubBuilder/TimeUnit.txt
+++ b/java/java-tests/testData/psi/cls/stubBuilder/TimeUnit.txt
@@ -18,18 +18,6 @@
       PsiModifierListStub[mask=26]
     PsiFieldStub[overflows:long[]]
       PsiModifierListStub[mask=26]
-    PsiMethodStub[values:java.util.concurrent.TimeUnit[]]
-      PsiModifierListStub[mask=25]
-      PsiTypeParameterListStub
-      PsiParameterListStub
-      PsiRefListStub[THROWS_LIST:]
-    PsiMethodStub[valueOf:java.util.concurrent.TimeUnit]
-      PsiModifierListStub[mask=9]
-      PsiTypeParameterListStub
-      PsiParameterListStub
-        PsiParameterStub[p1:java.lang.String]
-          PsiModifierListStub[mask=0]
-      PsiRefListStub[THROWS_LIST:]
     PsiMethodStub[cons TimeUnit:void]
       PsiModifierListStub[mask=2]
       PsiTypeParameterListStub
diff --git a/java/java-tests/testData/refactoring/encapsulateFields/commentsInside/after/Test.java b/java/java-tests/testData/refactoring/encapsulateFields/commentsInside/after/Test.java
new file mode 100644
index 0000000..f77bc3b
--- /dev/null
+++ b/java/java-tests/testData/refactoring/encapsulateFields/commentsInside/after/Test.java
@@ -0,0 +1,16 @@
+public class A {
+  public int i;
+
+  void foo(A a) {
+    System.out.println(a./*comment*/getI());
+    a/*comment*/.setI(42);
+  }
+
+    public int getI() {
+        return i;
+    }
+
+    public void setI(int i) {
+        this.i = i;
+    }
+}
diff --git a/java/java-tests/testData/refactoring/encapsulateFields/commentsInside/before/Test.java b/java/java-tests/testData/refactoring/encapsulateFields/commentsInside/before/Test.java
new file mode 100644
index 0000000..9e04d78
--- /dev/null
+++ b/java/java-tests/testData/refactoring/encapsulateFields/commentsInside/before/Test.java
@@ -0,0 +1,8 @@
+public class A {
+  public int i;
+
+  void foo(A a) {
+    System.out.println(a./*comment*/i);
+    a/*comment*/.i = 42;
+  }
+}
diff --git a/java/java-tests/testData/refactoring/renameCollisions/FieldHidesLocal.java b/java/java-tests/testData/refactoring/renameCollisions/FieldHidesLocal.java
new file mode 100644
index 0000000..587ca3b
--- /dev/null
+++ b/java/java-tests/testData/refactoring/renameCollisions/FieldHidesLocal.java
@@ -0,0 +1,14 @@
+class A4 {
+  protected final int <caret>a = 1;
+}
+
+class B {
+  void main() {
+    final int b = 2;
+    new A4() {
+      void m() {
+        System.out.println(b);
+      }
+    };
+  }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessorTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessorTest.java
index efc85b5..fbd85a3 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessorTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessorTest.java
@@ -29,6 +29,7 @@
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.impl.file.PsiDirectoryFactory;
+import com.intellij.psi.search.SearchScope;
 import com.intellij.testFramework.PsiTestCase;
 import com.intellij.testFramework.PsiTestUtil;
 import com.intellij.util.containers.ContainerUtil;
@@ -325,6 +326,18 @@
   private boolean myProcessOnlyChangedText;
   private boolean myIsOK = true;
 
+  @Nullable
+  @Override
+  public SearchScope getSearchScope() {
+    return null;
+  }
+
+  @Nullable
+  @Override
+  public String getFileTypeMask() {
+    return null;
+  }
+
   @Override
   public boolean isProcessWholeFile() {
     return myProcessWholeFile;
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/AbstractCompilerAwareTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/AbstractCompilerAwareTest.java
index 2a925bf..a16641f 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/AbstractCompilerAwareTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/AbstractCompilerAwareTest.java
@@ -18,14 +18,8 @@
 import com.intellij.openapi.compiler.CompilerMessage;
 import com.intellij.openapi.compiler.CompilerMessageCategory;
 import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiManager;
 import com.intellij.testFramework.CompilerTester;
 import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
-import com.intellij.util.Function;
-import com.intellij.util.containers.ContainerUtil;
 
 import java.io.File;
 import java.io.IOException;
@@ -39,12 +33,13 @@
   @Override
   protected void setUp() throws Exception {
     super.setUp();
-    myCompilerTester = new CompilerTester(true, myModule);
+    myCompilerTester = new CompilerTester(myModule);
   }
 
   @Override
   protected void tearDown() throws Exception {
     myCompilerTester.tearDown();
+    myCompilerTester = null;
     super.tearDown();
   }
 
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/ClassNameCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/ClassNameCompletionTest.java
index 4e7cc1f..03310a8 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/ClassNameCompletionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/ClassNameCompletionTest.java
@@ -17,6 +17,8 @@
 
 import com.intellij.JavaTestUtil;
 import com.intellij.codeInsight.lookup.LookupManager;
+import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
+import com.intellij.codeInsight.template.impl.TemplateState;
 import com.intellij.openapi.command.WriteCommandAction;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.roots.LanguageLevelProjectExtension;
@@ -56,6 +58,26 @@
     checkResultByFile(path + "/after2.java");
   }
 
+  public void testTypeParametersTemplate() throws Exception {
+    createClass("package pack; public interface Foo<T> {void foo(T t};");
+
+    String path = "/template";
+
+    TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
+    configureByFile(path + "/before1.java");
+    selectItem(myItems[0]);
+    TemplateState state = TemplateManagerImpl.getTemplateState(myFixture.getEditor());
+    type("String");
+    assert state != null;
+    state.gotoEnd(false);
+    checkResultByFile(path + "/after1.java");
+
+    configureByFile(path + "/before2.java");
+    selectItem(myItems[0]);
+    assert TemplateManagerImpl.getTemplateState(myFixture.getEditor()) == null;
+    checkResultByFile(path +"/after2.java");
+  }
+
   private void createClass(String text) {
     myFixture.addClass(text);
   }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy
index 7f94ec4..c1e6d41 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy
@@ -625,6 +625,14 @@
     checkPreferredItems 0, 'XException', 'XClass', 'XIntf'
   }
 
+  public void testNoNumberValueOf() {
+    checkPreferredItems 0, 'value'
+  }
+
+  public void testNoBooleansInMultiplication() {
+    checkPreferredItems 0, 'fact'
+  }
+
   public void testGlobalStaticMemberStats() {
     configureNoCompletion(getTestName(false) + ".java")
     myFixture.complete(CompletionType.BASIC, 2)
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
index f8bbb46..74d2465 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
@@ -82,7 +82,7 @@
   public void testUncheckedOverriding() { doTest5(true); }
   public void testWildcardTypes() { doTest5(true); }
   public void testConvertibleTypes() { doTest5(true); }
-  public void testIntersectionTypes() { doTest7Incompatibility(true); }
+  public void testIntersectionTypes() { doTest6(true); }
   public void testVarargs() { doTest5(true); }
   public void testTypeArgsOnRaw() { doTest5(false); }
   public void testConditionalExpression() { doTest5(false); }
@@ -353,6 +353,23 @@
   public void testIDEA123509() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
   public void testIDEA125031() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
   public void testIDEA24479() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA118536() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA125744() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA125423() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA118533() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA112117() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA24496() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA58692() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA57290() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA119757() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA67578() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA57388() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA125800() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA125816() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA57338() { doTest(LanguageLevel.JDK_1_6, JavaSdkVersion.JDK_1_6, false); }
+  public void testIDEA67600() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  //jdk should propagate LL 1.4 but actually it provides LL 1.7?!
+  public void testCastObjectToIntJdk14() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_4, false); }
 
   public void testJavaUtilCollections_NoVerify() throws Exception {
     PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk6Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk6Test.java
index 8d2c815..fa4334a 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk6Test.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk6Test.java
@@ -62,7 +62,10 @@
   public void testUnhandledExceptionsValueOf() { doTest(true, false); }
   public void testUnsupportedFeatures7() { doTest(false, false); }
   public void testEnumInitializers() { doTest(false, false); }
+  public void testEnumSynthetics() { doTest(false, false); }
   public void testIDEA79251() { doTest(false, false); }
+  public void testIDEA65473() { doTest(false, false); }
+  public void testIDEA61415() { doTest(false, false); }
   public void testAgentPremain() {
     doTest(false, false); 
   }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GraphInferenceHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GraphInferenceHighlightingTest.java
index dbf3e37..20a5d51 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GraphInferenceHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GraphInferenceHighlightingTest.java
@@ -180,6 +180,10 @@
     doTest();
   }
 
+  public void testRawTypeFromParent() throws Exception {
+    doTest();
+  }
+
   private void doTest() throws Exception {
     doTest(false);
   }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/MostSpecificResolutionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/MostSpecificResolutionTest.java
index 8755791..7a73bfe 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/MostSpecificResolutionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/MostSpecificResolutionTest.java
@@ -107,6 +107,10 @@
     doTest(false);
   }
 
+  public void testIDEA125855() throws Exception {
+    doTest();
+  }
+
   private void doTest() {
     doTest(true);
   }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java
index 6f7b5aa..f5e6a65 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java
@@ -218,6 +218,14 @@
     doTest();
   }
 
+  public void testIDEA118362() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA126056() throws Exception {
+    doTest();
+  }
+
   private void doTest() {
     doTest(false);
   }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java
index 3cbdd7a..16af900 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java
@@ -257,6 +257,10 @@
     doTest();
   }
 
+  public void testIDEA126062() {
+    doTest();
+  }
+
   private void doTest() {
     doTest(false);
   }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/AddMissingRequiredAnnotationParametersTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/AddMissingRequiredAnnotationParametersTest.java
new file mode 100644
index 0000000..f6f50ff
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/AddMissingRequiredAnnotationParametersTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.codeInsight.daemon.quickFix;
+
+import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
+import com.intellij.codeInsight.template.impl.TemplateState;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class AddMissingRequiredAnnotationParametersTest extends LightQuickFixTestCase {
+
+  private void doTest() {
+    doSingleTest(getTestName(false) + ".java");
+  }
+
+  public void testFewParameters() {
+    doTest();
+  }
+
+  public void testFewParameters2() {
+    doTest();
+  }
+
+  public void testFewParametersWithoutOrder() {
+    doTest();
+  }
+
+  public void testSingleParameter() {
+    doTest();
+  }
+
+  public void testParameterWithDefaultValue() {
+    doTest();
+  }
+
+  public void testValueTyping() {
+    configureByFile(getBasePath() + "/beforeValueTyping.java");
+    TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
+    doAction("Add missing annotation parameters - value3, value2, value1");
+    final TemplateState state = TemplateManagerImpl.getTemplateState(getEditor());
+    assertNotNull(state);
+    type("\"value33\"");
+    state.nextTab();
+    type("\"value22\"");
+    state.nextTab();
+    type("\"value11\"");
+    state.nextTab();
+    assertTrue(state.isFinished());
+    checkResultByFile(getBasePath() + "/afterValueTyping.java");
+  }
+
+  @Override
+  protected String getBasePath() {
+    return "/codeInsight/daemonCodeAnalyzer/quickFix/addMissingRequiredAnnotationParameters";
+  }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateConstructorParameterFromFieldTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateConstructorParameterFromFieldTest.java
index 63fc95e..d60e87c 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateConstructorParameterFromFieldTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateConstructorParameterFromFieldTest.java
@@ -2,6 +2,8 @@
 
 import com.intellij.codeInspection.LocalInspectionTool;
 import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspection;
+import com.siyeh.ig.style.MissortedModifiersInspection;
+import com.siyeh.ig.style.UnqualifiedFieldAccessInspection;
 import org.jetbrains.annotations.NotNull;
 
 /**
@@ -11,7 +13,7 @@
   @NotNull
   @Override
   protected LocalInspectionTool[] configureLocalInspectionTools() {
-    return new LocalInspectionTool[]{ new UnusedSymbolLocalInspection()};
+    return new LocalInspectionTool[]{ new UnusedSymbolLocalInspection(), new MissortedModifiersInspection(), new UnqualifiedFieldAccessInspection()};
   }
 
 
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RemoveUnusedAssignmentTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RemoveUnusedAssignmentTest.java
index a8816f8..10dbc98 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RemoveUnusedAssignmentTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RemoveUnusedAssignmentTest.java
@@ -17,6 +17,7 @@
 
 import com.intellij.codeInspection.LocalInspectionTool;
 import com.intellij.codeInspection.defUse.DefUseInspection;
+import com.intellij.codeInspection.sillyAssignment.SillyAssignmentInspection;
 import com.intellij.pom.java.LanguageLevel;
 import org.jetbrains.annotations.NotNull;
 
@@ -26,7 +27,7 @@
   @NotNull
   @Override
   protected LocalInspectionTool[] configureLocalInspectionTools() {
-    return new LocalInspectionTool[] {new DefUseInspection()};
+    return new LocalInspectionTool[] {new DefUseInspection(), new SillyAssignmentInspection()};
   }
 
   @Override
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/SurroundWithQuotesStringAnnotationParameterValueTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/SurroundWithQuotesStringAnnotationParameterValueTest.java
new file mode 100644
index 0000000..15c3de5
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/SurroundWithQuotesStringAnnotationParameterValueTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.codeInsight.daemon.quickFix;
+
+import com.intellij.codeInsight.daemon.LightIntentionActionTestCase;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class SurroundWithQuotesStringAnnotationParameterValueTest extends LightIntentionActionTestCase {
+
+  public void test() throws Exception { doAllTests(); }
+
+  @Override
+  protected String getBasePath() {
+    return "/codeInsight/surroundWithQuotesStringAnnotationParameterValue";
+  }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/WrapArrayToArraysAsListFixTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/WrapArrayToArraysAsListFixTest.java
new file mode 100644
index 0000000..289ff42
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/WrapArrayToArraysAsListFixTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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.codeInsight.daemon.quickFix;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class WrapArrayToArraysAsListFixTest extends LightQuickFixParameterizedTestCase {
+  public void test() throws Exception {
+    doAllTests();
+  }
+
+  @Override
+  protected String getBasePath() {
+    return "/codeInsight/daemonCodeAnalyzer/quickFix/wrapArrayToArraysAsList";
+  }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddJavadocIntentionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddJavadocIntentionTest.java
new file mode 100644
index 0000000..ee463ba
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddJavadocIntentionTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.codeInsight.intention;
+
+import com.intellij.codeInsight.daemon.LightIntentionActionTestCase;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class AddJavadocIntentionTest extends LightIntentionActionTestCase {
+
+  public void test() throws Exception { doAllTests(); }
+
+  @Override
+  protected String getBasePath() {
+    return "/codeInsight/addJavadoc";
+  }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/intention/CreateSwitchTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/intention/CreateSwitchTest.java
new file mode 100644
index 0000000..8002664
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/intention/CreateSwitchTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.codeInsight.intention;
+
+import com.intellij.JavaTestUtil;
+import com.intellij.codeInsight.intention.impl.CreateSwitchIntention;
+import com.intellij.openapi.roots.LanguageLevelProjectExtension;
+import com.intellij.pom.java.LanguageLevel;
+import com.intellij.testFramework.fixtures.CodeInsightTestUtil;
+import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class CreateSwitchTest extends JavaCodeInsightFixtureTestCase {
+  @Override
+  protected String getTestDataPath() {
+    return JavaTestUtil.getJavaTestDataPath() + "/codeInsight/createSwitch/";
+  }
+
+  public void testEnum() {
+    doTest();
+  }
+
+  public void testEnum2() {
+    doTest();
+  }
+
+  public void testString() {
+    doTestString();
+  }
+
+  public void testPrimitive() {
+    doTest();
+  }
+
+  public void testNotAvailable() {
+    doTestNotAvailable();
+  }
+
+  public void testNotAvailable2() {
+    doTestNotAvailable();
+  }
+
+  private void doTestString() {
+    final LanguageLevelProjectExtension languageLevelProjectExtension = LanguageLevelProjectExtension.getInstance(getProject());
+    final LanguageLevel oldLanguageLevel = languageLevelProjectExtension.getLanguageLevel();
+    languageLevelProjectExtension.setLanguageLevel(LanguageLevel.JDK_1_7);
+    try {
+      doTest();
+    }
+    finally {
+      languageLevelProjectExtension.setLanguageLevel(oldLanguageLevel);
+    }
+  }
+
+  private void doTest() {
+    final String name = getTestName(true);
+    CodeInsightTestUtil.doIntentionTest(myFixture, CreateSwitchIntention.TEXT, name + ".java", name + "_after.java");
+  }
+
+  private void doTestNotAvailable() {
+    myFixture.configureByFile(getTestName(true) + ".java");
+    assertEmpty(myFixture.filterAvailableIntentions(CreateSwitchIntention.TEXT));
+  }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/AssertStatementPostfixTemplateTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/AssertStatementPostfixTemplateTest.java
index dee2f8a..bad3863 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/AssertStatementPostfixTemplateTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/AssertStatementPostfixTemplateTest.java
@@ -63,5 +63,13 @@
   public void testNotNull() {
     doTest();
   }
+
+  public void testBeforeAssignment() {
+    doTest();
+  }
+
+  public void testSimpleWithSemicolon() {
+    doTest();
+  }
 }
 
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/IfStatementPostfixTemplateTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/IfStatementPostfixTemplateTest.java
index e6d89d8..3c2c50a 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/IfStatementPostfixTemplateTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/IfStatementPostfixTemplateTest.java
@@ -18,6 +18,13 @@
 import org.jetbrains.annotations.NotNull;
 
 public class IfStatementPostfixTemplateTest extends PostfixTemplateTestCase {
+
+  @NotNull
+  @Override
+  protected String getSuffix() {
+    return "if";
+  }
+
   public void testBooleanVariableBeforeAssignment() {
     doTest();
   }
@@ -54,9 +61,13 @@
     doTest();
   }
 
-  @NotNull
-  @Override
-  protected String getSuffix() {
-    return "if";
+  public void testSimpleWithSemicolon() {
+    doTest();
   }
+
+  public void testBeforeAssignment() {
+    doTest();
+  }
+
+
 }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/SwitchPostfixTemplateTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/SwitchPostfixTemplateTest.java
index 2da4bd6..8021fb9 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/SwitchPostfixTemplateTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/SwitchPostfixTemplateTest.java
@@ -15,6 +15,8 @@
  */
 package com.intellij.codeInsight.template.postfix.templates;
 
+import com.intellij.openapi.roots.LanguageLevelProjectExtension;
+import com.intellij.pom.java.LanguageLevel;
 import org.jetbrains.annotations.NotNull;
 
 /**
@@ -27,6 +29,12 @@
     return "switch";
   }
 
+  @Override
+  protected void setUp() throws Exception {
+    super.setUp();
+    LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
+  }
+
   public void testInt() {
     doTest();
   }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/ThrowStatementPostfixTemplateTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/ThrowStatementPostfixTemplateTest.java
index 68a83bf..c3981e4 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/ThrowStatementPostfixTemplateTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/ThrowStatementPostfixTemplateTest.java
@@ -27,4 +27,14 @@
   public void testSimple() {
     doTest();
   }
+
+  public void testNotThrowable() {
+    doTest();
+  }
+  public void testBeforeAssignment() {
+    doTest();
+  }
+  public void testSimpleWithSemicolon() {
+    doTest();
+  }
 }
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/BlockMarkerCommentsTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/BlockMarkerCommentsTest.java
new file mode 100644
index 0000000..0ca4026
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/BlockMarkerCommentsTest.java
@@ -0,0 +1,83 @@
+/*
+ * 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.codeInspection;
+
+import com.intellij.JavaTestUtil;
+import com.intellij.codeInsight.intention.IntentionAction;
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class BlockMarkerCommentsTest extends LightCodeInsightFixtureTestCase {
+
+  private final BlockMarkerCommentsInspection myInspection = new BlockMarkerCommentsInspection();
+
+  @Override
+  protected String getTestDataPath() {
+    return JavaTestUtil.getJavaTestDataPath() + "/inspection/blockMarkerComments/";
+  }
+
+  @Override
+  public void setUp() throws Exception {
+    super.setUp();
+    myFixture.enableInspections(myInspection);
+  }
+
+  @Override
+  public void tearDown() throws Exception {
+    myFixture.disableInspections(myInspection);
+    super.tearDown();
+  }
+
+  private void doTestInspection() {
+    myFixture.testHighlighting(getTestName(false) + ".java");
+  }
+
+  private void doTestQuickFix() {
+    final String testFileName = getTestName(false);
+    myFixture.enableInspections(new BlockMarkerCommentsInspection());
+    myFixture.configureByFile(testFileName + ".java");
+    final IntentionAction intentionAction = myFixture.findSingleIntention("Remove block marker comments");
+    assertNotNull(intentionAction);
+    myFixture.launchAction(intentionAction);
+    myFixture.checkResultByFile(testFileName + "_after.java", true);
+  }
+
+  public void testMethod() {
+    doTestInspection();
+  }
+
+  public void testIf() {
+    doTestInspection();
+  }
+
+  public void testLoop() {
+    doTestInspection();
+  }
+
+  public void testTryCatch() {
+    doTestInspection();
+  }
+
+  public void testClass() {
+    doTestInspection();
+  }
+
+  public void testRemoveBlockMarker() {
+    doTestQuickFix();
+  }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/ContractCheckTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/ContractCheckTest.java
new file mode 100644
index 0000000..5fbc4fb
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/ContractCheckTest.java
@@ -0,0 +1,41 @@
+package com.intellij.codeInspection;
+
+import com.intellij.JavaTestUtil;
+import com.intellij.codeInspection.dataFlow.ContractInspection;
+import com.intellij.testFramework.LightProjectDescriptor;
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author peter
+ */
+public class ContractCheckTest extends LightCodeInsightFixtureTestCase {
+  @NotNull
+  @Override
+  protected LightProjectDescriptor getProjectDescriptor() {
+    return JAVA_1_7;
+  }
+
+  @Override
+  protected String getTestDataPath() {
+    return JavaTestUtil.getJavaTestDataPath() + "/inspection/dataFlow/contractCheck/";
+  }
+
+  private void doTest() {
+    myFixture.enableInspections(new ContractInspection());
+    myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
+  }
+
+  public void testTrueInsteadOfFalse() { doTest(); }
+  public void testTrueInsteadOfFail() { doTest(); }
+  public void testWrongFail() { doTest(); }
+  public void testNotNullStringLiteral() { doTest(); }
+  public void testPlainDelegation() { doTest(); }
+  public void testDelegationToInstanceMethod() { doTest(); }
+  public void testFailDelegation() { doTest(); }
+  public void testDelegationWithUnknownArgument() { doTest(); }
+  public void testEqualsUnknownValue() { doTest(); }
+  public void testMissingFail() { doTest(); }
+
+  public void testSignatureIssues() { doTest(); }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/ContractInferenceFromSourceTest.groovy b/java/java-tests/testSrc/com/intellij/codeInspection/ContractInferenceFromSourceTest.groovy
new file mode 100644
index 0000000..ab9a566
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/ContractInferenceFromSourceTest.groovy
@@ -0,0 +1,182 @@
+/*
+ * 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.codeInspection
+
+import com.intellij.codeInspection.dataFlow.ContractInference
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
+
+/**
+ * @author peter
+ */
+class ContractInferenceFromSourceTest extends LightCodeInsightFixtureTestCase {
+
+  void "test if null return null"() {
+    def c = inferContract("""
+  String smth(String s) {
+    if (s == null) return null;
+    return s.substring(1);
+  }
+""")
+    assert c == 'null -> null'
+  }
+
+  void "test if not null return true"() {
+    def c = inferContract("""
+  boolean smth(int a, String s) {
+    if (s != null) { return true; }
+    return a == 2;
+  }
+""")
+    assert c == '_, !null -> true'
+  }
+
+  void "test if null fail"() {
+    def c = inferContract("""
+  boolean smth(int a, String s) {
+    if (null == s) { throw new RuntimeException(); }
+    return a == 2;
+  }
+""")
+    assert c == '_, null -> fail'
+  }
+
+  void "test if true return the same"() {
+    def c = inferContract("""
+  boolean smth(boolean b, int a) {
+    if (b) return b;
+    return a == 2;
+  }
+""")
+    assert c == 'true, _ -> true'
+  }
+
+  void "test if false return negation"() {
+    def c = inferContract("""
+  boolean smth(boolean b, int a) {
+    if (!b) return !(b);
+    return a == 2;
+  }
+""")
+    assert c == 'false, _ -> true'
+  }
+
+  void "test nested if"() {
+    def c = inferContract("""
+  boolean smth(boolean b, Object o) {
+    if (!b) if (o != null) return true;
+    return a == 2;
+  }
+""")
+    assert c == 'false, !null -> true'
+  }
+
+  void "test conjunction"() {
+    def c = inferContract("""
+  boolean smth(boolean b, Object o) {
+    if (!b && o != null) return true;
+    return a == 2;
+  }
+""")
+    assert c == 'false, !null -> true'
+  }
+
+  void "test disjunction"() {
+    def c = inferContracts("""
+  boolean smth(boolean b, Object o) {
+    if (!b || o != null) return true;
+    return a == 2;
+  }
+""")
+    assert c == ['false, _ -> true', 'true, !null -> true']
+  }
+
+  void "test ternary"() {
+    def c = inferContracts("""
+  boolean smth(boolean b, Object o, Object o1) {
+    return (!b || o != null) ? true : (o1 != null && o1.hashCode() == 3);
+  }
+""")
+    assert c == ['false, _, _ -> true', 'true, !null, _ -> true', 'true, null, null -> false']
+  }
+
+  void "test instanceof"() {
+    def c = inferContracts("""
+  boolean smth(Object o) {
+    return o instanceof String;
+  }
+""")
+    assert c == ['null -> false']
+  }
+
+  void "test if-else"() {
+    def c = inferContracts("""
+  boolean smth(Object o) {
+    if (o instanceof String) return false;
+    else return true;
+  }
+""")
+    assert c == ['null -> true']
+  }
+
+  void "test if return without else"() {
+    def c = inferContracts("""
+  boolean smth(Object o) {
+    if (o instanceof String) return false;
+    return true;
+  }
+""")
+    assert c == ['null -> true']
+  }
+
+  void "test if no-return without else"() {
+    def c = inferContracts("""
+  boolean smth(Object o) {
+    if (o instanceof String) callSomething();
+    return true;
+  }
+""")
+    assert c == []
+  }
+
+  void "test assertion"() {
+    def c = inferContracts("""
+  boolean smth(Object o) {
+    assert o instanceof String;
+    return true;
+  }
+""")
+    assert c == ['null -> fail']
+  }
+
+  void "_test no NotNull duplication"() {
+    def c = inferContracts("""
+  boolean smth(@org.jetbrains.annotations.NotNull Object o) {
+    if (o == null) throw new RuntimeException();
+    return o.hashCode() == 1;
+  }
+""")
+    assert c == []
+  }
+
+  private String inferContract(String method) {
+    return assertOneElement(inferContracts(method))
+  }
+
+  private List<String> inferContracts(String method) {
+    def clazz = myFixture.addClass("class Foo { $method }")
+    return ContractInference.inferContracts(clazz.methods[0]).collect { it as String }
+  }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
index e9bc54b..67987b3 100644
--- a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
@@ -207,8 +207,10 @@
   }
 
   public void testContractAnnotation() { doTest(); }
+  public void testContractInapplicableComparison() { doTest(); }
   public void testContractInLoopNotTooComplex() { doTest(); }
   public void testContractWithNullable() { doTest(); }
+  public void testContractWithNotNull() { doTest(); }
   public void testContractPreservesUnknownNullability() { doTest(); }
   public void testContractSeveralClauses() { doTest(); }
   public void testContractVarargs() { doTest(); }
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTestSuite.java b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTestSuite.java
index 22c583e..161dd5d 100644
--- a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTestSuite.java
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTestSuite.java
@@ -28,6 +28,8 @@
     suite.addTestSuite(DataFlowInspectionTest.class);
     suite.addTestSuite(DataFlowInspection8Test.class);
     suite.addTestSuite(DataFlowInspectionAncientTest.class);
+    suite.addTestSuite(ContractCheckTest.class);
+    suite.addTestSuite(ContractInferenceFromSourceTest.class);
     suite.addTestSuite(SliceTreeTest.class);
     suite.addTestSuite(SliceBackwardTest.class);
     suite.addTestSuite(SmartTypeCompletionDfaTest.class);
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/DeprecationInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/DeprecationInspectionTest.java
index 15b82e9..a259f06 100644
--- a/java/java-tests/testSrc/com/intellij/codeInspection/DeprecationInspectionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/DeprecationInspectionTest.java
@@ -53,4 +53,10 @@
     doTest();
   }
 
+  public void testMethodsOfDeprecatedClass() throws Exception {
+    final DeprecationInspection tool = new DeprecationInspection();
+    tool.IGNORE_METHODS_OF_DEPRECATED = false;
+    doTest("deprecation/" + getTestName(true), tool);
+  }
+
 }
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/RedundantTypeArgsInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/RedundantTypeArgsInspectionTest.java
index c3c092c..fbcdfd0 100644
--- a/java/java-tests/testSrc/com/intellij/codeInspection/RedundantTypeArgsInspectionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/RedundantTypeArgsInspectionTest.java
@@ -5,25 +5,37 @@
 package com.intellij.codeInspection;
 
 import com.intellij.JavaTestUtil;
+import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
 import com.intellij.codeInspection.miscGenerics.RedundantTypeArgsInspection;
+import com.intellij.openapi.projectRoots.JavaSdkVersion;
+import com.intellij.pom.java.LanguageLevel;
+import com.intellij.testFramework.IdeaTestUtil;
 import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
 import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
+import org.jetbrains.annotations.NotNull;
 
-public class RedundantTypeArgsInspectionTest extends JavaCodeInsightFixtureTestCase {
+public class RedundantTypeArgsInspectionTest extends LightDaemonAnalyzerTestCase {
+
+  @NotNull
   @Override
-  protected void tuneFixture(JavaModuleFixtureBuilder moduleBuilder) {
-    moduleBuilder.setMockJdkLevel(JavaModuleFixtureBuilder.MockJdkLevel.jdk15);
+  protected LocalInspectionTool[] configureLocalInspectionTools() {
+    return new LocalInspectionTool[] { new RedundantTypeArgsInspection()};
   }
 
   @Override
+  protected LanguageLevel getLanguageLevel() {
+    return LanguageLevel.JDK_1_6;
+  }
+
+  @NotNull
+  @Override
   protected String getTestDataPath() {
-    return JavaTestUtil.getJavaTestDataPath() + "/inspection/redundantTypeArgs/";
+    return JavaTestUtil.getJavaTestDataPath();
   }
 
   private void doTest() throws Throwable {
-    final RedundantTypeArgsInspection inspection = new RedundantTypeArgsInspection();
-    myFixture.enableInspections(inspection);
-    myFixture.testHighlighting(true, false, false, getTestName(false) + ".java");
+    IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_6, getModule(), myTestRootDisposable);
+    doTest("/inspection/redundantTypeArgs/" + getTestName(false) + ".java", true, false);
   }
 
   public void testReturnPrimitiveTypes() throws Throwable { // javac non-boxing: IDEA-53984
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/SuspiciousCollectionMethodCallsTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/SuspiciousCollectionMethodCallsTest.java
index cd96608..4d3ef19 100644
--- a/java/java-tests/testSrc/com/intellij/codeInspection/SuspiciousCollectionMethodCallsTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/SuspiciousCollectionMethodCallsTest.java
@@ -20,6 +20,8 @@
   }
 
   public void testConcurrentHashMap() throws Exception { doTest(); }
+  public void testRemoveAllCall() throws Exception { doTest(); }
+  public void testSetList() throws Exception { doTest(); }
   public void testUseDfa() throws Exception { doTest(); }
   public void testWildcard() throws Exception { doTest(); }
   public void testIgnoreConvertible() throws Exception {
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/UnusedLibraryInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/UnusedLibraryInspectionTest.java
new file mode 100644
index 0000000..bb6195a
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/UnusedLibraryInspectionTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+/*
+ * Created by IntelliJ IDEA.
+ * User: max
+ * Date: Apr 11, 2002
+ * Time: 6:50:50 PM
+ * To change template for new class use 
+ * Code Style | Class Templates options (Tools | IDE Options).
+ */
+package com.intellij.codeInspection;
+
+import com.intellij.JavaTestUtil;
+import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
+import com.intellij.codeInspection.magicConstant.MagicConstantInspection;
+import com.intellij.codeInspection.unusedLibraries.UnusedLibrariesInspection;
+import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.openapi.projectRoots.SdkModificator;
+import com.intellij.openapi.roots.AnnotationOrderRootType;
+import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.vfs.LocalFileSystem;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.testFramework.InspectionTestCase;
+import com.intellij.testFramework.PlatformTestUtil;
+import com.intellij.testFramework.PsiTestUtil;
+
+public class UnusedLibraryInspectionTest extends InspectionTestCase {
+  @Override
+  protected String getTestDataPath() {
+    return JavaTestUtil.getJavaTestDataPath() + "/inspection/unusedLibrary";
+  }
+
+  @Override
+  protected void setupRootModel(String testDir, VirtualFile[] sourceDir, String sdkName) {
+    super.setupRootModel(testDir, sourceDir, sdkName);
+    PsiTestUtil.addLibrary(getModule(), "JUnit", getTestDataPath() + "/junit.jar");
+  }
+
+  private void doTest() throws Exception {
+    doTest("/" + getTestName(true), new UnusedLibrariesInspection());
+  }
+
+  public void testSimple() throws Exception { doTest(); }
+}
diff --git a/java/java-tests/testSrc/com/intellij/psi/ClsMirrorBuildingTest.java b/java/java-tests/testSrc/com/intellij/psi/ClsMirrorBuildingTest.java
index 4ac4bfb..b832e65 100644
--- a/java/java-tests/testSrc/com/intellij/psi/ClsMirrorBuildingTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/ClsMirrorBuildingTest.java
@@ -53,6 +53,7 @@
   public void testDefaultPackage() { doTest(); }
   public void testLocalClass() { doTest(); }
   public void testBounds() { doTest(); }
+  public void testGrEnum() { doTest(); }
 
   public void testTextPsiMismatch() {
     CommonCodeStyleSettings.IndentOptions options =
@@ -70,7 +71,7 @@
   public void testJdk8Class() {
     String testDir = JavaTestUtil.getJavaTestDataPath();
     String clsPath = testDir + "/../../mockJDK-1.8/jre/lib/rt.jar!/java/lang/Class.class";
-    String txtPath = testDir + "/psi/cls/mirror/" + "Class.txt";
+    String txtPath = testDir + "/psi/cls/mirror/Class.txt";
     doTest(clsPath, txtPath);
   }
 
diff --git a/java/java-tests/testSrc/com/intellij/psi/ClsRepositoryUseTest.java b/java/java-tests/testSrc/com/intellij/psi/ClsRepositoryUseTest.java
index 709eb88..16392eb 100644
--- a/java/java-tests/testSrc/com/intellij/psi/ClsRepositoryUseTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/ClsRepositoryUseTest.java
@@ -24,6 +24,7 @@
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.VirtualFileFilter;
+import com.intellij.psi.impl.compiled.ClsParameterImpl;
 import com.intellij.psi.impl.java.stubs.PsiMethodStub;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.util.PsiUtil;
@@ -504,6 +505,8 @@
     assertNotNull(parameters[0].getModifierList());
     assertNotNull(parameters[1].getModifierList());
 
+    assertTrue(((ClsParameterImpl)parameters[0]).isAutoGeneratedName());
+    assertTrue(((ClsParameterImpl)parameters[1]).isAutoGeneratedName());
     assertEquals("ints", parameters[0].getName());
     assertEquals("o", parameters[1].getName());
   }
diff --git a/java/java-tests/testSrc/com/intellij/psi/codeStyle/arrangement/JavaRearrangerFieldReferenceTest.groovy b/java/java-tests/testSrc/com/intellij/psi/codeStyle/arrangement/JavaRearrangerFieldReferenceTest.groovy
index bd1b18b..302f1b3 100644
--- a/java/java-tests/testSrc/com/intellij/psi/codeStyle/arrangement/JavaRearrangerFieldReferenceTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/psi/codeStyle/arrangement/JavaRearrangerFieldReferenceTest.groovy
@@ -23,7 +23,6 @@
 class JavaRearrangerFieldReferenceTest extends AbstractJavaRearrangerTest {
 
   private List<StdArrangementMatchRule> defaultFieldsArrangement = [
-    rule(CLASS),
     rule(FIELD, STATIC, FINAL),
     rule(FIELD, PUBLIC),
     rule(FIELD, PROTECTED),
@@ -31,7 +30,6 @@
     rule(FIELD, PRIVATE)
   ]
 
-
   void "test keep referenced package private field before public one which has reference through binary expression"() {
     doTest(initial: '''\
 public class TestRunnable {
@@ -300,4 +298,39 @@
     )
   }
 
+  void "test IDEA-123733"() {
+    doTest(
+      initial: '''\
+class First {
+    protected int test = 12;
+}
+
+class Second extends First {
+    void test() {}
+
+    private int q = test;
+    public int t = q;
+}
+''',
+      expected: '''\
+class First {
+    protected int test = 12;
+}
+
+class Second extends First {
+    private int q = test;
+    public int t = q;
+
+    void test() {}
+}
+''',
+      rules: defaultFieldsArrangement
+    )
+  }
+
+
+
+
+
+
 }
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/EncapsulateFieldsTest.java b/java/java-tests/testSrc/com/intellij/refactoring/EncapsulateFieldsTest.java
index a24ffb0..9c820bc 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/EncapsulateFieldsTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/EncapsulateFieldsTest.java
@@ -59,6 +59,10 @@
     doTest("i", "A.B", "There is already a method <b><code>A.getI()</code></b> which would be hidden by generated getter");
   }
 
+  public void testCommentsInside() throws Exception {
+    doTest("i", "A", null);
+  }
+
   public void testMoveJavadocToGetter() throws Exception {
     doTest(new PerformAction() {
       @Override
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/RenameCollisionsTest.java b/java/java-tests/testSrc/com/intellij/refactoring/RenameCollisionsTest.java
index 4fc4240..204525c 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/RenameCollisionsTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/RenameCollisionsTest.java
@@ -193,6 +193,17 @@
     fail("Conflicts were not found");
   }
 
+  public void testFieldHidesLocal() throws Exception {
+    try {
+      doTest("b");
+    }
+    catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
+      Assert.assertEquals("Renamed field will hide local variable <b><code>b</code></b>", e.getMessage());
+      return;
+    }
+    fail("Conflicts were not found");
+  }
+
   public void testRenameMethodNoCollisionWithOtherSignature() throws Exception {
     doTest("foo2");
   }
diff --git a/java/java-tests/testSrc/com/intellij/roots/ModuleScopesTest.java b/java/java-tests/testSrc/com/intellij/roots/ModuleScopesTest.java
index 5780f46..180a8ee 100644
--- a/java/java-tests/testSrc/com/intellij/roots/ModuleScopesTest.java
+++ b/java/java-tests/testSrc/com/intellij/roots/ModuleScopesTest.java
@@ -3,7 +3,9 @@
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.StdModuleTypes;
+import com.intellij.openapi.module.impl.scopes.LibraryScope;
 import com.intellij.openapi.roots.*;
+import com.intellij.openapi.roots.libraries.Library;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.testFramework.ModuleTestCase;
 import com.intellij.testFramework.PsiTestUtil;
@@ -55,6 +57,16 @@
     assertTrue(moduleA.getModuleRuntimeScope(true).contains(libraryClass));
   }
 
+  public void testLibraryScope() throws IOException {
+    VirtualFile libraryClass = myFixture.createFile("lib/classes/Test.class");
+    VirtualFile librarySrc = myFixture.createFile("lib/src/Test.java", "public class Test { }");
+    Library library = PsiTestUtil.addProjectLibrary(myModule, "my-lib", Collections.singletonList(libraryClass.getParent()),
+                                                    Collections.singletonList(librarySrc.getParent()));
+    LibraryScope scope = new LibraryScope(myProject, library);
+    assertTrue(scope.contains(libraryClass));
+    assertTrue(scope.contains(librarySrc));
+  }
+
   public void testTestOnlyModuleDependency() throws Exception {
     Module moduleA = createModule("a.iml", StdModuleTypes.JAVA);
     Module moduleB = addDependentModule(moduleA, DependencyScope.TEST);
diff --git a/java/openapi/src/com/intellij/codeInspection/BaseJavaLocalInspectionTool.java b/java/openapi/src/com/intellij/codeInspection/BaseJavaLocalInspectionTool.java
deleted file mode 100644
index 201084a..0000000
--- a/java/openapi/src/com/intellij/codeInspection/BaseJavaLocalInspectionTool.java
+++ /dev/null
@@ -1,53 +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.codeInspection;
-
-import com.intellij.codeInsight.daemon.HighlightDisplayKey;
-import com.intellij.psi.PsiElement;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Implement this abstract class in order to provide new inspection tool functionality. The major API limitation here is
- * subclasses should be stateless. Thus <code>check&lt;XXX&gt;</code> methods will be called in no particular order and
- * instances of this class provided by {@link InspectionToolProvider#getInspectionClasses()} will be created on demand.
- * The other important thing is problem anchors (PsiElements) reported by <code>check&lt;XXX&gt;</code> methods should
- * lie under corresponding first parameter of one method.
- *
- * @see GlobalInspectionTool
- *
- * Please note that if your inspection/fixes/suppressions don't need UI components (e.g. Editor) to run, consider using
- * {@link BaseJavaBatchLocalInspectionTool} instead.
- */
-public abstract class BaseJavaLocalInspectionTool extends AbstractBaseJavaLocalInspectionTool implements CustomSuppressableInspectionTool {
-  @Override
-  public SuppressIntentionAction[] getSuppressActions(final PsiElement element) {
-    String shortName = getShortName();
-    HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
-    if (key == null) {
-      throw new AssertionError("HighlightDisplayKey.find(" + shortName + ") is null. Inspection: "+getClass());
-    }
-    return SuppressManager.getInstance().createSuppressActions(key);
-  }
-
-  @Override
-  public boolean isSuppressedFor(@NotNull PsiElement element) {
-    return isSuppressedFor(element, this);
-  }
-
-  public static boolean isSuppressedFor(@NotNull PsiElement element, @NotNull LocalInspectionTool tool) {
-    return BaseJavaBatchLocalInspectionTool.isSuppressedFor(element, tool);
-  }
-}
diff --git a/java/openapi/src/com/intellij/codeInspection/GlobalJavaInspectionTool.java b/java/openapi/src/com/intellij/codeInspection/GlobalJavaInspectionTool.java
deleted file mode 100644
index c01422b..0000000
--- a/java/openapi/src/com/intellij/codeInspection/GlobalJavaInspectionTool.java
+++ /dev/null
@@ -1,51 +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.
- */
-
-/*
- * User: anna
- * Date: 19-Dec-2007
- */
-package com.intellij.codeInspection;
-
-import com.intellij.codeInsight.daemon.HighlightDisplayKey;
-import com.intellij.codeInspection.reference.RefManager;
-import com.intellij.psi.PsiElement;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-public abstract class GlobalJavaInspectionTool extends GlobalInspectionTool implements CustomSuppressableInspectionTool {
-  @Override
-  public boolean queryExternalUsagesRequests(@NotNull final InspectionManager manager,
-                                             @NotNull final GlobalInspectionContext globalContext,
-                                             @NotNull final ProblemDescriptionsProcessor problemDescriptionsProcessor) {
-    return queryExternalUsagesRequests(globalContext.getRefManager(), globalContext.getExtension(GlobalJavaInspectionContext.CONTEXT), problemDescriptionsProcessor);
-  }
-
-  protected boolean queryExternalUsagesRequests(@NotNull RefManager manager, @NotNull GlobalJavaInspectionContext globalContext, @NotNull ProblemDescriptionsProcessor processor) {
-    return false;
-  }
-
-  @Override
-  @Nullable
-  public SuppressIntentionAction[] getSuppressActions(final PsiElement element) {
-    return SuppressManager.getInstance().createSuppressActions(HighlightDisplayKey.find(getShortName()));
-  }
-
-  @Override
-  public boolean isSuppressedFor(@NotNull final PsiElement element) {
-    return SuppressManager.getInstance().isSuppressedFor(element, getShortName());
-  }
-}
\ No newline at end of file
diff --git a/java/openapi/src/com/intellij/codeInspection/HTMLJavaHTMLComposer.java b/java/openapi/src/com/intellij/codeInspection/HTMLJavaHTMLComposer.java
deleted file mode 100644
index 028447e..0000000
--- a/java/openapi/src/com/intellij/codeInspection/HTMLJavaHTMLComposer.java
+++ /dev/null
@@ -1,68 +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.
- */
-
-/*
- * User: anna
- * Date: 19-Dec-2007
- */
-package com.intellij.codeInspection;
-
-import com.intellij.codeInspection.lang.HTMLComposerExtension;
-import com.intellij.codeInspection.reference.RefClass;
-import com.intellij.codeInspection.reference.RefMethod;
-import com.intellij.lang.Language;
-import com.intellij.lang.StdLanguages;
-import com.intellij.openapi.util.Key;
-
-public abstract class HTMLJavaHTMLComposer implements HTMLComposerExtension<HTMLJavaHTMLComposer> {
-  public static final Key<HTMLJavaHTMLComposer> COMPOSER = Key.create("HTMLJavaComposer");
-
-  public abstract void appendClassOrInterface(StringBuffer buf, RefClass refClass, boolean capitalizeFirstLetter);
-
-  public static String getClassOrInterface(RefClass refClass, boolean capitalizeFirstLetter) {
-    if (refClass.isInterface()) {
-      return capitalizeFirstLetter ? InspectionsBundle.message("inspection.export.results.capitalized.interface") : InspectionsBundle.message("inspection.export.results.interface");
-    }
-    else if (refClass.isAbstract()) {
-      return capitalizeFirstLetter ? InspectionsBundle.message("inspection.export.results.capitalized.abstract.class") : InspectionsBundle.message("inspection.export.results.abstract.class");
-    }
-    else {
-      return capitalizeFirstLetter ? InspectionsBundle.message("inspection.export.results.capitalized.class") : InspectionsBundle.message("inspection.export.results.class");
-    }
-  }
-
-  public abstract void appendClassExtendsImplements(StringBuffer buf, RefClass refClass);
-
-  public abstract void appendDerivedClasses(StringBuffer buf, RefClass refClass);
-
-  public abstract void appendLibraryMethods(StringBuffer buf, RefClass refClass);
-
-  public abstract void appendSuperMethods(StringBuffer buf, RefMethod refMethod);
-
-  public abstract void appendDerivedMethods(StringBuffer buf, RefMethod refMethod);
-
-  public abstract void appendTypeReferences(StringBuffer buf, RefClass refClass);
-
-  @Override
-  public Key<HTMLJavaHTMLComposer> getID() {
-    return COMPOSER;
-  }
-
-  @Override
-  public Language getLanguage() {
-    return StdLanguages.JAVA;
-  }
-}
\ No newline at end of file
diff --git a/java/openapi/src/com/intellij/codeInspection/SuppressManager.java b/java/openapi/src/com/intellij/codeInspection/SuppressManager.java
deleted file mode 100644
index 5e12940..0000000
--- a/java/openapi/src/com/intellij/codeInspection/SuppressManager.java
+++ /dev/null
@@ -1,51 +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.
- */
-
-/*
- * User: anna
- * Date: 24-Dec-2007
- */
-package com.intellij.codeInspection;
-
-import com.intellij.codeInsight.daemon.HighlightDisplayKey;
-import com.intellij.openapi.components.ServiceManager;
-import com.intellij.psi.PsiAnnotation;
-import com.intellij.psi.PsiCodeBlock;
-import com.intellij.psi.PsiField;
-import com.intellij.psi.PsiLiteralExpression;
-import com.intellij.psi.util.PsiTreeUtil;
-import org.jetbrains.annotations.NotNull;
-
-public abstract class SuppressManager implements BatchSuppressManager {
-
-  public static SuppressManager getInstance() {
-    return ServiceManager.getService(SuppressManager.class);
-  }
-
-  public static boolean isSuppressedInspectionName(PsiLiteralExpression expression) {
-    PsiAnnotation annotation = PsiTreeUtil.getParentOfType(expression, PsiAnnotation.class, true, PsiCodeBlock.class, PsiField.class);
-    return annotation != null && SUPPRESS_INSPECTIONS_ANNOTATION_NAME.equals(annotation.getQualifiedName());
-  }
-
-  @NotNull
-  @Override
-  public SuppressQuickFix[] createBatchSuppressActions(@NotNull HighlightDisplayKey key) {
-    return BatchSuppressManager.SERVICE.getInstance().createBatchSuppressActions(key);
-  }
-
-  @NotNull
-  public abstract SuppressIntentionAction[] createSuppressActions(@NotNull HighlightDisplayKey key);
-}
\ No newline at end of file
diff --git a/java/openapi/src/com/intellij/ide/util/ClassFilter.java b/java/openapi/src/com/intellij/ide/util/ClassFilter.java
deleted file mode 100644
index 8b1fc2e..0000000
--- a/java/openapi/src/com/intellij/ide/util/ClassFilter.java
+++ /dev/null
@@ -1,42 +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.ide.util;
-
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.util.PsiUtil;
-
-/**
-* @author traff
-*/
-public interface ClassFilter {
-  ClassFilter INSTANTIABLE = new ClassFilter() {
-    public boolean isAccepted(PsiClass aClass) {
-      return PsiUtil.isInstantiatable(aClass);
-    }
-  };
-
-  boolean isAccepted(PsiClass aClass);
-  ClassFilter ALL = new ClassFilter() {
-    public boolean isAccepted(PsiClass aClass) {
-      return true;
-    }
-  };
-
-  interface ClassFilterWithScope extends ClassFilter {
-    GlobalSearchScope getScope();
-  }
-}
diff --git a/java/openapi/src/com/intellij/psi/CommonReferenceProviderTypes.java b/java/openapi/src/com/intellij/psi/CommonReferenceProviderTypes.java
deleted file mode 100644
index 3710d5a..0000000
--- a/java/openapi/src/com/intellij/psi/CommonReferenceProviderTypes.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.psi;
-
-import com.intellij.openapi.components.ServiceManager;
-import com.intellij.openapi.project.Project;
-
-/**
- * @author peter
- */
-public abstract class CommonReferenceProviderTypes {
-
-  /**
-   * @deprecated
-   * @see #getInstance()
-   */
-  public static CommonReferenceProviderTypes getInstance(final Project project) {
-    return getInstance();
-  }
-
-  public static CommonReferenceProviderTypes getInstance() {
-    return ServiceManager.getService(CommonReferenceProviderTypes.class);
-  }
-
-  public static final ReferenceProviderType PROPERTIES_FILE_KEY_PROVIDER = new ReferenceProviderType("Properties File Key Provider");
-  public static final ReferenceProviderType URI_PROVIDER = new ReferenceProviderType("Uri references provider");
-  public static final ReferenceProviderType SCHEMA_PROVIDER = new ReferenceProviderType("Schema references provider");
-
-  public abstract PsiReferenceProvider getClassReferenceProvider();
-}
diff --git a/java/openapi/src/com/intellij/psi/JavaCodeFragmentFactory.java b/java/openapi/src/com/intellij/psi/JavaCodeFragmentFactory.java
deleted file mode 100644
index eefda40..0000000
--- a/java/openapi/src/com/intellij/psi/JavaCodeFragmentFactory.java
+++ /dev/null
@@ -1,121 +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.psi;
-
-import com.intellij.openapi.components.ServiceManager;
-import com.intellij.openapi.project.Project;
-import org.intellij.lang.annotations.MagicConstant;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-public abstract class JavaCodeFragmentFactory {
-  public static JavaCodeFragmentFactory getInstance(Project project) {
-    return ServiceManager.getService(project, JavaCodeFragmentFactory.class);
-  }
-  
-  /**
-   * Creates a Java expression code fragment from the text of the expression.
-   *
-   * @param text         the text of the expression to create.
-   * @param context      the context for resolving references from the code fragment.
-   * @param expectedType expected type of the expression (does not have any effect on creation
-   *                     but can be accessed as {@link PsiExpressionCodeFragment#getExpectedType()}).
-   * @param isPhysical   whether the code fragment is created as a physical element
-   *                     (see {@link PsiElement#isPhysical()}).
-   * @return the created code fragment.
-   */
-  @NotNull
-  public abstract PsiExpressionCodeFragment createExpressionCodeFragment(@NotNull String text,
-                                                                         @Nullable PsiElement context,
-                                                                         @Nullable final PsiType expectedType,
-                                                                         boolean isPhysical);
-
-  /**
-   * Creates a Java code fragment from the text of a Java code block.
-   *
-   * @param text       the text of the code block to create.
-   * @param context    the context for resolving references from the code fragment.
-   * @param isPhysical whether the code fragment is created as a physical element
-   *                   (see {@link PsiElement#isPhysical()}).
-   * @return the created code fragment.
-   */
-  @NotNull
-  public abstract JavaCodeFragment createCodeBlockCodeFragment(@NotNull String text, @Nullable PsiElement context, boolean isPhysical);
-
-  /**
-   * Flag for {@linkplain #createTypeCodeFragment(String, PsiElement, boolean, int)} - allows void type.
-   */
-  public static final int ALLOW_VOID = 0x01;
-  /**
-   * Flag for {@linkplain #createTypeCodeFragment(String, PsiElement, boolean, int)} - allows type with ellipsis.
-   */
-  public static final int ALLOW_ELLIPSIS = 0x02;
-  /**
-   * Flag for {@linkplain #createTypeCodeFragment(String, PsiElement, boolean, int)} - allows disjunctive type.
-   */
-  public static final int ALLOW_DISJUNCTION = 0x04;
-
-  /**
-   * Creates a Java type code fragment from the text of the name of a Java type (the name
-   * of a primitive type, array type or class), with <code>void</code> and ellipsis
-   * not treated as a valid type.
-   *
-   * @param text       the text of the Java type to create.
-   * @param context    the context for resolving references from the code fragment.
-   * @param isPhysical whether the code fragment is created as a physical element
-   *                   (see {@link PsiElement#isPhysical()}).
-   * @return the created code fragment.
-   */
-  @NotNull
-  public abstract PsiTypeCodeFragment createTypeCodeFragment(@NotNull String text, @Nullable PsiElement context, boolean isPhysical);
-
-  /**
-   * Creates a Java type code fragment from the text of the name of a Java type (the name
-   * of a primitive type, array type or class).<br>
-   * {@code void}, ellipsis and disjunctive types are optionally treated as valid ones.
-   *
-   * @param text       the text of the Java type to create.
-   * @param context    the context for resolving references from the code fragment.
-   * @param isPhysical whether the code fragment is created as a physical element
-   *                   (see {@link PsiElement#isPhysical()}).
-   * @param flags      types allowed to present in text.
-   * @return the created code fragment.
-   */
-  @NotNull
-  public abstract PsiTypeCodeFragment createTypeCodeFragment(@NotNull String text,
-                                                             @Nullable PsiElement context,
-                                                             boolean isPhysical,
-                                                             @MagicConstant(flags = {ALLOW_VOID, ALLOW_ELLIPSIS, ALLOW_DISJUNCTION}) int flags);
-
-  /**
-   * Creates a Java reference code fragment from the text of a Java reference to a
-   * package or class.
-   *
-   * @param text              the text of the reference to create.
-   * @param context           the context for resolving the reference.
-   * @param isPhysical        whether the code fragment is created as a physical element
-   *                          (see {@link PsiElement#isPhysical()}).
-   * @param isClassesAccepted if true then classes as well as packages are accepted as
-   *                          reference target, otherwise only packages are
-   * @return the created reference fragment.
-   */
-  @NotNull
-  public abstract PsiJavaCodeReferenceCodeFragment createReferenceCodeFragment(@NotNull String text,
-                                                                               @Nullable PsiElement context,
-                                                                               boolean isPhysical,
-                                                                               boolean isClassesAccepted);
-
-}
diff --git a/java/openapi/src/com/intellij/psi/LanguageAnnotationSupport.java b/java/openapi/src/com/intellij/psi/LanguageAnnotationSupport.java
deleted file mode 100644
index 71389fb..0000000
--- a/java/openapi/src/com/intellij/psi/LanguageAnnotationSupport.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.psi;
-
-import com.intellij.lang.LanguageExtension;
-
-/**
- * @author Serega.Vasiliev
- */
-public class LanguageAnnotationSupport extends LanguageExtension<PsiAnnotationSupport> {
-  public static final LanguageAnnotationSupport INSTANCE = new LanguageAnnotationSupport();
-
-  private LanguageAnnotationSupport() {
-    super("com.intellij.annotationSupport");
-  }
-}
diff --git a/java/openapi/src/com/intellij/psi/search/scope/packageSet/PatternPackageSet.java b/java/openapi/src/com/intellij/psi/search/scope/packageSet/PatternPackageSet.java
deleted file mode 100644
index 363a57c..0000000
--- a/java/openapi/src/com/intellij/psi/search/scope/packageSet/PatternPackageSet.java
+++ /dev/null
@@ -1,185 +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.psi.search.scope.packageSet;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.*;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.problems.WolfTheProblemSolver;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.File;
-import java.util.List;
-import java.util.regex.Pattern;
-
-public class PatternPackageSet extends PatternBasedPackageSet {
-  @NonNls public static final String SCOPE_TEST = "test";
-  @NonNls public static final String SCOPE_SOURCE = "src";
-  @NonNls public static final String SCOPE_LIBRARY = "lib";
-  @NonNls public static final String SCOPE_PROBLEM = "problem";
-  public static final String SCOPE_ANY = "";
-
-  private final Pattern myPattern;
-  private final Pattern myModulePattern;
-  private final Pattern myModuleGroupPattern;
-  private final String myAspectJSyntaxPattern;
-  private final String myScope;
-  private final String myModulePatternText;
-
-  public PatternPackageSet(@NonNls @Nullable String aspectPattern,
-                           @NotNull String scope,
-                           @NonNls String modulePattern) {
-    myAspectJSyntaxPattern = aspectPattern;
-    myScope = scope;
-    myModulePatternText = modulePattern;
-    Pattern mmgp = null;
-    Pattern mmp = null;
-    if (modulePattern == null || modulePattern.isEmpty()) {
-      mmp = null;
-    }
-    else {
-      if (modulePattern.startsWith("group:")) {
-        int idx = modulePattern.indexOf(':', 6);
-        if (idx == -1) idx = modulePattern.length();
-        mmgp = Pattern.compile(StringUtil.replace(modulePattern.substring(6, idx), "*", ".*"));
-        if (idx < modulePattern.length() - 1) {
-          mmp = Pattern.compile(StringUtil.replace(modulePattern.substring(idx + 1), "*", ".*"));
-        }
-      } else {
-        mmp = Pattern.compile(StringUtil.replace(modulePattern, "*", ".*"));
-      }
-    }
-    myModulePattern = mmp;
-    myModuleGroupPattern = mmgp;
-    myPattern = aspectPattern != null ? Pattern.compile(FilePatternPackageSet.convertToRegexp(aspectPattern, '.')) : null;
-  }
-
-  @Override
-  public boolean contains(VirtualFile file, @NotNull NamedScopesHolder holder) {
-    return contains(file, holder.getProject(), holder);
-  }
-
-  @Override
-  public boolean contains(VirtualFile file, @NotNull Project project, @Nullable NamedScopesHolder holder) {
-    ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
-    return matchesScope(file, project, fileIndex) && (myPattern == null || myPattern.matcher(getPackageName(file, fileIndex)).matches());
-  }
-
-  private boolean matchesScope(VirtualFile file, Project project, ProjectFileIndex fileIndex) {
-    if (file == null) return false;
-    boolean isSource = fileIndex.isInSourceContent(file);
-    if (myScope == SCOPE_ANY) {
-      return fileIndex.isInContent(file) && FilePatternPackageSet.matchesModule(myModuleGroupPattern, myModulePattern, file, fileIndex);
-    }
-    if (myScope == SCOPE_SOURCE) {
-      return isSource && !fileIndex.isInTestSourceContent(file) && FilePatternPackageSet.matchesModule(myModuleGroupPattern, myModulePattern,
-                                                                                                       file, fileIndex);
-    }
-    if (myScope == SCOPE_LIBRARY) {
-      return (fileIndex.isInLibraryClasses(file) || fileIndex.isInLibrarySource(file)) && matchesLibrary(myModulePattern, file, fileIndex);
-    }
-    if (myScope == SCOPE_TEST) {
-      return isSource && fileIndex.isInTestSourceContent(file) && FilePatternPackageSet.matchesModule(myModuleGroupPattern, myModulePattern,
-                                                                                                      file, fileIndex);
-    }
-    if (myScope == SCOPE_PROBLEM) {
-      return isSource && WolfTheProblemSolver.getInstance(project).isProblemFile(file) &&
-             FilePatternPackageSet.matchesModule(myModuleGroupPattern, myModulePattern, file, fileIndex);
-    }
-    throw new RuntimeException("Unknown scope: " + myScope);
-  }
-
-  private static String getPackageName(VirtualFile file, ProjectFileIndex fileIndex) {
-    return StringUtil.getQualifiedName(fileIndex.getPackageNameByDirectory(file.isDirectory() ? file :  file.getParent()), file.getNameWithoutExtension());
-  }
-
-  @NotNull
-  @Override
-  public PackageSet createCopy() {
-    return new PatternPackageSet(myAspectJSyntaxPattern, myScope, myModulePatternText);
-  }
-
-  @Override
-  public int getNodePriority() {
-    return 0;
-  }
-
-  @NotNull
-  @Override
-  public String getText() {
-    StringBuilder buf = new StringBuilder();
-    if (myScope != SCOPE_ANY) {
-      buf.append(myScope);
-    }
-
-    if (myModulePattern != null || myModuleGroupPattern != null) {
-      buf.append("[").append(myModulePatternText).append("]");
-    }
-
-    if (buf.length() > 0) {
-      buf.append(':');
-    }
-
-    buf.append(myAspectJSyntaxPattern);
-    return buf.toString();
-  }
-
-  @Override
-  public String getModulePattern() {
-    return myModulePatternText;
-  }
-
-  @Override
-  public boolean isOn(String oldQName) {
-    return Comparing.strEqual(oldQName, myAspectJSyntaxPattern) || //class qname
-           Comparing.strEqual(oldQName + "..*", myAspectJSyntaxPattern) || //package req
-           Comparing.strEqual(oldQName + ".*", myAspectJSyntaxPattern); //package
-  }
-
-  @Override
-  public String getPattern() {
-    return myAspectJSyntaxPattern;
-  }
-
-  public static boolean matchesLibrary(final Pattern libPattern,
-                                       final VirtualFile file,
-                                       final ProjectFileIndex fileIndex) {
-    if (libPattern != null) {
-      final List<OrderEntry> entries = fileIndex.getOrderEntriesForFile(file);
-      for (OrderEntry orderEntry : entries) {
-        if (orderEntry instanceof LibraryOrderEntry) {
-          final String libraryName = ((LibraryOrderEntry)orderEntry).getLibraryName();
-          if (libraryName != null) {
-            if (libPattern.matcher(libraryName).matches()) return true;
-          } else {
-            final String presentableName = orderEntry.getPresentableName();
-            final String fileName = new File(presentableName).getName();
-            if (libPattern.matcher(fileName).matches()) return true;
-          }
-        } else if (orderEntry instanceof JdkOrderEntry) {
-          final String jdkName = ((JdkOrderEntry)orderEntry).getJdkName();
-          if (jdkName != null && libPattern.matcher(jdkName).matches()) return true;
-        }
-      }
-      return false;
-    }
-    return true;
-  }
-}
\ No newline at end of file
diff --git a/java/openapi/src/com/intellij/psi/search/searches/AnnotatedMembersSearch.java b/java/openapi/src/com/intellij/psi/search/searches/AnnotatedMembersSearch.java
deleted file mode 100644
index 213c3e4..0000000
--- a/java/openapi/src/com/intellij/psi/search/searches/AnnotatedMembersSearch.java
+++ /dev/null
@@ -1,39 +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.search.searches;
-
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiMember;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.SearchScope;
-import com.intellij.util.Query;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author max
- */
-public class AnnotatedMembersSearch {
-
-  private AnnotatedMembersSearch() {}
-
-  public static Query<PsiMember> search(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
-    return AnnotatedElementsSearch.searchPsiMembers(annotationClass, scope);
-  }
-
-  public static Query<PsiMember> search(@NotNull PsiClass annotationClass) {
-    return search(annotationClass, GlobalSearchScope.allScope(annotationClass.getProject()));
-  }
-}
diff --git a/java/openapi/src/com/intellij/psi/search/searches/AnnotatedPackagesSearch.java b/java/openapi/src/com/intellij/psi/search/searches/AnnotatedPackagesSearch.java
deleted file mode 100644
index bece77b..0000000
--- a/java/openapi/src/com/intellij/psi/search/searches/AnnotatedPackagesSearch.java
+++ /dev/null
@@ -1,58 +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.search.searches;
-
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiPackage;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.SearchScope;
-import com.intellij.util.Query;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author max
- */
-public class AnnotatedPackagesSearch extends ExtensibleQueryFactory<PsiPackage, AnnotatedPackagesSearch.Parameters> {
-  public static final AnnotatedPackagesSearch INSTANCE = new AnnotatedPackagesSearch();
-
-  public static class Parameters {
-    private final PsiClass myAnnotationClass;
-    private final SearchScope myScope;
-
-    public Parameters(final PsiClass annotationClass, final SearchScope scope) {
-      myAnnotationClass = annotationClass;
-      myScope = scope;
-    }
-
-    public PsiClass getAnnotationClass() {
-      return myAnnotationClass;
-    }
-
-    public SearchScope getScope() {
-      return myScope;
-    }
-  }
-
-  private AnnotatedPackagesSearch() {}
-
-  public static Query<PsiPackage> search(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
-    return INSTANCE.createQuery(new Parameters(annotationClass, scope));
-  }
-
-  public static Query<PsiPackage> search(@NotNull PsiClass annotationClass) {
-    return search(annotationClass, GlobalSearchScope.allScope(annotationClass.getProject()));
-  }
-}
\ No newline at end of file
diff --git a/java/openapi/src/com/intellij/psi/search/searches/AnnotationTargetsSearch.java b/java/openapi/src/com/intellij/psi/search/searches/AnnotationTargetsSearch.java
deleted file mode 100644
index 586bb3a..0000000
--- a/java/openapi/src/com/intellij/psi/search/searches/AnnotationTargetsSearch.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.psi.search.searches;
-
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiMember;
-import com.intellij.psi.PsiModifierListOwner;
-import com.intellij.psi.PsiPackage;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.SearchScope;
-import com.intellij.util.MergeQuery;
-import com.intellij.util.Query;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author max
- */
-public class AnnotationTargetsSearch {
-  public static AnnotationTargetsSearch INSTANCE = new AnnotationTargetsSearch();
-
-  public static class Parameters {
-    private final PsiClass myAnnotationClass;
-    private final SearchScope myScope;
-
-    public Parameters(final PsiClass annotationClass, final SearchScope scope) {
-      myAnnotationClass = annotationClass;
-      myScope = scope;
-    }
-
-    public PsiClass getAnnotationClass() {
-      return myAnnotationClass;
-    }
-
-    public SearchScope getScope() {
-      return myScope;
-    }
-  }
-
-  private AnnotationTargetsSearch() {}
-
-  public static Query<PsiModifierListOwner> search(@NotNull PsiClass annotationClass, @NotNull SearchScope scope) {
-    final Query<PsiMember> members = AnnotatedMembersSearch.search(annotationClass, scope);
-    final Query<PsiPackage> packages = AnnotatedPackagesSearch.search(annotationClass, scope);
-    return new MergeQuery<PsiModifierListOwner>(members, packages);
-  }
-
-  public static Query<PsiModifierListOwner> search(@NotNull PsiClass annotationClass) {
-    return search(annotationClass, GlobalSearchScope.allScope(annotationClass.getProject()));
-  }
-}
\ No newline at end of file
diff --git a/java/openapi/src/com/intellij/psi/util/ClassKind.java b/java/openapi/src/com/intellij/psi/util/ClassKind.java
deleted file mode 100644
index 3c91030..0000000
--- a/java/openapi/src/com/intellij/psi/util/ClassKind.java
+++ /dev/null
@@ -1,23 +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.util;
-
-/**
- * @author peter
- */
-public enum ClassKind {
-  CLASS, INTERFACE, ENUM, ANNOTATION
-}
diff --git a/java/openapi/src/com/intellij/psi/util/ImportsUtil.java b/java/openapi/src/com/intellij/psi/util/ImportsUtil.java
deleted file mode 100644
index 7b61ade..0000000
--- a/java/openapi/src/com/intellij/psi/util/ImportsUtil.java
+++ /dev/null
@@ -1,82 +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.psi.util;
-
-import com.intellij.psi.*;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-/**
- * User: anna
- * Date: 9/1/11
- */
-public class ImportsUtil {
-  private ImportsUtil() {
-  }
-
-  public static List<PsiJavaCodeReferenceElement> collectReferencesThrough(PsiFile file,
-                                                                           @Nullable final PsiJavaCodeReferenceElement refExpr,
-                                                                           final PsiImportStaticStatement staticImport) {
-    final List<PsiJavaCodeReferenceElement> expressionToExpand = new ArrayList<PsiJavaCodeReferenceElement>();
-    file.accept(new JavaRecursiveElementWalkingVisitor() {
-      @Override
-      public void visitReferenceElement(PsiJavaCodeReferenceElement expression) {
-        if (refExpr == null || refExpr != expression) {
-          final PsiElement resolveScope = expression.advancedResolve(true).getCurrentFileResolveScope();
-          if (resolveScope == staticImport) {
-            expressionToExpand.add(expression);
-          }
-        }
-        super.visitElement(expression);
-      }
-    });
-    return expressionToExpand;
-  }
-
-  public static void replaceAllAndDeleteImport(List<PsiJavaCodeReferenceElement> expressionToExpand,
-                                               @Nullable PsiJavaCodeReferenceElement refExpr,
-                                                PsiImportStaticStatement staticImport) {
-    if (refExpr != null) {
-      expressionToExpand.add(refExpr);
-    }
-    Collections.sort(expressionToExpand, new Comparator<PsiJavaCodeReferenceElement>() {
-      @Override
-      public int compare(PsiJavaCodeReferenceElement o1, PsiJavaCodeReferenceElement o2) {
-        return o2.getTextOffset() - o1.getTextOffset();
-      }
-    });
-    for (PsiJavaCodeReferenceElement expression : expressionToExpand) {
-      expand(expression, staticImport);
-    }
-    staticImport.delete();
-  }
-
-  public static void expand(@NotNull PsiJavaCodeReferenceElement refExpr, PsiImportStaticStatement staticImport) {
-    final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(refExpr.getProject());
-    final PsiReferenceExpression referenceExpression = elementFactory.createReferenceExpression(staticImport.resolveTargetClass());
-    if (refExpr instanceof PsiReferenceExpression) {
-      ((PsiReferenceExpression)refExpr).setQualifierExpression(referenceExpression);
-    }
-    else {
-      refExpr.replace(elementFactory.createReferenceFromText(referenceExpression.getText() + "." + refExpr.getText(), refExpr));
-    }
-  }
-}
diff --git a/java/openapi/src/com/intellij/psi/util/PsiConcatenationUtil.java b/java/openapi/src/com/intellij/psi/util/PsiConcatenationUtil.java
deleted file mode 100644
index 08e3443..0000000
--- a/java/openapi/src/com/intellij/psi/util/PsiConcatenationUtil.java
+++ /dev/null
@@ -1,134 +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.psi.util;
-
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.psi.*;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.util.IncorrectOperationException;
-
-import java.util.List;
-
-/**
- * User: cdr
- */
-public class PsiConcatenationUtil {
-
-  public static void buildFormatString(PsiExpression expression, StringBuilder formatString,
-                                       List<PsiExpression> formatParameters, boolean printfFormat) {
-    if (expression instanceof PsiLiteralExpression) {
-      final PsiLiteralExpression literalExpression = (PsiLiteralExpression) expression;
-      final String text = String.valueOf(literalExpression.getValue());
-      final String formatText;
-      if (printfFormat) {
-        formatText = StringUtil.escapeStringCharacters(text).replace("%", "%%").replace("\\'", "'");
-      }
-      else {
-        formatText = StringUtil.escapeStringCharacters(text).replace("'", "''").replaceAll("((\\{|})+)", "'$1'");
-      }
-      formatString.append(formatText);
-    } else if (expression instanceof PsiPolyadicExpression) {
-      final PsiType type = expression.getType();
-      if (type != null && type.equalsToText("java.lang.String")) {
-        final PsiPolyadicExpression binaryExpression = (PsiPolyadicExpression) expression;
-        PsiExpression[] operands = binaryExpression.getOperands();
-        PsiType left = operands[0].getType();
-        boolean stringStarted = left != null && left.equalsToText("java.lang.String");
-        if (stringStarted) {
-          buildFormatString(operands[0], formatString, formatParameters, printfFormat);
-        }
-        for (int i = 1; i < operands.length; i++) {
-          PsiExpression op = operands[i];
-          PsiType optype = op.getType();
-          PsiType r = TypeConversionUtil.calcTypeForBinaryExpression(left, optype, binaryExpression.getOperationTokenType(), true);
-          if (r != null && r.equalsToText("java.lang.String") && !stringStarted) {
-            stringStarted = true;
-            PsiElement element = binaryExpression.getTokenBeforeOperand(op);
-            if (element.getPrevSibling() instanceof PsiWhiteSpace) element = element.getPrevSibling();
-            String text = binaryExpression.getText().substring(0, element.getStartOffsetInParent());
-            PsiExpression subExpression = JavaPsiFacade.getInstance(binaryExpression.getProject()).getElementFactory()
-              .createExpressionFromText(text, binaryExpression);
-            addFormatParameter(subExpression, formatString, formatParameters, printfFormat);
-          }
-          if (stringStarted) {
-            if (optype != null && (optype.equalsToText("java.lang.String") || optype == PsiType.CHAR)) {
-              buildFormatString(op, formatString, formatParameters, printfFormat);
-            }
-            else {
-              addFormatParameter(op, formatString, formatParameters, printfFormat);
-            }
-          }
-          left = r;
-        }
-      }
-      else {
-        addFormatParameter(expression, formatString, formatParameters, printfFormat);
-      }
-    }
-    else {
-      addFormatParameter(expression, formatString, formatParameters, printfFormat);
-    }
-  }
-
-  private static void addFormatParameter(PsiExpression expression,
-                                         StringBuilder formatString,
-                                         List<PsiExpression> formatParameters, boolean printfFormat) {
-    final PsiType type = expression.getType();
-    if (!printfFormat) {
-      formatString.append("{").append(formatParameters.size()).append("}");
-    }
-    else if (type != null &&
-             (type.equalsToText("long") ||
-              type.equalsToText("int") ||
-              type.equalsToText("java.lang.Long") ||
-              type.equalsToText("java.lang.Integer"))) {
-      formatString.append("%d");
-    }
-    else {
-      formatString.append("%s");
-    }
-    formatParameters.add(getBoxedArgument(expression));
-  }
-
-  private static PsiExpression getBoxedArgument(PsiExpression arg) throws IncorrectOperationException {
-    arg = PsiUtil.deparenthesizeExpression(arg);
-    assert arg != null;
-    if (PsiUtil.isLanguageLevel5OrHigher(arg)) {
-      return arg;
-    }
-    final PsiType type = arg.getType();
-    if (!(type instanceof PsiPrimitiveType) || type.equals(PsiType.NULL)) {
-      return arg;
-    }
-    final PsiPrimitiveType primitiveType = (PsiPrimitiveType)type;
-    final String boxedQName = primitiveType.getBoxedTypeName();
-    if (boxedQName == null) {
-      return arg;
-    }
-    final GlobalSearchScope resolveScope = arg.getResolveScope();
-    final PsiElementFactory factory = JavaPsiFacade.getElementFactory(arg.getProject());
-    final PsiJavaCodeReferenceElement ref = factory.createReferenceElementByFQClassName(boxedQName, resolveScope);
-    final PsiNewExpression newExpr = (PsiNewExpression)factory.createExpressionFromText("new A(b)", null);
-    final PsiElement classRef = newExpr.getClassReference();
-    assert classRef != null;
-    classRef.replace(ref);
-    final PsiExpressionList argumentList = newExpr.getArgumentList();
-    assert argumentList != null;
-    argumentList.getExpressions()[0].replace(arg);
-    return newExpr;
-  }
-
-}
diff --git a/java/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/deployment/debug/JavaDebuggerLauncherImpl.java b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/deployment/debug/JavaDebuggerLauncherImpl.java
index 9fb0d3f..0ff284e 100644
--- a/java/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/deployment/debug/JavaDebuggerLauncherImpl.java
+++ b/java/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/deployment/debug/JavaDebuggerLauncherImpl.java
@@ -11,11 +11,11 @@
 import com.intellij.execution.*;
 import com.intellij.execution.configurations.RemoteConnection;
 import com.intellij.execution.configurations.RunProfile;
+import com.intellij.execution.configurations.SearchScopeProvider;
 import com.intellij.execution.executors.DefaultDebugExecutor;
 import com.intellij.execution.impl.ConsoleViewImpl;
 import com.intellij.execution.process.ProcessHandler;
 import com.intellij.execution.runners.ExecutionEnvironment;
-import com.intellij.execution.runners.RunContentBuilder;
 import com.intellij.execution.ui.RunContentDescriptor;
 import com.intellij.execution.ui.actions.CloseAction;
 import com.intellij.openapi.actionSystem.DefaultActionGroup;
@@ -121,7 +121,7 @@
 
     public RemoteServerDebugEnvironment(Project project, RemoteConnection remoteConnection, RunProfile runProfile) {
       myProject = project;
-      mySearchScope = RunContentBuilder.createSearchScope(project, runProfile);
+      mySearchScope = SearchScopeProvider.createSearchScope(project, runProfile);
       myRemoteConnection = remoteConnection;
       myRunProfile = runProfile;
     }
diff --git a/java/testFramework/src/com/intellij/compiler/CompilerTestUtil.java b/java/testFramework/src/com/intellij/compiler/CompilerTestUtil.java
index 15b858f..0f8f11c 100644
--- a/java/testFramework/src/com/intellij/compiler/CompilerTestUtil.java
+++ b/java/testFramework/src/com/intellij/compiler/CompilerTestUtil.java
@@ -1,8 +1,6 @@
 package com.intellij.compiler;
 
-import com.intellij.compiler.impl.TranslatingCompilerFilesMonitor;
 import com.intellij.compiler.impl.javaCompiler.javac.JavacConfiguration;
-import com.intellij.compiler.options.ExternalBuildOptionListener;
 import com.intellij.compiler.server.BuildManager;
 import com.intellij.openapi.application.PathManager;
 import com.intellij.openapi.application.Result;
@@ -50,7 +48,8 @@
   public static void scanSourceRootsToRecompile(Project project) {
     // need this to emulate project opening
     final List<VirtualFile> roots = ProjectRootManager.getInstance(project).getModuleSourceRoots(JavaModuleSourceRootTypes.SOURCES);
-    TranslatingCompilerFilesMonitor.getInstance().scanSourceContent(new TranslatingCompilerFilesMonitor.ProjectRef(project), roots, roots.size(), true);
+    // todo: forced source roots scan is not needed?
+    //TranslatingCompilerFilesMonitor.getInstance().scanSourceContent(new TranslatingCompilerFilesMonitor.ProjectRef(project), roots, roots.size(), true);
   }
 
   public static void saveApplicationSettings() {
@@ -78,11 +77,9 @@
     JDOMUtil.writeDocument(new Document(root), file, SystemProperties.getLineSeparator());
   }
 
-  public static void enableExternalCompiler(final Project project) {
+  public static void enableExternalCompiler() {
     new WriteAction() {
       protected void run(final Result result) {
-        CompilerWorkspaceConfiguration.getInstance(project).USE_OUT_OF_PROCESS_BUILD = true;
-        project.getMessageBus().syncPublisher(ExternalBuildOptionListener.TOPIC).externalBuildOptionChanged(true);
         ApplicationManagerEx.getApplicationEx().doNotSave(false);
         JavaAwareProjectJdkTableImpl table = JavaAwareProjectJdkTableImpl.getInstanceEx();
         table.addJdk(table.getInternalJdk());
@@ -93,12 +90,10 @@
   public static void disableExternalCompiler(final Project project) {
     new WriteAction() {
       protected void run(final Result result) {
-        CompilerWorkspaceConfiguration.getInstance(project).USE_OUT_OF_PROCESS_BUILD = false;
-        project.getMessageBus().syncPublisher(ExternalBuildOptionListener.TOPIC).externalBuildOptionChanged(false);
         ApplicationManagerEx.getApplicationEx().doNotSave(true);
         JavaAwareProjectJdkTableImpl table = JavaAwareProjectJdkTableImpl.getInstanceEx();
         table.removeJdk(table.getInternalJdk());
-        BuildManager.getInstance().stopWatchingProject(project);
+        BuildManager.getInstance().clearState(project);
       }
     }.execute();
   }
diff --git a/java/testFramework/src/com/intellij/testFramework/CompilerTester.java b/java/testFramework/src/com/intellij/testFramework/CompilerTester.java
index 8040420..6af8389 100644
--- a/java/testFramework/src/com/intellij/testFramework/CompilerTester.java
+++ b/java/testFramework/src/com/intellij/testFramework/CompilerTester.java
@@ -15,7 +15,6 @@
  */
 package com.intellij.testFramework;
 
-import com.intellij.compiler.CompilerManagerImpl;
 import com.intellij.compiler.CompilerTestUtil;
 import com.intellij.openapi.application.AccessToken;
 import com.intellij.openapi.application.Result;
@@ -53,46 +52,40 @@
  * @author peter
  */
 public class CompilerTester {
-  private final boolean myExternalMake;
-  private final Module myModule;
+
+  private Module myModule;
   private TempDirTestFixture myMainOutput;
 
-  public CompilerTester(boolean externalMake, Module module) throws Exception {
-    myExternalMake = externalMake;
+  public CompilerTester(Module module) throws Exception {
     myModule = module;
     myMainOutput = new TempDirTestFixtureImpl();
     myMainOutput.setUp();
 
-    CompilerManagerImpl.testSetup();
     new WriteCommandAction(getProject()) {
       @Override
       protected void run(Result result) throws Throwable {
         //noinspection ConstantConditions
         CompilerProjectExtension.getInstance(getProject()).setCompilerOutputUrl(myMainOutput.findOrCreateDir("out").getUrl());
-        if (myExternalMake) {
-          CompilerTestUtil.enableExternalCompiler(getProject());
-          ModuleRootModificationUtil.setModuleSdk(myModule, JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk());
-        }
-        else {
-          CompilerTestUtil.disableExternalCompiler(getProject());
-        }
+        CompilerTestUtil.enableExternalCompiler();
+        ModuleRootModificationUtil.setModuleSdk(myModule, JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk());
       }
     }.execute();
 
   }
 
   public void tearDown() {
-    if (myExternalMake) {
-      CompilerTestUtil.disableExternalCompiler(getProject());
-    }
+    CompilerTestUtil.disableExternalCompiler(getProject());
 
     try {
       myMainOutput.tearDown();
     }
     catch (Exception e) {
       throw new RuntimeException(e);
+    } 
+    finally {
+      myMainOutput = null;
+      myModule = null;
     }
-    myMainOutput = null;
   }
 
   private Project getProject() {
@@ -102,15 +95,8 @@
   public void deleteClassFile(final String className) throws IOException {
     AccessToken token = WriteAction.start();
     try {
-      if (myExternalMake) {
         //noinspection ConstantConditions
-        touch(
-          JavaPsiFacade.getInstance(getProject()).findClass(className, GlobalSearchScope.allScope(getProject())).getContainingFile().getVirtualFile());
-      }
-      else {
-        //noinspection ConstantConditions
-        findClassFile(className, myModule).delete(this);
-      }
+        touch(JavaPsiFacade.getInstance(getProject()).findClass(className, GlobalSearchScope.allScope(getProject())).getContainingFile().getVirtualFile());
     }
     finally {
       token.finish();
@@ -204,14 +190,13 @@
       @Override
       public void run() {
         try {
-          if (myExternalMake) {
+          getProject().save();
+          CompilerTestUtil.saveApplicationSettings();
+          final VirtualFile moduleFile = myModule.getModuleFile();
+          File ioFile = VfsUtil.virtualToIoFile(moduleFile);
+          if (!ioFile.exists()) {
             getProject().save();
-            CompilerTestUtil.saveApplicationSettings();
-            File ioFile = VfsUtil.virtualToIoFile(myModule.getModuleFile());
-            if (!ioFile.exists()) {
-              getProject().save();
-              assert ioFile.exists() : "File does not exist: " + ioFile.getPath();
-            }
+            assert ioFile.exists() : "File does not exist: " + ioFile.getPath();
           }
           runnable.consume(callback);
         }
diff --git a/jps/jps-builders/jps-builders.iml b/jps/jps-builders/jps-builders.iml
index 9dd56d5..22e65e9 100644
--- a/jps/jps-builders/jps-builders.iml
+++ b/jps/jps-builders/jps-builders.iml
@@ -37,6 +37,7 @@
     <orderEntry type="module" module-name="jps-model-impl" />
     <orderEntry type="library" scope="TEST" name="Groovy" level="project" />
     <orderEntry type="module" module-name="jps-serialization-tests" scope="TEST" />
+    <orderEntry type="library" scope="TEST" name="KotlinJavaRuntime" level="project" />
   </component>
 </module>
 
diff --git a/jps/jps-builders/src/org/jetbrains/jps/ProjectPaths.java b/jps/jps-builders/src/org/jetbrains/jps/ProjectPaths.java
index 05c00b6..962f6d8 100644
--- a/jps/jps-builders/src/org/jetbrains/jps/ProjectPaths.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/ProjectPaths.java
@@ -42,6 +42,7 @@
   private ProjectPaths() {
   }
 
+  @NotNull
   public static Collection<File> getCompilationClasspathFiles(ModuleChunk chunk,
                                                        boolean includeTests,
                                                        final boolean excludeMainModuleOutput,
@@ -49,14 +50,17 @@
     return getClasspathFiles(chunk, JpsJavaClasspathKind.compile(includeTests), excludeMainModuleOutput, ClasspathPart.WHOLE, exportedOnly);
   }
 
+  @NotNull
   public static Collection<File> getPlatformCompilationClasspath(ModuleChunk chunk, boolean excludeMainModuleOutput) {
     return getClasspathFiles(chunk, JpsJavaClasspathKind.compile(chunk.containsTests()), excludeMainModuleOutput, ClasspathPart.BEFORE_JDK, true);
   }
 
+  @NotNull
   public static Collection<File> getCompilationClasspath(ModuleChunk chunk, boolean excludeMainModuleOutput) {
     return getClasspathFiles(chunk, JpsJavaClasspathKind.compile(chunk.containsTests()), excludeMainModuleOutput, ClasspathPart.AFTER_JDK, true);
   }
 
+  @NotNull
   private static Collection<File> getClasspathFiles(ModuleChunk chunk,
                                              JpsJavaClasspathKind kind,
                                              final boolean excludeMainModuleOutput,
diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/BuildOperations.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/BuildOperations.java
index 8e24d72..2dd1775 100644
--- a/jps/jps-builders/src/org/jetbrains/jps/incremental/BuildOperations.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/BuildOperations.java
@@ -17,6 +17,7 @@
 
 import com.intellij.openapi.util.io.FileUtil;
 import gnu.trove.THashSet;
+import gnu.trove.TObjectIntHashMap;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.jps.builders.*;
@@ -157,6 +158,7 @@
 
       dirtyFilesHolder.processDirtyFiles(new FileProcessor<R, T>() {
         private final Map<T, SourceToOutputMapping> mappingsCache = new java.util.HashMap<T, SourceToOutputMapping>(); // cache the mapping locally
+        private final TObjectIntHashMap<T> idsCache = new TObjectIntHashMap<T>();
 
         @Override
         public boolean apply(T target, File file, R sourceRoot) throws IOException {
@@ -165,6 +167,14 @@
             srcToOut = dataManager.getSourceToOutputMap(target);
             mappingsCache.put(target, srcToOut);
           }
+          final int targetId;
+          if (!idsCache.containsKey(target)) {
+            targetId = dataManager.getTargetsState().getBuildTargetId(target);
+            idsCache.put(target, targetId);
+          }
+          else {
+            targetId = idsCache.get(target);
+          }
           final String srcPath = file.getPath();
           final Collection<String> outputs = srcToOut.getOutputs(srcPath);
           if (outputs != null) {
@@ -174,7 +184,7 @@
               deleteRecursively(output, deletedForThisSource, shouldPruneOutputDirs ? dirsToDelete : null);
             }
             deletedPaths.addAll(deletedForThisSource);
-            dataManager.getOutputToSourceRegistry().removeMapping(deletedForThisSource, srcPath);
+            dataManager.getOutputToTargetRegistry().removeMapping(deletedForThisSource, targetId);
             Set<File> cleaned = cleanedSources.get(target);
             if (cleaned == null) {
               cleaned = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java
index 4096738..a981fa0 100644
--- a/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java
@@ -52,7 +52,7 @@
 import org.jetbrains.jps.incremental.messages.*;
 import org.jetbrains.jps.incremental.storage.BuildTargetConfiguration;
 import org.jetbrains.jps.incremental.storage.OneToManyPathsMapping;
-import org.jetbrains.jps.incremental.storage.OutputToSourceRegistry;
+import org.jetbrains.jps.incremental.storage.OutputToTargetRegistry;
 import org.jetbrains.jps.indices.ModuleExcludeIndex;
 import org.jetbrains.jps.model.java.JpsJavaExtensionService;
 import org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration;
@@ -975,7 +975,7 @@
         if (isTargetOutputCleared(context, target)) {
           continue;
         }
-
+        final int buildTargetId = context.getProjectDescriptor().getTargetsState().getBuildTargetId(target);
         final boolean shouldPruneEmptyDirs = target instanceof ModuleBasedTarget;
         final SourceToOutputMapping sourceToOutputStorage = context.getProjectDescriptor().dataManager.getSourceToOutputMap(target);
         final ProjectBuilderLogger logger = context.getLoggingManager().getProjectBuilderLogger();
@@ -994,8 +994,8 @@
           final Collection<String> outputs = sourceToOutputStorage.getOutputs(deletedSource);
           if (outputs != null && !outputs.isEmpty()) {
             List<String> deletedOutputPaths = new ArrayList<String>();
-            final OutputToSourceRegistry outputToSourceRegistry = context.getProjectDescriptor().dataManager.getOutputToSourceRegistry();
-            for (String output : outputToSourceRegistry.getSafeToDeleteOutputs(outputs, deletedSource)) {
+            final OutputToTargetRegistry outputToSourceRegistry = context.getProjectDescriptor().dataManager.getOutputToTargetRegistry();
+            for (String output : outputToSourceRegistry.getSafeToDeleteOutputs(outputs, buildTargetId)) {
               final boolean deleted = BuildOperations.deleteRecursively(output, deletedOutputPaths, shouldPruneEmptyDirs ? dirsToDelete : null);
               if (deleted) {
                 doneSomething = true;
diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/BuildDataManager.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/BuildDataManager.java
index f836c41..823fe08 100644
--- a/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/BuildDataManager.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/BuildDataManager.java
@@ -42,10 +42,10 @@
  *         Date: 10/7/11
  */
 public class BuildDataManager implements StorageOwner {
-  private static final int VERSION = 23;
+  private static final int VERSION = 24;
   private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.incremental.storage.BuildDataManager");
   private static final String SRC_TO_FORM_STORAGE = "src-form";
-  private static final String OUT_SRC_STORAGE = "out-src";
+  private static final String OUT_TARGET_STORAGE = "out-target";
   private static final String MAPPINGS_STORAGE = "mappings";
   private static final int CONCURRENCY_LEVEL = BuildRunner.PARALLEL_BUILD_ENABLED? IncProjectBuilder.MAX_BUILDER_THREADS : 1;
 
@@ -58,7 +58,7 @@
   private final Mappings myMappings;
   private final BuildDataPaths myDataPaths;
   private final BuildTargetsState myTargetsState;
-  private final OutputToSourceRegistry myOutputToSourceRegistry;
+  private final OutputToTargetRegistry myOutputToTargetRegistry;
   private final File myVersionFile;
   private StorageOwner myTargetStoragesOwner = new CompositeStorageOwner() {
     @Override
@@ -128,18 +128,23 @@
     myDataPaths = dataPaths;
     myTargetsState = targetsState;
     mySrcToFormMap = new OneToManyPathsMapping(new File(getSourceToFormsRoot(), "data"));
-    myOutputToSourceRegistry = new OutputToSourceRegistry(new File(getOutputToSourceRegistryRoot(), "data"));
+    myOutputToTargetRegistry = new OutputToTargetRegistry(new File(getOutputToSourceRegistryRoot(), "data"));
     myMappings = new Mappings(getMappingsRoot(myDataPaths.getDataStorageRoot()), useMemoryTempCaches);
     myVersionFile = new File(myDataPaths.getDataStorageRoot(), "version.dat");
   }
 
-  public OutputToSourceRegistry getOutputToSourceRegistry() {
-    return myOutputToSourceRegistry;
+  public BuildTargetsState getTargetsState() {
+    return myTargetsState;
+  }
+
+  public OutputToTargetRegistry getOutputToTargetRegistry() {
+    return myOutputToTargetRegistry;
   }
 
   public SourceToOutputMapping getSourceToOutputMap(final BuildTarget<?> target) throws IOException {
     final SourceToOutputMappingImpl sourceToOutputMapping = fetchValue(mySourceToOutputs, target, SOURCE_OUTPUT_MAPPING_VALUE_FACTORY);
-    return new SourceToOutputMappingWrapper(sourceToOutputMapping);
+    final int buildTargetId = myTargetsState.getBuildTargetId(target);
+    return new SourceToOutputMappingWrapper(sourceToOutputMapping, buildTargetId);
   }
 
   @NotNull
@@ -192,7 +197,7 @@
         }
         finally {
           try {
-            wipeStorage(getOutputToSourceRegistryRoot(), myOutputToSourceRegistry);
+            wipeStorage(getOutputToSourceRegistryRoot(), myOutputToTargetRegistry);
           }
           finally {
             final Mappings mappings = myMappings;
@@ -218,7 +223,7 @@
     for (AtomicNotNullLazyValue<SourceToOutputMappingImpl> mapping : mySourceToOutputs.values()) {
       mapping.getValue().flush(memoryCachesOnly);
     }
-    myOutputToSourceRegistry.flush(memoryCachesOnly);
+    myOutputToTargetRegistry.flush(memoryCachesOnly);
     mySrcToFormMap.flush(memoryCachesOnly);
     final Mappings mappings = myMappings;
     if (mappings != null) {
@@ -241,7 +246,7 @@
     finally {
       try {
         closeSourceToOutputStorages();
-        myOutputToSourceRegistry.close();
+        myOutputToTargetRegistry.close();
       }
       finally {
         try {
@@ -321,7 +326,7 @@
   }
 
   private File getOutputToSourceRegistryRoot() {
-    return new File(myDataPaths.getDataStorageRoot(), OUT_SRC_STORAGE);
+    return new File(myDataPaths.getDataStorageRoot(), OUT_TARGET_STORAGE);
   }
 
   public BuildDataPaths getDataPaths() {
@@ -399,9 +404,11 @@
   
   private final class SourceToOutputMappingWrapper implements SourceToOutputMapping {
     private final SourceToOutputMapping myDelegate;
+    private final int myBuildTargetId;
 
-    SourceToOutputMappingWrapper(SourceToOutputMapping delegate) {
+    SourceToOutputMappingWrapper(SourceToOutputMapping delegate, int buildTargetId) {
       myDelegate = delegate;
+      myBuildTargetId = buildTargetId;
     }
 
     public void setOutputs(@NotNull String srcPath, @NotNull Collection<String> outputs) throws IOException {
@@ -409,7 +416,7 @@
         myDelegate.setOutputs(srcPath, outputs);
       }
       finally {
-        myOutputToSourceRegistry.addMapping(outputs, srcPath);
+        myOutputToTargetRegistry.addMapping(outputs, myBuildTargetId);
       }
     }
 
@@ -418,7 +425,7 @@
         myDelegate.setOutput(srcPath, outputPath);
       }
       finally {
-        myOutputToSourceRegistry.addMapping(outputPath, srcPath);
+        myOutputToTargetRegistry.addMapping(outputPath, myBuildTargetId);
       }
     }
 
@@ -427,7 +434,7 @@
         myDelegate.appendOutput(srcPath, outputPath);
       }
       finally {
-        myOutputToSourceRegistry.addMapping(outputPath, srcPath);
+        myOutputToTargetRegistry.addMapping(outputPath, myBuildTargetId);
       }
     }
 
@@ -440,7 +447,7 @@
         myDelegate.remove(srcPath);
       }
       finally {
-        myOutputToSourceRegistry.removeMapping(outputs, srcPath);
+        myOutputToTargetRegistry.removeMapping(outputs, myBuildTargetId);
       }
     }
 
@@ -449,7 +456,7 @@
         myDelegate.removeOutput(sourcePath, outputPath);
       }
       finally {
-        myOutputToSourceRegistry.removeMapping(outputPath, sourcePath);
+        myOutputToTargetRegistry.removeMapping(outputPath, myBuildTargetId);
       }
     }
 
diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/OutputToSourceRegistry.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/OutputToSourceRegistry.java
deleted file mode 100644
index a52fe11..0000000
--- a/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/OutputToSourceRegistry.java
+++ /dev/null
@@ -1,134 +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 org.jetbrains.jps.incremental.storage;
-
-import com.intellij.openapi.util.Ref;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.util.io.DataExternalizer;
-import com.intellij.util.io.IntInlineKeyDescriptor;
-import gnu.trove.TIntHashSet;
-import gnu.trove.TIntProcedure;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.*;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: 10-Apr-14
- */
-public class OutputToSourceRegistry extends AbstractStateStorage<Integer, TIntHashSet>{
-  private static final DataExternalizer<TIntHashSet> DATA_EXTERNALIZER = new DataExternalizer<TIntHashSet>() {
-    public void save(@NotNull final DataOutput out, TIntHashSet value) throws IOException {
-      final Ref<IOException> exRef = Ref.create(null);
-      value.forEach(new TIntProcedure() {
-        public boolean execute(int value) {
-          try {
-            out.writeInt(value);
-          }
-          catch (IOException e) {
-            exRef.set(e);
-            return false;
-          }
-          return true;
-        }
-      });
-      final IOException error = exRef.get();
-      if (error != null) {
-        throw error;
-      }
-    }
-
-    public TIntHashSet read(@NotNull DataInput in) throws IOException {
-      final TIntHashSet result = new TIntHashSet();
-      final DataInputStream stream = (DataInputStream)in;
-      while (stream.available() > 0) {
-        result.add(in.readInt());
-      }
-      return result;
-    }
-  };
-  
-  OutputToSourceRegistry(@NonNls File storePath) throws IOException {
-    super(storePath, new IntInlineKeyDescriptor(), DATA_EXTERNALIZER);
-  }
-  
-  protected void addMapping(String outputPath, String sourcePath) throws IOException {
-    addMapping(Collections.singleton(outputPath), sourcePath);
-  }
-  
-  protected void addMapping(Collection<String> outputPaths, String sourcePath) throws IOException {
-    final TIntHashSet set = new TIntHashSet();
-    set.add(FileUtil.pathHashCode(sourcePath));
-    for (String outputPath : outputPaths) {
-      appendData(FileUtil.pathHashCode(outputPath), set);
-    }
-  }
-
-  public void removeMapping(String outputPath, String sourcePath) throws IOException {
-    removeMapping(Collections.singleton(outputPath), sourcePath);
-  }
-
-  public void removeMapping(Collection<String> outputPaths, String sourcePath) throws IOException {
-    if (outputPaths.isEmpty()) {
-      return;
-    }
-    final int value = FileUtil.pathHashCode(sourcePath);
-    for (String outputPath : outputPaths) {
-      final int key = FileUtil.pathHashCode(outputPath);
-      synchronized (myDataLock) {
-        final TIntHashSet state = getState(key);
-        if (state != null) {
-          final boolean removed = state.remove(value);
-          if (state.isEmpty()) {
-            remove(key);
-          }
-          else {
-            if (removed) {
-              update(key, state);
-            }
-          }
-        }
-      }
-    }
-  }
-  
-  public Collection<String> getSafeToDeleteOutputs(Collection<String> outputPaths, String associatedSourcePath) throws IOException {
-    final int size = outputPaths.size();
-    if (size == 0) {
-      return outputPaths;
-    }
-    final Collection<String> result = new ArrayList<String>(size);
-    Integer cached = null;
-    for (String outputPath : outputPaths) {
-      final int key = FileUtil.pathHashCode(outputPath);
-      synchronized (myDataLock) {
-        final TIntHashSet associatedSources = getState(key);
-        if (associatedSources == null || associatedSources.size() != 1) {
-          continue;
-        }
-        final int srcHash = cached == null? (cached = FileUtil.pathHashCode(associatedSourcePath)) : cached.intValue();
-        if (associatedSources.contains(srcHash)) {
-          result.add(outputPath);
-        }
-      }
-    }
-    return result;
-  }
-}
diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/OutputToTargetRegistry.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/OutputToTargetRegistry.java
new file mode 100644
index 0000000..7f1f1e4
--- /dev/null
+++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/storage/OutputToTargetRegistry.java
@@ -0,0 +1,131 @@
+/*
+ * 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 org.jetbrains.jps.incremental.storage;
+
+import com.intellij.openapi.util.Ref;
+import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.util.io.DataExternalizer;
+import com.intellij.util.io.IntInlineKeyDescriptor;
+import gnu.trove.TIntHashSet;
+import gnu.trove.TIntProcedure;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * @author Eugene Zhuravlev
+ *         Date: 10-Apr-14
+ */
+public class OutputToTargetRegistry extends AbstractStateStorage<Integer, TIntHashSet>{
+  private static final DataExternalizer<TIntHashSet> DATA_EXTERNALIZER = new DataExternalizer<TIntHashSet>() {
+    public void save(@NotNull final DataOutput out, TIntHashSet value) throws IOException {
+      final Ref<IOException> exRef = Ref.create(null);
+      value.forEach(new TIntProcedure() {
+        public boolean execute(int value) {
+          try {
+            out.writeInt(value);
+          }
+          catch (IOException e) {
+            exRef.set(e);
+            return false;
+          }
+          return true;
+        }
+      });
+      final IOException error = exRef.get();
+      if (error != null) {
+        throw error;
+      }
+    }
+
+    public TIntHashSet read(@NotNull DataInput in) throws IOException {
+      final TIntHashSet result = new TIntHashSet();
+      final DataInputStream stream = (DataInputStream)in;
+      while (stream.available() > 0) {
+        result.add(in.readInt());
+      }
+      return result;
+    }
+  };
+  
+  OutputToTargetRegistry(@NonNls File storePath) throws IOException {
+    super(storePath, new IntInlineKeyDescriptor(), DATA_EXTERNALIZER);
+  }
+  
+  protected void addMapping(String outputPath, int buildTargetId) throws IOException {
+    addMapping(Collections.singleton(outputPath), buildTargetId);
+  }
+  
+  protected void addMapping(Collection<String> outputPaths, int buildTargetId) throws IOException {
+    final TIntHashSet set = new TIntHashSet();
+    set.add(buildTargetId);
+    for (String outputPath : outputPaths) {
+      appendData(FileUtil.pathHashCode(outputPath), set);
+    }
+  }
+
+  public void removeMapping(String outputPath, int buildTargetId) throws IOException {
+    removeMapping(Collections.singleton(outputPath), buildTargetId);
+  }
+
+  public void removeMapping(Collection<String> outputPaths, int buildTargetId) throws IOException {
+    if (outputPaths.isEmpty()) {
+      return;
+    }
+    for (String outputPath : outputPaths) {
+      final int key = FileUtil.pathHashCode(outputPath);
+      synchronized (myDataLock) {
+        final TIntHashSet state = getState(key);
+        if (state != null) {
+          final boolean removed = state.remove(buildTargetId);
+          if (state.isEmpty()) {
+            remove(key);
+          }
+          else {
+            if (removed) {
+              update(key, state);
+            }
+          }
+        }
+      }
+    }
+  }
+  
+  public Collection<String> getSafeToDeleteOutputs(Collection<String> outputPaths, int currentTargetId) throws IOException {
+    final int size = outputPaths.size();
+    if (size == 0) {
+      return outputPaths;
+    }
+    final Collection<String> result = new ArrayList<String>(size);
+    for (String outputPath : outputPaths) {
+      final int key = FileUtil.pathHashCode(outputPath);
+      synchronized (myDataLock) {
+        final TIntHashSet associatedTargets = getState(key);
+        if (associatedTargets == null || associatedTargets.size() != 1) {
+          continue;
+        }
+        if (associatedTargets.contains(currentTargetId)) {
+          result.add(outputPath);
+        }
+      }
+    }
+    return result;
+  }
+}
diff --git a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/JpsBuildTestCase.java b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/JpsBuildTestCase.java
index b2f654f..2c3fca0 100644
--- a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/JpsBuildTestCase.java
+++ b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/JpsBuildTestCase.java
@@ -23,6 +23,7 @@
 import com.intellij.testFramework.UsefulTestCase;
 import com.intellij.util.containers.hash.HashMap;
 import com.intellij.util.io.TestFileSystemBuilder;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.jps.api.CanceledStatus;
 import org.jetbrains.jps.builders.impl.BuildDataPathsImpl;
@@ -67,7 +68,7 @@
  */
 public abstract class JpsBuildTestCase extends UsefulTestCase {
   private File myProjectDir;
-  protected JpsProject myProject;
+  @NotNull protected JpsProject myProject;
   protected JpsModel myModel;
   private JpsSdk<JpsDummyElement> myJdk;
   protected File myDataStorageRoot;
@@ -310,6 +311,7 @@
     BuildResult result = new BuildResult();
     builder.addMessageHandler(result);
     try {
+      beforeBuildStarted(descriptor);
       builder.build(scopeBuilder.build(), false);
     }
     catch (RebuildRequestedException e) {
@@ -318,6 +320,9 @@
     return result;
   }
 
+  protected void beforeBuildStarted(@NotNull ProjectDescriptor descriptor) {
+  }
+
   protected String createFile(String relativePath) {
     return createFile(relativePath, "");
   }
diff --git a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/ModuleClasspathTest.groovy b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/ModuleClasspathTest.groovy
deleted file mode 100644
index 6c33c43..0000000
--- a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/ModuleClasspathTest.groovy
+++ /dev/null
@@ -1,105 +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 org.jetbrains.jps.builders
-import com.intellij.openapi.util.io.FileUtil
-import org.jetbrains.jps.ModuleChunk
-import org.jetbrains.jps.ProjectPaths
-import org.jetbrains.jps.builders.java.JavaModuleBuildTargetType
-import org.jetbrains.jps.builders.rebuild.JpsRebuildTestCase
-import org.jetbrains.jps.incremental.ModuleBuildTarget
-/**
- * @author nik
- */
-public class ModuleClasspathTest extends JpsRebuildTestCase {
-  @Override
-  protected void setUp() {
-    super.setUp()
-    myModel.getGlobal().getLibraryCollection().findLibrary("1.6").delete()
-    addJdk("1.6", "/jdk.jar")
-    addJdk("1.5", "/jdk15.jar")
-    loadProject("moduleClasspath/moduleClasspath.ipr")
-  }
-
-  private String getProjectPath() {
-    return FileUtil.toSystemIndependentName(getTestDataRootPath()) + "/moduleClasspath/moduleClasspath.ipr"
-  }
-
-  public void testSimpleClasspath() {
-    assertClasspath('util', false, ["util/lib/exported.jar", "/jdk15.jar"])
-  }
-
-  public void testScopes() {
-    assertClasspath("test-util", false,
-                    ["/jdk.jar", "test-util/lib/provided.jar"])
-    assertClasspath("test-util", true,
-                    ["/jdk.jar", "test-util/lib/provided.jar", "test-util/lib/test.jar", "out/production/test-util"])
-  }
-
-  public void testDepModules() {
-    assertClasspath("main", false,
-            ["util/lib/exported.jar", "out/production/util", "/jdk.jar", "main/lib/service.jar"])
-    assertClasspath("main", true,
-            ["out/production/main", "util/lib/exported.jar", "out/test/util", "out/production/util", "/jdk.jar",
-             "out/test/test-util", "out/production/test-util", "main/lib/service.jar"])
-  }
-
-  public void testCompilationClasspath() {
-    ModuleChunk chunk = createChunk('main')
-    assertClasspath(["util/lib/exported.jar", "out/production/util", "/jdk.jar"],
-            getPathsList(ProjectPaths.getPlatformCompilationClasspath(chunk, true)))
-    assertClasspath(["main/lib/service.jar"],
-            getPathsList(ProjectPaths.getCompilationClasspath(chunk, true)))
-  }
-
-  private def assertClasspath(String moduleName, boolean includeTests, List<String> expected) {
-    ModuleChunk chunk = createChunk(moduleName)
-    final List<String> classpath = getPathsList(new ProjectPaths().getCompilationClasspathFiles(chunk, includeTests, true, true))
-    assertClasspath(expected, toSystemIndependentPaths(classpath))
-  }
-
-  private ModuleChunk createChunk(String moduleName) {
-    def module = myProject.modules.find {it.name == moduleName}
-    return new ModuleChunk([new ModuleBuildTarget(module, JavaModuleBuildTargetType.PRODUCTION)] as Set)
-  }
-
-  private def assertClasspath(List<String> expected, List<String> classpath) {
-    String basePath = FileUtil.toSystemIndependentName(new File(getProjectPath()).parentFile.absolutePath) + "/"
-    List<String> actual = toSystemIndependentPaths(classpath).collect { String path ->
-      path.startsWith(basePath) ? path.substring(basePath.length()) : path
-    }
-    assertEquals(expected.join("\n"), actual.join("\n"))
-  }
-
-  private static List<String> toSystemIndependentPaths(List<String> classpath) {
-    final List<String> result = new ArrayList<String>()
-    for (String path: classpath) {
-      result.add(FileUtil.toSystemIndependentName(path));
-    }
-    return result
-  }
-
-  public static List<String> getPathsList(Collection<File> files) {
-    final List<String> result = new ArrayList<String>();
-    for (File file : files) {
-      result.add(getCanonicalPath(file));
-    }
-    return result;
-  }
-  private static String getCanonicalPath(File file) {
-    final String path = file.getPath();
-    return path.contains(".")? FileUtil.toCanonicalPath(path) : FileUtil.toSystemIndependentName(path);
-  }
-}
diff --git a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/ModuleClasspathTest.kt b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/ModuleClasspathTest.kt
new file mode 100644
index 0000000..9d2960d
--- /dev/null
+++ b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/ModuleClasspathTest.kt
@@ -0,0 +1,98 @@
+/*
+ * 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 org.jetbrains.jps.builders
+
+import com.intellij.openapi.application.ex.PathManagerEx
+import com.intellij.openapi.util.io.FileUtil
+import com.intellij.openapi.util.io.FileUtil.*
+import org.jetbrains.jps.ModuleChunk
+import org.jetbrains.jps.ProjectPaths
+import org.jetbrains.jps.builders.java.JavaModuleBuildTargetType
+import org.jetbrains.jps.incremental.ModuleBuildTarget
+import java.io.File
+import com.intellij.openapi.util.text.StringUtil
+import org.junit.Assert
+import java.util.Collections
+
+/**
+ * @author nik
+ */
+public class ModuleClasspathTest(): JpsBuildTestCase() {
+    override fun setUp() {
+        super.setUp()
+        addJdk("1.6", "/jdk.jar")
+        addJdk("1.5", "/jdk15.jar")
+        loadProject("moduleClasspath/moduleClasspath.ipr")
+    }
+
+    private fun getProjectPath(): String {
+        return FileUtil.toSystemIndependentName(getTestDataRootPath()) + "/moduleClasspath/moduleClasspath.ipr"
+    }
+
+    override fun getTestDataRootPath(): String {
+        return FileUtil.toCanonicalPath(PathManagerEx.findFileUnderCommunityHome("jps/jps-builders/testData/output")!!.getAbsolutePath(), '/')!!
+    }
+
+    public fun testSimpleClasspath() {
+        assertClasspath("util", false, listOf("util/lib/exported.jar", "/jdk15.jar"))
+    }
+
+    public fun testScopes() {
+        assertClasspath("test-util", false, listOf("/jdk.jar", "test-util/lib/provided.jar"))
+        assertClasspath("test-util", true, listOf("/jdk.jar", "test-util/lib/provided.jar", "test-util/lib/test.jar", "out/production/test-util"))
+    }
+
+    public fun testDepModules() {
+        assertClasspath("main", false, listOf("util/lib/exported.jar", "out/production/util", "/jdk.jar", "main/lib/service.jar"))
+        assertClasspath("main", true, listOf("out/production/main", "util/lib/exported.jar", "out/test/util", "out/production/util", "/jdk.jar", "out/test/test-util", "out/production/test-util", "main/lib/service.jar"))
+    }
+
+    public fun testCompilationClasspath() {
+        val chunk = createChunk("main")
+        assertClasspath(listOf("util/lib/exported.jar", "out/production/util", "/jdk.jar"), getPathsList(ProjectPaths.getPlatformCompilationClasspath(chunk, true)))
+        assertClasspath(listOf("main/lib/service.jar"), getPathsList(ProjectPaths.getCompilationClasspath(chunk, true)))
+    }
+
+    private fun assertClasspath(moduleName: String, includeTests: Boolean, expected: List<String>) {
+        val classpath = getPathsList(ProjectPaths.getCompilationClasspathFiles(createChunk(moduleName), includeTests, true, true))
+        assertClasspath(expected, toSystemIndependentPaths(classpath))
+    }
+
+    private fun createChunk(moduleName: String): ModuleChunk {
+        val module = myProject.getModules().firstOrNull { it.getName() == moduleName }
+        return ModuleChunk(setOf(ModuleBuildTarget(module!!, JavaModuleBuildTargetType.PRODUCTION)))
+    }
+
+    private fun assertClasspath(expected: List<String>, classpath: List<String>) {
+        val basePath = FileUtil.toSystemIndependentName(File(getProjectPath()).getParentFile()!!.getAbsolutePath()) + "/"
+        val actual = toSystemIndependentPaths(classpath).map { StringUtil.trimStart(it, basePath) }
+        Assert.assertEquals(expected.makeString("\n"), actual.makeString("\n"))
+    }
+
+    private fun toSystemIndependentPaths(classpath: List<String>): List<String> {
+        return classpath.map(FileUtil::toSystemIndependentName)
+    }
+
+    public fun getPathsList(files: Collection<File>): List<String> {
+        return files.map(::getCanonicalPath)
+    }
+}
+
+private fun getCanonicalPath(file: File): String {
+    val path = file.getPath()
+    return if (path.contains(".")) FileUtil.toCanonicalPath(path)!! else FileUtil.toSystemIndependentName(path)
+}
+
diff --git a/jps/jps-builders/testSrc/org/jetbrains/jps/incremental/artifacts/IncrementalArtifactBuildingTest.java b/jps/jps-builders/testSrc/org/jetbrains/jps/incremental/artifacts/IncrementalArtifactBuildingTest.java
index ef662f2..13ce0e6 100644
--- a/jps/jps-builders/testSrc/org/jetbrains/jps/incremental/artifacts/IncrementalArtifactBuildingTest.java
+++ b/jps/jps-builders/testSrc/org/jetbrains/jps/incremental/artifacts/IncrementalArtifactBuildingTest.java
@@ -63,6 +63,21 @@
     buildAllAndAssertUpToDate();
   }
 
+  public void testRemoveAllFilesFromArchive() {
+    String file1 = createFile("dir/a.txt");
+    String file2 = createFile("dir/b.txt");
+    final JpsArtifact a = addArtifact("a", archive("a.jar").parentDirCopy(file1));
+    buildAll();
+    assertOutput(a, fs().archive("a.jar").file("a.txt").file("b.txt"));
+
+    delete(file1);
+    delete(file2);
+    buildAll();
+    assertDeleted("out/artifacts/a/a.jar");
+    assertEmptyOutput(a);
+    buildAllAndAssertUpToDate();
+  }
+
   public void testPackChangedFile() {
     String file1 = createFile("dir/a.txt", "aaa");
     createFile("dir/b.txt", "bbb");
diff --git a/jps/model-api/src/org/jetbrains/jps/model/module/JpsDependenciesEnumerator.java b/jps/model-api/src/org/jetbrains/jps/model/module/JpsDependenciesEnumerator.java
index d310247..5170beb 100644
--- a/jps/model-api/src/org/jetbrains/jps/model/module/JpsDependenciesEnumerator.java
+++ b/jps/model-api/src/org/jetbrains/jps/model/module/JpsDependenciesEnumerator.java
@@ -71,9 +71,17 @@
   Set<JpsLibrary> getLibraries();
 
   /**
-   * Runs <code>consumer.consume()</code> for each module processed by this enumerator
-   *
-   * @param consumer consumer
+   * Runs {@code consumer.consume()} for each module processed by this enumerator
    */
   void processModules(@NotNull Consumer<JpsModule> consumer);
+
+  /**
+   * Runs {@code consumer.consume()} for each library processed by this enumerator
+   */
+  void processLibraries(@NotNull Consumer<JpsLibrary> consumer);
+
+  /**
+   * Runs {@code moduleConsumer.consume()} for each module and {@code libraryConsumer.consume()} for each library processed by this enumerator
+   */
+  void processModuleAndLibraries(@NotNull Consumer<JpsModule> moduleConsumer, @NotNull Consumer<JpsLibrary> libraryConsumer);
 }
diff --git a/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsDependenciesEnumeratorBase.java b/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsDependenciesEnumeratorBase.java
index 5f273ea..38885b1 100644
--- a/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsDependenciesEnumeratorBase.java
+++ b/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsDependenciesEnumeratorBase.java
@@ -21,6 +21,7 @@
 import com.intellij.util.Processor;
 import gnu.trove.THashSet;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 import org.jetbrains.jps.model.library.JpsLibrary;
 import org.jetbrains.jps.model.module.*;
 
@@ -98,21 +99,8 @@
 
   @Override
   public void processModules(@NotNull final Consumer<JpsModule> consumer) {
-    processDependencies(new Processor<JpsDependencyElement>() {
-      @Override
-      public boolean process(JpsDependencyElement dependencyElement) {
-        if (myRecursively && dependencyElement instanceof JpsModuleSourceDependency) {
-          consumer.consume(dependencyElement.getContainingModule());
-        }
-        else if ((!myRecursively || !shouldProcessDependenciesRecursively())&& dependencyElement instanceof JpsModuleDependency) {
-          JpsModule module = ((JpsModuleDependency)dependencyElement).getModule();
-          if (module != null) {
-            consumer.consume(module);
-          }
-        }
-        return true;
-      }
-    });
+    //noinspection unchecked
+    processModuleAndLibraries(consumer, Consumer.EMPTY_CONSUMER);
   }
 
   protected boolean shouldProcessDependenciesRecursively() {
@@ -183,14 +171,32 @@
     return libraries;
   }
 
-  public void processLibraries(final Consumer<JpsLibrary> consumer) {
+  @Override
+  public void processLibraries(@NotNull final Consumer<JpsLibrary> consumer) {
+    //noinspection unchecked
+    processModuleAndLibraries(Consumer.EMPTY_CONSUMER, consumer);
+  }
+
+  @Override
+  public void processModuleAndLibraries(@Nullable final Consumer<JpsModule> moduleConsumer, @Nullable final Consumer<JpsLibrary> libraryConsumer) {
     processDependencies(new Processor<JpsDependencyElement>() {
       @Override
       public boolean process(JpsDependencyElement dependencyElement) {
-        if (dependencyElement instanceof JpsLibraryDependency) {
+        if (moduleConsumer != null) {
+          if (myRecursively && dependencyElement instanceof JpsModuleSourceDependency) {
+            moduleConsumer.consume(dependencyElement.getContainingModule());
+          }
+          else if ((!myRecursively || !shouldProcessDependenciesRecursively()) && dependencyElement instanceof JpsModuleDependency) {
+            JpsModule module = ((JpsModuleDependency)dependencyElement).getModule();
+            if (module != null) {
+              moduleConsumer.consume(module);
+            }
+          }
+        }
+        if (libraryConsumer != null && dependencyElement instanceof JpsLibraryDependency) {
           JpsLibrary library = ((JpsLibraryDependency)dependencyElement).getLibrary();
           if (library != null) {
-            consumer.consume(library);
+            libraryConsumer.consume(library);
           }
         }
         return true;
diff --git a/jps/standalone-builder/jps-standalone-builder.iml b/jps/standalone-builder/jps-standalone-builder.iml
index eff77fd..e861da7 100644
--- a/jps/standalone-builder/jps-standalone-builder.iml
+++ b/jps/standalone-builder/jps-standalone-builder.iml
@@ -12,7 +12,7 @@
     <orderEntry type="module" module-name="jps-model-api" />
     <orderEntry type="library" name="cli-parser" level="project" />
     <orderEntry type="library" name="Ant" level="project" />
-    <orderEntry type="module" module-name="jps-model-serialization" />
+    <orderEntry type="module" module-name="jps-model-serialization" exported="" />
     <orderEntry type="module-library" scope="PROVIDED">
       <library>
         <CLASSES>
diff --git a/jps/standalone-builder/src/org/jetbrains/jps/gant/JpsGantTool.groovy b/jps/standalone-builder/src/org/jetbrains/jps/gant/JpsGantTool.groovy
index f5d81e6..964d160 100644
--- a/jps/standalone-builder/src/org/jetbrains/jps/gant/JpsGantTool.groovy
+++ b/jps/standalone-builder/src/org/jetbrains/jps/gant/JpsGantTool.groovy
@@ -24,6 +24,7 @@
 import org.jetbrains.jps.model.JpsProject
 import org.jetbrains.jps.model.java.JpsJavaExtensionService
 import org.jetbrains.jps.model.library.JpsOrderRootType
+import org.jetbrains.jps.model.serialization.JpsModelSerializationDataService
 import org.jetbrains.jps.model.serialization.JpsProjectLoader
 /**
  * @author nik
@@ -105,7 +106,8 @@
   }
 
   private void loadProject(String path, JpsModel model, JpsGantProjectBuilder builder) {
-    JpsProjectLoader.loadProject(model.project, [:], path)
+    def pathVariables = JpsModelSerializationDataService.computeAllPathVariables(model.global)
+    JpsProjectLoader.loadProject(model.project, pathVariables, path)
     if (builder.getDataStorageRoot() == null) {
       builder.setDataStorageRoot(Utils.getDataStorageRoot(path))
     }
diff --git a/native/fsNotifier/mac/fsnotifier.c b/native/fsNotifier/mac/fsnotifier.c
index 0a4a6c8..1f774c4 100644
--- a/native/fsNotifier/mac/fsnotifier.c
+++ b/native/fsNotifier/mac/fsnotifier.c
@@ -18,7 +18,11 @@
 #include <pthread.h>
 #include <sys/mount.h>
 
+#define PRIVATE_DIR "/private/"
+#define PRIVATE_LEN 9
+
 static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
+static bool report_private = true;
 
 static void reportEvent(char *event, char *path) {
     int len = 0;
@@ -32,15 +36,15 @@
     }
 
     pthread_mutex_lock(&lock);
-
-    fputs(event, stdout);
-    fputc('\n', stdout);
-    if (path != NULL) {
-        fwrite(path, len, 1, stdout);
+    if (report_private || strncasecmp(path, PRIVATE_DIR, PRIVATE_LEN) != 0) {
+        fputs(event, stdout);
         fputc('\n', stdout);
+        if (path != NULL) {
+            fwrite(path, len, 1, stdout);
+            fputc('\n', stdout);
+        }
+        fflush(stdout);
     }
-
-    fflush(stdout);
     pthread_mutex_unlock(&lock);
 }
 
@@ -128,14 +132,22 @@
 
 static void ParseRoots() {
     CFMutableArrayRef roots = CFArrayCreateMutable(NULL, 0, NULL);
+    bool has_private_root = false;
 
     while (TRUE) {
         fscanf(stdin, "%s", command);
         if (strcmp(command, "#") == 0 || feof(stdin)) break;
         char* path = command[0] == '|' ? command + 1 : command;
         CFArrayAppendValue(roots, strdup(path));
+        if (strcmp(path, "/") == 0 || strncasecmp(path, PRIVATE_DIR, PRIVATE_LEN) == 0) {
+            has_private_root = true;
+        }
     }
 
+    pthread_mutex_lock(&lock);
+    report_private = has_private_root;
+    pthread_mutex_unlock(&lock);
+
     PrintMountedFileSystems(roots);
 
     for (int i = 0; i < CFArrayGetCount(roots); i++) {
diff --git a/platform/analysis-api/src/com/intellij/codeInsight/intention/impl/PriorityActionWrapper.java b/platform/analysis-api/src/com/intellij/codeInsight/intention/impl/PriorityActionWrapper.java
new file mode 100644
index 0000000..ace31c9
--- /dev/null
+++ b/platform/analysis-api/src/com/intellij/codeInsight/intention/impl/PriorityActionWrapper.java
@@ -0,0 +1,90 @@
+/*
+ * 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.codeInsight.intention.impl;
+
+import com.intellij.codeInsight.intention.HighPriorityAction;
+import com.intellij.codeInsight.intention.LowPriorityAction;
+import com.intellij.codeInspection.LocalQuickFixAndIntentionActionOnPsiElement;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public abstract class PriorityActionWrapper extends LocalQuickFixAndIntentionActionOnPsiElement {
+  private final LocalQuickFixAndIntentionActionOnPsiElement fix;
+
+  private PriorityActionWrapper(PsiElement element, @NotNull LocalQuickFixAndIntentionActionOnPsiElement fix) {
+    super(element);
+    this.fix = fix;
+  }
+
+  @NotNull
+  @Override
+  public String getFamilyName() {
+    return fix.getFamilyName();
+  }
+
+  @Override
+  public void invoke(@NotNull Project project,
+                     @NotNull PsiFile file,
+                     @Nullable("is null when called from inspection") Editor editor,
+                     @NotNull PsiElement startElement,
+                     @NotNull PsiElement endElement) {
+    fix.invoke(project, file, editor, startElement, endElement);
+  }
+
+  @NotNull
+  @Override
+  public String getText() {
+    return fix.getName();
+  }
+
+  private static class HighPriorityLocalQuickFixWrapper extends PriorityActionWrapper implements HighPriorityAction {
+    protected HighPriorityLocalQuickFixWrapper(PsiElement element, @NotNull LocalQuickFixAndIntentionActionOnPsiElement fix) {
+      super(element, fix);
+    }
+  }
+
+  private static class NormalPriorityLocalQuickFixWrapper extends PriorityActionWrapper {
+    protected NormalPriorityLocalQuickFixWrapper(PsiElement element, @NotNull LocalQuickFixAndIntentionActionOnPsiElement fix) {
+      super(element, fix);
+    }
+  }
+
+
+  private static class LowPriorityLocalQuickFixWrapper extends PriorityActionWrapper implements LowPriorityAction {
+    protected LowPriorityLocalQuickFixWrapper(PsiElement element, @NotNull LocalQuickFixAndIntentionActionOnPsiElement fix) {
+      super(element, fix);
+    }
+  }
+
+  @NotNull
+  public static LocalQuickFixAndIntentionActionOnPsiElement highPriority(PsiElement element, @NotNull LocalQuickFixAndIntentionActionOnPsiElement fix) {
+    return new HighPriorityLocalQuickFixWrapper(element, fix);
+  }
+
+  @NotNull
+  public static LocalQuickFixAndIntentionActionOnPsiElement normalPriority(PsiElement element, @NotNull LocalQuickFixAndIntentionActionOnPsiElement fix) {
+    return new NormalPriorityLocalQuickFixWrapper(element, fix);
+  }
+
+  @NotNull
+  public static LocalQuickFixAndIntentionActionOnPsiElement lowPriority(PsiElement element, @NotNull LocalQuickFixAndIntentionActionOnPsiElement fix) {
+    return new LowPriorityLocalQuickFixWrapper(element, fix);
+  }
+}
diff --git a/platform/analysis-api/src/com/intellij/codeInspection/InspectionProfileEntry.java b/platform/analysis-api/src/com/intellij/codeInspection/InspectionProfileEntry.java
index a14c9f4..0b8d364 100644
--- a/platform/analysis-api/src/com/intellij/codeInspection/InspectionProfileEntry.java
+++ b/platform/analysis-api/src/com/intellij/codeInspection/InspectionProfileEntry.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.
@@ -135,7 +135,7 @@
 
   @NotNull
   public static String getShortName(@NotNull String className) {
-    return StringUtil.trimEnd(className, "Inspection");
+    return StringUtil.trimEnd(StringUtil.trimEnd(className, "Inspection"),"InspectionBase");
   }
 
   /**
diff --git a/platform/analysis-api/src/com/intellij/codeInspection/IntentionAndQuickFixAction.java b/platform/analysis-api/src/com/intellij/codeInspection/IntentionAndQuickFixAction.java
new file mode 100644
index 0000000..cebbca3
--- /dev/null
+++ b/platform/analysis-api/src/com/intellij/codeInspection/IntentionAndQuickFixAction.java
@@ -0,0 +1,71 @@
+/*
+ * 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.codeInspection;
+
+import com.intellij.codeInsight.intention.IntentionAction;
+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;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author Gregory.Shrago
+ */
+public abstract class IntentionAndQuickFixAction implements LocalQuickFix, IntentionAction{
+  public static IntentionAndQuickFixAction[] EMPTY_ARRAY = new IntentionAndQuickFixAction[0];
+
+  @Override
+  @NotNull
+  public abstract String getName();
+
+  @Override
+  @NotNull
+  public abstract String getFamilyName();
+
+  public abstract void applyFix(@NotNull Project project, final PsiFile file, @Nullable final Editor editor);
+
+  @Override
+  @NotNull
+  public final String getText() {
+    return getName();
+  }
+
+  @Override
+  public final void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
+    applyFix(project, descriptor.getPsiElement().getContainingFile(), null);
+  }
+
+  @Override
+  public final void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
+    applyFix(project, file, editor);
+  }
+
+  /**
+   *  In general case will be called if invoked as IntentionAction.
+   */
+  @Override
+  public boolean isAvailable(@NotNull final Project project, @Nullable final Editor editor, final PsiFile file) {
+    return true;
+  }
+
+  @Override
+  public boolean startInWriteAction() {
+    return true;
+  }
+}
diff --git a/platform/analysis-api/src/com/intellij/codeInspection/ProblemDescriptor.java b/platform/analysis-api/src/com/intellij/codeInspection/ProblemDescriptor.java
index be035f2..63f0818 100644
--- a/platform/analysis-api/src/com/intellij/codeInspection/ProblemDescriptor.java
+++ b/platform/analysis-api/src/com/intellij/codeInspection/ProblemDescriptor.java
@@ -46,7 +46,7 @@
   void setTextAttributes(TextAttributesKey key);
 
   /**
-   * Gets the unique object, which is the same for all of the problems of this group
+   * Gets the unique object, which has the same {@link com.intellij.lang.annotation.ProblemGroup#getProblemName()} for all of the problems of this group
    *
    * @return the problem group
    */
@@ -54,7 +54,7 @@
   ProblemGroup getProblemGroup();
 
   /**
-   * Sets the unique object, which is the same for all of the problems of this group
+   * Sets the unique object, which has the same {@link com.intellij.lang.annotation.ProblemGroup#getProblemName()} for all of the problems of this group
    *
    * @param problemGroup the problemGroup
    */
diff --git a/java/openapi/src/com/intellij/codeInspection/package.html b/platform/analysis-api/src/com/intellij/codeInspection/package.html
similarity index 100%
rename from java/openapi/src/com/intellij/codeInspection/package.html
rename to platform/analysis-api/src/com/intellij/codeInspection/package.html
diff --git a/platform/analysis-api/src/com/intellij/codeInspection/reference/RefGraphAnnotator.java b/platform/analysis-api/src/com/intellij/codeInspection/reference/RefGraphAnnotator.java
index fd7313c..e1f139c 100644
--- a/platform/analysis-api/src/com/intellij/codeInspection/reference/RefGraphAnnotator.java
+++ b/platform/analysis-api/src/com/intellij/codeInspection/reference/RefGraphAnnotator.java
@@ -15,6 +15,8 @@
  */
 package com.intellij.codeInspection.reference;
 
+import com.intellij.psi.PsiElement;
+
 /**
  * Callback which gets called while a reference graph is being built during a global
  * inspection run.
@@ -71,4 +73,16 @@
     onMarkReferenced(refWhat, refFrom, referencedFromClassInitializer);
   }
 
+
+  /**
+   * Called when 'what' element doesn't belong to the selected scope. 
+   * @param what                            the referenced element
+   * @param from                            the referencing element
+   * @param referencedFromClassInitializer if true, <code>refFrom</code> is a class and the reference
+   *                                       has been found in its initializer block.
+   */
+  public void onMarkReferenced(PsiElement what,
+                               PsiElement from,
+                               boolean referencedFromClassInitializer) {}
+
 }
diff --git a/platform/analysis-api/src/com/intellij/lang/annotation/Annotation.java b/platform/analysis-api/src/com/intellij/lang/annotation/Annotation.java
index 2750d29..d3aef6d 100644
--- a/platform/analysis-api/src/com/intellij/lang/annotation/Annotation.java
+++ b/platform/analysis-api/src/com/intellij/lang/annotation/Annotation.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -61,6 +61,7 @@
   private List<QuickFixInfo> myBatchFixes;
 
   public static class QuickFixInfo {
+    @NotNull
     public final IntentionAction quickFix;
     @NotNull
     public final TextRange textRange;
diff --git a/platform/analysis-api/src/com/intellij/lang/annotation/ProblemGroup.java b/platform/analysis-api/src/com/intellij/lang/annotation/ProblemGroup.java
index 585d087..23f010c 100644
--- a/platform/analysis-api/src/com/intellij/lang/annotation/ProblemGroup.java
+++ b/platform/analysis-api/src/com/intellij/lang/annotation/ProblemGroup.java
@@ -18,7 +18,7 @@
 import org.jetbrains.annotations.Nullable;
 
 /**
- * Unique object, which is the same for all of the problems of some group.
+ * Unique object, which has the same {@link com.intellij.lang.annotation.ProblemGroup#getProblemName()} for all of the problems of this group.
  * It is used to split some inspection to several fake inspections
  */
 public interface ProblemGroup {
diff --git a/platform/analysis-api/src/com/intellij/psi/search/GlobalSearchScopesCore.java b/platform/analysis-api/src/com/intellij/psi/search/GlobalSearchScopesCore.java
index ffea51b..072e121 100644
--- a/platform/analysis-api/src/com/intellij/psi/search/GlobalSearchScopesCore.java
+++ b/platform/analysis-api/src/com/intellij/psi/search/GlobalSearchScopesCore.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -26,8 +26,14 @@
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiManager;
 import com.intellij.psi.search.scope.packageSet.*;
+import com.intellij.util.ArrayUtil;
 import org.jetbrains.annotations.NotNull;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.BitSet;
+import java.util.List;
+
 public class GlobalSearchScopesCore {
   @NotNull
   public static GlobalSearchScope projectProductionScope(@NotNull Project project) {
@@ -216,5 +222,131 @@
       //noinspection HardCodedStringLiteral
       return "directory scope: " + myDirectory + "; withSubdirs:"+myWithSubdirectories;
     }
+
+    @Override
+    public int hashCode() {
+      return myDirectory.hashCode() *31 + (myWithSubdirectories?1:0);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+      return obj instanceof DirectoryScope &&
+             myDirectory.equals(((DirectoryScope)obj).myDirectory) &&
+             myWithSubdirectories == ((DirectoryScope)obj).myWithSubdirectories;
+    }
+
+    @NotNull
+    @Override
+    public GlobalSearchScope uniteWith(@NotNull GlobalSearchScope scope) {
+      if (equals(scope)) return this;
+      if (scope instanceof DirectoryScope) {
+        DirectoryScope other = (DirectoryScope)scope;
+        VirtualFile otherDirectory = other.myDirectory;
+        if (myWithSubdirectories && VfsUtilCore.isAncestor(myDirectory, otherDirectory, false)) return this;
+        if (other.myWithSubdirectories && VfsUtilCore.isAncestor(otherDirectory, myDirectory, false)) return other;
+        BitSet newWithSubdirectories = new BitSet();
+        newWithSubdirectories.set(0, myWithSubdirectories);
+        newWithSubdirectories.set(1, other.myWithSubdirectories);
+        return new DirectoriesScope(getProject(), new VirtualFile[]{myDirectory,otherDirectory}, newWithSubdirectories);
+      }
+      return super.uniteWith(scope);
+    }
+  }
+
+  static class DirectoriesScope extends GlobalSearchScope {
+    private final VirtualFile[] myDirectories;
+    private final BitSet myWithSubdirectories;
+
+    private DirectoriesScope(@NotNull Project project, @NotNull VirtualFile[] directories, @NotNull BitSet withSubdirectories) {
+      super(project);
+      myWithSubdirectories = withSubdirectories;
+      myDirectories = directories;
+    }
+
+    @Override
+    public boolean contains(@NotNull VirtualFile file) {
+      VirtualFile parent = file.getParent();
+      return parent != null && in(parent);
+    }
+
+    private boolean in(@NotNull VirtualFile parent) {
+      for (int i = 0; i < myDirectories.length; i++) {
+        VirtualFile directory = myDirectories[i];
+        boolean withSubdirectories = myWithSubdirectories.get(i);
+        if (withSubdirectories ? VfsUtilCore.isAncestor(directory, parent, false) : directory.equals(parent)) return true;
+      }
+      return false;
+    }
+
+    @Override
+    public int compare(@NotNull VirtualFile file1, @NotNull VirtualFile file2) {
+      return 0;
+    }
+
+    @Override
+    public boolean isSearchInModuleContent(@NotNull Module aModule) {
+      return true;
+    }
+
+    @Override
+    public boolean isSearchInLibraries() {
+      return false;
+    }
+
+    public String toString() {
+      //noinspection HardCodedStringLiteral
+      return "Directories scope: " + Arrays.asList(myDirectories);
+    }
+
+    @Override
+    public int hashCode() {
+      int result = 1;
+      for (int i = 0; i < myDirectories.length; i++) {
+        VirtualFile directory = myDirectories[i];
+        boolean withSubdirectories = myWithSubdirectories.get(i);
+        result = result*31 + directory.hashCode() *31 + (withSubdirectories?1:0);
+      }
+      return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+      return obj instanceof DirectoriesScope &&
+             Arrays.equals(myDirectories, ((DirectoriesScope)obj).myDirectories) &&
+             myWithSubdirectories.equals(((DirectoriesScope)obj).myWithSubdirectories);
+    }
+
+    @NotNull
+    @Override
+    public GlobalSearchScope uniteWith(@NotNull GlobalSearchScope scope) {
+      if (equals(scope)) {
+        return this;
+      }
+      if (scope instanceof DirectoryScope) {
+        if (in(((DirectoryScope)scope).myDirectory)) {
+          return this;
+        }
+        VirtualFile[] newDirectories = ArrayUtil.append(myDirectories, ((DirectoryScope)scope).myDirectory, VirtualFile.class);
+        BitSet newWithSubdirectories = (BitSet)myWithSubdirectories.clone();
+        newWithSubdirectories.set(myDirectories.length, ((DirectoryScope)scope).myWithSubdirectories);
+        return new DirectoriesScope(getProject(), newDirectories, newWithSubdirectories);
+      }
+      if (scope instanceof DirectoriesScope) {
+        DirectoriesScope other = (DirectoriesScope)scope;
+        List<VirtualFile> newDirectories = new ArrayList<VirtualFile>(myDirectories.length + other.myDirectories.length);
+        newDirectories.addAll(Arrays.asList(other.myDirectories));
+        BitSet newWithSubdirectories = (BitSet)myWithSubdirectories.clone();
+        VirtualFile[] directories = other.myDirectories;
+        for (int i = 0; i < directories.length; i++) {
+          VirtualFile otherDirectory = directories[i];
+          if (!in(otherDirectory)) {
+            newWithSubdirectories.set(newDirectories.size(), other.myWithSubdirectories.get(i));
+            newDirectories.add(otherDirectory);
+          }
+        }
+        return new DirectoriesScope(getProject(), newDirectories.toArray(new VirtualFile[newDirectories.size()]), newWithSubdirectories);
+      }
+      return super.uniteWith(scope);
+    }
   }
 }
diff --git a/platform/analysis-api/src/com/intellij/psi/search/scope/packageSet/PatternPackageSet.java b/platform/analysis-api/src/com/intellij/psi/search/scope/packageSet/PatternPackageSet.java
new file mode 100644
index 0000000..41ff050
--- /dev/null
+++ b/platform/analysis-api/src/com/intellij/psi/search/scope/packageSet/PatternPackageSet.java
@@ -0,0 +1,185 @@
+/*
+ * 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.psi.search.scope.packageSet;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.*;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.problems.WolfTheProblemSolver;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.File;
+import java.util.List;
+import java.util.regex.Pattern;
+
+public class PatternPackageSet extends PatternBasedPackageSet {
+  @NonNls public static final String SCOPE_TEST = "test";
+  @NonNls public static final String SCOPE_SOURCE = "src";
+  @NonNls public static final String SCOPE_LIBRARY = "lib";
+  @NonNls public static final String SCOPE_PROBLEM = "problem";
+  public static final String SCOPE_ANY = "";
+
+  private final Pattern myPattern;
+  private final Pattern myModulePattern;
+  private final Pattern myModuleGroupPattern;
+  private final String myAspectJSyntaxPattern;
+  private final String myScope;
+  private final String myModulePatternText;
+
+  public PatternPackageSet(@NonNls @Nullable String aspectPattern,
+                           @NotNull String scope,
+                           @NonNls String modulePattern) {
+    myAspectJSyntaxPattern = aspectPattern;
+    myScope = scope;
+    myModulePatternText = modulePattern;
+    Pattern mmgp = null;
+    Pattern mmp = null;
+    if (modulePattern == null || modulePattern.isEmpty()) {
+      mmp = null;
+    }
+    else {
+      if (modulePattern.startsWith("group:")) {
+        int idx = modulePattern.indexOf(':', 6);
+        if (idx == -1) idx = modulePattern.length();
+        mmgp = Pattern.compile(StringUtil.replace(modulePattern.substring(6, idx), "*", ".*"));
+        if (idx < modulePattern.length() - 1) {
+          mmp = Pattern.compile(StringUtil.replace(modulePattern.substring(idx + 1), "*", ".*"));
+        }
+      } else {
+        mmp = Pattern.compile(StringUtil.replace(modulePattern, "*", ".*"));
+      }
+    }
+    myModulePattern = mmp;
+    myModuleGroupPattern = mmgp;
+    myPattern = aspectPattern != null ? Pattern.compile(FilePatternPackageSet.convertToRegexp(aspectPattern, '.')) : null;
+  }
+
+  @Override
+  public boolean contains(VirtualFile file, @NotNull NamedScopesHolder holder) {
+    return contains(file, holder.getProject(), holder);
+  }
+
+  @Override
+  public boolean contains(VirtualFile file, @NotNull Project project, @Nullable NamedScopesHolder holder) {
+    ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
+    return matchesScope(file, project, fileIndex) && (myPattern == null || myPattern.matcher(getPackageName(file, fileIndex)).matches());
+  }
+
+  private boolean matchesScope(VirtualFile file, Project project, ProjectFileIndex fileIndex) {
+    if (file == null) return false;
+    boolean isSource = fileIndex.isInSourceContent(file);
+    if (myScope == SCOPE_ANY) {
+      return fileIndex.isInContent(file) && FilePatternPackageSet.matchesModule(myModuleGroupPattern, myModulePattern, file, fileIndex);
+    }
+    if (myScope == SCOPE_SOURCE) {
+      return isSource && !fileIndex.isInTestSourceContent(file) && FilePatternPackageSet.matchesModule(myModuleGroupPattern, myModulePattern,
+                                                                                                       file, fileIndex);
+    }
+    if (myScope == SCOPE_LIBRARY) {
+      return (fileIndex.isInLibraryClasses(file) || fileIndex.isInLibrarySource(file)) && matchesLibrary(myModulePattern, file, fileIndex);
+    }
+    if (myScope == SCOPE_TEST) {
+      return isSource && fileIndex.isInTestSourceContent(file) && FilePatternPackageSet.matchesModule(myModuleGroupPattern, myModulePattern,
+                                                                                                      file, fileIndex);
+    }
+    if (myScope == SCOPE_PROBLEM) {
+      return isSource && WolfTheProblemSolver.getInstance(project).isProblemFile(file) &&
+             FilePatternPackageSet.matchesModule(myModuleGroupPattern, myModulePattern, file, fileIndex);
+    }
+    throw new RuntimeException("Unknown scope: " + myScope);
+  }
+
+  private static String getPackageName(VirtualFile file, ProjectFileIndex fileIndex) {
+    return StringUtil.getQualifiedName(fileIndex.getPackageNameByDirectory(file.isDirectory() ? file :  file.getParent()), file.getNameWithoutExtension());
+  }
+
+  @NotNull
+  @Override
+  public PackageSet createCopy() {
+    return new PatternPackageSet(myAspectJSyntaxPattern, myScope, myModulePatternText);
+  }
+
+  @Override
+  public int getNodePriority() {
+    return 0;
+  }
+
+  @NotNull
+  @Override
+  public String getText() {
+    StringBuilder buf = new StringBuilder();
+    if (myScope != SCOPE_ANY) {
+      buf.append(myScope);
+    }
+
+    if (myModulePattern != null || myModuleGroupPattern != null) {
+      buf.append("[").append(myModulePatternText).append("]");
+    }
+
+    if (buf.length() > 0) {
+      buf.append(':');
+    }
+
+    buf.append(myAspectJSyntaxPattern);
+    return buf.toString();
+  }
+
+  @Override
+  public String getModulePattern() {
+    return myModulePatternText;
+  }
+
+  @Override
+  public boolean isOn(String oldQName) {
+    return Comparing.strEqual(oldQName, myAspectJSyntaxPattern) || //class qname
+           Comparing.strEqual(oldQName + "..*", myAspectJSyntaxPattern) || //package req
+           Comparing.strEqual(oldQName + ".*", myAspectJSyntaxPattern); //package
+  }
+
+  @Override
+  public String getPattern() {
+    return myAspectJSyntaxPattern;
+  }
+
+  public static boolean matchesLibrary(final Pattern libPattern,
+                                       final VirtualFile file,
+                                       final ProjectFileIndex fileIndex) {
+    if (libPattern != null) {
+      final List<OrderEntry> entries = fileIndex.getOrderEntriesForFile(file);
+      for (OrderEntry orderEntry : entries) {
+        if (orderEntry instanceof LibraryOrderEntry) {
+          final String libraryName = ((LibraryOrderEntry)orderEntry).getLibraryName();
+          if (libraryName != null) {
+            if (libPattern.matcher(libraryName).matches()) return true;
+          } else {
+            final String presentableName = orderEntry.getPresentableName();
+            final String fileName = new File(presentableName).getName();
+            if (libPattern.matcher(fileName).matches()) return true;
+          }
+        } else if (orderEntry instanceof JdkOrderEntry) {
+          final String jdkName = ((JdkOrderEntry)orderEntry).getJdkName();
+          if (jdkName != null && libPattern.matcher(jdkName).matches()) return true;
+        }
+      }
+      return false;
+    }
+    return true;
+  }
+}
\ No newline at end of file
diff --git a/platform/analysis-impl/src/com/intellij/codeHighlighting/EditorBoundHighlightingPass.java b/platform/analysis-impl/src/com/intellij/codeHighlighting/EditorBoundHighlightingPass.java
new file mode 100644
index 0000000..86120b5
--- /dev/null
+++ b/platform/analysis-impl/src/com/intellij/codeHighlighting/EditorBoundHighlightingPass.java
@@ -0,0 +1,41 @@
+/*
+ * 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.codeHighlighting;
+
+import com.intellij.openapi.editor.Editor;
+import com.intellij.psi.PsiFile;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * The pass which should be applied to every editor, even if there are many for this document.
+ *
+ * Ordinary {@link TextEditorHighlightingPass} is document-bound,
+ * i.e. after the pass finishes the markup is stored in the document.
+ * For example, there is no point to recalculate syntax errors for each splitted editor of the same document.
+ * This pass however is for editor-specific markup, e.g. code folding.
+ */
+public abstract class EditorBoundHighlightingPass extends TextEditorHighlightingPass {
+  @NotNull protected final Editor myEditor;
+  @NotNull protected final PsiFile myFile;
+
+  protected EditorBoundHighlightingPass(@NotNull Editor editor,
+                                        @NotNull PsiFile psiFile,
+                                        boolean runIntentionPassAfter) {
+    super(psiFile.getProject(), editor.getDocument(), runIntentionPassAfter);
+    myEditor = editor;
+    myFile = psiFile;
+  }
+}
diff --git a/platform/analysis-impl/src/com/intellij/codeHighlighting/TextEditorHighlightingPass.java b/platform/analysis-impl/src/com/intellij/codeHighlighting/TextEditorHighlightingPass.java
index 741ba29..6e30e2d 100644
--- a/platform/analysis-impl/src/com/intellij/codeHighlighting/TextEditorHighlightingPass.java
+++ b/platform/analysis-impl/src/com/intellij/codeHighlighting/TextEditorHighlightingPass.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -30,6 +30,7 @@
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import java.util.Collections;
 import java.util.List;
 
 public abstract class TextEditorHighlightingPass implements HighlightingPass {
@@ -113,9 +114,9 @@
     myId = id;
   }
 
-  @Nullable
+  @NotNull
   public List<HighlightInfo> getInfos() {
-    return null;
+    return Collections.emptyList();
   }
 
   @NotNull
diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/intention/QuickFixes.java b/platform/analysis-impl/src/com/intellij/codeInsight/intention/QuickFixes.java
new file mode 100644
index 0000000..47b382c
--- /dev/null
+++ b/platform/analysis-impl/src/com/intellij/codeInsight/intention/QuickFixes.java
@@ -0,0 +1,66 @@
+/*
+ * 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.codeInsight.intention;
+
+import com.intellij.codeInspection.IntentionAndQuickFixAction;
+import com.intellij.codeInspection.LocalQuickFixAndIntentionActionOnPsiElement;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public class QuickFixes {
+  public static final LocalQuickFixAndIntentionActionOnPsiElement EMPTY_FIX = new LocalQuickFixAndIntentionActionOnPsiElement(null) {
+    @Override
+    public void invoke(@NotNull Project project, @NotNull PsiFile file, @Nullable("is null when called from inspection") Editor editor, @NotNull PsiElement psiElement, @NotNull PsiElement psiElement2) {
+      throw new UnsupportedOperationException();
+    }
+
+    @NotNull
+    @Override
+    public String getText() {
+      throw new UnsupportedOperationException();
+    }
+
+    @NotNull
+    @Override
+    public String getFamilyName() {
+      throw new UnsupportedOperationException();
+    }
+  };
+
+  public static final IntentionAndQuickFixAction EMPTY_ACTION = new IntentionAndQuickFixAction() {
+    @NotNull
+    @Override
+    public String getName() {
+      throw new UnsupportedOperationException();
+    }
+
+    @NotNull
+    @Override
+    public String getFamilyName() {
+      throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void applyFix(@NotNull Project project, PsiFile file, @Nullable Editor editor) {
+      throw new UnsupportedOperationException();
+    }
+  };
+
+}
diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ExternalAnnotatorInspectionVisitor.java b/platform/analysis-impl/src/com/intellij/codeInspection/ExternalAnnotatorInspectionVisitor.java
index f2a7c67..2dfa17d 100644
--- a/platform/analysis-impl/src/com/intellij/codeInspection/ExternalAnnotatorInspectionVisitor.java
+++ b/platform/analysis-impl/src/com/intellij/codeInspection/ExternalAnnotatorInspectionVisitor.java
@@ -16,17 +16,23 @@
 package com.intellij.codeInspection;
 
 import com.intellij.codeInsight.daemon.impl.AnnotationHolderImpl;
+import com.intellij.codeInsight.intention.IntentionAction;
 import com.intellij.lang.annotation.Annotation;
 import com.intellij.lang.annotation.AnnotationSession;
 import com.intellij.lang.annotation.ExternalAnnotator;
 import com.intellij.lang.annotation.HighlightSeverity;
 import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Iconable;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiElementVisitor;
 import com.intellij.psi.PsiFile;
+import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
-import java.util.ArrayList;
+import javax.swing.*;
+import java.util.IdentityHashMap;
 import java.util.List;
 
 public class ExternalAnnotatorInspectionVisitor extends PsiElementVisitor {
@@ -34,12 +40,18 @@
 
   private final ProblemsHolder myHolder;
   private final ExternalAnnotator myAnnotator;
-  private final boolean myOnTheFly;
+  private final boolean myIsOnTheFly;
 
-  public ExternalAnnotatorInspectionVisitor(ProblemsHolder holder, ExternalAnnotator annotator, boolean onTheFly) {
+  public ExternalAnnotatorInspectionVisitor(ProblemsHolder holder, ExternalAnnotator annotator, boolean isOnTheFly) {
     myHolder = holder;
     myAnnotator = annotator;
-    myOnTheFly = onTheFly;
+    myIsOnTheFly = isOnTheFly;
+  }
+
+  @Override
+  public void visitFile(PsiFile file) {
+    ProblemDescriptor[] descriptors = checkFileWithExternalAnnotator(file, myHolder.getManager(), myIsOnTheFly, myAnnotator);
+    addDescriptors(descriptors);
   }
 
   @NotNull
@@ -48,7 +60,7 @@
                                                                                  boolean isOnTheFly,
                                                                                  @NotNull ExternalAnnotator<Init,Result> annotator) {
     if (isOnTheFly) {
-      // concrete JSLinterExternalAnnotator implementation does this work
+      // ExternalAnnotator does this work
       return ProblemDescriptor.EMPTY_ARRAY;
     }
 
@@ -73,8 +85,9 @@
       return ProblemDescriptor.EMPTY_ARRAY;
     }
 
-    final List<ProblemDescriptor> problems = new ArrayList<ProblemDescriptor>();
-    for (final Annotation annotation : annotations) {
+    List<ProblemDescriptor> problems = ContainerUtil.newArrayListWithCapacity(annotations.size());
+    IdentityHashMap<IntentionAction, LocalQuickFix> quickFixMappingCache = ContainerUtil.newIdentityHashMap();
+    for (Annotation annotation : annotations) {
       if (annotation.getSeverity() == HighlightSeverity.INFORMATION ||
           annotation.getStartOffset() == annotation.getEndOffset()) {
         continue;
@@ -86,19 +99,43 @@
         continue;
       }
 
-      problems.add(manager.createProblemDescriptor(startElement, endElement, annotation.getMessage(),
-                                                   ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false));
+      LocalQuickFix[] quickFixes = toLocalQuickFixes(annotation.getQuickFixes(), quickFixMappingCache);
+      ProblemDescriptor descriptor = manager.createProblemDescriptor(startElement,
+                                                                     endElement,
+                                                                     annotation.getMessage(),
+                                                                     ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
+                                                                     false,
+                                                                     quickFixes);
+      problems.add(descriptor);
     }
     return problems.toArray(new ProblemDescriptor[problems.size()]);
   }
 
-  @Override
-  public void visitFile(PsiFile file) {
-    if (!myOnTheFly) {
-      ProblemDescriptor[] descriptors = checkFileWithExternalAnnotator(file, myHolder.getManager(),
-                                                                       false, myAnnotator);
-      addDescriptors(descriptors);
+  @NotNull
+  private static LocalQuickFix[] toLocalQuickFixes(@Nullable List<Annotation.QuickFixInfo> fixInfos,
+                                                   @NotNull IdentityHashMap<IntentionAction, LocalQuickFix> quickFixMappingCache) {
+    if (fixInfos == null || fixInfos.isEmpty()) {
+      return LocalQuickFix.EMPTY_ARRAY;
     }
+    LocalQuickFix[] result = new LocalQuickFix[fixInfos.size()];
+    int i = 0;
+    for (Annotation.QuickFixInfo fixInfo : fixInfos) {
+      IntentionAction intentionAction = fixInfo.quickFix;
+      final LocalQuickFix fix;
+      if (intentionAction instanceof LocalQuickFix) {
+        fix = (LocalQuickFix) intentionAction;
+      }
+      else {
+        LocalQuickFix lqf = quickFixMappingCache.get(intentionAction);
+        if (lqf == null) {
+          lqf = new LocalQuickFixBackedByIntentionAction(intentionAction);
+          quickFixMappingCache.put(intentionAction, lqf);
+        }
+        fix = lqf;
+      }
+      result[i++] = fix;
+    }
+    return result;
   }
 
   private void addDescriptors(@NotNull ProblemDescriptor[] descriptors) {
@@ -107,4 +144,65 @@
       myHolder.registerProblem(descriptor);
     }
   }
+
+  public static class LocalQuickFixBackedByIntentionAction implements LocalQuickFix, Iconable {
+    private final IntentionAction myAction;
+
+    public LocalQuickFixBackedByIntentionAction(@NotNull IntentionAction action) {
+      myAction = action;
+    }
+
+    @NotNull
+    @Override
+    public String getName() {
+      return myAction.getText();
+    }
+
+    @NotNull
+    @Override
+    public String getFamilyName() {
+      return myAction.getFamilyName();
+    }
+
+    @Override
+    public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
+      myAction.invoke(project, null, getPsiFile(descriptor));
+    }
+
+    @Nullable
+    private static PsiFile getPsiFile(@NotNull ProblemDescriptor descriptor) {
+      PsiElement startElement = descriptor.getStartElement();
+      if (startElement != null) {
+        return startElement.getContainingFile();
+      }
+      PsiElement endElement = descriptor.getEndElement();
+      if (endElement != null) {
+        return endElement.getContainingFile();
+      }
+      return null;
+    }
+
+    @Override
+    public Icon getIcon(@IconFlags int flags) {
+      if (myAction instanceof Iconable) {
+        return ((Iconable) myAction).getIcon(flags);
+      }
+      return null;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+
+      LocalQuickFixBackedByIntentionAction action = (LocalQuickFixBackedByIntentionAction)o;
+
+      return myAction.equals(action.myAction);
+    }
+
+    @Override
+    public int hashCode() {
+      return myAction.hashCode();
+    }
+  }
 }
diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/GlobalInspectionUtil.java b/platform/analysis-impl/src/com/intellij/codeInspection/GlobalInspectionUtil.java
index 43a9be4..8d07c3c 100644
--- a/platform/analysis-impl/src/com/intellij/codeInspection/GlobalInspectionUtil.java
+++ b/platform/analysis-impl/src/com/intellij/codeInspection/GlobalInspectionUtil.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.
@@ -44,7 +44,7 @@
     return message + LOC_MARKER;
   }
 
-  public static void createProblem(PsiElement elt,
+  public static void createProblem(@NotNull PsiElement elt,
                                    @NotNull HighlightInfo info,
                                    TextRange range,
                                    @Nullable ProblemGroup problemGroup,
diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ProblemDescriptorUtil.java b/platform/analysis-impl/src/com/intellij/codeInspection/ProblemDescriptorUtil.java
index b5f326b..93f40c4 100644
--- a/platform/analysis-impl/src/com/intellij/codeInspection/ProblemDescriptorUtil.java
+++ b/platform/analysis-impl/src/com/intellij/codeInspection/ProblemDescriptorUtil.java
@@ -40,7 +40,7 @@
   @interface FlagConstant {
   }
 
-  public static Couple<String> XML_CODE_MARKER = Couple.newOne("<xml-code>", "</xml-code>");
+  public static Couple<String> XML_CODE_MARKER = Couple.of("<xml-code>", "</xml-code>");
 
   public static String extractHighlightedText(@NotNull CommonProblemDescriptor descriptor, PsiElement psiElement) {
     if (psiElement == null || !psiElement.isValid()) return "";
diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/SuppressionUtil.java b/platform/analysis-impl/src/com/intellij/codeInspection/SuppressionUtil.java
index 89ed9ab..51ec4bb 100644
--- a/platform/analysis-impl/src/com/intellij/codeInspection/SuppressionUtil.java
+++ b/platform/analysis-impl/src/com/intellij/codeInspection/SuppressionUtil.java
@@ -122,7 +122,7 @@
       final String prefix = commenter.getBlockCommentPrefix();
       final String suffix = commenter.getBlockCommentSuffix();
       if (prefix != null || suffix != null) {
-        return Couple.newOne(StringUtil.notNullize(prefix), StringUtil.notNullize(suffix));
+        return Couple.of(StringUtil.notNullize(prefix), StringUtil.notNullize(suffix));
       }
     }
     return null;
diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/actions/CleanupIntention.java b/platform/analysis-impl/src/com/intellij/codeInspection/actions/CleanupIntention.java
index bdf25c6..d55671b 100644
--- a/platform/analysis-impl/src/com/intellij/codeInspection/actions/CleanupIntention.java
+++ b/platform/analysis-impl/src/com/intellij/codeInspection/actions/CleanupIntention.java
@@ -56,7 +56,7 @@
     final AnalysisScope scope = getScope(project, file);
     if (scope != null) {
       final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
-      globalContext.codeCleanup(project, scope, profile, getText(), null);
+      globalContext.codeCleanup(project, scope, profile, getText(), null, false);
     }
   }
 
diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextBase.java b/platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextBase.java
index 3c7f552..35f1e4c 100644
--- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextBase.java
+++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextBase.java
@@ -39,6 +39,7 @@
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiManager;
+import com.intellij.psi.search.LocalSearchScope;
 import com.intellij.psi.search.scope.packageSet.NamedScope;
 import com.intellij.util.Function;
 import com.intellij.util.containers.ContainerUtil;
@@ -409,13 +410,19 @@
   public void codeCleanup(final Project project,
                           final AnalysisScope scope,
                           final InspectionProfile profile,
-                          final String commandName, Runnable postRunnable) {}
+                          final String commandName, Runnable postRunnable, 
+                          final boolean modal) {}
 
   public static void codeCleanup(Project project, AnalysisScope scope, Runnable runnable) {
-    GlobalInspectionContextBase globalContext =
-      (GlobalInspectionContextBase)InspectionManager.getInstance(project).createNewGlobalContext(false);
+    GlobalInspectionContextBase globalContext = (GlobalInspectionContextBase)InspectionManager.getInstance(project).createNewGlobalContext(false);
     final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
-    globalContext.codeCleanup(project, scope, profile, null, runnable);
+    globalContext.codeCleanup(project, scope, profile, null, runnable, false);
+  }
+
+  public static void cleanupElements(Project project, Runnable runnable, PsiElement... scope) {
+    GlobalInspectionContextBase globalContext = (GlobalInspectionContextBase)InspectionManager.getInstance(project).createNewGlobalContext(false);
+    final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
+    globalContext.codeCleanup(project, new AnalysisScope(new LocalSearchScope(scope), project), profile, null, runnable, true);
   }
 
    public void close(boolean noSuspisiousCodeFound) {
diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefManagerImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefManagerImpl.java
index 529db44..c417f72 100644
--- a/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefManagerImpl.java
+++ b/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefManagerImpl.java
@@ -162,6 +162,14 @@
     }
   }
 
+  public void fireNodeMarkedReferenced(PsiElement what,
+                                       PsiElement from,
+                                       boolean referencedFromClassInitializer) {
+    for (RefGraphAnnotator annotator : myGraphAnnotators) {
+      annotator.onMarkReferenced(what, from, referencedFromClassInitializer);
+    }
+  }
+
   public void fireBuildReferences(RefElement refElement) {
     for (RefGraphAnnotator annotator : myGraphAnnotators) {
       annotator.onReferencesBuild(refElement);
diff --git a/platform/core-api/src/com/intellij/codeInsight/PsiEquivalenceUtil.java b/platform/core-api/src/com/intellij/codeInsight/PsiEquivalenceUtil.java
index 9a34f81..44a46de 100644
--- a/platform/core-api/src/com/intellij/codeInsight/PsiEquivalenceUtil.java
+++ b/platform/core-api/src/com/intellij/codeInsight/PsiEquivalenceUtil.java
@@ -118,7 +118,7 @@
     findChildRangeDuplicates(first, last, scope, new PairConsumer<PsiElement, PsiElement>() {
       @Override
       public void consume(final PsiElement start, final PsiElement end) {
-        result.add(Couple.newOne(start, end));
+        result.add(Couple.of(start, end));
       }
     });
   }
diff --git a/platform/core-api/src/com/intellij/lang/folding/CustomFoldingBuilder.java b/platform/core-api/src/com/intellij/lang/folding/CustomFoldingBuilder.java
index f9f3148..f43c1c9 100644
--- a/platform/core-api/src/com/intellij/lang/folding/CustomFoldingBuilder.java
+++ b/platform/core-api/src/com/intellij/lang/folding/CustomFoldingBuilder.java
@@ -1,8 +1,23 @@
+/*
+ * 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.folding;
 
 import com.intellij.lang.ASTNode;
 import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.project.DumbAware;
+import com.intellij.openapi.project.PossiblyDumbAware;
 import com.intellij.openapi.util.TextRange;
 import com.intellij.psi.PsiComment;
 import com.intellij.psi.PsiElement;
@@ -18,7 +33,7 @@
  * 
  * @author Rustam Vishnyakov
  */
-public abstract class CustomFoldingBuilder extends FoldingBuilderEx implements DumbAware {
+public abstract class CustomFoldingBuilder extends FoldingBuilderEx implements PossiblyDumbAware {
 
   private CustomFoldingProvider myDefaultProvider;
   private static final int MAX_LOOKUP_DEPTH = 10;
@@ -199,4 +214,16 @@
       return owner;
     }
   }
+
+  /**
+   * Checks if the folding ranges can be created in the Dumb Mode. In the most of
+   * language implementations the method returns true, but for strong context-dependent
+   * languages (like ObjC/C++) overridden method returns false.
+   *
+   * @return True if the folding ranges can be created in the Dumb Mode
+   */
+  @Override
+  public boolean isDumbAware() {
+    return true;
+  }
 }
diff --git a/platform/core-api/src/com/intellij/lexer/MergeFunction.java b/platform/core-api/src/com/intellij/lexer/MergeFunction.java
new file mode 100644
index 0000000..6d909c1
--- /dev/null
+++ b/platform/core-api/src/com/intellij/lexer/MergeFunction.java
@@ -0,0 +1,26 @@
+/*
+ * 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.lexer;
+
+import com.intellij.psi.tree.IElementType;
+
+/**
+ * @author Anna Bulenkova
+ */
+
+public interface MergeFunction {
+  IElementType merge(IElementType type, Lexer originalLexer);
+}
diff --git a/platform/core-api/src/com/intellij/lexer/MergingLexerAdapter.java b/platform/core-api/src/com/intellij/lexer/MergingLexerAdapter.java
index 3b99f83..08152b3 100644
--- a/platform/core-api/src/com/intellij/lexer/MergingLexerAdapter.java
+++ b/platform/core-api/src/com/intellij/lexer/MergingLexerAdapter.java
@@ -19,21 +19,32 @@
 import com.intellij.psi.tree.TokenSet;
 
 public class MergingLexerAdapter extends MergingLexerAdapterBase {
+  private final TokenSet myTokenSet;
+  private final MergeFunction myMergeFunction = new MyMergeFunction();
+
   public MergingLexerAdapter(final Lexer original, final TokenSet tokensToMerge){
-    super(original, new MergeFunction() {
+    super(original);
+    myTokenSet = tokensToMerge;
+  }
+
+  @Override
+  public MergeFunction getMergeFunction() {
+    return myMergeFunction;
+  }
+
+  private class MyMergeFunction implements MergeFunction {
       @Override
       public IElementType merge(final IElementType type, final Lexer originalLexer) {
-        if (!tokensToMerge.contains(type)){
+        if (!myTokenSet.contains(type)) {
           return type;
         }
 
-        while(true){
+        while (true) {
           final IElementType tokenType = originalLexer.getTokenType();
           if (tokenType != type) break;
           originalLexer.advance();
         }
         return type;
       }
-    });
   }
 }
\ No newline at end of file
diff --git a/platform/core-api/src/com/intellij/lexer/MergingLexerAdapterBase.java b/platform/core-api/src/com/intellij/lexer/MergingLexerAdapterBase.java
index 2d55098a..bb76d3f 100644
--- a/platform/core-api/src/com/intellij/lexer/MergingLexerAdapterBase.java
+++ b/platform/core-api/src/com/intellij/lexer/MergingLexerAdapterBase.java
@@ -18,17 +18,17 @@
 import com.intellij.psi.tree.IElementType;
 import org.jetbrains.annotations.NotNull;
 
-public class MergingLexerAdapterBase extends DelegateLexer {
+public abstract class MergingLexerAdapterBase extends DelegateLexer {
   private IElementType myTokenType;
   private int myState;
   private int myTokenStart;
-  private final MergeFunction myMergeFunction;
 
-  public MergingLexerAdapterBase(final Lexer original, final MergeFunction mergeFunction){
+  public MergingLexerAdapterBase(final Lexer original){
     super(original);
-    myMergeFunction = mergeFunction;
   }
 
+  public abstract MergeFunction getMergeFunction();
+
   @Override
   public void start(@NotNull final CharSequence buffer, final int startOffset, final int endOffset, final int initialState) {
     super.start(buffer, startOffset, endOffset, initialState);
@@ -73,7 +73,7 @@
       myState = orig.getState();
       if (myTokenType == null) return;
       orig.advance();
-      myTokenType = myMergeFunction.merge(myTokenType, orig);
+      myTokenType = getMergeFunction().merge(myTokenType, orig);
     }
   }
 
@@ -133,7 +133,4 @@
     }
   }
 
-  protected interface MergeFunction {
-    IElementType merge(IElementType type, Lexer originalLexer);
-  }
 }
diff --git a/platform/core-api/src/com/intellij/openapi/editor/colors/CodeInsightColors.java b/platform/core-api/src/com/intellij/openapi/editor/colors/CodeInsightColors.java
index ede0246..3bcc0f0 100644
--- a/platform/core-api/src/com/intellij/openapi/editor/colors/CodeInsightColors.java
+++ b/platform/core-api/src/com/intellij/openapi/editor/colors/CodeInsightColors.java
@@ -65,6 +65,7 @@
   TextAttributesKey FOLLOWED_HYPERLINK_ATTRIBUTES = TextAttributesKey.createTextAttributesKey("FOLLOWED_HYPERLINK_ATTRIBUTES");
 
   TextAttributesKey TODO_DEFAULT_ATTRIBUTES = TextAttributesKey.createTextAttributesKey("TODO_DEFAULT_ATTRIBUTES");
+  TextAttributesKey BOOKMARKS_ATTRIBUTES = TextAttributesKey.createTextAttributesKey("BOOKMARKS_ATTRIBUTES");
 
 // Colors
   ColorKey METHOD_SEPARATORS_COLOR = ColorKey.createColorKey("METHOD_SEPARATORS_COLOR");
diff --git a/platform/core-api/src/com/intellij/openapi/module/ModuleServiceManager.java b/platform/core-api/src/com/intellij/openapi/module/ModuleServiceManager.java
index da0c385..1c32e0e 100644
--- a/platform/core-api/src/com/intellij/openapi/module/ModuleServiceManager.java
+++ b/platform/core-api/src/com/intellij/openapi/module/ModuleServiceManager.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.
@@ -26,6 +26,6 @@
   }
 
   public static <T> T getService(@NotNull Module module, @NotNull Class<T> serviceClass) {
-    return (T)module.getPicoContainer().getComponentInstance(serviceClass.getName());
+    return (T)module.getPicoContainer().getComponentInstance(serviceClass);
   }
 }
\ No newline at end of file
diff --git a/platform/core-api/src/com/intellij/openapi/vfs/impl/ArchiveHandler.java b/platform/core-api/src/com/intellij/openapi/vfs/impl/ArchiveHandler.java
index 55e3bbc..835208a 100644
--- a/platform/core-api/src/com/intellij/openapi/vfs/impl/ArchiveHandler.java
+++ b/platform/core-api/src/com/intellij/openapi/vfs/impl/ArchiveHandler.java
@@ -16,7 +16,7 @@
 package com.intellij.openapi.vfs.impl;
 
 import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.Couple;
+import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.io.FileAttributes;
 import com.intellij.openapi.util.io.FileSystemUtil;
 import com.intellij.reference.SoftReference;
@@ -138,7 +138,7 @@
   protected EntryInfo getOrCreate(@NotNull Map<String, EntryInfo> map, @NotNull String entryName) {
     EntryInfo entry = map.get(entryName);
     if (entry == null) {
-      Couple<String> path = splitPath(entryName);
+      Pair<String, String> path = splitPath(entryName);
       EntryInfo parentEntry = getOrCreate(map, path.first);
       entry = new EntryInfo(parentEntry, path.second, true, DEFAULT_LENGTH, DEFAULT_TIMESTAMP);
       map.put(entryName, entry);
@@ -147,11 +147,11 @@
   }
 
   @NotNull
-  protected Couple<String> splitPath(@NotNull String entryName) {
+  protected Pair<String, String> splitPath(@NotNull String entryName) {
     int p = entryName.lastIndexOf('/');
     String parentName = p > 0 ? entryName.substring(0, p) : "";
     String shortName = p > 0 ? entryName.substring(p + 1) : entryName;
-    return Couple.newOne(parentName, shortName);
+    return Pair.create(parentName, shortName);
   }
 
   @NotNull
diff --git a/platform/core-api/src/com/intellij/psi/PsiElement.java b/platform/core-api/src/com/intellij/psi/PsiElement.java
index 7db1ad5..39300b5 100644
--- a/platform/core-api/src/com/intellij/psi/PsiElement.java
+++ b/platform/core-api/src/com/intellij/psi/PsiElement.java
@@ -375,11 +375,25 @@
   PsiElement replace(@NotNull PsiElement newElement) throws IncorrectOperationException;
 
   /**
-   * Checks if the PSI element corresponds to the current state of the underlying
-   * document. The element is no longer valid after the document has been reparsed
-   * and a new PSI tree has been built for it.
+   * Checks if this PSI element is valid. Valid elements and their hierarchy members
+   * can be accessed for reading and writing. Valid elements can still correspond to
+   * underlying documents whose text is different, when those documents have been changed
+   * and not yet committed ({@link com.intellij.psi.PsiDocumentManager#commitDocument(com.intellij.openapi.editor.Document)}).
+   * (In this case an attempt to change PSI will result in an exception).
+   *
+   * Any access to invalid elements results in {@link com.intellij.psi.PsiInvalidElementAccessException}.
+   *
+   * Once invalid, elements can't become valid again.
+   *
+   * Elements become invalid in following cases:
+   * <ul>
+   *   <li>They have been deleted via PSI operation ({@link #delete()})</li>
+   *   <li>They have been deleted as a result of an incremental reparse (document commit)</li>
+   *   <li>Their containing file has been changed externally, or renamed so that its PSI had to be rebuilt from scratch</li>
+   * </ul>
    *
    * @return true if the element is valid, false otherwise.
+   * @see com.intellij.psi.util.PsiUtilCore#ensureValid(PsiElement)
    */
   boolean isValid();
 
diff --git a/platform/core-api/src/com/intellij/psi/PsiInvalidElementAccessException.java b/platform/core-api/src/com/intellij/psi/PsiInvalidElementAccessException.java
index 91445df..fb2ae2c 100644
--- a/platform/core-api/src/com/intellij/psi/PsiInvalidElementAccessException.java
+++ b/platform/core-api/src/com/intellij/psi/PsiInvalidElementAccessException.java
@@ -62,6 +62,9 @@
     if (element == null) {
       myMessage = message;
       myDiagnostic = Attachment.EMPTY_ARRAY;
+    } else if (element == PsiUtilCore.NULL_PSI_ELEMENT) {
+      myMessage = "NULL_PSI_ELEMENT ;" + message;
+      myDiagnostic = Attachment.EMPTY_ARRAY;
     } else {
       boolean recursiveInvocation = Boolean.TRUE.equals(element.getUserData(REPORTING_EXCEPTION));
       element.putUserData(REPORTING_EXCEPTION, Boolean.TRUE);
@@ -142,7 +145,6 @@
       if (context != null && !context.isValid()) {
         return "invalid context: " + reason(context);
       }
-      return "non-physical provider: " + provider; // "dummy" file?
     }
     PsiManager manager = file.getManager();
     if (manager.getProject().isDisposed()) return "project is disposed";
@@ -151,6 +153,9 @@
 
     FileViewProvider provider1 = manager.findViewProvider(vFile);
     if (provider != provider1) return "different providers: "+provider+"("+Integer.toHexString(System.identityHashCode(provider))+"); "+provider1+"("+Integer.toHexString(System.identityHashCode(provider1))+")";
+    if (!provider.isPhysical()) {
+      return "non-physical provider: " + provider; // "dummy" file?
+    }
     return "psi is outdated";
   }
 
diff --git a/platform/lang-api/src/com/intellij/psi/ReferenceProviderType.java b/platform/core-api/src/com/intellij/psi/ReferenceProviderType.java
similarity index 100%
rename from platform/lang-api/src/com/intellij/psi/ReferenceProviderType.java
rename to platform/core-api/src/com/intellij/psi/ReferenceProviderType.java
diff --git a/platform/core-api/src/com/intellij/psi/search/NonClasspathDirectoryScope.java b/platform/core-api/src/com/intellij/psi/search/NonClasspathDirectoryScope.java
new file mode 100644
index 0000000..069017d
--- /dev/null
+++ b/platform/core-api/src/com/intellij/psi/search/NonClasspathDirectoryScope.java
@@ -0,0 +1,92 @@
+/*
+ * 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.psi.search;
+
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.vfs.VfsUtilCore;
+import com.intellij.openapi.vfs.VirtualFile;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+/**
+ * @author peter
+ */
+public class NonClasspathDirectoryScope extends GlobalSearchScope {
+  private final VirtualFile myRoot;
+
+  public NonClasspathDirectoryScope(@NotNull VirtualFile root) {
+    myRoot = root;
+  }
+
+  @Override
+  public boolean isSearchOutsideRootModel() {
+    return true;
+  }
+
+  @NotNull
+  public static GlobalSearchScope compose(List<VirtualFile> roots) {
+    if (roots.isEmpty()) {
+      return EMPTY_SCOPE;
+    }
+
+    GlobalSearchScope scope = new NonClasspathDirectoryScope(roots.get(0));
+    for (int i = 1; i < roots.size(); i++) {
+      scope = scope.uniteWith(new NonClasspathDirectoryScope(roots.get(i)));
+    }
+    return scope;
+  }
+
+  @Override
+  public boolean contains(@NotNull VirtualFile file) {
+    return VfsUtilCore.isAncestor(myRoot, file, false);
+  }
+
+  @Override
+  public int compare(@NotNull VirtualFile file1, @NotNull VirtualFile file2) {
+    return 0;
+  }
+
+  @Override
+  public boolean isSearchInModuleContent(@NotNull Module aModule) {
+    return false;
+  }
+
+  @Override
+  public boolean isSearchInLibraries() {
+    return false;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+    if (!(o instanceof NonClasspathDirectoryScope)) return false;
+
+    NonClasspathDirectoryScope that = (NonClasspathDirectoryScope)o;
+
+    if (!myRoot.equals(that.myRoot)) return false;
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    int result = super.hashCode();
+    result = 31 * result + myRoot.hashCode();
+    return result;
+  }
+}
diff --git a/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java b/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java
index bb6273b..f305b6e 100644
--- a/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java
+++ b/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java
@@ -223,7 +223,7 @@
    * @return first found element, or null if nothing found.
    */
   @Nullable
-  @Contract("null, _, _ -> null")
+  @Contract("null, _ -> null")
   public static <T extends PsiElement> T findChildOfAnyType(@Nullable final PsiElement element, @NotNull final Class<? extends T>... classes) {
     return findChildOfAnyType(element, true, classes);
   }
diff --git a/platform/core-api/src/com/intellij/psi/util/PsiUtilCore.java b/platform/core-api/src/com/intellij/psi/util/PsiUtilCore.java
index 0328899..8977da5 100644
--- a/platform/core-api/src/com/intellij/psi/util/PsiUtilCore.java
+++ b/platform/core-api/src/com/intellij/psi/util/PsiUtilCore.java
@@ -451,6 +451,12 @@
     return language;
   }
 
+  /**
+   * Checks if the element is valid. If not, throws {@link com.intellij.psi.PsiInvalidElementAccessException} with
+   * a meaningful message that points to the reasons why the element is not valid and may contain the stack trace
+   * when it was invalidated.
+   * @param element
+   */
   public static void ensureValid(@NotNull PsiElement element) {
     if (!element.isValid()) {
       TimeoutUtil.sleep(1); // to see if processing in another thread suddenly makes the element valid again (which is a bug)
diff --git a/platform/core-api/src/com/intellij/util/IconUtil.java b/platform/core-api/src/com/intellij/util/IconUtil.java
index d1f1d62..28ff9df 100644
--- a/platform/core-api/src/com/intellij/util/IconUtil.java
+++ b/platform/core-api/src/com/intellij/util/IconUtil.java
@@ -380,6 +380,7 @@
           AffineTransform transform = AffineTransform.getScaleInstance(scale, scale);
           transform.preConcatenate(g2d.getTransform());
           g2d.setTransform(transform);
+          g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
           source.paintIcon(c, g2d, x, y);
         } finally {
           g2d.dispose();
diff --git a/platform/core-impl/src/com/intellij/core/CoreApplicationEnvironment.java b/platform/core-impl/src/com/intellij/core/CoreApplicationEnvironment.java
index 4fb5cc3..2d204dc 100644
--- a/platform/core-impl/src/com/intellij/core/CoreApplicationEnvironment.java
+++ b/platform/core-impl/src/com/intellij/core/CoreApplicationEnvironment.java
@@ -15,6 +15,7 @@
  */
 package com.intellij.core;
 
+import com.intellij.codeInsight.folding.CodeFoldingSettings;
 import com.intellij.concurrency.*;
 import com.intellij.lang.*;
 import com.intellij.lang.impl.PsiBuilderFactoryImpl;
@@ -34,7 +35,9 @@
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.fileTypes.*;
 import com.intellij.openapi.progress.*;
+import com.intellij.openapi.util.ClassExtension;
 import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.KeyedExtensionCollector;
 import com.intellij.openapi.util.StaticGetter;
 import com.intellij.openapi.vfs.VirtualFileManager;
 import com.intellij.openapi.vfs.VirtualFileSystem;
@@ -125,6 +128,7 @@
     ProgressIndicatorProvider.ourInstance = createProgressIndicatorProvider();
 
     myApplication.registerService(JobLauncher.class, createJobLauncher());
+    myApplication.registerService(CodeFoldingSettings.class, new CodeFoldingSettings());
   }
 
   public <T> void registerApplicationService(@NotNull Class<T> serviceInterface, @NotNull T serviceImplementation) {
@@ -274,13 +278,7 @@
   }
 
   public <T> void addExplicitExtension(final LanguageExtension<T> instance, final Language language, final T object) {
-    instance.addExplicitExtension(language, object);
-    Disposer.register(myParentDisposable, new Disposable() {
-      @Override
-      public void dispose() {
-        instance.removeExplicitExtension(language, object);
-      }
-    });
+    doAddExplicitExtension(instance, language, object);
   }
 
   public void registerParserDefinition(Language language, ParserDefinition parserDefinition) {
@@ -288,15 +286,23 @@
   }
 
   public <T> void addExplicitExtension(@NotNull final FileTypeExtension<T> instance, @NotNull final FileType fileType, @NotNull final T object) {
-    instance.addExplicitExtension(fileType, object);
+    doAddExplicitExtension(instance, fileType, object);
+  }
+
+  private <T,U> void doAddExplicitExtension(@NotNull final KeyedExtensionCollector<T,U> instance, @NotNull final U key, @NotNull final T object) {
+    instance.addExplicitExtension(key, object);
     Disposer.register(myParentDisposable, new Disposable() {
       @Override
       public void dispose() {
-        instance.removeExplicitExtension(fileType, object);
+        instance.removeExplicitExtension(key, object);
       }
     });
   }
 
+  public <T> void addExplicitExtension(@NotNull final ClassExtension<T> instance, @NotNull final Class aClass, @NotNull final T object) {
+    doAddExplicitExtension(instance, aClass, object);
+  }
+
   public <T> void addExtension(ExtensionPointName<T> name, final T extension) {
     final ExtensionPoint<T> extensionPoint = Extensions.getRootArea().getExtensionPoint(name);
     extensionPoint.registerExtension(extension);
diff --git a/platform/core-impl/src/com/intellij/mock/MockFileDocumentManagerImpl.java b/platform/core-impl/src/com/intellij/mock/MockFileDocumentManagerImpl.java
index cae738a..ffaba2b 100644
--- a/platform/core-impl/src/com/intellij/mock/MockFileDocumentManagerImpl.java
+++ b/platform/core-impl/src/com/intellij/mock/MockFileDocumentManagerImpl.java
@@ -23,20 +23,17 @@
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Key;
 import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.reference.SoftReference;
 import com.intellij.util.Function;
 import com.intellij.util.containers.WeakFactoryMap;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.lang.ref.Reference;
-
 public class MockFileDocumentManagerImpl extends FileDocumentManager {
   private static final Key<VirtualFile> MOCK_VIRTUAL_FILE_KEY = Key.create("MockVirtualFile");
   private final Function<CharSequence, Document> myFactory;
-  @Nullable private final Key<Reference<Document>> myCachedDocumentKey;
+  @Nullable private final Key<Document> myCachedDocumentKey;
 
-  public MockFileDocumentManagerImpl(Function<CharSequence, Document> factory, @Nullable Key<Reference<Document>> cachedDocumentKey) {
+  public MockFileDocumentManagerImpl(Function<CharSequence, Document> factory, @Nullable Key<Document> cachedDocumentKey) {
     myFactory = factory;
     myCachedDocumentKey = cachedDocumentKey;
   }
@@ -66,8 +63,7 @@
   @Override
   public Document getCachedDocument(@NotNull VirtualFile file) {
     if (myCachedDocumentKey != null) {
-      Reference<Document> reference = file.getUserData(myCachedDocumentKey);
-      return SoftReference.dereference(reference);
+      return file.getUserData(myCachedDocumentKey);
     }
     return null;
   }
diff --git a/platform/core-impl/src/com/intellij/openapi/util/JDOMExternalizableAdapter.java b/platform/core-impl/src/com/intellij/openapi/util/JDOMExternalizableAdapter.java
new file mode 100644
index 0000000..5248f4a
--- /dev/null
+++ b/platform/core-impl/src/com/intellij/openapi/util/JDOMExternalizableAdapter.java
@@ -0,0 +1,57 @@
+/*
+ * 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.openapi.util;
+
+import com.intellij.openapi.components.PersistentStateComponent;
+import com.intellij.openapi.diagnostic.Logger;
+import org.jdom.Element;
+
+/**
+ * @author Dmitry Avdeev
+ */
+public class JDOMExternalizableAdapter implements PersistentStateComponent<Element> {
+
+  private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.util.JDOMExternalizableAdapter");
+
+  private final JDOMExternalizable myExternalizable;
+  private final String myName;
+
+  public JDOMExternalizableAdapter(JDOMExternalizable externalizable, String name) {
+    myExternalizable = externalizable;
+    myName = name;
+  }
+
+  public Element getState() {
+    Element element = new Element(myName);
+    try {
+      myExternalizable.writeExternal(element);
+    }
+    catch (WriteExternalException e) {
+      LOG.info(e);
+    }
+    return element;
+  }
+
+  public void loadState(Element state) {
+    try {
+      myExternalizable.readExternal(state);
+    }
+    catch (InvalidDataException e) {
+      LOG.info(e);
+    }
+  }
+}
diff --git a/platform/core-impl/src/com/intellij/openapi/vfs/impl/ZipHandler.java b/platform/core-impl/src/com/intellij/openapi/vfs/impl/ZipHandler.java
index 79033f7..fc4844e 100644
--- a/platform/core-impl/src/com/intellij/openapi/vfs/impl/ZipHandler.java
+++ b/platform/core-impl/src/com/intellij/openapi/vfs/impl/ZipHandler.java
@@ -16,7 +16,7 @@
 package com.intellij.openapi.vfs.impl;
 
 import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.Couple;
+import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.io.ZipFileCache;
 import com.intellij.openapi.util.text.StringUtil;
@@ -79,7 +79,7 @@
     EntryInfo info = map.get(entryName);
     if (info != null) return info;
 
-    Couple<String> path = splitPath(entryName);
+    Pair<String, String> path = splitPath(entryName);
     EntryInfo parentInfo = getOrCreate(path.first, map, zip);
     if (".".equals(path.second)) {
       return parentInfo;
@@ -99,7 +99,7 @@
         return getOrCreate(entry, map, zip);
       }
 
-      Couple<String> path = splitPath(entryName);
+      Pair<String, String> path = splitPath(entryName);
       EntryInfo parentInfo = getOrCreate(path.first, map, zip);
       info = new EntryInfo(parentInfo, path.second, true, DEFAULT_LENGTH, DEFAULT_TIMESTAMP);
       map.put(entryName, info);
diff --git a/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/CoreJarFileSystem.java b/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/CoreJarFileSystem.java
index 444617b..b1fb350 100644
--- a/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/CoreJarFileSystem.java
+++ b/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/CoreJarFileSystem.java
@@ -52,7 +52,7 @@
     }
     String localPath = path.substring(0, separator);
     String pathInJar = path.substring(separator + 2);
-    return Couple.newOne(localPath, pathInJar);
+    return Couple.of(localPath, pathInJar);
   }
 
   @NotNull
diff --git a/platform/core-impl/src/com/intellij/psi/impl/DocumentCommitProcessor.java b/platform/core-impl/src/com/intellij/psi/impl/DocumentCommitProcessor.java
index 89b04e0..40da8f1 100644
--- a/platform/core-impl/src/com/intellij/psi/impl/DocumentCommitProcessor.java
+++ b/platform/core-impl/src/com/intellij/psi/impl/DocumentCommitProcessor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -39,7 +39,6 @@
 import com.intellij.psi.impl.source.text.DiffLog;
 import com.intellij.psi.impl.source.tree.FileElement;
 import com.intellij.psi.text.BlockSupport;
-import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.Processor;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -127,14 +126,7 @@
           return false; // optimistic locking failed
         }
 
-        CodeStyleManager.getInstance(file.getProject()).performActionWithFormatterDisabled(new Runnable() {
-          @Override
-          public void run() {
-            synchronized (PsiLock.LOCK) {
-              doActualPsiChange(file, diffLog);
-            }
-          }
-        });
+        doActualPsiChange(file, diffLog);
 
         assertAfterCommit(document, file, oldPsiText, myTreeElementBeingReparsedSoItWontBeCollected);
 
@@ -158,38 +150,40 @@
   }
 
   public static void doActualPsiChange(@NotNull final PsiFile file, @NotNull final DiffLog diffLog) {
-    file.getViewProvider().beforeContentsSynchronized();
+    CodeStyleManager.getInstance(file.getProject()).performActionWithFormatterDisabled(new Runnable() {
+      @Override
+      public void run() {
+        synchronized (PsiLock.LOCK) {
+          file.getViewProvider().beforeContentsSynchronized();
 
-    try {
-      final Document document = file.getViewProvider().getDocument();
-      PsiDocumentManagerBase documentManager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(file.getProject());
-      PsiToDocumentSynchronizer.DocumentChangeTransaction transaction = documentManager.getSynchronizer().getTransaction(document);
+          final Document document = file.getViewProvider().getDocument();
+          PsiDocumentManagerBase documentManager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(file.getProject());
+          PsiToDocumentSynchronizer.DocumentChangeTransaction transaction = documentManager.getSynchronizer().getTransaction(document);
 
-      final PsiFileImpl fileImpl = (PsiFileImpl)file;
+          final PsiFileImpl fileImpl = (PsiFileImpl)file;
 
-      if (transaction == null) {
-        final PomModel model = PomManager.getModel(fileImpl.getProject());
+          if (transaction == null) {
+            final PomModel model = PomManager.getModel(fileImpl.getProject());
 
-        model.runTransaction(new PomTransactionBase(fileImpl, model.getModelAspect(TreeAspect.class)) {
-          @Override
-          public PomModelEvent runInner() {
-            return new TreeAspectEvent(model, diffLog.performActualPsiChange(file));
+            model.runTransaction(new PomTransactionBase(fileImpl, model.getModelAspect(TreeAspect.class)) {
+              @Override
+              public PomModelEvent runInner() {
+                return new TreeAspectEvent(model, diffLog.performActualPsiChange(file));
+              }
+            });
           }
-        });
+          else {
+            diffLog.performActualPsiChange(file);
+          }
+        }
       }
-      else {
-        diffLog.performActualPsiChange(file);
-      }
-    }
-    catch (IncorrectOperationException e) {
-      LOG.error(e);
-    }
+    });
   }
 
-  private void assertAfterCommit(Document document,
-                                        final PsiFile file,
-                                        CharSequence oldPsiText,
-                                        FileElement myTreeElementBeingReparsedSoItWontBeCollected) {
+  private void assertAfterCommit(@NotNull Document document,
+                                 @NotNull final PsiFile file,
+                                 @NotNull CharSequence oldPsiText,
+                                 @NotNull FileElement myTreeElementBeingReparsedSoItWontBeCollected) {
     if (myTreeElementBeingReparsedSoItWontBeCollected.getTextLength() != document.getTextLength()) {
       final String documentText = document.getText();
       String fileText = file.getText();
@@ -205,14 +199,7 @@
       try {
         BlockSupport blockSupport = BlockSupport.getInstance(file.getProject());
         final DiffLog diffLog = blockSupport.reparseRange(file, new TextRange(0, documentText.length()), documentText, createProgressIndicator());
-        CodeStyleManager.getInstance(file.getProject()).performActionWithFormatterDisabled(new Runnable() {
-          @Override
-          public void run() {
-            synchronized (PsiLock.LOCK) {
-              doActualPsiChange(file, diffLog);
-            }
-          }
-        });
+        doActualPsiChange(file, diffLog);
 
         if (myTreeElementBeingReparsedSoItWontBeCollected.getTextLength() != document.getTextLength()) {
           LOG.error("PSI is broken beyond repair in: " + file);
diff --git a/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java b/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java
index b111c42..26e0797 100644
--- a/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java
+++ b/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java
@@ -39,6 +39,7 @@
 import com.intellij.psi.impl.source.PsiFileImpl;
 import com.intellij.psi.impl.source.text.BlockSupportImpl;
 import com.intellij.psi.text.BlockSupport;
+import com.intellij.psi.util.PsiUtilCore;
 import com.intellij.util.FileContentUtilCore;
 import com.intellij.util.Processor;
 import com.intellij.util.SmartList;
@@ -145,6 +146,7 @@
     Document document = getCachedDocument(file);
     if (document != null) {
       if (!file.getViewProvider().isPhysical() && document.getUserData(HARD_REF_TO_PSI) == null) {
+        PsiUtilCore.ensureValid(file);
         cachePsi(document, file);
       }
       return document;
@@ -164,6 +166,7 @@
       }
 
       if (!viewProvider.isPhysical()) {
+        PsiUtilCore.ensureValid(file);
         cachePsi(document, file);
         file.putUserData(HARD_REF_TO_DOCUMENT, document);
       }
diff --git a/platform/core-impl/src/com/intellij/psi/impl/PsiTreeChangeEventImpl.java b/platform/core-impl/src/com/intellij/psi/impl/PsiTreeChangeEventImpl.java
index e06474d..9c9bc6c 100644
--- a/platform/core-impl/src/com/intellij/psi/impl/PsiTreeChangeEventImpl.java
+++ b/platform/core-impl/src/com/intellij/psi/impl/PsiTreeChangeEventImpl.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.
@@ -20,6 +20,7 @@
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiManager;
 import com.intellij.psi.PsiTreeChangeEvent;
+import org.jetbrains.annotations.NotNull;
 
 public class PsiTreeChangeEventImpl extends PsiTreeChangeEvent{
   private boolean isGenericChange;
@@ -49,7 +50,7 @@
     return myCode;
   }
 
-  public void setCode(PsiEventType code) {
+  public void setCode(@NotNull PsiEventType code) {
     myCode = code;
   }
 
@@ -81,7 +82,7 @@
     myElement = element;
   }
 
-  public void setPropertyName(String propertyName) {
+  public void setPropertyName(@NotNull String propertyName) {
     myPropertyName = propertyName;
   }
 
@@ -122,4 +123,9 @@
   public void setGenericChange(boolean genericChange) {
     isGenericChange = genericChange;
   }
+
+  @Override
+  public String toString() {
+    return "PsiTreeChangeEventImpl{myCode=" + myCode + (isGenericChange ? " (generic)" : "") + '}';
+  }
 }
diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/TreeUtil.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/TreeUtil.java
index f1f74cd..ca23224 100644
--- a/platform/core-impl/src/com/intellij/psi/impl/source/tree/TreeUtil.java
+++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/TreeUtil.java
@@ -230,7 +230,7 @@
   }
 
   public static Couple<ASTNode> findTopmostSiblingParents(ASTNode one, ASTNode two) {
-    if (one == two) return Couple.newOne(null, null);
+    if (one == two) return Couple.of(null, null);
 
     LinkedList<ASTNode> oneParents = new LinkedList<ASTNode>();
     LinkedList<ASTNode> twoParents = new LinkedList<ASTNode>();
@@ -249,7 +249,7 @@
     }
     while (one == two && one != null);
 
-    return Couple.newOne(one, two);
+    return Couple.of(one, two);
   }
 
   public static void clearCaches(@NotNull final TreeElement tree) {
diff --git a/platform/dvcs/testFramework/com/intellij/dvcs/test/MockVcsHelper.java b/platform/dvcs/testFramework/com/intellij/dvcs/test/MockVcsHelper.java
index da6f752..55e0a0e 100644
--- a/platform/dvcs/testFramework/com/intellij/dvcs/test/MockVcsHelper.java
+++ b/platform/dvcs/testFramework/com/intellij/dvcs/test/MockVcsHelper.java
@@ -145,7 +145,7 @@
   }
 
   @Override
-  public void showFileHistory(VcsHistoryProvider vcsHistoryProvider, FilePath path, AbstractVcs vcs, RepositoryLocation repositoryLocation) {
+  public void showFileHistory(VcsHistoryProvider vcsHistoryProvider, FilePath path, AbstractVcs vcs, String repositoryPath) {
     throw new UnsupportedOperationException();
   }
 
@@ -153,7 +153,7 @@
   public void showFileHistory(VcsHistoryProvider vcsHistoryProvider,
                               AnnotationProvider annotationProvider,
                               FilePath path,
-                              RepositoryLocation repositoryLocation,
+                              String repositoryPath,
                               AbstractVcs vcs) {
     throw new UnsupportedOperationException();
   }
diff --git a/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.java b/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.java
index 4b7d370..cb0e1a2 100644
--- a/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.java
+++ b/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.java
@@ -118,7 +118,7 @@
   public int PRESENTATION_MODE_FONT_SIZE = 24;
   public boolean MARK_MODIFIED_TABS_WITH_ASTERISK = false;
   public boolean SHOW_TABS_TOOLTIPS = true;
-  public boolean SHOW_DIRECTORY_FOR_NON_UNIQUE_FILENAMES = false;
+  public boolean SHOW_DIRECTORY_FOR_NON_UNIQUE_FILENAMES = true;
 
   private final EventListenerList myListenerList;
 
diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorFactory.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorFactory.java
index 730ff5f..a935850 100644
--- a/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorFactory.java
+++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorFactory.java
@@ -28,6 +28,8 @@
 
 /**
  * Provides services for creating document and editor instances.
+ *
+ * Creating and releasing of editors must be done from EDT.
  */
 public abstract class EditorFactory {
   /**
@@ -61,6 +63,8 @@
   /**
    * Creates an editor for the specified document.
    *
+   * Must be invoked in EDT.
+   *
    * @param document the document to create the editor for.
    * @return the editor instance.
    * @see #releaseEditor(Editor)
@@ -70,6 +74,8 @@
   /**
    * Creates a read-only editor for the specified document.
    *
+   * Must be invoked in EDT.
+   *
    * @param document the document to create the editor for.
    * @return the editor instance.
    * @see #releaseEditor(Editor)
@@ -79,6 +85,8 @@
   /**
    * Creates an editor for the specified document associated with the specified project.
    *
+   * Must be invoked in EDT.
+   *
    * @param document the document to create the editor for.
    * @param project  the project with which the editor is associated.
    * @return the editor instance.
@@ -90,6 +98,8 @@
   /**
    * Creates an editor for the specified document associated with the specified project.
    *
+   * Must be invoked in EDT.
+   *
    * @param document the document to create the editor for.
    * @param project  the project for which highlighter should be created
    * @param fileType the file type according to which the editor contents is highlighted.
@@ -103,6 +113,8 @@
   /**
    * Creates an editor for the specified document associated with the specified project.
    *
+   * Must be invoked in EDT.
+   *
    * @param document the document to create the editor for.
    * @param project  the project for which highlighter should be created
    * @param file     the file according to which the editor contents is highlighted.
@@ -116,6 +128,8 @@
   /**
    * Creates a read-only editor for the specified document associated with the specified project.
    *
+   * Must be invoked in EDT.
+   *
    * @param document the document to create the editor for.
    * @param project  the project with which the editor is associated.
    * @return the editor instance.
@@ -127,6 +141,8 @@
   /**
    * Disposes of the specified editor instance.
    *
+   * Must be invoked in EDT.
+   *
    * @param editor the editor instance to release.
    */
   public abstract void releaseEditor(@NotNull Editor editor);
diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/FoldingModel.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/FoldingModel.java
index dca85b6..0720134 100644
--- a/platform/editor-ui-api/src/com/intellij/openapi/editor/FoldingModel.java
+++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/FoldingModel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -33,11 +33,19 @@
    * @param startOffset     the start offset of the region to fold.
    * @param endOffset       the end offset of the region to fold.
    * @param placeholderText the text to display instead of the region contents when the region is folded.
-   * @return the fold region, or null if folding is currently disabled.
+   * @return the fold region, or <code>null</code> if folding is currently disabled or corresponding region cannot be added (e.g. if it
+   * intersects with another existing region)
    */
   @Nullable
   FoldRegion addFoldRegion(int startOffset, int endOffset, @NotNull String placeholderText);
 
+  /**
+   * Tries to add given region to the folding model. This method must be called
+   * from the <code>Runnable</code> passed to {@link #runBatchFoldingOperation(Runnable)}.
+   *
+   * @return <code>true</code>, if region was added successfully, <code>false</code> if the region cannot be added, e.g. if it
+   * intersects with another existing region
+   */
   boolean addFoldRegion(@NotNull FoldRegion region);
 
   /**
@@ -57,13 +65,22 @@
   FoldRegion[] getAllFoldRegions();
 
   /**
-   * Checks if the specified offset in the document belongs to a folded region.
+   * Checks if the specified offset in the document belongs to a folded region. The region must contain given offset or be located right
+   * after given offset, i.e. the following condition must hold: foldStartOffset <= offset < foldEndOffset.
    *
    * @param offset the offset to check.
    * @return true if the offset belongs to a folded region, false otherwise.
+   *
+   * @see #getCollapsedRegionAtOffset(int)
    */
   boolean isOffsetCollapsed(int offset);
 
+  /**
+   * Returns collapsed folded region at a given offset or <code>null</code> if there's no such region. Returned region will satisfy the
+   * following condition: region.getStartOffset() <= offset < region.getEndOffset()
+   *
+   * @see #isOffsetCollapsed(int)
+   */
   @Nullable
   FoldRegion getCollapsedRegionAtOffset(int offset);
 
diff --git a/platform/editor-ui-ex/src/com/intellij/codeInsight/folding/CodeFoldingSettingsImpl.java b/platform/editor-ui-ex/src/com/intellij/codeInsight/folding/CodeFoldingSettingsImpl.java
new file mode 100644
index 0000000..144a604
--- /dev/null
+++ b/platform/editor-ui-ex/src/com/intellij/codeInsight/folding/CodeFoldingSettingsImpl.java
@@ -0,0 +1,60 @@
+/*
+ * 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.codeInsight.folding;
+
+import com.intellij.ide.IdeBundle;
+import com.intellij.openapi.application.PathManager;
+import com.intellij.openapi.components.*;
+import com.intellij.util.xmlb.XmlSerializerUtil;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.File;
+
+/**
+ * @author yole
+ */
+@State(
+  name="CodeFoldingSettings",
+  storages= {
+    @Storage(
+      file = StoragePathMacros.APP_CONFIG + "/editor.codeinsight.xml"
+    )}
+)
+public class CodeFoldingSettingsImpl extends CodeFoldingSettings implements PersistentStateComponent<CodeFoldingSettings>, ExportableComponent {
+
+  @Override
+  public CodeFoldingSettings getState() {
+    return this;
+  }
+
+  @Override
+  public void loadState(final CodeFoldingSettings state) {
+    XmlSerializerUtil.copyBean(state, this);
+  }
+
+  @Override
+  @NotNull
+  public File[] getExportFiles() {
+    return new File[] { PathManager.getOptionsFile("editor.codeinsight") };
+  }
+
+  @Override
+  @NotNull
+  public String getPresentableName() {
+    return IdeBundle.message("code.folding.settings");
+  }
+}
diff --git a/platform/external-system-api/resources/i18n/ExternalSystemBundle.properties b/platform/external-system-api/resources/i18n/ExternalSystemBundle.properties
index 2df3fb5..42cdd96 100644
--- a/platform/external-system-api/resources/i18n/ExternalSystemBundle.properties
+++ b/platform/external-system-api/resources/i18n/ExternalSystemBundle.properties
@@ -66,4 +66,9 @@
 run.text.starting.single.task={0}: Executing external task ''{1}''...\n
 run.text.ended.multiple.task={0}: External tasks execution finished ''{1}''.\n
 run.text.ended.single.task={0}: External task execution finished ''{1}''.\n
-run.error.undefined.task=No task to execute is specified
\ No newline at end of file
+run.error.undefined.task=No task to execute is specified
+
+tasks.select.task.title=Select {0} task
+tasks.edit.task.title=Edit {0} Task
+tasks.before.run.empty=Run {0} task
+tasks.before.run=Run {0} task ''{1}''
\ No newline at end of file
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/task/ExternalSystemTaskManager.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/task/ExternalSystemTaskManager.java
index c65c7a4..1c51b5a 100644
--- a/platform/external-system-api/src/com/intellij/openapi/externalSystem/task/ExternalSystemTaskManager.java
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/task/ExternalSystemTaskManager.java
@@ -32,19 +32,14 @@
  */
 public interface ExternalSystemTaskManager<S extends ExternalSystemExecutionSettings> {
 
-  /**
-   *
-   * @deprecated will be removed in 13.1
-   */
-  @Deprecated
   void executeTasks(@NotNull ExternalSystemTaskId id,
                     @NotNull List<String> taskNames,
                     @NotNull String projectPath,
                     @Nullable S settings,
-                    @Nullable String vmOptions,
+                    @NotNull final List<String> vmOptions,
+                    @NotNull List<String> scriptParameters,
                     @Nullable String debuggerSetup,
-                    @NotNull ExternalSystemTaskNotificationListener listener)
-    throws ExternalSystemException;
+                    @NotNull ExternalSystemTaskNotificationListener listener) throws ExternalSystemException;
 
   boolean cancelTask(@NotNull ExternalSystemTaskId id,
                   @NotNull ExternalSystemTaskNotificationListener listener)
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/importing/ImportSpec.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/importing/ImportSpec.java
new file mode 100644
index 0000000..a7f59e4
--- /dev/null
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/importing/ImportSpec.java
@@ -0,0 +1,92 @@
+/*
+ * 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.openapi.externalSystem.importing;
+
+import com.intellij.openapi.externalSystem.model.ProjectSystemId;
+import com.intellij.openapi.externalSystem.service.execution.ProgressExecutionMode;
+import com.intellij.openapi.project.Project;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 5/29/2014
+ */
+public class ImportSpec {
+  @NotNull private final Project myProject;
+  @NotNull private final ProjectSystemId myExternalSystemId;
+  @NotNull private ProgressExecutionMode myProgressExecutionMode;
+  private boolean forceWhenUptodate;
+  private boolean whenAutoImportEnabled;
+  //private boolean isPreviewMode;
+  //private boolean isReportRefreshError;
+
+  public ImportSpec(@NotNull Project project, @NotNull ProjectSystemId id) {
+    myProject = project;
+    myExternalSystemId = id;
+    myProgressExecutionMode = ProgressExecutionMode.MODAL_SYNC;
+  }
+
+  @NotNull
+  public Project getProject() {
+    return myProject;
+  }
+
+  @NotNull
+  public ProjectSystemId getExternalSystemId() {
+    return myExternalSystemId;
+  }
+
+  @NotNull
+  public ProgressExecutionMode getProgressExecutionMode() {
+    return myProgressExecutionMode;
+  }
+
+  public void setProgressExecutionMode(@NotNull ProgressExecutionMode progressExecutionMode) {
+    myProgressExecutionMode = progressExecutionMode;
+  }
+
+  public boolean isForceWhenUptodate() {
+    return forceWhenUptodate;
+  }
+
+  public void setForceWhenUptodate(boolean forceWhenUptodate) {
+    this.forceWhenUptodate = forceWhenUptodate;
+  }
+
+  public boolean isWhenAutoImportEnabled() {
+    return whenAutoImportEnabled;
+  }
+
+  public void setWhenAutoImportEnabled(boolean whenAutoImportEnabled) {
+    this.whenAutoImportEnabled = whenAutoImportEnabled;
+  }
+
+  //public boolean isPreviewMode() {
+  //  return isPreviewMode;
+  //}
+  //
+  //public void setPreviewMode(boolean isPreviewMode) {
+  //  this.isPreviewMode = isPreviewMode;
+  //}
+  //
+  //public boolean isReportRefreshError() {
+  //  return isReportRefreshError;
+  //}
+  //
+  //public void setReportRefreshError(boolean isReportRefreshError) {
+  //  this.isReportRefreshError = isReportRefreshError;
+  //}
+}
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/importing/ImportSpecBuilder.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/importing/ImportSpecBuilder.java
new file mode 100644
index 0000000..b67189d
--- /dev/null
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/importing/ImportSpecBuilder.java
@@ -0,0 +1,76 @@
+/*
+ * 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.openapi.externalSystem.importing;
+
+import com.intellij.openapi.externalSystem.model.ProjectSystemId;
+import com.intellij.openapi.externalSystem.service.execution.ProgressExecutionMode;
+import com.intellij.openapi.project.Project;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 5/29/2014
+ */
+public class ImportSpecBuilder {
+
+  @NotNull private final Project myProject;
+  @NotNull private final ProjectSystemId myExternalSystemId;
+  @NotNull private ProgressExecutionMode myProgressExecutionMode;
+  private boolean myForceWhenUptodate;
+  private boolean myWhenAutoImportEnabled;
+  //private boolean isPreviewMode;
+  //private boolean isReportRefreshError;
+
+  public ImportSpecBuilder(@NotNull Project project, @NotNull ProjectSystemId id) {
+    myProject = project;
+    myExternalSystemId = id;
+    myProgressExecutionMode = ProgressExecutionMode.IN_BACKGROUND_ASYNC;
+  }
+
+  public ImportSpecBuilder whenAutoImportEnabled() {
+    myWhenAutoImportEnabled = true;
+    return this;
+  }
+
+  public ImportSpecBuilder use(@NotNull ProgressExecutionMode executionMode) {
+    myProgressExecutionMode = executionMode;
+    return this;
+  }
+
+  public ImportSpecBuilder forceWhenUptodate() {
+    return forceWhenUptodate(true);
+  }
+
+  public ImportSpecBuilder forceWhenUptodate(boolean force) {
+    myForceWhenUptodate = force;
+    return this;
+  }
+
+  //public ImportSpecBuilder usePreviewMode() {
+  //  isPreviewMode = true;
+  //  return this;
+  //}
+
+  public ImportSpec build() {
+    ImportSpec mySpec = new ImportSpec(myProject, myExternalSystemId);
+    mySpec.setWhenAutoImportEnabled(myWhenAutoImportEnabled);
+    mySpec.setProgressExecutionMode(myProgressExecutionMode);
+    mySpec.setForceWhenUptodate(myForceWhenUptodate);
+    //mySpec.setPreviewMode(isPreviewMode);
+    //mySpec.setReportRefreshError(isReportRefreshError);
+    return mySpec;
+  }
+}
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java
index c2f885f..7429537 100644
--- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java
@@ -40,6 +40,7 @@
     = DataKey.create("external.system.recent.tasks.list");
 
   @NotNull public static final Key<Boolean> NEWLY_IMPORTED_PROJECT = new Key<Boolean>("external.system.newly.imported");
+  @NotNull public static final Key<Boolean> NEWLY_CREATED_PROJECT = new Key<Boolean>("external.system.newly.created");
 
   private ExternalSystemDataKeys() {
   }
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ExternalSystemStartupActivity.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ExternalSystemStartupActivity.java
index 2edb0f5..f7040a2 100644
--- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ExternalSystemStartupActivity.java
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ExternalSystemStartupActivity.java
@@ -17,6 +17,7 @@
 
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.externalSystem.ExternalSystemManager;
+import com.intellij.openapi.externalSystem.importing.ImportSpecBuilder;
 import com.intellij.openapi.externalSystem.model.ExternalSystemDataKeys;
 import com.intellij.openapi.externalSystem.service.project.ProjectRenameAware;
 import com.intellij.openapi.externalSystem.service.project.autoimport.ExternalSystemAutoImporter;
@@ -51,7 +52,16 @@
         }
         if (project.getUserData(ExternalSystemDataKeys.NEWLY_IMPORTED_PROJECT) != Boolean.TRUE) {
           for (ExternalSystemManager manager : ExternalSystemManager.EP_NAME.getExtensions()) {
-            ExternalSystemUtil.refreshProjects(project, manager.getSystemId(), false);
+            if (project.getUserData(ExternalSystemDataKeys.NEWLY_CREATED_PROJECT) == Boolean.TRUE) {
+              ExternalSystemUtil.refreshProjects(
+                new ImportSpecBuilder(project, manager.getSystemId())
+              );
+            }
+            else {
+              ExternalSystemUtil.refreshProjects(
+                new ImportSpecBuilder(project, manager.getSystemId()).whenAutoImportEnabled()
+              );
+            }
           }
         }
         ExternalSystemAutoImporter.letTheMagicBegin(project);
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/AbstractExternalSystemTaskConfigurationType.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/AbstractExternalSystemTaskConfigurationType.java
index 2d8377b..1345d49 100644
--- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/AbstractExternalSystemTaskConfigurationType.java
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/AbstractExternalSystemTaskConfigurationType.java
@@ -162,6 +162,9 @@
     if (!StringUtil.isEmptyOrSpaces(projectName)) {
       buffer.append(projectName);
       buffer.append(" ");
+    } else {
+      buffer.append(externalProjectPath);
+      buffer.append(" ");
     }
 
     buffer.append("[");
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemBeforeRunTask.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemBeforeRunTask.java
new file mode 100644
index 0000000..2cf934c
--- /dev/null
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemBeforeRunTask.java
@@ -0,0 +1,88 @@
+/*
+ * 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.openapi.externalSystem.service.execution;
+
+import com.intellij.execution.BeforeRunTask;
+import com.intellij.openapi.externalSystem.model.ProjectSystemId;
+import com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings;
+import com.intellij.openapi.util.Key;
+import com.intellij.openapi.util.text.StringUtil;
+import org.jdom.Element;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 5/30/2014
+ */
+public class ExternalSystemBeforeRunTask extends BeforeRunTask<ExternalSystemBeforeRunTask> {
+
+  @NotNull
+  private final ExternalSystemTaskExecutionSettings myTaskExecutionSettings;
+
+  public ExternalSystemBeforeRunTask(@NotNull Key<ExternalSystemBeforeRunTask> providerId, @NotNull ProjectSystemId systemId) {
+    super(providerId);
+    myTaskExecutionSettings = new ExternalSystemTaskExecutionSettings();
+    myTaskExecutionSettings.setExternalSystemIdString(systemId.getId());
+  }
+
+  @NotNull
+  public ExternalSystemTaskExecutionSettings getTaskExecutionSettings() {
+    return myTaskExecutionSettings;
+  }
+
+  @Override
+  public void writeExternal(Element element) {
+    super.writeExternal(element);
+
+    element.setAttribute("tasks", StringUtil.join(myTaskExecutionSettings.getTaskNames(), " "));
+    if (myTaskExecutionSettings.getExternalProjectPath() != null) {
+      element.setAttribute("externalProjectPath", myTaskExecutionSettings.getExternalProjectPath());
+    }
+    if (myTaskExecutionSettings.getVmOptions() != null) element.setAttribute("vmOptions", myTaskExecutionSettings.getVmOptions());
+    if (myTaskExecutionSettings.getScriptParameters() != null) {
+      element.setAttribute("scriptParameters", myTaskExecutionSettings.getScriptParameters());
+    }
+  }
+
+  @Override
+  public void readExternal(Element element) {
+    super.readExternal(element);
+    myTaskExecutionSettings.setTaskNames(StringUtil.split(StringUtil.notNullize(element.getAttributeValue("tasks")), " "));
+    myTaskExecutionSettings.setExternalProjectPath(element.getAttributeValue("externalProjectPath"));
+    myTaskExecutionSettings.setVmOptions(element.getAttributeValue("vmOptions"));
+    myTaskExecutionSettings.setScriptParameters(element.getAttributeValue("scriptParameters"));
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+    if (!(o instanceof ExternalSystemBeforeRunTask)) return false;
+    if (!super.equals(o)) return false;
+
+    ExternalSystemBeforeRunTask task = (ExternalSystemBeforeRunTask)o;
+
+    if (!myTaskExecutionSettings.equals(task.myTaskExecutionSettings)) return false;
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    int result = super.hashCode();
+    result = 31 * result + myTaskExecutionSettings.hashCode();
+    return result;
+  }
+}
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemBeforeRunTaskProvider.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemBeforeRunTaskProvider.java
new file mode 100644
index 0000000..0886403
--- /dev/null
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemBeforeRunTaskProvider.java
@@ -0,0 +1,222 @@
+/*
+ * 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.openapi.externalSystem.service.execution;
+
+import com.intellij.execution.*;
+import com.intellij.execution.configurations.RunConfiguration;
+import com.intellij.execution.executors.DefaultRunExecutor;
+import com.intellij.execution.process.ProcessAdapter;
+import com.intellij.execution.process.ProcessEvent;
+import com.intellij.execution.process.ProcessHandler;
+import com.intellij.execution.runners.ExecutionEnvironment;
+import com.intellij.execution.runners.ProgramRunner;
+import com.intellij.openapi.Disposable;
+import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.application.ModalityState;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.externalSystem.model.ProjectSystemId;
+import com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings;
+import com.intellij.openapi.externalSystem.model.execution.ExternalTaskPojo;
+import com.intellij.openapi.externalSystem.util.ExternalSystemBundle;
+import com.intellij.openapi.externalSystem.util.ExternalSystemConstants;
+import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.Key;
+import com.intellij.openapi.util.Pair;
+import com.intellij.openapi.util.Ref;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.util.concurrency.Semaphore;
+import com.intellij.util.containers.ContainerUtilRt;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 5/30/2014
+ */
+public abstract class ExternalSystemBeforeRunTaskProvider extends BeforeRunTaskProvider<ExternalSystemBeforeRunTask> {
+
+  private static final Logger LOG = Logger.getInstance(ExternalSystemBeforeRunTaskProvider.class);
+
+  @NotNull private final ProjectSystemId mySystemId;
+  @NotNull private final Project myProject;
+  @NotNull private final Key<ExternalSystemBeforeRunTask> myId;
+
+  public ExternalSystemBeforeRunTaskProvider(@NotNull ProjectSystemId systemId,
+                                             @NotNull Project project,
+                                             @NotNull Key<ExternalSystemBeforeRunTask> id) {
+    mySystemId = systemId;
+    myProject = project;
+    myId = id;
+  }
+
+  @NotNull
+  public Key<ExternalSystemBeforeRunTask> getId() {
+    return myId;
+  }
+
+  @Override
+  public String getName() {
+    return ExternalSystemBundle.message("tasks.before.run.empty", mySystemId.getReadableName());
+  }
+
+  @Override
+  public boolean isConfigurable() {
+    return true;
+  }
+
+  @Override
+  public boolean configureTask(RunConfiguration runConfiguration, ExternalSystemBeforeRunTask task) {
+    ExternalSystemEditTaskDialog dialog = new ExternalSystemEditTaskDialog(myProject, task.getTaskExecutionSettings(), mySystemId);
+    dialog.setTitle(ExternalSystemBundle.message("tasks.select.task.title", mySystemId.getReadableName()));
+
+    dialog.show();
+    if (!dialog.isOK()) return false;
+
+    return true;
+  }
+
+  @Override
+  public boolean canExecuteTask(RunConfiguration configuration, ExternalSystemBeforeRunTask beforeRunTask) {
+    final ExternalSystemTaskExecutionSettings executionSettings = beforeRunTask.getTaskExecutionSettings();
+
+    final List<ExternalTaskPojo> tasks = ContainerUtilRt.newArrayList();
+    for (String taskName : executionSettings.getTaskNames()) {
+      tasks.add(new ExternalTaskPojo(taskName, executionSettings.getExternalProjectPath(), null));
+    }
+    if (tasks.isEmpty()) return true;
+
+    final Pair<ProgramRunner, ExecutionEnvironment> pair =
+      ExternalSystemUtil.createRunner(executionSettings, DefaultRunExecutor.EXECUTOR_ID, myProject, mySystemId);
+
+    if (pair == null) return false;
+
+    final ProgramRunner runner = pair.first;
+    final ExecutionEnvironment environment = pair.second;
+
+    return runner.canRun(DefaultRunExecutor.EXECUTOR_ID, environment.getRunProfile());
+  }
+
+  @Override
+  public boolean executeTask(DataContext context,
+                             RunConfiguration configuration,
+                             ExecutionEnvironment env,
+                             ExternalSystemBeforeRunTask beforeRunTask) {
+
+    final ExternalSystemTaskExecutionSettings executionSettings = beforeRunTask.getTaskExecutionSettings();
+
+    final List<ExternalTaskPojo> tasks = ContainerUtilRt.newArrayList();
+    for (String taskName : executionSettings.getTaskNames()) {
+      tasks.add(new ExternalTaskPojo(taskName, executionSettings.getExternalProjectPath(), null));
+    }
+    if (tasks.isEmpty()) return true;
+
+    final Pair<ProgramRunner, ExecutionEnvironment> pair =
+      ExternalSystemUtil.createRunner(executionSettings, DefaultRunExecutor.EXECUTOR_ID, myProject, mySystemId);
+
+    if (pair == null) return false;
+
+    final ProgramRunner runner = pair.first;
+    final ExecutionEnvironment environment = pair.second;
+    environment.setExecutionId(env.getExecutionId());
+
+    final Semaphore targetDone = new Semaphore();
+    final Ref<Boolean> result = new Ref<Boolean>(false);
+    final Disposable disposable = Disposer.newDisposable();
+
+    final Executor executor = DefaultRunExecutor.getRunExecutorInstance();
+    final String executorId = executor.getId();
+
+    myProject.getMessageBus().connect(disposable).subscribe(ExecutionManager.EXECUTION_TOPIC, new ExecutionAdapter() {
+      public void processStartScheduled(final String executorIdLocal, final ExecutionEnvironment environmentLocal) {
+        if (executorId.equals(executorIdLocal) && environment.equals(environmentLocal)) {
+          targetDone.down();
+        }
+      }
+
+      public void processNotStarted(final String executorIdLocal, @NotNull final ExecutionEnvironment environmentLocal) {
+        if (executorId.equals(executorIdLocal) && environment.equals(environmentLocal)) {
+          targetDone.up();
+        }
+      }
+
+      public void processStarted(final String executorIdLocal,
+                                 @NotNull final ExecutionEnvironment environmentLocal,
+                                 @NotNull final ProcessHandler handler) {
+        if (executorId.equals(executorIdLocal) && environment.equals(environmentLocal)) {
+          handler.addProcessListener(new ProcessAdapter() {
+            public void processTerminated(ProcessEvent event) {
+              result.set(event.getExitCode() == 0);
+              targetDone.up();
+              environmentLocal.getContentToReuse();
+            }
+          });
+        }
+      }
+    });
+
+    try {
+      ApplicationManager.getApplication().invokeAndWait(new Runnable() {
+        @Override
+        public void run() {
+          try {
+            runner.execute(environment);
+          }
+          catch (ExecutionException e) {
+            targetDone.up();
+            LOG.error(e);
+          }
+        }
+      }, ModalityState.NON_MODAL);
+    }
+    catch (Exception e) {
+      LOG.error(e);
+      Disposer.dispose(disposable);
+      return false;
+    }
+
+    targetDone.waitFor();
+    Disposer.dispose(disposable);
+
+    return result.get();
+  }
+
+  @Override
+  public String getDescription(ExternalSystemBeforeRunTask task) {
+    final String externalProjectPath = task.getTaskExecutionSettings().getExternalProjectPath();
+
+    if (task.getTaskExecutionSettings().getTaskNames().isEmpty()) {
+      return ExternalSystemBundle.message("tasks.before.run.empty", mySystemId.getReadableName());
+    }
+
+    String desc = StringUtil.join(task.getTaskExecutionSettings().getTaskNames(), " ");
+    for (Module module : ModuleManager.getInstance(myProject).getModules()) {
+      if (!mySystemId.toString().equals(module.getOptionValue(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY))) continue;
+
+      if (StringUtil.equals(externalProjectPath, module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY))) {
+        desc = module.getName() + ": " + desc;
+        break;
+      }
+    }
+
+    return ExternalSystemBundle.message("tasks.before.run", mySystemId.getReadableName(), desc);
+  }
+}
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemEditTaskDialog.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemEditTaskDialog.java
new file mode 100644
index 0000000..cad9fdb
--- /dev/null
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemEditTaskDialog.java
@@ -0,0 +1,73 @@
+/*
+ * 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.openapi.externalSystem.service.execution;
+
+import com.intellij.openapi.externalSystem.model.ProjectSystemId;
+import com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings;
+import com.intellij.openapi.externalSystem.util.ExternalSystemBundle;
+import com.intellij.openapi.externalSystem.util.PaintAwarePanel;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.DialogWrapper;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import java.awt.*;
+
+public class ExternalSystemEditTaskDialog extends DialogWrapper {
+
+  @NotNull private final ExternalSystemTaskExecutionSettings myTaskExecutionSettings;
+  @NotNull private final ExternalSystemTaskSettingsControl myControl;
+  @Nullable private JComponent contentPane;
+
+  public ExternalSystemEditTaskDialog(@NotNull Project project,
+                                      @NotNull ExternalSystemTaskExecutionSettings taskExecutionSettings,
+                                      @NotNull ProjectSystemId externalSystemId) {
+    super(project, true);
+    myTaskExecutionSettings = taskExecutionSettings;
+
+    setTitle(ExternalSystemBundle.message("tasks.edit.task.title", externalSystemId.getReadableName()));
+    myControl = new ExternalSystemTaskSettingsControl(project, externalSystemId);
+    myControl.setOriginalSettings(taskExecutionSettings);
+    setModal(true);
+    init();
+  }
+
+  protected JComponent createCenterPanel() {
+    if (contentPane == null) {
+      contentPane = new PaintAwarePanel(new GridBagLayout());
+      myControl.fillUi((PaintAwarePanel)contentPane, 0);
+      myControl.reset();
+    }
+    return contentPane;
+  }
+
+  public JComponent getPreferredFocusedComponent() {
+    return null;
+  }
+
+  @Override
+  protected void dispose() {
+    super.dispose();
+    myControl.disposeUIResources();
+  }
+
+  @Override
+  protected void doOKAction() {
+    myControl.apply(myTaskExecutionSettings);
+    super.doOKAction();
+  }
+}
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemRunConfiguration.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemRunConfiguration.java
index f9996a9..4c27ae1 100644
--- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemRunConfiguration.java
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemRunConfiguration.java
@@ -215,7 +215,7 @@
               String exceptionMessage = ExceptionUtil.getMessage(e);
               String text = exceptionMessage == null ? e.toString() : exceptionMessage;
               processHandler.notifyTextAvailable(text + '\n', ProcessOutputTypes.STDERR);
-              processHandler.notifyProcessTerminated(0);
+              processHandler.notifyProcessTerminated(1);
             }
 
             @Override
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/LibraryDependencyDataService.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/LibraryDependencyDataService.java
index f8fc059..ed0cbe9 100644
--- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/LibraryDependencyDataService.java
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/LibraryDependencyDataService.java
@@ -142,7 +142,7 @@
         LibraryTable moduleLibraryTable = moduleRootModel.getModuleLibraryTable();
         LibraryTable libraryTable = myPlatformFacade.getProjectLibraryTable(module.getProject());
         try {
-          filterUpToDateAndRemoveObsolete(moduleLibrariesToImport, projectLibrariesToImport, toImport, moduleRootModel, hasUnresolved);
+          syncExistingAndRemoveObsolete(moduleLibrariesToImport, projectLibrariesToImport, toImport, moduleRootModel, hasUnresolved);
 
           // Import missing library dependencies.
           if (!toImport.isEmpty()) {
@@ -168,17 +168,7 @@
       switch (dependencyData.getLevel()) {
         case MODULE:
           final Library moduleLib = moduleLibraryTable.createLibrary(libraryName);
-          final Library.ModifiableModel libModel = moduleLib.getModifiableModel();
-          try {
-            Map<OrderRootType, Collection<File>> files = myLibraryManager.prepareLibraryFiles(libraryData);
-            myLibraryManager.registerPaths(files, libModel, libraryName);
-            LibraryOrderEntry orderEntry = moduleRootModel.findLibraryOrderEntry(moduleLib);
-            assert orderEntry != null;
-            setLibraryScope(orderEntry, moduleLib, module, dependencyData);
-          }
-          finally {
-            libModel.commit();
-          }
+          syncExistingLibraryDependency(dependencyData, moduleLib, moduleRootModel, module);
           break;
         case PROJECT:
           final Library projectLib = libraryTable.getLibraryByName(libraryName);
@@ -205,11 +195,11 @@
     ));
   }
 
-  private static void filterUpToDateAndRemoveObsolete(@NotNull Map<Set<String>, LibraryDependencyData> moduleLibrariesToImport,
-                                                      @NotNull Map<String, LibraryDependencyData> projectLibrariesToImport,
-                                                      @NotNull Set<LibraryDependencyData> toImport,
-                                                      @NotNull ModifiableRootModel moduleRootModel,
-                                                      boolean hasUnresolvedLibraries)
+  private void syncExistingAndRemoveObsolete(@NotNull Map<Set<String>, LibraryDependencyData> moduleLibrariesToImport,
+                                             @NotNull Map<String, LibraryDependencyData> projectLibrariesToImport,
+                                             @NotNull Set<LibraryDependencyData> toImport,
+                                             @NotNull ModifiableRootModel moduleRootModel,
+                                             boolean hasUnresolvedLibraries)
   {
     Set<String> moduleLibraryKey = ContainerUtilRt.newHashSet();
     for (OrderEntry entry : moduleRootModel.getOrderEntries()) {
@@ -229,7 +219,7 @@
           moduleRootModel.removeOrderEntry(entry);
         }
         else {
-
+          syncExistingLibraryDependency(existing, library, moduleRootModel, moduleLibraryOrderEntry.getOwnerModule());
           toImport.remove(existing);
         }
       }
@@ -249,6 +239,24 @@
     }
   }
 
+  private void syncExistingLibraryDependency(@NotNull LibraryDependencyData libraryDependencyData,
+                                             @NotNull Library library,
+                                             @NotNull ModifiableRootModel moduleRootModel,
+                                             @NotNull Module module) {
+    final Library.ModifiableModel libModel = library.getModifiableModel();
+    try {
+      final String libraryName = libraryDependencyData.getInternalName();
+      Map<OrderRootType, Collection<File>> files = myLibraryManager.prepareLibraryFiles(libraryDependencyData.getTarget());
+      myLibraryManager.registerPaths(files, libModel, libraryName);
+      LibraryOrderEntry orderEntry = moduleRootModel.findLibraryOrderEntry(library);
+      assert orderEntry != null;
+      setLibraryScope(orderEntry, library, module, libraryDependencyData);
+    }
+    finally {
+      libModel.commit();
+    }
+  }
+
   private void importMissingProjectLibraries(@NotNull Module module,
                                              @NotNull Collection<DataNode<LibraryDependencyData>> nodesToImport,
                                              boolean synchronous)
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/remote/RemoteExternalSystemTaskManagerImpl.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/remote/RemoteExternalSystemTaskManagerImpl.java
index 566695a..f132e43 100644
--- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/remote/RemoteExternalSystemTaskManagerImpl.java
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/remote/RemoteExternalSystemTaskManagerImpl.java
@@ -18,10 +18,8 @@
 import com.intellij.openapi.externalSystem.model.ExternalSystemException;
 import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
-import com.intellij.openapi.externalSystem.task.AbstractExternalSystemTaskManager;
 import com.intellij.openapi.externalSystem.task.ExternalSystemTaskManager;
 import com.intellij.util.Producer;
-import com.intellij.util.execution.ParametersListUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -55,12 +53,8 @@
       @Nullable
       @Override
       public Object produce() {
-        if(myDelegate instanceof AbstractExternalSystemTaskManager) {
-          ((AbstractExternalSystemTaskManager<S>)myDelegate)
-            .executeTasks(id, taskNames, projectPath, settings, vmOptions, scriptParameters, debuggerSetup, getNotificationListener());
-        } else {
-          myDelegate.executeTasks(id, taskNames, projectPath, settings, ParametersListUtil.join(vmOptions), debuggerSetup, getNotificationListener());
-        }
+        myDelegate.executeTasks(
+          id, taskNames, projectPath, settings, vmOptions, scriptParameters, debuggerSetup, getNotificationListener());
         return null;
       }
     });
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/util/ExternalSystemUtil.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/util/ExternalSystemUtil.java
index 8b494cf..969c5b2 100644
--- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/util/ExternalSystemUtil.java
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/util/ExternalSystemUtil.java
@@ -31,6 +31,8 @@
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.externalSystem.ExternalSystemManager;
+import com.intellij.openapi.externalSystem.importing.ImportSpec;
+import com.intellij.openapi.externalSystem.importing.ImportSpecBuilder;
 import com.intellij.openapi.externalSystem.model.*;
 import com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings;
 import com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo;
@@ -65,6 +67,7 @@
 import com.intellij.openapi.roots.libraries.Library;
 import com.intellij.openapi.roots.libraries.LibraryTable;
 import com.intellij.openapi.ui.DialogWrapper;
+import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -99,8 +102,9 @@
 public class ExternalSystemUtil {
 
   private static final Logger LOG = Logger.getInstance("#" + ExternalSystemUtil.class.getName());
-  
+
   @NotNull private static final Map<String, String> RUNNER_IDS = ContainerUtilRt.newHashMap();
+
   static {
     RUNNER_IDS.put(DefaultRunExecutor.EXECUTOR_ID, ExternalSystemConstants.RUNNER_ID);
     RUNNER_IDS.put(DefaultDebugExecutor.EXECUTOR_ID, ExternalSystemConstants.DEBUG_RUNNER_ID);
@@ -127,14 +131,13 @@
       }
     }
   }
-  
+
   @SuppressWarnings("unchecked")
   @Nullable
   public static <T> T getToolWindowElement(@NotNull Class<T> clazz,
                                            @NotNull Project project,
                                            @NotNull DataKey<T> key,
-                                           @NotNull ProjectSystemId externalSystemId)
-  {
+                                           @NotNull ProjectSystemId externalSystemId) {
     if (project.isDisposed() || !project.isOpen()) {
       return null;
     }
@@ -181,12 +184,14 @@
   /**
    * Asks to refresh all external projects of the target external system linked to the given ide project.
    * <p/>
-   * 'Refresh' here means 'obtain the most up-to-date version and apply it to the ide'. 
+   * 'Refresh' here means 'obtain the most up-to-date version and apply it to the ide'.
    *
-   * @param project           target ide project
-   * @param externalSystemId  target external system which projects should be refreshed
-   * @param force             flag which defines if external project refresh should be performed if it's config is up-to-date
+   * @param project          target ide project
+   * @param externalSystemId target external system which projects should be refreshed
+   * @param force            flag which defines if external project refresh should be performed if it's config is up-to-date
+   * @deprecated use {@link  ExternalSystemUtil#refreshProjects(com.intellij.openapi.externalSystem.importing.ImportSpecBuilder)}
    */
+  @Deprecated
   public static void refreshProjects(@NotNull final Project project, @NotNull final ProjectSystemId externalSystemId, boolean force) {
     refreshProjects(project, externalSystemId, force, ProgressExecutionMode.IN_BACKGROUND_ASYNC);
   }
@@ -199,13 +204,31 @@
    * @param project           target ide project
    * @param externalSystemId  target external system which projects should be refreshed
    * @param force             flag which defines if external project refresh should be performed if it's config is up-to-date
+   *
+   * @deprecated use {@link  ExternalSystemUtil#refreshProjects(com.intellij.openapi.externalSystem.importing.ImportSpecBuilder)}
    */
+  @Deprecated
   public static void refreshProjects(@NotNull final Project project, @NotNull final ProjectSystemId externalSystemId, boolean force, @NotNull final ProgressExecutionMode progressExecutionMode) {
-    ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(externalSystemId);
+    refreshProjects(
+      new ImportSpecBuilder(project, externalSystemId)
+        .forceWhenUptodate(force)
+        .use(progressExecutionMode)
+    );
+  }
+
+  /**
+   * Asks to refresh all external projects of the target external system linked to the given ide project based on provided spec
+   *
+   * @param specBuilder import specification builder
+   */
+  public static void refreshProjects(@NotNull final ImportSpecBuilder specBuilder) {
+    ImportSpec spec = specBuilder.build();
+
+    ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(spec.getExternalSystemId());
     if (manager == null) {
       return;
     }
-    AbstractExternalSystemSettings<?, ?, ?> settings = manager.getSettingsProvider().fun(project);
+    AbstractExternalSystemSettings<?, ?, ?> settings = manager.getSettingsProvider().fun(spec.getProject());
     final Collection<? extends ExternalProjectSettings> projectsSettings = settings.getLinkedProjectsSettings();
     if (projectsSettings.isEmpty()) {
       return;
@@ -215,25 +238,36 @@
     final int[] counter = new int[1];
 
     ExternalProjectRefreshCallback callback =
-      new MyMultiExternalProjectRefreshCallback(project, projectDataManager, counter, externalSystemId);
+      new MyMultiExternalProjectRefreshCallback(spec.getProject(), projectDataManager, counter, spec.getExternalSystemId());
 
-    Map<String, Long> modificationStamps = manager.getLocalSettingsProvider().fun(project).getExternalConfigModificationStamps();
+    Map<String, Long> modificationStamps =
+      manager.getLocalSettingsProvider().fun(spec.getProject()).getExternalConfigModificationStamps();
     Set<String> toRefresh = ContainerUtilRt.newHashSet();
     for (ExternalProjectSettings setting : projectsSettings) {
-      Long oldModificationStamp = modificationStamps.get(setting.getExternalProjectPath());
-      long currentModificationStamp = getTimeStamp(setting, externalSystemId);
-      if (force || oldModificationStamp == null || oldModificationStamp < currentModificationStamp) {
+
+      // don't refresh project when auto-import is disabled if such behavior needed (e.g. on project opening when auto-import is disabled)
+      if (!setting.isUseAutoImport() && spec.isWhenAutoImportEnabled()) continue;
+
+      if (spec.isForceWhenUptodate()) {
         toRefresh.add(setting.getExternalProjectPath());
       }
+      else {
+        Long oldModificationStamp = modificationStamps.get(setting.getExternalProjectPath());
+        long currentModificationStamp = getTimeStamp(setting, spec.getExternalSystemId());
+        if (oldModificationStamp == null || oldModificationStamp < currentModificationStamp) {
+          toRefresh.add(setting.getExternalProjectPath());
+        }
+      }
     }
 
     if (!toRefresh.isEmpty()) {
-      ExternalSystemNotificationManager.getInstance(project)
-        .clearNotifications(null, NotificationSource.PROJECT_SYNC, externalSystemId);
+      ExternalSystemNotificationManager.getInstance(spec.getProject())
+        .clearNotifications(null, NotificationSource.PROJECT_SYNC, spec.getExternalSystemId());
 
       counter[0] = toRefresh.size();
       for (String path : toRefresh) {
-        refreshProject(project, externalSystemId, path, callback, false, progressExecutionMode);
+        refreshProject(
+          spec.getProject(), spec.getExternalSystemId(), path, callback, false, spec.getProgressExecutionMode());
       }
     }
   }
@@ -340,6 +374,8 @@
   }
 
   /**
+   * TODO[Vlad]: refactor the method to use {@link com.intellij.openapi.externalSystem.importing.ImportSpecBuilder}
+   *
    * Queries slave gradle process to refresh target gradle project.
    *
    * @param project               target intellij project to use
@@ -358,6 +394,8 @@
   }
 
   /**
+   * TODO[Vlad]: refactor the method to use {@link com.intellij.openapi.externalSystem.importing.ImportSpecBuilder}
+   *
    * Queries slave gradle process to refresh target gradle project.
    *
    * @param project               target intellij project to use
@@ -500,40 +538,50 @@
   public static void runTask(@NotNull ExternalSystemTaskExecutionSettings taskSettings,
                              @NotNull String executorId,
                              @NotNull Project project,
-                             @NotNull ProjectSystemId externalSystemId)
-  {
+                             @NotNull ProjectSystemId externalSystemId) {
+    runTask(taskSettings, executorId, project, externalSystemId, null);
+  }
+
+  public static void runTask(@NotNull ExternalSystemTaskExecutionSettings taskSettings,
+                             @NotNull String executorId,
+                             @NotNull Project project,
+                             @NotNull ProjectSystemId externalSystemId,
+                             @Nullable ProgramRunner.Callback callback) {
+    final Pair<ProgramRunner, ExecutionEnvironment> pair = createRunner(taskSettings, executorId, project, externalSystemId);
+    if (pair == null) return;
+
+    try {
+      pair.first.execute(pair.second, callback);
+    }
+    catch (ExecutionException e) {
+      LOG.warn("Can't execute task " + taskSettings, e);
+    }
+  }
+
+  @Nullable
+  public static Pair<ProgramRunner, ExecutionEnvironment> createRunner(@NotNull ExternalSystemTaskExecutionSettings taskSettings,
+                                                                       @NotNull String executorId,
+                                                                       @NotNull Project project,
+                                                                       @NotNull ProjectSystemId externalSystemId) {
     Executor executor = ExecutorRegistry.getInstance().getExecutorById(executorId);
-    if (executor == null) {
-      return;
-    }
+    if (executor == null) return null;
+
     String runnerId = getRunnerId(executorId);
-    if (runnerId == null) {
-      return;
-    }
+    if (runnerId == null) return null;
+
     ProgramRunner runner = RunnerRegistry.getInstance().findRunnerById(runnerId);
-    if (runner == null) {
-      return;
-    }
+    if (runner == null) return null;
+
     AbstractExternalSystemTaskConfigurationType configurationType = findConfigurationType(externalSystemId);
-    if (configurationType == null) {
-      return;
-    }
+    if (configurationType == null) return null;
 
     String name = AbstractExternalSystemTaskConfigurationType.generateName(project, taskSettings);
     RunnerAndConfigurationSettings settings = RunManager.getInstance(project).createRunConfiguration(name, configurationType.getFactory());
     ExternalSystemRunConfiguration runConfiguration = (ExternalSystemRunConfiguration)settings.getConfiguration();
     runConfiguration.getSettings().setExternalProjectPath(taskSettings.getExternalProjectPath());
     runConfiguration.getSettings().setTaskNames(taskSettings.getTaskNames());
-    
-    
-    ExecutionEnvironment env = new ExecutionEnvironment(executor, runner, settings, project);
-    
-    try {
-      runner.execute(env, null);
-    }
-    catch (ExecutionException e) {
-      LOG.warn("Can't execute task " + taskSettings, e);
-    }
+
+    return Pair.create(runner, new ExecutionEnvironment(executor, runner, settings, project));
   }
 
   @Nullable
diff --git a/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/service/project/ExternalProjectServiceTest.groovy b/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/service/project/ExternalProjectServiceTest.groovy
index 60e4c1d..3dbd9a9 100644
--- a/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/service/project/ExternalProjectServiceTest.groovy
+++ b/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/service/project/ExternalProjectServiceTest.groovy
@@ -21,10 +21,12 @@
 import com.intellij.openapi.externalSystem.test.AbstractExternalSystemTest
 import com.intellij.openapi.externalSystem.test.ExternalSystemTestUtil
 import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil
+import com.intellij.openapi.roots.JavadocOrderRootType
 import com.intellij.openapi.roots.LibraryOrderEntry
 import com.intellij.openapi.roots.ModuleSourceOrderEntry
 import com.intellij.openapi.roots.OrderEntry
 import com.intellij.openapi.roots.OrderRootType
+import com.intellij.openapi.util.io.FileUtil
 
 import static com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType.*
 /**
@@ -102,15 +104,28 @@
   }
 
   void 'test library dependency with sources path added on subsequent refresh'() {
+
+    def libBinPath = new File(projectDir, "bin_path");
+    def libSrcPath = new File(projectDir, "source_path");
+    def libDocPath = new File(projectDir, "doc_path");
+
+    FileUtil.createDirectory(libBinPath);
+    FileUtil.createDirectory(libSrcPath);
+    FileUtil.createDirectory(libDocPath);
+
     applyProjectState([
       buildExternalProjectInfo {
         project {
           module('module') {
-            lib('lib1', level: 'module', bin: ["bin_path"]) } } },
+            lib('lib1', level: 'module', bin: [libBinPath.absolutePath]) } } },
       buildExternalProjectInfo {
         project {
           module('module') {
-            lib('lib1', level: 'module', bin: ["bin_path"], src: ["source_path"]) } } }
+            lib('lib1', level: 'module', bin: [libBinPath.absolutePath], src: [libSrcPath.absolutePath]) } } },
+      buildExternalProjectInfo {
+        project {
+          module('module') {
+            lib('lib1', level: 'module', bin: [libBinPath.absolutePath], src: [libSrcPath.absolutePath],  doc: [libDocPath.absolutePath]) } } }
     ])
 
     def helper = ServiceManager.getService(ProjectStructureHelper.class)
@@ -131,6 +146,9 @@
           def sourceUrls = entry.getUrls(OrderRootType.SOURCES)
           assertEquals(1, sourceUrls.length)
           assertTrue(sourceUrls[0].endsWith("source_path"))
+          def docUrls = entry.getUrls(JavadocOrderRootType.instance)
+          assertEquals(1, docUrls.length)
+          assertTrue(docUrls[0].endsWith("doc_path"))
         }
         else {
           fail()
diff --git a/platform/icons/src/gutter/extAnnotation.png b/platform/icons/src/gutter/extAnnotation.png
new file mode 100644
index 0000000..68fcd67
--- /dev/null
+++ b/platform/icons/src/gutter/extAnnotation.png
Binary files differ
diff --git a/platform/icons/src/gutter/extAnnotation@2x.png b/platform/icons/src/gutter/extAnnotation@2x.png
new file mode 100644
index 0000000..91b7e88
--- /dev/null
+++ b/platform/icons/src/gutter/extAnnotation@2x.png
Binary files differ
diff --git a/platform/icons/src/gutter/extAnnotation@2x_dark.png b/platform/icons/src/gutter/extAnnotation@2x_dark.png
new file mode 100644
index 0000000..d84a71d
--- /dev/null
+++ b/platform/icons/src/gutter/extAnnotation@2x_dark.png
Binary files differ
diff --git a/platform/icons/src/gutter/extAnnotation_dark.png b/platform/icons/src/gutter/extAnnotation_dark.png
new file mode 100644
index 0000000..a0cc10b
--- /dev/null
+++ b/platform/icons/src/gutter/extAnnotation_dark.png
Binary files differ
diff --git a/platform/indexing-api/src/com/intellij/util/indexing/PsiDependentIndex.java b/platform/indexing-api/src/com/intellij/util/indexing/PsiDependentIndex.java
new file mode 100644
index 0000000..7788771
--- /dev/null
+++ b/platform/indexing-api/src/com/intellij/util/indexing/PsiDependentIndex.java
@@ -0,0 +1,22 @@
+/*
+ * 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.util.indexing;
+
+/**
+ * Marker interface of index that is built from PSI, meaning its invalidation will happen upon producing new PSI.
+ */
+public interface PsiDependentIndex {
+}
diff --git a/platform/indexing-impl/src/com/intellij/openapi/module/impl/scopes/LibraryScopeBase.java b/platform/indexing-impl/src/com/intellij/openapi/module/impl/scopes/LibraryScopeBase.java
index f70c3c1..6961f94 100644
--- a/platform/indexing-impl/src/com/intellij/openapi/module/impl/scopes/LibraryScopeBase.java
+++ b/platform/indexing-impl/src/com/intellij/openapi/module/impl/scopes/LibraryScopeBase.java
@@ -53,7 +53,7 @@
     if (myIndex.isInLibraryClasses(file)) {
       return myIndex.getClassRootForFile(file);
     }
-    if (myIndex.isInContent(file)) {
+    if (myIndex.isInLibrarySource(file)) {
       return myIndex.getSourceRootForFile(file);
     }
     return null;
diff --git a/platform/lang-api/src/com/intellij/codeInsight/intention/impl/PriorityLocalQuickFixWrapper.java b/platform/lang-api/src/com/intellij/codeInsight/intention/impl/PriorityLocalQuickFixWrapper.java
index e9f3d44..67b14a8 100644
--- a/platform/lang-api/src/com/intellij/codeInsight/intention/impl/PriorityLocalQuickFixWrapper.java
+++ b/platform/lang-api/src/com/intellij/codeInsight/intention/impl/PriorityLocalQuickFixWrapper.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.
diff --git a/platform/lang-api/src/com/intellij/codeInsight/template/impl/TextExpression.java b/platform/lang-api/src/com/intellij/codeInsight/template/impl/TextExpression.java
new file mode 100644
index 0000000..6a09c46
--- /dev/null
+++ b/platform/lang-api/src/com/intellij/codeInsight/template/impl/TextExpression.java
@@ -0,0 +1,44 @@
+/*
+ * 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.codeInsight.template.impl;
+
+import com.intellij.codeInsight.lookup.LookupElement;
+import com.intellij.codeInsight.template.Expression;
+import com.intellij.codeInsight.template.ExpressionContext;
+import com.intellij.codeInsight.template.Result;
+import com.intellij.codeInsight.template.TextResult;
+
+
+public class TextExpression extends Expression {
+  private final String myString;
+
+  public TextExpression(String string) { myString = string; }
+
+  @Override
+  public Result calculateResult(ExpressionContext expressionContext) {
+    return new TextResult(myString);
+  }
+
+  @Override
+  public Result calculateQuickResult(ExpressionContext expressionContext) {
+    return calculateResult(expressionContext);
+  }
+
+  @Override
+  public LookupElement[] calculateLookupItems(ExpressionContext expressionContext) {
+    return LookupElement.EMPTY_ARRAY;
+  }
+}
diff --git a/platform/lang-api/src/com/intellij/codeInspection/IntentionAndQuickFixAction.java b/platform/lang-api/src/com/intellij/codeInspection/IntentionAndQuickFixAction.java
deleted file mode 100644
index 830445d..0000000
--- a/platform/lang-api/src/com/intellij/codeInspection/IntentionAndQuickFixAction.java
+++ /dev/null
@@ -1,71 +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;
-
-import com.intellij.codeInsight.intention.IntentionAction;
-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;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author Gregory.Shrago
- */
-public abstract class IntentionAndQuickFixAction implements LocalQuickFix, IntentionAction{
-  public static IntentionAndQuickFixAction[] EMPTY_ARRAY = new IntentionAndQuickFixAction[0];
-
-  @Override
-  @NotNull
-  public abstract String getName();
-
-  @Override
-  @NotNull
-  public abstract String getFamilyName();
-
-  public abstract void applyFix(@NotNull Project project, final PsiFile file, @Nullable final Editor editor);
-
-  @Override
-  @NotNull
-  public final String getText() {
-    return getName();
-  }
-
-  @Override
-  public final void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
-    applyFix(project, descriptor.getPsiElement().getContainingFile(), null);
-  }
-
-  @Override
-  public final void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
-    applyFix(project, file, editor);
-  }
-
-  /**
-   *  In general case will be called if invoked as IntentionAction.
-   */
-  @Override
-  public boolean isAvailable(@NotNull final Project project, @Nullable final Editor editor, final PsiFile file) {
-    return true;
-  }
-
-  @Override
-  public boolean startInWriteAction() {
-    return true;
-  }
-}
diff --git a/platform/lang-api/src/com/intellij/execution/actions/ConfigurationContext.java b/platform/lang-api/src/com/intellij/execution/actions/ConfigurationContext.java
index 32fd9c9..bf8cffe 100644
--- a/platform/lang-api/src/com/intellij/execution/actions/ConfigurationContext.java
+++ b/platform/lang-api/src/com/intellij/execution/actions/ConfigurationContext.java
@@ -220,12 +220,12 @@
     }
     if (element == null) {
       final PsiElement[] elements = LangDataKeys.PSI_ELEMENT_ARRAY.getData(dataContext);
-      element = elements != null && elements.length >= 1 ? elements[0] : null;
+      element = elements != null && elements.length > 0 ? elements[0] : null;
     }
     if (element == null) {
-      final VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(dataContext);
-      if (file != null) {
-        element = PsiManager.getInstance(project).findFile(file);
+      final VirtualFile[] files = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext);
+      if (files != null && files.length > 0) {
+        element = PsiManager.getInstance(project).findFile(files[0]);
       }
     }
     return element;
diff --git a/platform/lang-api/src/com/intellij/execution/configurations/CommandLineState.java b/platform/lang-api/src/com/intellij/execution/configurations/CommandLineState.java
index bf52dde..b2593ef 100644
--- a/platform/lang-api/src/com/intellij/execution/configurations/CommandLineState.java
+++ b/platform/lang-api/src/com/intellij/execution/configurations/CommandLineState.java
@@ -31,6 +31,8 @@
 import com.intellij.openapi.actionSystem.ToggleAction;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.project.DumbAware;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.search.GlobalSearchScope;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -48,7 +50,11 @@
 
   protected CommandLineState(ExecutionEnvironment environment) {
     myEnvironment = environment;
-    myConsoleBuilder = myEnvironment != null ? TextConsoleBuilderFactory.getInstance().createBuilder(myEnvironment.getProject()) : null;
+    if (myEnvironment != null) {
+      final Project project = myEnvironment.getProject();
+      final GlobalSearchScope searchScope = SearchScopeProvider.createSearchScope(project, myEnvironment.getRunProfile());
+      myConsoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(project, searchScope);
+    }
   }
 
   public ExecutionEnvironment getEnvironment() {
diff --git a/platform/lang-api/src/com/intellij/execution/configurations/SearchScopeProvider.java b/platform/lang-api/src/com/intellij/execution/configurations/SearchScopeProvider.java
new file mode 100644
index 0000000..ea6b158
--- /dev/null
+++ b/platform/lang-api/src/com/intellij/execution/configurations/SearchScopeProvider.java
@@ -0,0 +1,46 @@
+/*
+ * 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.execution.configurations;
+
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.search.GlobalSearchScope;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author Vojtech Krasa
+ */
+public class SearchScopeProvider {
+  @NotNull
+  public static GlobalSearchScope createSearchScope(@NotNull Project project, @Nullable RunProfile runProfile) {
+    Module[] modules = null;
+    if (runProfile instanceof ModuleRunProfile) {
+      modules = ((ModuleRunProfile)runProfile).getModules();
+    }
+    if (modules == null || modules.length == 0) {
+      return GlobalSearchScope.allScope(project);
+    }
+    else {
+      GlobalSearchScope scope = GlobalSearchScope.moduleRuntimeScope(modules[0], true);
+      for (int idx = 1; idx < modules.length; idx++) {
+        Module module = modules[idx];
+        scope = scope.uniteWith(GlobalSearchScope.moduleRuntimeScope(module, true));
+      }
+      return scope;
+    }
+  }
+}
diff --git a/platform/lang-api/src/com/intellij/execution/filters/CompositeFilter.java b/platform/lang-api/src/com/intellij/execution/filters/CompositeFilter.java
index 867c78c..fb782db 100644
--- a/platform/lang-api/src/com/intellij/execution/filters/CompositeFilter.java
+++ b/platform/lang-api/src/com/intellij/execution/filters/CompositeFilter.java
@@ -33,7 +33,7 @@
 
   private final List<Filter> myFilters = new ArrayList<Filter>();
   private boolean myIsAnyHeavy;
-  private boolean forceUseAllFilters = true;
+  private boolean forceUseAllFilters = false;
   private final DumbService myDumbService;
 
   public CompositeFilter(@NotNull Project project) {
@@ -85,8 +85,8 @@
     }
     if (resultItems.size() == 1) {
       ResultItem resultItem = resultItems.get(0);
-      return new Result(resultItem.highlightStartOffset, resultItem.highlightEndOffset, resultItem.hyperlinkInfo,
-                        resultItem.highlightAttributes);
+      return new Result(resultItem.getHighlightStartOffset(), resultItem.getHighlightEndOffset(), resultItem.getHyperlinkInfo(),
+                        resultItem.getHighlightAttributes());
     }
     return new Result(resultItems);
   }
@@ -104,7 +104,7 @@
       List<ResultItem> newItems = newResult.getResultItems();
       for (int i = 0; i < newItems.size(); i++) {
         ResultItem item = newItems.get(i);
-        if (item.hyperlinkInfo == null || !intersects(resultItems, item)) {
+        if (item.getHyperlinkInfo() == null || !intersects(resultItems, item)) {
           resultItems.add(item);
         }
       }
@@ -117,7 +117,7 @@
 
     for (int i = 0; i < items.size(); i++) {
       ResultItem item = items.get(i);
-      if (item.hyperlinkInfo != null) {
+      if (item.getHyperlinkInfo() != null) {
         if (newItemTextRange == null) {
           newItemTextRange = new TextRange(newItem.highlightStartOffset, newItem.highlightEndOffset);
         }
diff --git a/platform/lang-api/src/com/intellij/execution/filters/Filter.java b/platform/lang-api/src/com/intellij/execution/filters/Filter.java
index 1e375ac..66cde5b 100644
--- a/platform/lang-api/src/com/intellij/execution/filters/Filter.java
+++ b/platform/lang-api/src/com/intellij/execution/filters/Filter.java
@@ -34,20 +34,23 @@
     protected NextAction myNextAction = NextAction.EXIT;
     protected final List<ResultItem> myResultItems;
 
-    public Result(final int highlightStartOffset, final int highlightEndOffset, final HyperlinkInfo hyperlinkInfo) {
+    public Result(final int highlightStartOffset, final int highlightEndOffset, @Nullable final HyperlinkInfo hyperlinkInfo) {
       this(highlightStartOffset, highlightEndOffset, hyperlinkInfo, null);
     }
 
-    public Result(final int highlightStartOffset, final int highlightEndOffset, final HyperlinkInfo hyperlinkInfo, final TextAttributes highlightAttributes) {
+    public Result(final int highlightStartOffset,
+                  final int highlightEndOffset,
+                  @Nullable final HyperlinkInfo hyperlinkInfo,
+                  @Nullable final TextAttributes highlightAttributes) {
       super(highlightStartOffset, highlightEndOffset, hyperlinkInfo, highlightAttributes);
       myResultItems = null;
     }
-    
+
     public Result(@NotNull List<ResultItem> resultItems) {
       super(-1, -1, null, null);
       myResultItems = resultItems;
     }
-    
+
     public List<ResultItem> getResultItems() {
       List<ResultItem> resultItems = myResultItems;
       if (resultItems == null) {
@@ -56,6 +59,59 @@
       return resultItems;
     }
 
+    /**
+     * @deprecated This method will be removed. Result may be constructed using ResultItems, in that case this method will return incorrect value. Use {@link #getResultItems()} instead.
+     */
+    @Deprecated
+    @Override
+    public int getHighlightStartOffset() {
+      return super.getHighlightStartOffset();
+    }
+
+    /**
+     * @deprecated This method will be removed. Result may be constructed using ResultItems, in that case this method will return incorrect value. Use {@link #getResultItems()} instead.
+     */
+    @Deprecated
+    @Override
+    public int getHighlightEndOffset() {
+      return super.getHighlightEndOffset();
+    }
+
+    /**
+     * @deprecated This method will be removed. Result may be constructed using ResultItems, in that case this method will return incorrect value. Use {@link #getResultItems()} instead.
+     */
+    @Deprecated
+    @Nullable
+    @Override
+    public TextAttributes getHighlightAttributes() {
+      return super.getHighlightAttributes();
+    }
+
+    /**
+     * @deprecated This method will be removed. Result may be constructed using ResultItems, in that case this method will return incorrect value. Use {@link #getResultItems()} or {@link #getFirstHyperlinkInfo()} instead.
+     */
+    @Deprecated
+    @Nullable
+    @Override
+    public HyperlinkInfo getHyperlinkInfo() {
+      return super.getHyperlinkInfo();
+    }
+
+    @Nullable
+    public HyperlinkInfo getFirstHyperlinkInfo() {
+      HyperlinkInfo info = super.getHyperlinkInfo();
+      if (info == null && myResultItems != null) {
+        //noinspection ForLoopReplaceableByForEach
+        for (int i = 0; i < myResultItems.size(); i++) {
+          ResultItem resultItem = myResultItems.get(i);
+          if (resultItem.getHyperlinkInfo() != null) {
+            return resultItem.getHyperlinkInfo();
+          }
+        }
+      }
+      return info;
+    }
+
     public NextAction getNextAction() {
       return myNextAction;
     }
@@ -70,36 +126,73 @@
   }
 
   class ResultItem {
+    /**
+     * @deprecated use getter, the visibility of this field will be decreased.
+     */
+    @Deprecated
     public final int highlightStartOffset;
+    /**
+     * @deprecated use getter, the visibility of this field will be decreased.
+     */
+    @Deprecated
     public final int highlightEndOffset;
+    /**
+     * @deprecated use getter, the visibility of this field will be decreased.
+     */
+    @Deprecated @Nullable
     public final TextAttributes highlightAttributes;
+    /**
+     * @deprecated use getter, the visibility of this field will be decreased.
+     */
+    @Deprecated @Nullable
     public final HyperlinkInfo hyperlinkInfo;
 
-    public ResultItem(final int highlightStartOffset, final int highlightEndOffset, final HyperlinkInfo hyperlinkInfo) {
+    @SuppressWarnings("deprecation")
+    public ResultItem(final int highlightStartOffset, final int highlightEndOffset, @Nullable final HyperlinkInfo hyperlinkInfo) {
       this(highlightStartOffset, highlightEndOffset, hyperlinkInfo, null);
     }
 
-    public ResultItem(final int highlightStartOffset, final int highlightEndOffset, final HyperlinkInfo hyperlinkInfo, final TextAttributes highlightAttributes) {
+    @SuppressWarnings("deprecation")
+    public ResultItem(final int highlightStartOffset,
+                      final int highlightEndOffset,
+                      @Nullable final HyperlinkInfo hyperlinkInfo,
+                      @Nullable final TextAttributes highlightAttributes) {
       this.highlightStartOffset = highlightStartOffset;
       this.highlightEndOffset = highlightEndOffset;
       this.hyperlinkInfo = hyperlinkInfo;
       this.highlightAttributes = highlightAttributes;
     }
+
+    public int getHighlightStartOffset() {
+      //noinspection deprecation
+      return highlightStartOffset;
+    }
+
+    public int getHighlightEndOffset() {
+      //noinspection deprecation
+      return highlightEndOffset;
+    }
+
+    @Nullable
+    public TextAttributes getHighlightAttributes() {
+      //noinspection deprecation
+      return highlightAttributes;
+    }
+
+    @Nullable
+    public HyperlinkInfo getHyperlinkInfo() {
+      //noinspection deprecation
+      return hyperlinkInfo;
+    }
   }
 
   /**
    * Filters line by creating an instance of {@link Result}.
    *
-   *
-   * @param line
-   *     The line to be filtered. Note that the line must contain a line
-   *     separator at the end.
-   *
-   * @param entireLength
-   *     The length of the entire text including the line passed for filtration.
-   *
-   * @return
-   *    <tt>null</tt>, if there was no match, otherwise, an instance of {@link Result}
+   * @param line         The line to be filtered. Note that the line must contain a line
+   *                     separator at the end.
+   * @param entireLength The length of the entire text including the line passed for filtration.
+   * @return <tt>null</tt>, if there was no match, otherwise, an instance of {@link Result}
    */
   @Nullable
   Result applyFilter(String line, int entireLength);
diff --git a/platform/lang-api/src/com/intellij/execution/ui/RunContentDescriptor.java b/platform/lang-api/src/com/intellij/execution/ui/RunContentDescriptor.java
index 2e0f047..efee74b 100644
--- a/platform/lang-api/src/com/intellij/execution/ui/RunContentDescriptor.java
+++ b/platform/lang-api/src/com/intellij/execution/ui/RunContentDescriptor.java
@@ -40,6 +40,7 @@
   private final String myHelpId;
 
   private boolean myActivateToolWindowWhenAdded = true;
+  private boolean myReuseToolWindowActivation = false;
   private long myExecutionId = 0;
   private Computable<JComponent> myFocusComputable = null;
   private boolean myAutoFocusContent = false;
@@ -157,6 +158,14 @@
     myActivateToolWindowWhenAdded = activateToolWindowWhenAdded;
   }
 
+  public boolean isReuseToolWindowActivation() {
+    return myReuseToolWindowActivation;
+  }
+
+  public void setReuseToolWindowActivation(boolean reuseToolWindowActivation) {
+    myReuseToolWindowActivation = reuseToolWindowActivation;
+  }
+
   public long getExecutionId() {
     return myExecutionId;
   }
diff --git a/platform/lang-api/src/com/intellij/psi/search/NonClasspathDirectoryScope.java b/platform/lang-api/src/com/intellij/psi/search/NonClasspathDirectoryScope.java
deleted file mode 100644
index ce96fe0..0000000
--- a/platform/lang-api/src/com/intellij/psi/search/NonClasspathDirectoryScope.java
+++ /dev/null
@@ -1,92 +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.psi.search;
-
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.vfs.VfsUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-/**
- * @author peter
- */
-public class NonClasspathDirectoryScope extends GlobalSearchScope {
-  private final VirtualFile myRoot;
-
-  public NonClasspathDirectoryScope(@NotNull VirtualFile root) {
-    myRoot = root;
-  }
-
-  @Override
-  public boolean isSearchOutsideRootModel() {
-    return true;
-  }
-
-  @NotNull
-  public static GlobalSearchScope compose(List<VirtualFile> roots) {
-    if (roots.isEmpty()) {
-      return EMPTY_SCOPE;
-    }
-
-    GlobalSearchScope scope = new NonClasspathDirectoryScope(roots.get(0));
-    for (int i = 1; i < roots.size(); i++) {
-      scope = scope.uniteWith(new NonClasspathDirectoryScope(roots.get(i)));
-    }
-    return scope;
-  }
-
-  @Override
-  public boolean contains(@NotNull VirtualFile file) {
-    return VfsUtil.isAncestor(myRoot, file, false);
-  }
-
-  @Override
-  public int compare(@NotNull VirtualFile file1, @NotNull VirtualFile file2) {
-    return 0;
-  }
-
-  @Override
-  public boolean isSearchInModuleContent(@NotNull Module aModule) {
-    return false;
-  }
-
-  @Override
-  public boolean isSearchInLibraries() {
-    return false;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    if (!(o instanceof NonClasspathDirectoryScope)) return false;
-
-    NonClasspathDirectoryScope that = (NonClasspathDirectoryScope)o;
-
-    if (!myRoot.equals(that.myRoot)) return false;
-
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    int result = super.hashCode();
-    result = 31 * result + myRoot.hashCode();
-    return result;
-  }
-}
diff --git a/platform/lang-api/src/com/intellij/util/PsiNavigateUtil.java b/platform/lang-api/src/com/intellij/util/PsiNavigateUtil.java
index 7daf4db..82ad15e 100644
--- a/platform/lang-api/src/com/intellij/util/PsiNavigateUtil.java
+++ b/platform/lang-api/src/com/intellij/util/PsiNavigateUtil.java
@@ -18,8 +18,10 @@
 
 import com.intellij.openapi.fileEditor.OpenFileDescriptor;
 import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.pom.Navigatable;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiFile;
+import com.intellij.psi.util.PsiUtilCore;
 import org.jetbrains.annotations.Nullable;
 
 public class PsiNavigateUtil {
@@ -27,10 +29,14 @@
     if (psiElement != null && psiElement.isValid()) {
       final PsiElement navigationElement = psiElement.getNavigationElement();
       final int offset = navigationElement instanceof PsiFile ? -1 : navigationElement.getTextOffset();
-      final VirtualFile virtualFile = navigationElement.getContainingFile().getVirtualFile();
+
+      VirtualFile virtualFile = PsiUtilCore.getVirtualFile(psiElement);
       if (virtualFile != null && virtualFile.isValid()) {
         new OpenFileDescriptor(navigationElement.getProject(), virtualFile, offset).navigate(true);
       }
+      else if (navigationElement instanceof Navigatable) {
+        ((Navigatable)navigationElement).navigate(true);
+      }
     }
   }
 }
\ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/application/options/GeneralCodeStylePanel.java b/platform/lang-impl/src/com/intellij/application/options/GeneralCodeStylePanel.java
index 844b1cc..c96f5e7 100644
--- a/platform/lang-impl/src/com/intellij/application/options/GeneralCodeStylePanel.java
+++ b/platform/lang-impl/src/com/intellij/application/options/GeneralCodeStylePanel.java
@@ -42,6 +42,7 @@
 import com.intellij.ui.IdeBorderFactory;
 import com.intellij.ui.awt.RelativePoint;
 import com.intellij.ui.components.JBLabel;
+import com.intellij.ui.components.JBScrollPane;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -80,6 +81,7 @@
   private JBLabel myFormatterOnLabel;
   private JPanel myMarkerOptionsPanel;
   private final SmartIndentOptionsEditor myIndentOptionsEditor;
+  private final JBScrollPane myScrollPane;
 
 
   public GeneralCodeStylePanel(CodeStyleSettings settings) {
@@ -126,6 +128,8 @@
       ApplicationBundle.message("settings.code.style.general.formatter.marker.title"), true));
     myMarkerOptionsPanel.setBorder(
       IdeBorderFactory.createTitledBorder(ApplicationBundle.message("settings.code.style.general.formatter.marker.options.title"), true));
+    myScrollPane = new JBScrollPane(myPanel,
+                                    ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
   }
 
   @Nullable
@@ -241,7 +245,7 @@
 
   @Override
   public JComponent getPanel() {
-    return myPanel;
+    return myScrollPane;
   }
 
   @Override
diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleMainPanel.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleMainPanel.java
index 4db811b..3a710fd 100644
--- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleMainPanel.java
+++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleMainPanel.java
@@ -226,7 +226,6 @@
       panel.setModel(myModel);
       mySettingsPanels.put(name, panel);
       mySettingsPanel.add(scheme.getName(), panel);
-      mySchemesPanel.setCodeStyleSettingsPanel(panel);
       panel.setLanguage(myLangSelector.getLanguage());
     }
 
diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleSchemesPanel.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleSchemesPanel.java
index 0f3ad0f..b4a2a24 100644
--- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleSchemesPanel.java
+++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleSchemesPanel.java
@@ -20,6 +20,7 @@
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.psi.codeStyle.CodeStyleScheme;
 import com.intellij.ui.ListCellRendererWrapper;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
@@ -29,7 +30,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
-public class CodeStyleSchemesPanel{
+public class CodeStyleSchemesPanel {
   private JComboBox myCombo;
 
   private final CodeStyleSchemesModel myModel;
@@ -37,7 +38,6 @@
   private JButton myManageButton;
 
   private boolean myIsReset = false;
-  private NewCodeStyleSettingsPanel mySettingsPanel;
   private final Font myDefaultComboFont;
   private final Font myBoldComboFont;
 
@@ -48,7 +48,7 @@
     myBoldComboFont = myDefaultComboFont.deriveFont(Font.BOLD);
     myCombo.addActionListener(new ActionListener() {
       @Override
-      public void actionPerformed(ActionEvent e) {
+      public void actionPerformed(@NotNull ActionEvent e) {
         if (!myIsReset) {
           ApplicationManager.getApplication().invokeLater(new Runnable() {
                 @Override
@@ -75,7 +75,7 @@
     
     myManageButton.addActionListener(new ActionListener() {
       @Override
-      public void actionPerformed(ActionEvent e) {
+      public void actionPerformed(@NotNull ActionEvent e) {
         showManageSchemesDialog();
       }
     });
@@ -148,10 +148,6 @@
     return myPanel;
   }
 
-  public void setCodeStyleSettingsPanel(NewCodeStyleSettingsPanel settingsPanel) {
-    mySettingsPanel = settingsPanel;
-  }
-
   private void showManageSchemesDialog() {
     ManageCodeStyleSchemesDialog manageSchemesDialog = new ManageCodeStyleSchemesDialog(myPanel, myModel);
     manageSchemesDialog.show();
diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/ManageCodeStyleSchemesDialog.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/ManageCodeStyleSchemesDialog.java
index 67b99f1..653f6b5 100644
--- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/ManageCodeStyleSchemesDialog.java
+++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/ManageCodeStyleSchemesDialog.java
@@ -82,7 +82,7 @@
     mySchemesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
     mySchemesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
       @Override
-      public void valueChanged(ListSelectionEvent e) {
+      public void valueChanged(@NotNull ListSelectionEvent e) {
         updateActions();
       }
     });
@@ -91,25 +91,25 @@
 
     myDeleteButton.addActionListener(new ActionListener() {
       @Override
-      public void actionPerformed(ActionEvent e) {
+      public void actionPerformed(@NotNull ActionEvent e) {
         deleteSelected();
       }
     });
     mySaveAsButton.addActionListener(new ActionListener() {
       @Override
-      public void actionPerformed(ActionEvent e) {
+      public void actionPerformed(@NotNull ActionEvent e) {
         onSaveAs();
       }
     });
     myCopyToProjectButton.addActionListener(new ActionListener() {
       @Override
-      public void actionPerformed(ActionEvent e) {
+      public void actionPerformed(@NotNull ActionEvent e) {
         onCopyToProject();
       }
     });
     myCloseButton.addActionListener(new ActionListener(){
       @Override
-      public void actionPerformed(ActionEvent e) {
+      public void actionPerformed(@NotNull ActionEvent e) {
         doCancelAction();
       }
     });
@@ -120,7 +120,7 @@
       myExportButton.setVisible(true);
       myExportButton.addActionListener(new ActionListener() {
         @Override
-        public void actionPerformed(final ActionEvent e) {
+        public void actionPerformed(@NotNull final ActionEvent e) {
           CodeStyleScheme selected = getSelectedScheme();
           ExportSchemeAction.doExport((CodeStyleSchemeImpl)selected, mySchemesManager);
         }
@@ -135,7 +135,7 @@
       myImportButton.setVisible(true);
       myImportButton.addActionListener(new ActionListener() {
         @Override
-        public void actionPerformed(final ActionEvent e) {
+        public void actionPerformed(@NotNull final ActionEvent e) {
           chooseAndImport();
         }
       });
@@ -326,8 +326,9 @@
 
     private MySchemesTable() {
       myFixedItemsRenderer = new DefaultTableCellRenderer() {
+        @NotNull
         @Override
-        public Component getTableCellRendererComponent(JTable table,
+        public Component getTableCellRendererComponent(@NotNull JTable table,
                                                        Object value,
                                                        boolean isSelected,
                                                        boolean hasFocus,
@@ -361,6 +362,7 @@
       updateSchemes();
     }
 
+    @NotNull
     @Override
     public String getColumnName(int column) {
       assert column == 0;
@@ -479,7 +481,8 @@
       for (CodeStyleScheme scheme : schemes) {
         names.add(scheme.getName());
       }
-      SaveSchemeDialog saveDialog = new SaveSchemeDialog(myParent, ApplicationBundle.message("title.save.code.style.scheme.as"), names);
+      String selectedName = getSelectedScheme().getName();
+      SaveSchemeDialog saveDialog = new SaveSchemeDialog(myParent, ApplicationBundle.message("title.save.code.style.scheme.as"), names, selectedName);
       saveDialog.show();
       if (saveDialog.isOK()) {
         int row = mySchemesTableModel.createNewScheme(getSelectedScheme(), saveDialog.getSchemeName());
diff --git a/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java b/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java
index 7a2bc3a..5e30172 100644
--- a/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java
+++ b/platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java
@@ -20,6 +20,7 @@
 import com.intellij.application.options.editor.EditorOptionsProvider;
 import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
 import com.intellij.execution.impl.ConsoleViewUtil;
+import com.intellij.ide.bookmarks.BookmarkManager;
 import com.intellij.ide.todo.TodoConfiguration;
 import com.intellij.ide.ui.LafManager;
 import com.intellij.ide.ui.laf.darcula.DarculaInstaller;
@@ -275,6 +276,7 @@
     for (Project openProject : openProjects) {
       FileStatusManager.getInstance(openProject).fileStatusesChanged();
       DaemonCodeAnalyzer.getInstance(openProject).restart();
+      BookmarkManager.getInstance(openProject).colorsChanged();
     }
   }
 
diff --git a/platform/lang-impl/src/com/intellij/application/options/colors/SchemesPanel.java b/platform/lang-impl/src/com/intellij/application/options/colors/SchemesPanel.java
index c373fa2..4216a0c 100644
--- a/platform/lang-impl/src/com/intellij/application/options/colors/SchemesPanel.java
+++ b/platform/lang-impl/src/com/intellij/application/options/colors/SchemesPanel.java
@@ -29,13 +29,14 @@
 import com.intellij.openapi.options.SchemesManager;
 import com.intellij.util.Consumer;
 import com.intellij.util.EventDispatcher;
-import org.jetbrains.annotations.Nullable;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
-import java.util.ArrayList;
+import java.util.List;
 
 public class SchemesPanel extends JPanel implements SkipSelfSearchComponent {
   private final ColorAndFontOptions myOptions;
@@ -61,7 +62,7 @@
 
     mySchemeComboBox.addActionListener(new ActionListener() {
       @Override
-      public void actionPerformed(ActionEvent e) {
+      public void actionPerformed(@NotNull ActionEvent e) {
         if (mySchemeComboBox.getSelectedIndex() != -1) {
           EditorColorsScheme selected = myOptions.selectScheme((String)mySchemeComboBox.getSelectedItem());
           if (ColorAndFontOptions.isReadOnly(selected)) {
@@ -97,16 +98,6 @@
     return myListLoaded;
   }
 
-  public void clearSearch() {
-  }
-
-  @Nullable
-  @SuppressWarnings({"unchecked"})
-  public static <T> T safeCast(final Object obj, final Class<T> expectedClass) {
-    if (expectedClass.isInstance(obj)) return (T)obj;
-    return null;
-  }
-
   private JPanel createSchemePanel() {
     JPanel panel = new JPanel(new GridBagLayout());
 
@@ -124,7 +115,7 @@
     JButton saveAsButton = new JButton(ApplicationBundle.message("button.save.as"));
     saveAsButton.addActionListener(new ActionListener() {
       @Override
-      public void actionPerformed(ActionEvent e) {
+      public void actionPerformed(@NotNull ActionEvent e) {
         showSaveAsDialog();
       }
     });
@@ -135,7 +126,7 @@
     myDeleteButton = new JButton(ApplicationBundle.message("button.delete"));
     myDeleteButton.addActionListener(new ActionListener() {
       @Override
-      public void actionPerformed(ActionEvent e) {
+      public void actionPerformed(@NotNull ActionEvent e) {
         if (mySchemeComboBox.getSelectedIndex() != -1) {
           myOptions.removeScheme((String)mySchemeComboBox.getSelectedItem());
         }
@@ -151,7 +142,7 @@
       myExportButton = new JButton("Share...");
       myExportButton.addActionListener(new ActionListener() {
         @Override
-        public void actionPerformed(final ActionEvent e) {
+        public void actionPerformed(@NotNull final ActionEvent e) {
           EditorColorsScheme selected = myOptions.getOriginalSelectedScheme();
           ExportSchemeAction
             .doExport((EditorColorsSchemeImpl)selected, ((EditorColorsManagerImpl)EditorColorsManager.getInstance()).getSchemesManager());
@@ -170,7 +161,7 @@
       myImportButton.setMnemonic('I');
       myImportButton.addActionListener(new ActionListener() {
         @Override
-        public void actionPerformed(final ActionEvent e) {
+        public void actionPerformed(@NotNull final ActionEvent e) {
           SchemesToImportPopup<EditorColorsScheme, EditorColorsSchemeImpl> popup =
             new SchemesToImportPopup<EditorColorsScheme, EditorColorsSchemeImpl>(SchemesPanel.this) {
               @Override
@@ -196,7 +187,7 @@
       final JButton button = new JButton(importHandler.getTitle());
       button.addActionListener(new ActionListener() {
         @Override
-        public void actionPerformed(ActionEvent e) {
+        public void actionPerformed(@NotNull ActionEvent e) {
           importHandler.performImport(button, new Consumer<EditorColorsScheme>() {
             @Override
             public void consume(EditorColorsScheme scheme) {
@@ -214,14 +205,9 @@
   }
 
   private void showSaveAsDialog() {
-    ArrayList<String> names = new ArrayList<String>();
-    EditorColorsScheme[] allSchemes = EditorColorsManager.getInstance().getAllSchemes();
-
-    for (EditorColorsScheme scheme : allSchemes) {
-      names.add(scheme.getName());
-    }
-
-    SaveSchemeDialog dialog = new SaveSchemeDialog(this, ApplicationBundle.message("title.save.color.scheme.as"), names);
+    List<String> names = ContainerUtil.newArrayList(myOptions.getSchemeNames());
+    String selectedName = myOptions.getSelectedScheme().getName();
+    SaveSchemeDialog dialog = new SaveSchemeDialog(this, ApplicationBundle.message("title.save.color.scheme.as"), names, selectedName);
     dialog.show();
     if (dialog.isOK()) {
       myOptions.saveSchemeAs(dialog.getSchemeName());
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java b/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java
index f389920..6d13f27 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java
@@ -113,6 +113,7 @@
   public boolean AUTOINSERT_PAIR_QUOTE = true;
   public boolean REFORMAT_BLOCK_ON_RBRACE = true;
 
+  @MagicConstant(intValues = {NO_REFORMAT, INDENT_BLOCK, INDENT_EACH_LINE, REFORMAT_BLOCK})
   public int REFORMAT_ON_PASTE = INDENT_EACH_LINE;
   public static final int NO_REFORMAT = 1;
   public static final int INDENT_BLOCK = 2;
@@ -121,7 +122,8 @@
 
   public boolean INDENT_TO_CARET_ON_PASTE = false;
 
-  public int ADD_IMPORTS_ON_PASTE = ASK; // YES, NO or ASK
+  @MagicConstant(intValues = {YES, NO, ASK})
+  public int ADD_IMPORTS_ON_PASTE = ASK;
   public static final int YES = 1;
   public static final int NO = 2;
   public static final int ASK = 3;
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessor.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessor.java
index b524697..1a682e7 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessor.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/AbstractLayoutCodeProcessor.java
@@ -71,6 +71,7 @@
   private final boolean myProcessChangedTextOnly;
 
   protected AbstractLayoutCodeProcessor myPreviousCodeProcessor;
+  private List<FileFilter> myFilters = ContainerUtil.newArrayList();
 
   protected AbstractLayoutCodeProcessor(Project project, String commandName, String progressText, boolean processChangedTextOnly) {
     this(project, (Module)null, commandName, progressText, processChangedTextOnly);
@@ -173,6 +174,10 @@
                                            : null;
   }
 
+  public void addFileFilter(@NotNull FileFilter filter) {
+    myFilters.add(filter);
+  }
+
   /**
    * Ensures that given file is ready to reformatting and prepares it if necessary.
    *
@@ -492,7 +497,7 @@
       if (myFileTreeIterator.hasNext()) {
         PsiFile file = myFileTreeIterator.next();
         myFilesProcessed++;
-        if (file.isWritable() && canBeFormatted(file)) {
+        if (file.isWritable() && canBeFormatted(file) && acceptedByFilters(file)) {
           performFileProcessing(file);
         }
       }
@@ -533,4 +538,19 @@
       myCompositeTask = compositeTask;
     }
   }
+
+  private boolean acceptedByFilters(@NotNull PsiFile file) {
+    VirtualFile vFile = file.getVirtualFile();
+    if (vFile == null) {
+      return false;
+    }
+
+    for (FileFilter filter : myFilters) {
+      if (!filter.accept(file.getVirtualFile())) {
+        return false;
+      }
+    }
+
+    return true;
+  }
 }
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/FileFilter.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/FileFilter.java
new file mode 100644
index 0000000..2d5325a
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/FileFilter.java
@@ -0,0 +1,30 @@
+/*
+ * 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.codeInsight.actions;
+
+import com.intellij.openapi.vfs.VirtualFile;
+import org.jetbrains.annotations.NotNull;
+
+public interface FileFilter {
+  boolean accept(@NotNull VirtualFile file);
+
+  @NotNull FileFilter ACCEPT_ALL = new FileFilter() {
+    @Override
+    public boolean accept(@NotNull VirtualFile file) {
+      return true;
+    }
+  };
+}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutCodeDialog.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutCodeDialog.java
index cbf36e1..716d2f8 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutCodeDialog.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutCodeDialog.java
@@ -29,6 +29,7 @@
 import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
 import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
 import com.intellij.psi.codeStyle.arrangement.Rearranger;
+import com.intellij.psi.search.SearchScope;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -326,6 +327,18 @@
     return myCbArrangeEntries.isSelected();
   }
 
+  @Nullable
+  @Override
+  public String getFileTypeMask() {
+    return null;
+  }
+
+  @Nullable
+  @Override
+  public SearchScope getSearchScope() {
+    return null;
+  }
+
   @Override
   public boolean isProcessOnlyChangedText() {
     return myCbOnlyVcsChangedRegions.isEnabled() && myCbOnlyVcsChangedRegions.isSelected();
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutDirectoryDialog.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutDirectoryDialog.java
index e8be41b..1d6c23d 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutDirectoryDialog.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutDirectoryDialog.java
@@ -15,48 +15,34 @@
  */
 package com.intellij.codeInsight.actions;
 
-import com.intellij.codeInsight.CodeInsightBundle;
 import com.intellij.openapi.project.Project;
 import org.jetbrains.annotations.NotNull;
 
-import javax.swing.*;
-import java.awt.*;
-
 public class LayoutDirectoryDialog extends LayoutProjectCodeDialog implements DirectoryFormattingOptions {
-  private JCheckBox myIncludeSubdirs;
-
   public LayoutDirectoryDialog(@NotNull Project project,
                                String title,
                                String text,
                                boolean enableOnlyVCSChangedTextCb)
   {
-    super(project, title, text, true, enableOnlyVCSChangedTextCb);
-  }
-
-  public void setEnabledIncludeSubdirsCb(boolean isEnabled) {
-    myIncludeSubdirs.setEnabled(isEnabled);
-  }
-
-  public void setSelectedIncludeSubdirsCb(boolean isSelected) {
-    myIncludeSubdirs.setSelected(isSelected);
+    super(project, title, text, enableOnlyVCSChangedTextCb);
   }
 
   @Override
-  protected JComponent createCenterPanel() {
-    JPanel panel = new JPanel(new BorderLayout(0, 7));
-    JComponent layoutProjectDialog = super.createCenterPanel();
+  protected boolean shouldShowIncludeSubdirsCb() {
+    return true;
+  }
 
-    myIncludeSubdirs = new JCheckBox(CodeInsightBundle.message("reformat.option.include.subdirectories"));
+  public void setEnabledIncludeSubdirsCb(boolean isEnabled) {
+    myIncludeSubdirsCb.setEnabled(isEnabled);
+  }
 
-    panel.add(layoutProjectDialog, BorderLayout.CENTER);
-    panel.add(myIncludeSubdirs, BorderLayout.SOUTH);
-
-    return panel;
+  public void setSelectedIncludeSubdirsCb(boolean isSelected) {
+    myIncludeSubdirsCb.setSelected(isSelected);
   }
 
   @Override
   public boolean isIncludeSubdirectories() {
-    return myIncludeSubdirs.isSelected();
+    return myIncludeSubdirsCb.isSelected();
   }
 
 }
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutProjectCodeDialog.form b/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutProjectCodeDialog.form
new file mode 100644
index 0000000..19f7afe
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutProjectCodeDialog.form
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.codeInsight.actions.LayoutProjectCodeDialog">
+  <grid id="27dc6" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="5" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+    <margin top="0" left="0" bottom="0" right="0"/>
+    <constraints>
+      <xy x="20" y="20" width="500" height="400"/>
+    </constraints>
+    <properties/>
+    <border type="none"/>
+    <children>
+      <grid id="5ad43" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+        <margin top="0" left="0" bottom="0" right="0"/>
+        <constraints>
+          <grid row="2" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+        </constraints>
+        <properties/>
+        <border type="none"/>
+        <children>
+          <grid id="8e614" binding="myOptionsPanel" layout-manager="GridLayoutManager" row-count="5" 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="f9a34" class="javax.swing.JCheckBox" binding="myCbOptimizeImports">
+                <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 value="&amp;Optimize imports"/>
+                </properties>
+              </component>
+              <component id="6b074" class="javax.swing.JCheckBox" binding="myCbRearrangeEntries">
+                <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 value="&amp;Rearrange entries"/>
+                </properties>
+              </component>
+              <component id="3eac4" class="javax.swing.JCheckBox" binding="myCbOnlyVcsChangedRegions">
+                <constraints>
+                  <grid row="3" 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 value="Only &amp;VCS changed text"/>
+                </properties>
+              </component>
+              <vspacer id="e34be">
+                <constraints>
+                  <grid row="4" 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>
+              <component id="98ba2" class="javax.swing.JCheckBox" binding="myIncludeSubdirsCb">
+                <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 value="&amp;Include subdirectories"/>
+                </properties>
+              </component>
+            </children>
+          </grid>
+          <hspacer id="96281">
+            <constraints>
+              <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+            </constraints>
+          </hspacer>
+        </children>
+      </grid>
+      <hspacer id="840c6">
+        <constraints>
+          <grid row="2" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+        </constraints>
+      </hspacer>
+      <grid id="65f22" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+        <margin top="0" left="0" bottom="0" right="0"/>
+        <constraints>
+          <grid row="0" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+        </constraints>
+        <properties/>
+        <border type="none"/>
+        <children/>
+      </grid>
+      <grid id="9e46c" binding="myFiltersPanel" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+        <margin top="0" left="0" bottom="0" right="0"/>
+        <constraints>
+          <grid row="3" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+        </constraints>
+        <properties/>
+        <border type="none"/>
+        <children>
+          <grid id="819e" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+            <margin top="0" left="0" bottom="0" right="0"/>
+            <constraints>
+              <grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+            </constraints>
+            <properties/>
+            <border type="none"/>
+            <children>
+              <component id="4177a" class="com.intellij.ui.components.JBCheckBox" binding="myEnableFileNameFilterCb">
+                <constraints>
+                  <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
+                </constraints>
+                <properties>
+                  <text value="&amp;File mask(s)"/>
+                </properties>
+              </component>
+              <component id="5da" class="com.intellij.openapi.ui.ComboBox" binding="myFileFilter">
+                <constraints>
+                  <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
+                </constraints>
+                <properties/>
+              </component>
+              <hspacer id="8a23a">
+                <constraints>
+                  <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+                </constraints>
+              </hspacer>
+            </children>
+          </grid>
+          <grid id="96685" layout-manager="GridLayoutManager" row-count="1" column-count="3" 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="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+            </constraints>
+            <properties/>
+            <border type="none"/>
+            <children>
+              <component id="16999" class="javax.swing.JCheckBox" binding="myUseScopeFilteringCb">
+                <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 value="&amp;Scope"/>
+                </properties>
+              </component>
+              <hspacer id="386ac">
+                <constraints>
+                  <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+                </constraints>
+              </hspacer>
+              <component id="ab1a2" class="com.intellij.ide.util.scopeChooser.ScopeChooserCombo" binding="myScopeCombo" custom-create="true">
+                <constraints>
+                  <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
+                </constraints>
+                <properties/>
+              </component>
+            </children>
+          </grid>
+          <component id="8b7d7" class="javax.swing.JLabel" binding="myMaskWarningLabel">
+            <constraints>
+              <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="3" use-parent-layout="false"/>
+            </constraints>
+            <properties>
+              <text value="File mask is invalid"/>
+            </properties>
+          </component>
+          <vspacer id="15160">
+            <constraints>
+              <grid row="3" 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>
+      <component id="8a230" class="javax.swing.JLabel" binding="myTitle">
+        <constraints>
+          <grid row="1" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+        </constraints>
+        <properties>
+          <text value=""/>
+        </properties>
+      </component>
+      <grid id="9d0ba" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+        <margin top="0" left="0" bottom="0" right="0"/>
+        <constraints>
+          <grid row="4" column="0" row-span="1" col-span="4" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
+            <minimum-size width="-1" height="5"/>
+          </grid>
+        </constraints>
+        <properties/>
+        <border type="none"/>
+        <children/>
+      </grid>
+    </children>
+  </grid>
+  <buttonGroups>
+    <group name="myScopeGroup">
+      <member id="a255d"/>
+      <member id="2d29d"/>
+    </group>
+  </buttonGroups>
+</form>
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutProjectCodeDialog.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutProjectCodeDialog.java
index aa4aadc..7f76f1b 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutProjectCodeDialog.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/LayoutProjectCodeDialog.java
@@ -17,15 +17,26 @@
 package com.intellij.codeInsight.actions;
 
 import com.intellij.codeInsight.CodeInsightBundle;
+import com.intellij.find.FindSettings;
+import com.intellij.find.impl.FindDialog;
+import com.intellij.find.impl.FindInProjectUtil;
+import com.intellij.icons.AllIcons;
 import com.intellij.ide.util.PropertiesComponent;
+import com.intellij.ide.util.scopeChooser.ScopeChooserCombo;
 import com.intellij.openapi.help.HelpManager;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.ComboBox;
 import com.intellij.openapi.ui.DialogWrapper;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.psi.search.SearchScope;
+import com.intellij.ui.IdeBorderFactory;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
-import java.awt.*;
+import java.awt.event.*;
+import java.util.regex.PatternSyntaxException;
 
 /**
  * @author max
@@ -33,25 +44,35 @@
 public class LayoutProjectCodeDialog extends DialogWrapper implements ReformatFilesOptions {
   private static @NonNls final String HELP_ID = "editing.codeReformatting";
 
+  private final Project myProject;
   private final String  myText;
   private final boolean myEnableOnlyVCSChangedTextCb;
-  private final boolean mySuggestOptimizeImports;
-  private final Project myProject;
 
-  
+  private JLabel myTitle;
+  protected JCheckBox myIncludeSubdirsCb;
+
+  private JCheckBox myUseScopeFilteringCb;
+  private ScopeChooserCombo myScopeCombo;
+
+  private JCheckBox myEnableFileNameFilterCb;
+  private ComboBox myFileFilter;
+
   private JCheckBox myCbOptimizeImports;
-  private JCheckBox myCbOnlyVcsChangedRegions;
   private JCheckBox myCbRearrangeEntries;
+  private JCheckBox myCbOnlyVcsChangedRegions;
+
+  private JPanel myWholePanel;
+  private JPanel myOptionsPanel;
+  private JPanel myFiltersPanel;
+  private JLabel myMaskWarningLabel;
 
   public LayoutProjectCodeDialog(@NotNull Project project,
-                                 String title,
-                                 String text,
-                                 boolean suggestOptimizeImports,
+                                 @NotNull String title,
+                                 @NotNull String text,
                                  boolean enableOnlyVCSChangedTextCb)
   {
     super(project, false);
     myText = text;
-    mySuggestOptimizeImports = suggestOptimizeImports;
     myProject = project;
     myEnableOnlyVCSChangedTextCb = enableOnlyVCSChangedTextCb;
 
@@ -62,30 +83,93 @@
 
   @Override
   protected JComponent createCenterPanel() {
-    if (!mySuggestOptimizeImports) {
-      return new JLabel(myText);
-    }
+    myTitle.setText(myText);
+    myOptionsPanel.setBorder(IdeBorderFactory.createTitledBorder(CodeInsightBundle.message("reformat.directory.dialog.options")));
+    myFiltersPanel.setBorder(IdeBorderFactory.createTitledBorder(CodeInsightBundle.message("reformat.directory.dialog.filters")));
 
-    JPanel panel = new JPanel(new GridLayout(4, 1));
-    myCbOptimizeImports = new JCheckBox(CodeInsightBundle.message("reformat.option.optimize.imports"));
-    myCbRearrangeEntries = new JCheckBox(CodeInsightBundle.message("reformat.option.rearrange.entries"));
-    myCbOnlyVcsChangedRegions = new JCheckBox(CodeInsightBundle.message("reformat.option.vcs.changed.region"));
+    myMaskWarningLabel.setIcon(AllIcons.General.Warning);
+    myMaskWarningLabel.setVisible(false);
 
-    panel.add(new JLabel(myText));
-    panel.add(myCbOptimizeImports);
-    panel.add(myCbRearrangeEntries);
-    panel.add(myCbOnlyVcsChangedRegions);
+    myIncludeSubdirsCb.setVisible(shouldShowIncludeSubdirsCb());
 
+    initFileTypeFilter();
+    initScopeFilter();
+
+    restoreCbsStates();
+    return myWholePanel;
+  }
+
+  private void restoreCbsStates() {
     myCbOptimizeImports.setSelected(PropertiesComponent.getInstance().getBoolean(LayoutCodeConstants.OPTIMIZE_IMPORTS_KEY, false));
     myCbRearrangeEntries.setSelected(LayoutCodeSettingsStorage.getLastSavedRearrangeEntriesCbStateFor(myProject));
     myCbOnlyVcsChangedRegions.setEnabled(myEnableOnlyVCSChangedTextCb);
     myCbOnlyVcsChangedRegions.setSelected(
       myEnableOnlyVCSChangedTextCb && PropertiesComponent.getInstance().getBoolean(LayoutCodeConstants.PROCESS_CHANGED_TEXT_KEY, false)
     );
-
-    return panel;
   }
-  
+
+  private void initScopeFilter() {
+    myUseScopeFilteringCb.setSelected(false);
+    myScopeCombo.setEnabled(false);
+    myUseScopeFilteringCb.addActionListener(new ActionListener() {
+      @Override
+      public void actionPerformed(ActionEvent e) {
+        myScopeCombo.setEnabled(myUseScopeFilteringCb.isSelected());
+      }
+    });
+  }
+
+  private void initFileTypeFilter() {
+    FindDialog.initFileFilter(myFileFilter, myEnableFileNameFilterCb);
+    myEnableFileNameFilterCb.addActionListener(new ActionListener() {
+      @Override
+      public void actionPerformed(ActionEvent e) {
+        updateMaskWarning();
+      }
+    });
+    myFileFilter.getEditor().getEditorComponent().addKeyListener(new KeyAdapter() {
+      @Override
+      public void keyReleased(KeyEvent e) {
+        updateMaskWarning();
+      }
+    });
+  }
+
+  private void updateMaskWarning() {
+    if (myEnableFileNameFilterCb.isSelected()) {
+      String mask = (String)myFileFilter.getEditor().getItem();
+      if (mask == null || !isMaskValid(mask)) {
+        showWarningAndDisableOK();
+        return;
+      }
+    }
+
+    if (myMaskWarningLabel.isVisible()) {
+      clearWarningAndEnableOK();
+    }
+  }
+
+  private void showWarningAndDisableOK() {
+    myMaskWarningLabel.setVisible(true);
+    setOKActionEnabled(false);
+  }
+
+  private void clearWarningAndEnableOK() {
+    myMaskWarningLabel.setVisible(false);
+    setOKActionEnabled(true);
+  }
+
+  private static boolean isMaskValid(@NotNull String mask) {
+    try {
+      FindInProjectUtil.createFileMaskRegExp(mask);
+    }
+    catch (PatternSyntaxException e) {
+      return false;
+    }
+
+    return true;
+  }
+
   @NotNull
   @Override
   protected Action[] createActions() {
@@ -105,12 +189,10 @@
   @Override
   protected void doOKAction() {
     super.doOKAction();
-    if (mySuggestOptimizeImports) {
-      PropertiesComponent.getInstance().setValue(LayoutCodeConstants.OPTIMIZE_IMPORTS_KEY, Boolean.toString(isOptimizeImports()));
-      LayoutCodeSettingsStorage.saveRearrangeEntriesOptionFor(myProject, isRearrangeEntries());
-      if (myEnableOnlyVCSChangedTextCb) {
-        PropertiesComponent.getInstance().setValue(LayoutCodeConstants.PROCESS_CHANGED_TEXT_KEY, Boolean.toString(myCbOnlyVcsChangedRegions.isSelected()));
-      }
+    PropertiesComponent.getInstance().setValue(LayoutCodeConstants.OPTIMIZE_IMPORTS_KEY, Boolean.toString(isOptimizeImports()));
+    LayoutCodeSettingsStorage.saveRearrangeEntriesOptionFor(myProject, isRearrangeEntries());
+    if (myEnableOnlyVCSChangedTextCb) {
+      PropertiesComponent.getInstance().setValue(LayoutCodeConstants.PROCESS_CHANGED_TEXT_KEY, Boolean.toString(myCbOnlyVcsChangedRegions.isSelected()));
     }
   }
 
@@ -122,4 +204,32 @@
     return myCbOnlyVcsChangedRegions.isEnabled() && myCbOnlyVcsChangedRegions.isSelected();
   }
 
+  @Nullable
+  public String getFileTypeMask() {
+    if (myEnableFileNameFilterCb.isSelected()) {
+      return (String)myFileFilter.getSelectedItem();
+    }
+
+    return null;
+  }
+
+  protected void createUIComponents() {
+    myScopeCombo = new ScopeChooserCombo(myProject, false, false, FindSettings.getInstance().getDefaultScopeName());
+    Disposer.register(myDisposable, myScopeCombo);
+  }
+
+  @Nullable
+  @Override
+  public SearchScope getSearchScope() {
+    if (myUseScopeFilteringCb.isSelected()) {
+      return myScopeCombo.getSelectedScope();
+    }
+
+    return null;
+  }
+
+  protected boolean shouldShowIncludeSubdirsCb() {
+    return false;
+  }
+
 }
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/OptimizeImportsAction.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/OptimizeImportsAction.java
index 5a84a20..27b89fd 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/actions/OptimizeImportsAction.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/OptimizeImportsAction.java
@@ -24,10 +24,14 @@
 import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.vfs.ReadonlyStatusHandler;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.*;
 import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
 
 public class OptimizeImportsAction extends AnAction {
   private static final @NonNls String HELP_ID = "editing.manageImports";
@@ -74,8 +78,7 @@
         else {
           text = CodeInsightBundle.message("process.scope.project", projectContext.getPresentableUrl());
         }
-        LayoutProjectCodeDialog dialog
-          = new LayoutProjectCodeDialog(project, CodeInsightBundle.message("process.optimize.imports"), text, false, false);
+        DialogWrapper dialog = new OptimizeOnModuleDialog(project, text);
         dialog.show();
         if (!dialog.isOK()) return;
         if (moduleContext != null) {
@@ -197,4 +200,22 @@
   private static boolean isOptimizeImportsAvailable(final PsiFile file) {
     return !LanguageImportStatements.INSTANCE.forFile(file).isEmpty();
   }
+
+  private static class OptimizeOnModuleDialog extends DialogWrapper {
+    private final String myText;
+
+    OptimizeOnModuleDialog(Project project, String text) {
+      super(project, false);
+      myText = text;
+      setOKButtonText(CodeInsightBundle.message("reformat.code.accept.button.text"));
+      setTitle(CodeInsightBundle.message("process.optimize.imports"));
+      init();
+    }
+
+    @Nullable
+    @Override
+    protected JComponent createCenterPanel() {
+      return new JLabel(myText);
+    }
+  }
 }
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeAction.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeAction.java
index 42bfdb3..50942cb 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeAction.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeAction.java
@@ -18,6 +18,7 @@
 
 import com.intellij.application.options.editor.EditorOptions;
 import com.intellij.codeInsight.CodeInsightBundle;
+import com.intellij.find.impl.FindInProjectUtil;
 import com.intellij.formatting.FormattingModelBuilder;
 import com.intellij.ide.util.PropertiesComponent;
 import com.intellij.lang.LanguageFormatting;
@@ -29,6 +30,7 @@
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.command.CommandProcessor;
 import com.intellij.openapi.components.ServiceManager;
+import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.SelectionModel;
 import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
@@ -44,17 +46,25 @@
 import com.intellij.openapi.wm.ex.WindowManagerEx;
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.arrangement.engine.ArrangementEngine;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.LocalSearchScope;
+import com.intellij.psi.search.SearchScope;
 import com.intellij.psi.util.PsiUtilCore;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.TestOnly;
 
 import javax.swing.*;
 import javax.swing.event.HyperlinkEvent;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
 
 public class ReformatCodeAction extends AnAction implements DumbAware {
+  private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.actions.ReformatCodeAction");
+
   private static final @NonNls String HELP_ID = "editing.codeReformatting";
   protected static ReformatFilesOptions myTestOptions;
 
@@ -230,6 +240,9 @@
       options.isProcessOnlyChangedText()
     );
 
+    registerScopeFilter(processor, options.getSearchScope());
+    registerFileMaskFilter(processor, options.getFileTypeMask());
+
     if (options.isOptimizeImports()) {
       processor = new OptimizeImportsProcessor(processor);
     }
@@ -253,6 +266,8 @@
     else
       processor = new ReformatCodeProcessor(project, processOnlyChangedText);
 
+    registerScopeFilter(processor, selectedFlags.getSearchScope());
+    registerFileMaskFilter(processor, selectedFlags.getFileTypeMask());
 
     if (shouldOptimizeImports) {
       processor = new OptimizeImportsProcessor(processor);
@@ -265,6 +280,51 @@
     processor.run();
   }
 
+  public static void registerScopeFilter(@NotNull AbstractLayoutCodeProcessor processor, @Nullable final SearchScope scope) {
+    if (scope == null) {
+      return;
+    }
+
+    processor.addFileFilter(new FileFilter() {
+      @Override
+      public boolean accept(@NotNull VirtualFile file) {
+        if (scope instanceof LocalSearchScope) {
+          return ((LocalSearchScope)scope).isInScope(file);
+        }
+        if (scope instanceof GlobalSearchScope) {
+          return ((GlobalSearchScope)scope).contains(file);
+        }
+
+        return false;
+      }
+    });
+  }
+
+  public static void registerFileMaskFilter(@NotNull AbstractLayoutCodeProcessor processor, @Nullable String fileTypeMask) {
+    if (fileTypeMask == null)
+      return;
+
+    final Pattern pattern = getFileTypeMaskPattern(fileTypeMask);
+    if (pattern != null) {
+      processor.addFileFilter(new FileFilter() {
+        @Override
+        public boolean accept(@NotNull VirtualFile file) {
+          return pattern.matcher(file.getName()).matches();
+        }
+      });
+    }
+  }
+
+  @Nullable
+  private static Pattern getFileTypeMaskPattern(@Nullable String mask) {
+    try {
+      return FindInProjectUtil.createFileMaskRegExp(mask);
+    } catch (PatternSyntaxException e) {
+      LOG.info("Error while processing file mask: ", e);
+      return null;
+    }
+  }
+
   public static void updateShowDialogSetting(LayoutCodeDialog dialog, String title) {
     if (dialog.isDoNotAskMe()) {
       Notifications.Bus.notify(new Notification("Reformat Code", title,
@@ -384,7 +444,7 @@
     final boolean enableOnlyVCSChangedRegions = module != null ? FormatChangedTextUtil.hasChanges(module)
                                                                : FormatChangedTextUtil.hasChanges(project);
 
-    LayoutProjectCodeDialog dialog = new LayoutProjectCodeDialog(project, CodeInsightBundle.message("process.reformat.code"), text, true, enableOnlyVCSChangedRegions);
+    LayoutProjectCodeDialog dialog = new LayoutProjectCodeDialog(project, CodeInsightBundle.message("process.reformat.code"), text, enableOnlyVCSChangedRegions);
     dialog.show();
     if (!dialog.isOK()) return null;
     return dialog;
@@ -415,6 +475,7 @@
     return LayoutCodeSettingsStorage.getLastSavedRearrangeEntriesCbStateFor(project);
   }
 
+  @TestOnly
   protected static void setTestOptions(ReformatFilesOptions options) {
     myTestOptions = options;
   }
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesDialog.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesDialog.java
index 26a158e..d364857 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesDialog.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesDialog.java
@@ -21,7 +21,9 @@
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.search.SearchScope;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
 
@@ -78,4 +80,16 @@
   static boolean isOptmizeImportsOptionOn() {
     return PropertiesComponent.getInstance().getBoolean(LayoutCodeConstants.OPTIMIZE_IMPORTS_KEY, false);
   }
+
+  @Nullable
+  @Override
+  public SearchScope getSearchScope() {
+    return null;
+  }
+
+  @Nullable
+  @Override
+  public String getFileTypeMask() {
+    return null;
+  }
 }
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesOptions.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesOptions.java
index 37bf43c..bb958e7 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesOptions.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesOptions.java
@@ -15,6 +15,9 @@
  */
 package com.intellij.codeInsight.actions;
 
+import com.intellij.psi.search.SearchScope;
+import org.jetbrains.annotations.Nullable;
+
 public interface ReformatFilesOptions {
 
   boolean isOptimizeImports();
@@ -23,4 +26,10 @@
 
   boolean isRearrangeEntries();
 
+  @Nullable
+  String getFileTypeMask();
+
+  @Nullable
+  SearchScope getSearchScope();
+
 }
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/AddSpaceInsertHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/AddSpaceInsertHandler.java
new file mode 100644
index 0000000..d0e9906
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/AddSpaceInsertHandler.java
@@ -0,0 +1,36 @@
+package com.intellij.codeInsight.completion;
+
+import com.intellij.codeInsight.lookup.LookupElement;
+import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.EditorModificationUtil;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiDocumentManager;
+
+/**
+ * @author zolotov
+ */
+public class AddSpaceInsertHandler implements InsertHandler<LookupElement> {
+  public final static InsertHandler<LookupElement> INSTANCE = new AddSpaceInsertHandler();
+
+  public void handleInsert(InsertionContext context, LookupElement item) {
+    Editor editor = context.getEditor();
+    if (context.getCompletionChar() == ' ') return;
+    Project project = editor.getProject();
+    if (project != null) {
+      if (!isCharAtSpace(editor)) {
+        EditorModificationUtil.insertStringAtCaret(editor, " ");
+        PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
+      }
+      else {
+        editor.getCaretModel().moveToOffset(editor.getCaretModel().getOffset() + 1);
+      }
+    }
+  }
+
+  private static boolean isCharAtSpace(Editor editor) {
+    final int startOffset = editor.getCaretModel().getOffset();
+    final Document document = editor.getDocument();
+    return document.getTextLength() > startOffset && document.getCharsSequence().charAt(startOffset) == ' ';
+  }
+}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java
index 7a96fd0..b98fe4a 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java
@@ -121,6 +121,7 @@
     }
   };
   private volatile int myCount;
+  private volatile boolean myHasPsiElements;
   private boolean myLookupUpdated;
   private final ConcurrentHashMap<LookupElement, CompletionSorterImpl> myItemSorters =
     new ConcurrentHashMap<LookupElement, CompletionSorterImpl>(
@@ -320,7 +321,7 @@
 
     if (!myLookupUpdated) {
       if (myLookup.getAdvertisements().isEmpty() && !isAutopopupCompletion() && !DumbService.isDumb(getProject())) {
-        DefaultCompletionContributor.addDefaultAdvertisements(myParameters, myLookup);
+        DefaultCompletionContributor.addDefaultAdvertisements(myParameters, myLookup, myHasPsiElements);
       }
       myLookup.getAdvertiser().showRandomText();
     }
@@ -380,8 +381,12 @@
 
     LOG.assertTrue(myParameters.getPosition().isValid());
 
-    myItemSorters.put(item.getLookupElement(), (CompletionSorterImpl)item.getSorter());
-    if (!myLookup.addItem(item.getLookupElement(), item.getPrefixMatcher())) {
+    LookupElement lookupElement = item.getLookupElement();
+    if (!myHasPsiElements && lookupElement.getPsiElement() != null) {
+      myHasPsiElements = true;
+    }
+    myItemSorters.put(lookupElement, (CompletionSorterImpl)item.getSorter());
+    if (!myLookup.addItem(lookupElement, item.getPrefixMatcher())) {
       return;
     }
     myCount++;
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/DefaultCompletionContributor.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/DefaultCompletionContributor.java
index 9e112ad..cc69a9a 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/completion/DefaultCompletionContributor.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/DefaultCompletionContributor.java
@@ -30,17 +30,12 @@
  */
 public class DefaultCompletionContributor extends CompletionContributor {
 
-  static void addDefaultAdvertisements(@NotNull final CompletionParameters parameters, LookupImpl lookup) {
+  static void addDefaultAdvertisements(@NotNull final CompletionParameters parameters, LookupImpl lookup, boolean includePsiFeatures) {
     if (CompletionUtil.shouldShowFeature(parameters, CodeCompletionFeatures.EDITING_COMPLETION_FINISH_BY_DOT_ETC)) {
       lookup.addAdvertisement(LangBundle.message("completion.dot.etc.ad"), null);
     }
-    if (CompletionUtil.shouldShowFeature(parameters, CodeCompletionFeatures.EDITING_COMPLETION_FINISH_BY_SMART_ENTER)) {
-      final String shortcut = getActionShortcut(IdeActions.ACTION_CHOOSE_LOOKUP_ITEM_COMPLETE_STATEMENT);
-      if (shortcut != null) {
-        lookup.addAdvertisement(LangBundle.message("completion.smart.enter.ad", shortcut), null);
-      }
-    }
-
+    if (!includePsiFeatures) return;
+    
     if (CompletionUtil.shouldShowFeature(parameters, CodeCompletionFeatures.EDITING_COMPLETION_FINISH_BY_SMART_ENTER)) {
       final String shortcut = getActionShortcut(IdeActions.ACTION_CHOOSE_LOOKUP_ITEM_COMPLETE_STATEMENT);
       if (shortcut != null) {
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/CodeFoldingPass.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/CodeFoldingPass.java
index c888de7..0d95d24 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/CodeFoldingPass.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/CodeFoldingPass.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.
@@ -16,37 +16,30 @@
 
 package com.intellij.codeInsight.daemon.impl;
 
-import com.intellij.codeHighlighting.TextEditorHighlightingPass;
+import com.intellij.codeHighlighting.EditorBoundHighlightingPass;
 import com.intellij.codeInsight.folding.CodeFoldingManager;
+import com.intellij.codeInsight.folding.impl.FoldingUpdate;
 import com.intellij.lang.injection.InjectedLanguageManager;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.IndexNotReadyException;
-import com.intellij.openapi.project.Project;
+import com.intellij.openapi.project.PossiblyDumbAware;
 import com.intellij.openapi.util.Key;
 import com.intellij.psi.PsiFile;
 import org.jetbrains.annotations.NotNull;
 
-class CodeFoldingPass extends TextEditorHighlightingPass implements DumbAware {
+class CodeFoldingPass extends EditorBoundHighlightingPass implements PossiblyDumbAware {
   private static final Key<Boolean> THE_FIRST_TIME = Key.create("FirstFoldingPass");
-  private Runnable myRunnable;
-  private final Editor myEditor;
-  private final PsiFile myFile;
+  private volatile Runnable myRunnable;
 
-  CodeFoldingPass(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
-    super(project, editor.getDocument(), false);
-    myEditor = editor;
-    myFile = file;
+  CodeFoldingPass(@NotNull Editor editor, @NotNull PsiFile file) {
+    super(editor, file, false);
   }
 
   @Override
   public void doCollectInformation(@NotNull ProgressIndicator progress) {
     final boolean firstTime = isFirstTime(myFile, myEditor, THE_FIRST_TIME);
-    Runnable runnable = CodeFoldingManager.getInstance(myProject).updateFoldRegionsAsync(myEditor, firstTime);
-    synchronized (this) {
-      myRunnable = runnable;
-    }
+    myRunnable = CodeFoldingManager.getInstance(myProject).updateFoldRegionsAsync(myEditor, firstTime);
   }
 
   static boolean isFirstTime(PsiFile file, Editor editor, Key<Boolean> key) {
@@ -60,10 +53,7 @@
 
   @Override
   public void doApplyInformationToEditor() {
-    Runnable runnable;
-    synchronized (this) {
-      runnable = myRunnable;
-    }
+    Runnable runnable = myRunnable;
     if (runnable != null){
       try {
         runnable.run();
@@ -76,4 +66,13 @@
       clearFirstTimeFlag(myFile, myEditor, THE_FIRST_TIME);
     }
   }
+
+  /**
+   * Checks the ability to update folding in the Dumb Mode. True by default.
+   * @return true if the language implementation can update folding ranges
+   */
+  @Override
+  public boolean isDumbAware() {
+    return FoldingUpdate.supportsDumbModeFolding(myEditor);
+  }
 }
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/CodeFoldingPassFactory.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/CodeFoldingPassFactory.java
index c86df2e..5d9f854 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/CodeFoldingPassFactory.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/CodeFoldingPassFactory.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.
@@ -46,6 +46,6 @@
   @Override
   @NotNull
   public TextEditorHighlightingPass createHighlightingPass(@NotNull PsiFile file, @NotNull final Editor editor) {
-    return new CodeFoldingPass(myProject, editor, file);
+    return new CodeFoldingPass(editor, file);
   }
 }
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java
index aff59a8..65d302e 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java
@@ -27,7 +27,6 @@
 import com.intellij.codeInsight.hint.HintManager;
 import com.intellij.codeInsight.intention.impl.FileLevelIntentionComponent;
 import com.intellij.codeInsight.intention.impl.IntentionHintComponent;
-import com.intellij.concurrency.Job;
 import com.intellij.ide.PowerSaveMode;
 import com.intellij.lang.annotation.HighlightSeverity;
 import com.intellij.openapi.Disposable;
@@ -81,7 +80,7 @@
 /**
  * This class also controls the auto-reparse and auto-hints.
  */
-public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzerEx implements JDOMExternalizable, NamedComponent {
+public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzerEx implements JDOMExternalizable, NamedComponent, Disposable {
   private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl");
 
   private static final Key<List<LineMarkerInfo>> MARKERS_IN_EDITOR_DOCUMENT_KEY = Key.create("MARKERS_IN_EDITOR_DOCUMENT");
@@ -115,41 +114,27 @@
   public DaemonCodeAnalyzerImpl(@NotNull Project project,
                                 @NotNull DaemonCodeAnalyzerSettings daemonCodeAnalyzerSettings,
                                 @NotNull EditorTracker editorTracker,
-                                @NotNull final NamedScopeManager namedScopeManager,
-                                @NotNull final DependencyValidationManager dependencyValidationManager) {
+                                @SuppressWarnings("UnusedParameters") @NotNull final NamedScopeManager namedScopeManager,
+                                @SuppressWarnings("UnusedParameters") @NotNull final DependencyValidationManager dependencyValidationManager) {
     myProject = project;
 
     mySettings = daemonCodeAnalyzerSettings;
     myEditorTracker = editorTracker;
     myLastSettings = ((DaemonCodeAnalyzerSettingsImpl)daemonCodeAnalyzerSettings).clone();
 
-    myFileStatusMap = new FileStatusMap(myProject);
-    myPassExecutorService = new PassExecutorService(myProject) {
-      @Override
-      protected void afterApplyInformationToEditor(final TextEditorHighlightingPass pass,
-                                                   @NotNull final FileEditor fileEditor,
-                                                   final ProgressIndicator updateProgress) {
-        if (fileEditor instanceof TextEditor) {
-          log(updateProgress, pass, "Apply ");
-        }
-      }
-
-      @Override
-      protected boolean isDisposed() {
-        return myDisposed || super.isDisposed();
-      }
-    };
-    Disposer.register(project, myPassExecutorService);
-    Disposer.register(project, myFileStatusMap);
+    myFileStatusMap = new FileStatusMap(project);
+    myPassExecutorService = new PassExecutorService(project);
+    Disposer.register(this, myPassExecutorService);
+    Disposer.register(this, myFileStatusMap);
     DaemonProgressIndicator.setDebug(LOG.isDebugEnabled());
 
     assert !myInitialized : "Double Initializing";
-    Disposer.register(myProject, new StatusBarUpdater(myProject));
+    Disposer.register(this, new StatusBarUpdater(project));
 
     myInitialized = true;
     myDisposed = false;
     myFileStatusMap.markAllFilesDirty();
-    Disposer.register(project, new Disposable() {
+    Disposer.register(this, new Disposable() {
       @Override
       public void dispose() {
         assert myInitialized : "Disposing not initialized component";
@@ -163,6 +148,11 @@
     });
   }
 
+  @Override
+  public void dispose() {
+
+  }
+
   @NotNull
   @TestOnly
   public static List<HighlightInfo> getHighlights(@NotNull Document document, HighlightSeverity minSeverity, @NotNull Project project) {
@@ -270,6 +260,17 @@
                                        @NotNull int[] toIgnore,
                                        boolean canChangeDocument,
                                        @Nullable Runnable callbackWhileWaiting) throws ProcessCanceledException {
+    return runPasses(file, document, Collections.singletonList(textEditor), toIgnore, canChangeDocument, callbackWhileWaiting);
+  }
+
+  @NotNull
+  @TestOnly
+  public List<HighlightInfo> runPasses(@NotNull PsiFile file,
+                                       @NotNull Document document,
+                                       @NotNull List<TextEditor> textEditors,
+                                       @NotNull int[] toIgnore,
+                                       boolean canChangeDocument,
+                                       @Nullable Runnable callbackWhileWaiting) throws ProcessCanceledException {
     assert myInitialized;
     assert !myDisposed;
     Application application = ApplicationManager.getApplication();
@@ -291,13 +292,16 @@
     }
     fileStatusMap.allowDirt(canChangeDocument);
 
-    TextEditorBackgroundHighlighter highlighter = (TextEditorBackgroundHighlighter)textEditor.getBackgroundHighlighter();
-    final List<TextEditorHighlightingPass> passes = highlighter.getPasses(toIgnore);
-    HighlightingPass[] array = passes.toArray(new HighlightingPass[passes.size()]);
-    assert array.length != 0 : "Highlighting is disabled for the file " + file;
-
+    Map<FileEditor, HighlightingPass[]> map = new HashMap<FileEditor, HighlightingPass[]>();
+    for (TextEditor textEditor : textEditors) {
+      TextEditorBackgroundHighlighter highlighter = (TextEditorBackgroundHighlighter)textEditor.getBackgroundHighlighter();
+      final List<TextEditorHighlightingPass> passes = highlighter.getPasses(toIgnore);
+      HighlightingPass[] array = passes.toArray(new HighlightingPass[passes.size()]);
+      assert array.length != 0 : "Highlighting is disabled for the file " + file;
+      map.put(textEditor, array);
+    }
     final DaemonProgressIndicator progress = createUpdateProgress();
-    myPassExecutorService.submitPasses(Collections.singletonMap((FileEditor)textEditor, array), progress, Job.DEFAULT_PRIORITY);
+    myPassExecutorService.submitPasses(map, progress);
     try {
       while (progress.isRunning()) {
         try {
@@ -323,8 +327,7 @@
       UIUtil.dispatchAllInvocationEvents();
       UIUtil.dispatchAllInvocationEvents();
 
-      List<HighlightInfo> highlights = getHighlights(document, null, project);
-      return highlights;
+      return getHighlights(document, null, project);
     }
     finally {
       fileStatusMap.allowDirt(true);
@@ -738,7 +741,7 @@
             cancelUpdateProgress(true, "Cancel by alarm");
             myAlarm.cancelAllRequests();
             DaemonProgressIndicator progress = createUpdateProgress();
-            myPassExecutorService.submitPasses(passes, progress, Job.DEFAULT_PRIORITY);
+            myPassExecutorService.submitPasses(passes, progress);
           }
         };
 
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java
index dc6da3e..8c79df5 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java
@@ -311,7 +311,7 @@
         if (VirtualFile.PROP_NAME.equals(propertyName)) {
           stopDaemonAndRestartAllFiles();
           VirtualFile virtualFile = event.getFile();
-          PsiFile psiFile = ((PsiManagerEx)psiManager).getFileManager().getCachedPsiFile(virtualFile);
+          PsiFile psiFile = !virtualFile.isValid() ? null : ((PsiManagerEx)psiManager).getFileManager().getCachedPsiFile(virtualFile);
           if (psiFile != null && !myDaemonCodeAnalyzer.isHighlightingAvailable(psiFile)) {
             Document document = fileDocumentManager.getCachedDocument(virtualFile);
             if (document != null) {
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ExternalToolPass.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ExternalToolPass.java
index a887f3a..73113a4 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ExternalToolPass.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ExternalToolPass.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.
@@ -25,13 +25,13 @@
 import com.intellij.lang.annotation.ExternalAnnotator;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.ModalityState;
+import com.intellij.openapi.application.ex.ApplicationManagerEx;
 import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.editor.event.DocumentEvent;
-import com.intellij.openapi.editor.event.DocumentListener;
 import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.psi.FileViewProvider;
 import com.intellij.psi.PsiFile;
 import com.intellij.util.containers.HashMap;
+import com.intellij.util.ui.UIUtil;
 import com.intellij.util.ui.update.Update;
 import org.jetbrains.annotations.NotNull;
 
@@ -47,19 +47,16 @@
   private final AnnotationHolderImpl myAnnotationHolder;
   private final Editor myEditor;
 
-  private volatile DocumentListener myDocumentListener;
-  private volatile boolean myDocumentChanged;
-
-  private final Map<ExternalAnnotator, MyData> myAnnotator2DataMap;
+  private final Map<ExternalAnnotator, MyData> myAnnotator2DataMap = new HashMap<ExternalAnnotator, MyData>();
 
   private final ExternalToolPassFactory myExternalToolPassFactory;
 
   private static class MyData {
-    final PsiFile myPsiRoot;
-    final Object myCollectedInfo;
-    volatile Object myAnnotationResult;
+    private final PsiFile myPsiRoot;
+    private final Object myCollectedInfo;
+    private volatile Object myAnnotationResult;
 
-    private MyData(PsiFile psiRoot, Object collectedInfo) {
+    private MyData(@NotNull PsiFile psiRoot, @NotNull Object collectedInfo) {
       myPsiRoot = psiRoot;
       myCollectedInfo = collectedInfo;
     }
@@ -77,14 +74,11 @@
     myEndOffset = endOffset;
     myAnnotationHolder = new AnnotationHolderImpl(new AnnotationSession(file));
 
-    myAnnotator2DataMap = new HashMap<ExternalAnnotator, MyData>();
     myExternalToolPassFactory = externalToolPassFactory;
   }
 
   @Override
   public void doCollectInformation(@NotNull ProgressIndicator progress) {
-    myDocumentChanged = false;
-
     final FileViewProvider viewProvider = myFile.getViewProvider();
     final Set<Language> relevantLanguages = viewProvider.getLanguages();
     for (Language language : relevantLanguages) {
@@ -111,32 +105,28 @@
     DaemonCodeAnalyzerEx daemonCodeAnalyzer = DaemonCodeAnalyzerEx.getInstanceEx(myProject);
     daemonCodeAnalyzer.getFileStatusMap().markFileUpToDate(myDocument, getId());
 
-    myDocumentListener = new DocumentListener() {
+    final long modificationStampBefore = myDocument.getModificationStamp();
+
+    Update update = new Update(myFile) {
       @Override
-      public void beforeDocumentChange(DocumentEvent event) {
+      public void setRejected() {
+        super.setRejected();
+        doFinish(Collections.<HighlightInfo>emptyList());
       }
 
       @Override
-      public void documentChanged(DocumentEvent event) {
-        myDocumentChanged = true;
-      }
-    };
-    myDocument.addDocumentListener(myDocumentListener);
-
-    final Runnable r = new Runnable() {
-      @Override
       public void run() {
-        if (myDocumentChanged || myProject.isDisposed()) {
-          doFinish();
+        if (documentChanged(modificationStampBefore) || myProject.isDisposed()) {
+          doFinish(Collections.<HighlightInfo>emptyList());
           return;
         }
         doAnnotate();
 
-        ApplicationManager.getApplication().runReadAction(new Runnable() {
+        if (!ApplicationManagerEx.getApplicationEx().tryRunReadAction(new Runnable() {
           @Override
           public void run() {
-            if (myDocumentChanged || myProject.isDisposed()) {
-              doFinish();
+            if (documentChanged(modificationStampBefore) || myProject.isDisposed()) {
+              doFinish(Collections.<HighlightInfo>emptyList());
               return;
             }
             collectHighlighters();
@@ -144,41 +134,26 @@
             ApplicationManager.getApplication().invokeLater(new Runnable() {
               @Override
               public void run() {
-                if (myDocumentChanged || myProject.isDisposed()) {
-                  doFinish();
-                  return;
-                }
-
-                myDocument.removeDocumentListener(myDocumentListener);
-                final List<HighlightInfo> infos = getHighlights();
-                UpdateHighlightersUtil
-                  .setHighlightersToEditor(myProject, myDocument, myStartOffset, myEndOffset, infos, getColorsScheme(), getId());
+                List<HighlightInfo> highlights =
+                  documentChanged(modificationStampBefore) || myProject.isDisposed() ? Collections.<HighlightInfo>emptyList() : getHighlights();
+                doFinish(highlights);
               }
             }, ModalityState.stateForComponent(myEditor.getComponent()));
           }
-        });
+        })) {
+          doFinish(Collections.<HighlightInfo>emptyList());
+        }
       }
     };
 
-    if (ApplicationManager.getApplication().isUnitTestMode()) {
-      r.run();
-    }
-    else {
-      myExternalToolPassFactory.scheduleExternalActivity(new Update(myFile) {
-        @Override
-        public void run() {
-          r.run();
-        }
-
-        @Override
-        public void setRejected() {
-          super.setRejected();
-          doFinish();
-        }
-      });
-    }
+    myExternalToolPassFactory.scheduleExternalActivity(update);
   }
 
+  private boolean documentChanged(long modificationStampBefore) {
+    return myDocument.getModificationStamp() != modificationStampBefore;
+  }
+
+  @NotNull
   private List<HighlightInfo> getHighlights() {
     List<HighlightInfo> infos = new ArrayList<HighlightInfo>();
     for (Annotation annotation : myAnnotationHolder) {
@@ -196,23 +171,15 @@
     }
   }
 
-  private void doFinish() {
-    myDocument.removeDocumentListener(myDocumentListener);
-    final Runnable r = new Runnable() {
+  private void doFinish(@NotNull final List<HighlightInfo> highlights) {
+    UIUtil.invokeLaterIfNeeded(new Runnable() {
       @Override
       public void run() {
         if (!myProject.isDisposed()) {
-          UpdateHighlightersUtil.setHighlightersToEditor(myProject, myDocument, myStartOffset, myEndOffset, Collections.<HighlightInfo>emptyList(),
-                                   getColorsScheme(), getId());
+          UpdateHighlightersUtil.setHighlightersToEditor(myProject, myDocument, myStartOffset, myEndOffset, highlights, getColorsScheme(), getId());
         }
       }
-    };
-    if (ApplicationManager.getApplication().isDispatchThread()) {
-      r.run();
-    }
-    else {
-      ApplicationManager.getApplication().invokeLater(r);
-    }
+    });
   }
 
   private void doAnnotate() {
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ExternalToolPassFactory.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ExternalToolPassFactory.java
index 7d09095..5440408 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ExternalToolPassFactory.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ExternalToolPassFactory.java
@@ -23,6 +23,7 @@
 import com.intellij.lang.ExternalLanguageAnnotators;
 import com.intellij.lang.Language;
 import com.intellij.lang.annotation.ExternalAnnotator;
+import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.components.AbstractProjectComponent;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.project.Project;
@@ -49,6 +50,7 @@
 
     myExternalActivitiesQueue = new MergingUpdateQueue("ExternalActivitiesQueue", 300, true, MergingUpdateQueue.ANY_COMPONENT, project,
                                                        null, false);
+    myExternalActivitiesQueue.setPassThrough(ApplicationManager.getApplication().isUnitTestMode());
   }
 
   @Override
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java
index b0265af..207b66b 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java
@@ -250,11 +250,13 @@
     calculateDialects(inside, languages, langIds, dialects);
     calculateDialects(outside, languages, langIds, dialects);
     MultiMap<LocalInspectionToolWrapper, String> toolToLanguages = new MultiMap<LocalInspectionToolWrapper, String>() {
+      @NotNull
       @Override
       protected Collection<String> createCollection() {
         return new SmartHashSet<String>();
       }
 
+      @NotNull
       @Override
       protected Collection<String> createEmptyCollection() {
         return Collections.emptySet();
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PassExecutorService.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PassExecutorService.java
index 3b40edb..12f0434 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PassExecutorService.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PassExecutorService.java
@@ -16,6 +16,7 @@
 
 package com.intellij.codeInsight.daemon.impl;
 
+import com.intellij.codeHighlighting.EditorBoundHighlightingPass;
 import com.intellij.codeHighlighting.HighlightingPass;
 import com.intellij.codeHighlighting.TextEditorHighlightingPass;
 import com.intellij.concurrency.Job;
@@ -38,18 +39,18 @@
 import com.intellij.openapi.project.DumbAwareRunnable;
 import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Condition;
 import com.intellij.openapi.util.Key;
 import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.ConcurrencyUtil;
 import com.intellij.util.Consumer;
-import com.intellij.util.SmartList;
 import com.intellij.util.containers.ContainerUtil;
-import gnu.trove.THashMap;
+import com.intellij.util.containers.MultiMap;
+import gnu.trove.*;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 import org.jetbrains.annotations.TestOnly;
 
 import java.util.*;
@@ -59,15 +60,16 @@
 /**
  * @author cdr
  */
-public abstract class PassExecutorService implements Disposable {
+public class PassExecutorService implements Disposable {
   private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.PassExecutorService");
+  private static final boolean CHECK_CONSISTENCY = ApplicationManager.getApplication().isUnitTestMode();
 
   private final Map<ScheduledPass, Job<Void>> mySubmittedPasses = new ConcurrentHashMap<ScheduledPass, Job<Void>>();
   private final Project myProject;
-  private volatile boolean isDisposed;
+  protected volatile boolean isDisposed;
   private final AtomicInteger nextPassId = new AtomicInteger(100);
 
-  public PassExecutorService(Project project) {
+  public PassExecutorService(@NotNull Project project) {
     myProject = project;
   }
 
@@ -97,15 +99,13 @@
     mySubmittedPasses.clear();
   }
 
-  public void submitPasses(@NotNull Map<FileEditor, HighlightingPass[]> passesMap, @NotNull DaemonProgressIndicator updateProgress, final int jobPriority) {
+  public void submitPasses(@NotNull Map<FileEditor, HighlightingPass[]> passesMap, @NotNull DaemonProgressIndicator updateProgress) {
     if (isDisposed()) return;
-    int id = 1;
 
-    // (doc, passId) -> created pass
-    Map<Pair<Document, Integer>, ScheduledPass> toBeSubmitted = new THashMap<Pair<Document, Integer>, ScheduledPass>(passesMap.size());
     // null keys are ok
-    Map<Document, List<FileEditor>> documentToEditors = new HashMap<Document, List<FileEditor>>();
-    Map<FileEditor, List<TextEditorHighlightingPass>> textPasses = new HashMap<FileEditor, List<TextEditorHighlightingPass>>(passesMap.size());
+    MultiMap<Document, FileEditor> documentToEditors = MultiMap.createSet();
+    MultiMap<FileEditor, TextEditorHighlightingPass> documentBoundPasses = MultiMap.createSmartList();
+    MultiMap<FileEditor, EditorBoundHighlightingPass> editorBoundPasses = MultiMap.createSmartList();
     for (Map.Entry<FileEditor, HighlightingPass[]> entry : passesMap.entrySet()) {
       FileEditor fileEditor = entry.getKey();
       HighlightingPass[] passes = entry.getValue();
@@ -116,83 +116,59 @@
         document = editor.getDocument();
       }
 
-      for (int i = 0; i < passes.length; i++) {
-        final HighlightingPass pass = passes[i];
-
-        TextEditorHighlightingPass textEditorHighlightingPass;
-        if (pass instanceof TextEditorHighlightingPass) {
-          textEditorHighlightingPass = (TextEditorHighlightingPass)pass;
+      int prevId = 0;
+      for (final HighlightingPass pass : passes) {
+        if (pass instanceof EditorBoundHighlightingPass) {
+          EditorBoundHighlightingPass editorPass = (EditorBoundHighlightingPass)pass;
+          editorPass.setId(nextPassId.incrementAndGet()); // have to make ids unique for this document
+          editorBoundPasses.putValue(fileEditor, editorPass);
         }
         else {
-          // run all passes in sequence
-          textEditorHighlightingPass = new TextEditorHighlightingPass(myProject, document, true) {
-            @Override
-            public void doCollectInformation(@NotNull ProgressIndicator progress) {
-              pass.collectInformation(progress);
-            }
-
-            @Override
-            public void doApplyInformationToEditor() {
-              pass.applyInformationToEditor();
-            }
-          };
-          textEditorHighlightingPass.setId(id++);
-          if (i > 0) {
-            textEditorHighlightingPass.setCompletionPredecessorIds(new int[]{i - 1});
-          }
+          TextEditorHighlightingPass textEditorHighlightingPass = convertToTextHighlightingPass(pass, document, nextPassId, prevId);
+          document = textEditorHighlightingPass.getDocument();
+          documentBoundPasses.putValue(fileEditor, textEditorHighlightingPass);
+          documentToEditors.putValue(document, fileEditor);
+          prevId = textEditorHighlightingPass.getId();
         }
-        document = textEditorHighlightingPass.getDocument();
-
-        List<TextEditorHighlightingPass> textPassesForDocument = textPasses.get(fileEditor);
-        if (textPassesForDocument == null) {
-          textPassesForDocument = new SmartList<TextEditorHighlightingPass>();
-          textPasses.put(fileEditor, textPassesForDocument);
-        }
-        textPassesForDocument.add(textEditorHighlightingPass);
-
-        List<FileEditor> editors = documentToEditors.get(document);
-        if (editors == null) {
-          editors = new SmartList<FileEditor>();
-          documentToEditors.put(document, editors);
-        }
-        if (!editors.contains(fileEditor)) editors.add(fileEditor);
       }
     }
 
     List<ScheduledPass> freePasses = new ArrayList<ScheduledPass>(documentToEditors.size()*5);
     List<ScheduledPass> dependentPasses = new ArrayList<ScheduledPass>(documentToEditors.size()*10);
+    // (fileEditor, passId) -> created pass
+    Map<Pair<FileEditor, Integer>, ScheduledPass> toBeSubmitted = new THashMap<Pair<FileEditor, Integer>, ScheduledPass>(passesMap.size());
+
     final AtomicInteger threadsToStartCountdown = new AtomicInteger(0);
-    for (Map.Entry<Document, List<FileEditor>> entry : documentToEditors.entrySet()) {
-      final List<FileEditor> fileEditors = entry.getValue();
-      List<TextEditorHighlightingPass> passes = textPasses.get(getPreferredFileEditor(entry.getKey(), fileEditors));
-      if (passes == null) {
+    for (Map.Entry<Document, Collection<FileEditor>> entry : documentToEditors.entrySet()) {
+      Collection<FileEditor> fileEditors = entry.getValue();
+      Document document = entry.getKey();
+      FileEditor preferredFileEditor = getPreferredFileEditor(document, fileEditors);
+      List<TextEditorHighlightingPass> passes = (List<TextEditorHighlightingPass>)documentBoundPasses.get(preferredFileEditor);
+      if (passes.isEmpty()) {
         continue;
       }
-      threadsToStartCountdown.addAndGet(passes.size());
-
-      // create one scheduled pass per unique id (possibly for multiple file editors. they all will be applied at the pass finish)
-      ContainerUtil.quickSort(passes, new Comparator<TextEditorHighlightingPass>() {
-        @Override
-        public int compare(final TextEditorHighlightingPass o1, final TextEditorHighlightingPass o2) {
-          return o1.getId() - o2.getId();
-        }
-      });
-      int passId = -1;
-      TextEditorHighlightingPass currentPass = null;
-      for (int i = 0; i <= passes.size(); i++) {
-        int newId = -1;
-        if (i < passes.size()) {
-          currentPass = passes.get(i);
-          newId = currentPass.getId();
-        }
-        if (newId != passId) {
-          createScheduledPass(fileEditors, currentPass, toBeSubmitted, passes, freePasses, dependentPasses, updateProgress, threadsToStartCountdown,
-                              jobPriority);
-          passId = newId;
-        }
+      sortById(passes);
+      for (TextEditorHighlightingPass currentPass : passes) {
+        createScheduledPass(preferredFileEditor, currentPass, toBeSubmitted, passes, freePasses, dependentPasses, updateProgress, threadsToStartCountdown);
       }
     }
 
+    for (Map.Entry<FileEditor, Collection<EditorBoundHighlightingPass>> entry : editorBoundPasses.entrySet()) {
+      FileEditor fileEditor = entry.getKey();
+      Collection<EditorBoundHighlightingPass> createdEditorBoundPasses = entry.getValue();
+      List<TextEditorHighlightingPass> createdDocumentBoundPasses = (List<TextEditorHighlightingPass>)documentBoundPasses.get(fileEditor);
+      List<TextEditorHighlightingPass> allCreatedPasses = new ArrayList<TextEditorHighlightingPass>(createdDocumentBoundPasses);
+      allCreatedPasses.addAll(createdEditorBoundPasses);
+
+      for (EditorBoundHighlightingPass pass : createdEditorBoundPasses) {
+        createScheduledPass(fileEditor, pass, toBeSubmitted, allCreatedPasses, freePasses, dependentPasses, updateProgress, threadsToStartCountdown);
+      }
+    }
+
+    if (CHECK_CONSISTENCY) {
+      assertConsistency(freePasses, toBeSubmitted, threadsToStartCountdown);
+    }
+
     log(updateProgress, null, "---------------------starting------------------------ " + threadsToStartCountdown.get(), freePasses);
 
     for (ScheduledPass dependentPass : dependentPasses) {
@@ -203,54 +179,117 @@
     }
   }
 
-  @Nullable
-  private FileEditor getPreferredFileEditor(Document document, @NotNull List<FileEditor> fileEditors) {
+  private void assertConsistency(List<ScheduledPass> freePasses,
+                                   Map<Pair<FileEditor, Integer>, ScheduledPass> toBeSubmitted,
+                                   AtomicInteger threadsToStartCountdown) {
+    assert threadsToStartCountdown.get() == toBeSubmitted.size();
+    TIntObjectHashMap<Pair<ScheduledPass, Integer>> id2Visits = new TIntObjectHashMap<Pair<ScheduledPass, Integer>>();
+    for (ScheduledPass freePass : freePasses) {
+      id2Visits.put(freePass.myPass.getId(), Pair.create(freePass, 0));
+      checkConsistency(freePass, id2Visits);
+    }
+    id2Visits.forEachEntry(new TIntObjectProcedure<Pair<ScheduledPass,Integer>>() {
+      @Override
+      public boolean execute(int id, Pair<ScheduledPass, Integer> pair) {
+        int count = pair.second;
+        assert count == 0 : id;
+        return true;
+      }
+    });
+    assert id2Visits.size() == threadsToStartCountdown.get();
+  }
+
+  private void checkConsistency(ScheduledPass pass, TIntObjectHashMap<Pair<ScheduledPass, Integer>> id2Visits) {
+    for (ScheduledPass succ : ContainerUtil.concat(pass.mySuccessorsOnCompletion, pass.mySuccessorsOnSubmit)) {
+      int succId = succ.myPass.getId();
+      Pair<ScheduledPass, Integer> succPair = id2Visits.get(succId);
+      if (succPair == null) {
+        succPair = Pair.create(succ, succ.myRunningPredecessorsCount.get());
+        id2Visits.put(succId, succPair);
+      }
+      int newPred = succPair.second - 1;
+      id2Visits.put(succId, Pair.create(succ, newPred));
+      assert newPred >= 0;
+      if (newPred == 0) {
+        checkConsistency((succ), id2Visits);
+      }
+    }
+  }
+
+  @NotNull
+  private TextEditorHighlightingPass convertToTextHighlightingPass(@NotNull final HighlightingPass pass,
+                                                                   final Document document,
+                                                                   @NotNull AtomicInteger id,
+                                                                   int previousPassId) {
+    TextEditorHighlightingPass textEditorHighlightingPass;
+    if (pass instanceof TextEditorHighlightingPass) {
+      textEditorHighlightingPass = (TextEditorHighlightingPass)pass;
+    }
+    else {
+      // run all passes in sequence
+      textEditorHighlightingPass = new TextEditorHighlightingPass(myProject, document, true) {
+        @Override
+        public void doCollectInformation(@NotNull ProgressIndicator progress) {
+          pass.collectInformation(progress);
+        }
+
+        @Override
+        public void doApplyInformationToEditor() {
+          pass.applyInformationToEditor();
+        }
+      };
+      textEditorHighlightingPass.setId(id.incrementAndGet());
+      if (previousPassId != 0) {
+        textEditorHighlightingPass.setCompletionPredecessorIds(new int[]{previousPassId});
+      }
+    }
+    return textEditorHighlightingPass;
+  }
+
+  @NotNull
+  private FileEditor getPreferredFileEditor(Document document, @NotNull Collection<FileEditor> fileEditors) {
+    assert !fileEditors.isEmpty();
     if (document != null) {
       final VirtualFile file = FileDocumentManager.getInstance().getFile(document);
       if (file != null) {
         final FileEditor selected = FileEditorManager.getInstance(myProject).getSelectedEditor(file);
-        if (fileEditors.contains(selected)) {
+        if (selected != null && fileEditors.contains(selected)) {
           return selected;
         }
       }
     }
-    if (!fileEditors.isEmpty()) {
-      return fileEditors.get(0);
-    }
-    return null;
+    return fileEditors.iterator().next();
   }
 
   @NotNull
-  private ScheduledPass createScheduledPass(@NotNull List<FileEditor> fileEditors,
+  private ScheduledPass createScheduledPass(@NotNull FileEditor fileEditor,
                                             @NotNull TextEditorHighlightingPass pass,
-                                            @NotNull Map<Pair<Document, Integer>, ScheduledPass> toBeSubmitted,
+                                            @NotNull Map<Pair<FileEditor, Integer>, ScheduledPass> toBeSubmitted,
                                             @NotNull List<TextEditorHighlightingPass> textEditorHighlightingPasses,
                                             @NotNull List<ScheduledPass> freePasses,
                                             @NotNull List<ScheduledPass> dependentPasses,
                                             @NotNull DaemonProgressIndicator updateProgress,
-                                            @NotNull AtomicInteger threadsToStartCountdown,
-                                            int jobPriority) {
+                                            @NotNull AtomicInteger threadsToStartCountdown) {
     int passId = pass.getId();
-    Document document = pass.getDocument();
-    Pair<Document, Integer> key = Pair.create(document, passId);
+    Pair<FileEditor, Integer> key = Pair.create(fileEditor, passId);
     ScheduledPass scheduledPass = toBeSubmitted.get(key);
     if (scheduledPass != null) return scheduledPass;
-    scheduledPass = new ScheduledPass(fileEditors, pass, updateProgress, threadsToStartCountdown, jobPriority);
+    scheduledPass = new ScheduledPass(fileEditor, pass, updateProgress, threadsToStartCountdown);
+    threadsToStartCountdown.incrementAndGet();
     toBeSubmitted.put(key, scheduledPass);
     for (int predecessorId : pass.getCompletionPredecessorIds()) {
-      ScheduledPass predecessor = findOrCreatePredecessorPass(fileEditors, document, toBeSubmitted, textEditorHighlightingPasses, freePasses, dependentPasses,
-                                                              updateProgress, threadsToStartCountdown, jobPriority, predecessorId);
+      ScheduledPass predecessor = findOrCreatePredecessorPass(fileEditor, toBeSubmitted, textEditorHighlightingPasses, freePasses, dependentPasses,
+                                                              updateProgress, threadsToStartCountdown, predecessorId);
       if (predecessor != null) {
-        predecessor.mySuccessorsOnCompletion.add(scheduledPass);
-        scheduledPass.myRunningPredecessorsCount.incrementAndGet();
+        predecessor.addSuccessorOnCompletion(scheduledPass);
       }
     }
     for (int predecessorId : pass.getStartingPredecessorIds()) {
-      ScheduledPass predecessor = findOrCreatePredecessorPass(fileEditors, document, toBeSubmitted, textEditorHighlightingPasses, freePasses,
-                                                              dependentPasses, updateProgress, threadsToStartCountdown, jobPriority, predecessorId);
+      ScheduledPass predecessor = findOrCreatePredecessorPass(fileEditor, toBeSubmitted, textEditorHighlightingPasses, freePasses,
+                                                              dependentPasses, updateProgress, threadsToStartCountdown,
+                                                              predecessorId);
       if (predecessor != null) {
-        predecessor.mySuccessorsOnSubmit.add(scheduledPass);
-        scheduledPass.myRunningPredecessorsCount.incrementAndGet();
+        predecessor.addSuccessorOnSubmit(scheduledPass);
       }
     }
     if (scheduledPass.myRunningPredecessorsCount.get() == 0 && !freePasses.contains(scheduledPass)) {
@@ -259,43 +298,49 @@
     else if (!dependentPasses.contains(scheduledPass)) {
       dependentPasses.add(scheduledPass);
     }
+
+    if (pass.isRunIntentionPassAfter() && fileEditor instanceof TextEditor) {
+      Editor editor = ((TextEditor)fileEditor).getEditor();
+      ShowIntentionsPass ip = new ShowIntentionsPass(myProject, editor, -1);
+      ip.setId(nextPassId.incrementAndGet());
+      ip.setCompletionPredecessorIds(new int[]{scheduledPass.myPass.getId()});
+
+      createScheduledPass(fileEditor, ip, toBeSubmitted, textEditorHighlightingPasses, freePasses, dependentPasses, updateProgress, threadsToStartCountdown);
+    }
+
     return scheduledPass;
   }
 
-  private ScheduledPass findOrCreatePredecessorPass(@NotNull List<FileEditor> fileEditors,
-                                                    Document document,
-                                                    @NotNull Map<Pair<Document, Integer>, ScheduledPass> toBeSubmitted,
+  private ScheduledPass findOrCreatePredecessorPass(@NotNull FileEditor fileEditor,
+                                                    @NotNull Map<Pair<FileEditor, Integer>, ScheduledPass> toBeSubmitted,
                                                     @NotNull List<TextEditorHighlightingPass> textEditorHighlightingPasses,
                                                     @NotNull List<ScheduledPass> freePasses,
                                                     @NotNull List<ScheduledPass> dependentPasses,
                                                     @NotNull DaemonProgressIndicator updateProgress,
                                                     @NotNull AtomicInteger myThreadsToStartCountdown,
-                                                    final int jobPriority,
                                                     final int predecessorId) {
-    Pair<Document, Integer> predKey = Pair.create(document, predecessorId);
+    Pair<FileEditor, Integer> predKey = Pair.create(fileEditor, predecessorId);
     ScheduledPass predecessor = toBeSubmitted.get(predKey);
     if (predecessor == null) {
       TextEditorHighlightingPass textEditorPass = findPassById(predecessorId, textEditorHighlightingPasses);
-      predecessor = textEditorPass == null ? null : createScheduledPass(fileEditors, textEditorPass, toBeSubmitted, textEditorHighlightingPasses, freePasses,
-                                                                        dependentPasses, updateProgress, myThreadsToStartCountdown, jobPriority);
+      predecessor = textEditorPass == null ? null : createScheduledPass(fileEditor, textEditorPass, toBeSubmitted, textEditorHighlightingPasses, freePasses,
+                                                                        dependentPasses, updateProgress, myThreadsToStartCountdown);
     }
     return predecessor;
   }
 
   private static TextEditorHighlightingPass findPassById(final int id, @NotNull List<TextEditorHighlightingPass> textEditorHighlightingPasses) {
-    TextEditorHighlightingPass textEditorPass = null;
-    for (TextEditorHighlightingPass found : textEditorHighlightingPasses) {
-      if (found.getId() == id) {
-        textEditorPass = found;
-        break;
+    return ContainerUtil.find(textEditorHighlightingPasses, new Condition<TextEditorHighlightingPass>() {
+      @Override
+      public boolean value(TextEditorHighlightingPass pass) {
+        return pass.getId() == id;
       }
-    }
-    return textEditorPass;
+    });
   }
 
   private void submit(@NotNull ScheduledPass pass) {
     if (!pass.myUpdateProgress.isCanceled()) {
-      Job<Void> job = JobLauncher.getInstance().submitToJobThread(pass.myJobPriority, pass, new Consumer<Future>() {
+      Job<Void> job = JobLauncher.getInstance().submitToJobThread(Job.DEFAULT_PRIORITY, pass, new Consumer<Future>() {
         @Override
         public void consume(Future future) {
           try {
@@ -317,25 +362,21 @@
   }
 
   private class ScheduledPass implements Runnable {
-    private final List<FileEditor> myFileEditors;
+    private final FileEditor myFileEditor;
     private final TextEditorHighlightingPass myPass;
     private final AtomicInteger myThreadsToStartCountdown;
-    private final int myJobPriority;
-    private final AtomicInteger myRunningPredecessorsCount;
+    private final AtomicInteger myRunningPredecessorsCount = new AtomicInteger(0);
     private final Collection<ScheduledPass> mySuccessorsOnCompletion = new ArrayList<ScheduledPass>();
     private final Collection<ScheduledPass> mySuccessorsOnSubmit = new ArrayList<ScheduledPass>();
     private final DaemonProgressIndicator myUpdateProgress;
 
-    private ScheduledPass(@NotNull List<FileEditor> fileEditors,
+    private ScheduledPass(@NotNull FileEditor fileEditor,
                           @NotNull TextEditorHighlightingPass pass,
                           @NotNull DaemonProgressIndicator progressIndicator,
-                          @NotNull AtomicInteger threadsToStartCountdown,
-                          int jobPriority) {
-      myFileEditors = fileEditors;
+                          @NotNull AtomicInteger threadsToStartCountdown) {
+      myFileEditor = fileEditor;
       myPass = pass;
       myThreadsToStartCountdown = threadsToStartCountdown;
-      myJobPriority = jobPriority;
-      myRunningPredecessorsCount = new AtomicInteger(0);
       myUpdateProgress = progressIndicator;
     }
 
@@ -410,7 +451,7 @@
       log(myUpdateProgress, myPass, "Finished. ");
 
       if (!myUpdateProgress.isCanceled()) {
-        applyInformationToEditorsLater(myFileEditors, myPass, myUpdateProgress, myThreadsToStartCountdown);
+        applyInformationToEditorsLater(myFileEditor, myPass, myUpdateProgress, myThreadsToStartCountdown);
         for (ScheduledPass successor : mySuccessorsOnCompletion) {
           int predecessorsToRun = successor.myRunningPredecessorsCount.decrementAndGet();
           if (predecessorsToRun == 0) {
@@ -425,75 +466,57 @@
     public String toString() {
       return "SP: " + myPass;
     }
+
+    private void addSuccessorOnCompletion(@NotNull ScheduledPass successor) {
+      mySuccessorsOnCompletion.add(successor);
+      successor.myRunningPredecessorsCount.incrementAndGet();
+    }
+
+    private void addSuccessorOnSubmit(@NotNull ScheduledPass successor) {
+      mySuccessorsOnSubmit.add(successor);
+      successor.myRunningPredecessorsCount.incrementAndGet();
+    }
   }
 
-  private void applyInformationToEditorsLater(@NotNull final List<FileEditor> fileEditors,
+  private void applyInformationToEditorsLater(@NotNull final FileEditor fileEditor,
                                               @NotNull final TextEditorHighlightingPass pass,
                                               @NotNull final DaemonProgressIndicator updateProgress,
                                               @NotNull final AtomicInteger threadsToStartCountdown) {
-    final boolean testMode = ApplicationManager.getApplication().isUnitTestMode();
     ApplicationManager.getApplication().invokeLater(new DumbAwareRunnable() {
       @Override
       public void run() {
-        doApplyInformationToEditors(updateProgress, pass, fileEditors, threadsToStartCountdown, testMode);
-      }
-    }, ModalityState.stateForComponent(fileEditors.get(0).getComponent()));
-  }
-
-  private void doApplyInformationToEditors(@NotNull DaemonProgressIndicator updateProgress,
-                                           @NotNull TextEditorHighlightingPass pass,
-                                           @NotNull List<FileEditor> fileEditors,
-                                           @NotNull AtomicInteger threadsToStartCountdown,
-                                           boolean testMode) {
-    ApplicationManager.getApplication().assertIsDispatchThread();
-    if (isDisposed() || myProject.isDisposed()) {
-      updateProgress.cancel();
-    }
-    if (updateProgress.isCanceled()) {
-      log(updateProgress, pass, " is canceled during apply, sorry");
-      return;
-    }
-    boolean applied = false;
-    for (final FileEditor fileEditor : fileEditors) {
-      LOG.assertTrue(fileEditor != null);
-      try {
-        if (testMode || fileEditor.getComponent().isDisplayable()) {
-          if (!applied) {
-            applied = true;
+        if (isDisposed() || myProject.isDisposed()) {
+          updateProgress.cancel();
+        }
+        if (updateProgress.isCanceled()) {
+          log(updateProgress, pass, " is canceled during apply, sorry");
+          return;
+        }
+        try {
+          if (fileEditor.getComponent().isDisplayable() || ApplicationManager.getApplication().isUnitTestMode()) {
             log(updateProgress, pass, " Applied");
             pass.applyInformationToEditor();
           }
-          afterApplyInformationToEditor(pass, fileEditor, updateProgress);
-
-          if (pass.isRunIntentionPassAfter() && fileEditor instanceof TextEditor && !updateProgress.isCanceled()) {
-            Editor editor = ((TextEditor)fileEditor).getEditor();
-            ShowIntentionsPass ip = new ShowIntentionsPass(myProject, editor, -1);
-            ip.setId(nextPassId.incrementAndGet());
-            threadsToStartCountdown.incrementAndGet();
-            submit(new ScheduledPass(fileEditors, ip, updateProgress, threadsToStartCountdown, Job.DEFAULT_PRIORITY));
-          }
+        }
+        catch (RuntimeException e) {
+          log(updateProgress, pass, "Error " + e);
+          throw e;
+        }
+        if (threadsToStartCountdown.decrementAndGet() == 0) {
+          log(updateProgress, pass, "Stopping ");
+          updateProgress.stopIfRunning();
+        }
+        else {
+          log(updateProgress, pass, "Finished but there are passes in the queue: " + threadsToStartCountdown.get());
         }
       }
-      catch (RuntimeException e) {
-        log(updateProgress, pass, "Error " + e);
-        throw e;
-      }
-    }
-    if (threadsToStartCountdown.decrementAndGet() == 0) {
-      log(updateProgress, pass, "Stopping ");
-      updateProgress.stopIfRunning();
-    }
-    else {
-      log(updateProgress, pass, "Finished but there are passes in the queue: "+threadsToStartCountdown.get());
-    }
+    }, ModalityState.stateForComponent(fileEditor.getComponent()));
   }
 
   protected boolean isDisposed() {
     return isDisposed;
   }
 
-  protected abstract void afterApplyInformationToEditor(TextEditorHighlightingPass pass, FileEditor fileEditor, ProgressIndicator updateProgress);
-
   @NotNull
   public List<TextEditorHighlightingPass> getAllSubmittedPasses() {
     List<TextEditorHighlightingPass> result = new ArrayList<TextEditorHighlightingPass>(mySubmittedPasses.size());
@@ -502,13 +525,17 @@
         result.add(scheduledPass.myPass);
       }
     }
+    sortById(result);
+    return result;
+  }
+
+  private void sortById(@NotNull List<TextEditorHighlightingPass> result) {
     ContainerUtil.quickSort(result, new Comparator<TextEditorHighlightingPass>() {
       @Override
       public int compare(TextEditorHighlightingPass o1, TextEditorHighlightingPass o2) {
         return o1.getId() - o2.getId();
       }
     });
-    return result;
   }
 
   private static final ConcurrentHashMap<Thread, Integer> threads = new ConcurrentHashMap<Thread, Integer>();
@@ -537,11 +564,11 @@
   }
 
   private static final Key<Throwable> THROWABLE_KEY = Key.create("THROWABLE_KEY");
-  private static void saveException(Throwable e, DaemonProgressIndicator indicator) {
+  private static void saveException(@NotNull Throwable e, @NotNull DaemonProgressIndicator indicator) {
     indicator.putUserDataIfAbsent(THROWABLE_KEY, e);
   }
   @TestOnly
-  public static Throwable getSavedException(DaemonProgressIndicator indicator) {
+  public static Throwable getSavedException(@NotNull DaemonProgressIndicator indicator) {
     return indicator.getUserData(THROWABLE_KEY);
   }
 
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/FixDocCommentAction.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/FixDocCommentAction.java
index 58a0c77..813c3ea 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/FixDocCommentAction.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/FixDocCommentAction.java
@@ -33,7 +33,6 @@
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.CodeStyleManager;
-import com.intellij.psi.util.PsiUtilCore;
 import com.intellij.util.text.CharArrayUtil;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -71,15 +70,25 @@
 
       process(psiFile, editor, project, editor.getCaretModel().getOffset()); 
     }
-  } 
-  
+  }
+
   private static void process(@NotNull final PsiFile file, @NotNull final Editor editor, @NotNull final Project project, int offset) {
     PsiElement elementAtOffset = file.findElementAt(offset);
     if (elementAtOffset == null) {
       return;
     }
+    generateOrFixComment(elementAtOffset, project, editor);
+  }
 
-    Language language = PsiUtilCore.getLanguageAtOffset(file, offset);
+  /**
+   * Generates comment if it's not exist or try to fix if exists
+   *
+   * @param element     target element for which a comment should be generated
+   * @param project     current project
+   * @param editor      target editor
+   */
+  public static void generateOrFixComment(@NotNull final PsiElement element, @NotNull final Project project, @NotNull final Editor editor) {
+    Language language = element.getLanguage();
     final CodeDocumentationProvider docProvider;
     final DocumentationProvider langDocumentationProvider = LanguageDocumentation.INSTANCE.forLanguage(language);
     if (langDocumentationProvider instanceof CompositeDocumentationProvider) {
@@ -95,7 +104,7 @@
       return;
     }
 
-    final Pair<PsiElement, PsiComment> pair = docProvider.parseContext(elementAtOffset);
+    final Pair<PsiElement, PsiComment> pair = docProvider.parseContext(element);
     if (pair == null) {
       return;
     }
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/folding/CodeFoldingManager.java b/platform/lang-impl/src/com/intellij/codeInsight/folding/CodeFoldingManager.java
index 7a9ab3f..87fdbc4 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/folding/CodeFoldingManager.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/folding/CodeFoldingManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -50,4 +50,6 @@
 
   public abstract void releaseFoldings(@NotNull Editor editor);
   public abstract void buildInitialFoldings(@NotNull Editor editor);
+  @Nullable
+  public abstract CodeFoldingState buildInitialFoldings(@NotNull Document document);
 }
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/folding/CodeFoldingSettingsImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/folding/CodeFoldingSettingsImpl.java
deleted file mode 100644
index 92f449c..0000000
--- a/platform/lang-impl/src/com/intellij/codeInsight/folding/CodeFoldingSettingsImpl.java
+++ /dev/null
@@ -1,60 +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.codeInsight.folding;
-
-import com.intellij.ide.IdeBundle;
-import com.intellij.openapi.application.PathManager;
-import com.intellij.openapi.components.*;
-import com.intellij.util.xmlb.XmlSerializerUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-
-/**
- * @author yole
- */
-@State(
-  name="CodeFoldingSettings",
-  storages= {
-    @Storage(
-      file = StoragePathMacros.APP_CONFIG + "/editor.codeinsight.xml"
-    )}
-)
-public class CodeFoldingSettingsImpl extends CodeFoldingSettings implements PersistentStateComponent<CodeFoldingSettings>, ExportableComponent {
-
-  @Override
-  public CodeFoldingSettings getState() {
-    return this;
-  }
-
-  @Override
-  public void loadState(final CodeFoldingSettings state) {
-    XmlSerializerUtil.copyBean(state, this);
-  }
-
-  @Override
-  @NotNull
-  public File[] getExportFiles() {
-    return new File[] { PathManager.getOptionsFile("editor.codeinsight") };
-  }
-
-  @Override
-  @NotNull
-  public String getPresentableName() {
-    return IdeBundle.message("code.folding.settings");
-  }
-}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CodeFoldingManagerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CodeFoldingManagerImpl.java
index a965a85..9a5bd2c 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CodeFoldingManagerImpl.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CodeFoldingManagerImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -31,6 +31,7 @@
 import com.intellij.openapi.editor.ex.FoldingModelEx;
 import com.intellij.openapi.fileEditor.impl.text.CodeFoldingState;
 import com.intellij.openapi.project.DumbAwareRunnable;
+import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.startup.StartupManager;
 import com.intellij.openapi.util.*;
@@ -54,7 +55,7 @@
   private final List<Document> myDocumentsWithFoldingInfo = new WeakList<Document>();
 
   private final Key<DocumentFoldingInfo> myFoldingInfoInDocumentKey = Key.create("FOLDING_INFO_IN_DOCUMENT_KEY");
-  private static final Key<Boolean> FOLDING_STATE_INFO_IN_DOCUMENT_KEY = Key.create("FOLDING_STATE_IN_DOCUMENT");
+  private static final Key<Boolean> FOLDING_STATE_KEY = Key.create("FOLDING_STATE_KEY");
 
   CodeFoldingManagerImpl(Project project) {
     myProject = project;
@@ -96,7 +97,7 @@
         HintManager hintManager = HintManager.getInstance();
         if (hintManager != null && hintManager.hasShownHintsThatWillHideByOtherHint(false)) {
           return;
-        } 
+        }
 
         if (e.getArea() != EditorMouseEventArea.FOLDING_OUTLINE_AREA) return;
         LightweightHint hint = null;
@@ -127,8 +128,8 @@
               myCurrentHint.hide();
               myCurrentHint = null;
             }
-            
-            
+
+
             // We want to show a hint with the top fold region content that is above the current viewport position.
             // However, there is a possible case that complete region has a big height and only a little bottom part
             // is shown at the moment. We can't just show hint with the whole top content because it would hide actual
@@ -183,7 +184,7 @@
 
   @Override
   public void releaseFoldings(@NotNull Editor editor) {
-    ApplicationManagerEx.getApplicationEx().assertIsDispatchThread(editor.getComponent());
+    ApplicationManagerEx.getApplicationEx().assertIsDispatchThread();
     final Project project = editor.getProject();
     if (project != null && (!project.equals(myProject) || !project.isOpen())) return;
 
@@ -201,39 +202,73 @@
 
   @Override
   public void buildInitialFoldings(@NotNull final Editor editor) {
-    ApplicationManagerEx.getApplicationEx().assertIsDispatchThread(editor.getComponent());
     final Project project = editor.getProject();
-    if (project == null || !project.equals(myProject)) return;
+    if (project == null || !project.equals(myProject) || editor.isDisposed()) return;
+    if (!((FoldingModelEx)editor.getFoldingModel()).isFoldingEnabled()) return;
+    if (!FoldingUpdate.supportsDumbModeFolding(editor)) return;
 
-    final Document document = editor.getDocument();
-    //Do not save/restore folding for code fragments
-    final PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(document);
-    if (file == null || !file.getViewProvider().isPhysical() && !ApplicationManager.getApplication().isUnitTestMode()) return;
-
-    final FoldingModelEx foldingModel = (FoldingModelEx)editor.getFoldingModel();
-    if (!foldingModel.isFoldingEnabled()) return;
-    if (project.isDisposed() || editor.isDisposed() || !file.isValid()) return;
-
+    Document document = editor.getDocument();
     PsiDocumentManager.getInstance(myProject).commitDocument(document);
-
-    Runnable runnable = updateFoldRegions(editor, true, true);
-    if (runnable != null) {
-      runnable.run();
+    CodeFoldingState foldingState = buildInitialFoldings(document);
+    if (foldingState != null) {
+      foldingState.setToEditor(editor);
     }
-    if (myProject.isDisposed() || editor.isDisposed()) return;
-    foldingModel.runBatchFoldingOperation(new Runnable() {
+  }
+
+  @Nullable
+  @Override
+  public CodeFoldingState buildInitialFoldings(@NotNull final Document document) {
+    if (myProject.isDisposed()) {
+      return null;
+    }
+    ApplicationManager.getApplication().assertReadAccessAllowed();
+    PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(myProject);
+    if (psiDocumentManager.isUncommited(document)) {
+      // skip building foldings for uncommitted document, CodeFoldingPass invoked by daemon will do it later
+      return null;
+    }
+    //Do not save/restore folding for code fragments
+    final PsiFile file = psiDocumentManager.getPsiFile(document);
+    if (file == null || !file.isValid() || !file.getViewProvider().isPhysical() && !ApplicationManager.getApplication().isUnitTestMode()) {
+      return null;
+    }
+
+
+    final FoldingUpdate.FoldingMap foldingMap = FoldingUpdate.getFoldingsFor(myProject, file, document, true);
+
+    return new CodeFoldingState() {
+      @Override
+      public void setToEditor(@NotNull final Editor editor) {
+        ApplicationManagerEx.getApplicationEx().assertIsDispatchThread();
+        if (myProject.isDisposed() || editor.isDisposed()) return;
+        final FoldingModelEx foldingModel = (FoldingModelEx)editor.getFoldingModel();
+        if (!foldingModel.isFoldingEnabled()) return;
+        if (isFoldingsInitializedInEditor(editor)) return;
+        if (DumbService.isDumb(myProject) && !FoldingUpdate.supportsDumbModeFolding(editor)) return;
+
+        foldingModel.runBatchFoldingOperationDoNotCollapseCaret(new UpdateFoldRegionsOperation(myProject, editor, file, foldingMap, true, false));
+        initFolding(editor);
+      }
+    };
+  }
+
+  private void initFolding(@NotNull final Editor editor) {
+    final Document document = editor.getDocument();
+    editor.getFoldingModel().runBatchFoldingOperation(new Runnable() {
       @Override
       public void run() {
         DocumentFoldingInfo documentFoldingInfo = getDocumentFoldingInfo(document);
         Editor[] editors = EditorFactory.getInstance().getEditors(document, myProject);
         for (Editor otherEditor : editors) {
-          if (otherEditor == editor) continue;
+          if (otherEditor == editor || !isFoldingsInitializedInEditor(otherEditor)) continue;
           documentFoldingInfo.loadFromEditor(otherEditor);
           break;
         }
         documentFoldingInfo.setToEditor(editor);
-
         documentFoldingInfo.clear();
+
+        document.putUserData(FOLDING_STATE_KEY, Boolean.TRUE);
+        editor.putUserData(FOLDING_STATE_KEY, Boolean.TRUE);
       }
     });
   }
@@ -241,7 +276,7 @@
   @Override
   public void projectClosed() {
   }
-  
+
   @Override
   @Nullable
   public FoldRegion findFoldRegion(@NotNull Editor editor, int startOffset, int endOffset) {
@@ -291,15 +326,25 @@
 
   @Override
   @Nullable
-  public Runnable updateFoldRegionsAsync(@NotNull Editor editor, boolean firstTime) {
-    return updateFoldRegions(editor, firstTime, false);
+  public Runnable updateFoldRegionsAsync(@NotNull final Editor editor, final boolean firstTime) {
+    final Runnable runnable = updateFoldRegions(editor, firstTime, false);
+    return new Runnable() {
+      @Override
+      public void run() {
+        if (runnable != null) {
+          runnable.run();
+        }
+        if (firstTime && !isFoldingsInitializedInEditor(editor)) {
+          initFolding(editor);
+        }
+      }
+    };
   }
 
   @Nullable
   private Runnable updateFoldRegions(@NotNull Editor editor, boolean applyDefaultState, boolean quick) {
     PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(editor.getDocument());
     if (file != null) {
-      editor.getDocument().putUserData(FOLDING_STATE_INFO_IN_DOCUMENT_KEY, Boolean.TRUE);
       return FoldingUpdate.updateFoldRegions(editor, file, applyDefaultState, quick);
     }
     else {
@@ -311,19 +356,28 @@
   public CodeFoldingState saveFoldingState(@NotNull Editor editor) {
     ApplicationManager.getApplication().assertIsDispatchThread();
     DocumentFoldingInfo info = getDocumentFoldingInfo(editor.getDocument());
-    info.loadFromEditor(editor);
+    if (isFoldingsInitializedInEditor(editor)) {
+      info.loadFromEditor(editor);
+    }
     return info;
   }
 
   @Override
   public void restoreFoldingState(@NotNull Editor editor, @NotNull CodeFoldingState state) {
     ApplicationManager.getApplication().assertIsDispatchThread();
-    ((DocumentFoldingInfo)state).setToEditor(editor);
+    if (isFoldingsInitializedInEditor(editor)) {
+      state.setToEditor(editor);
+    }
   }
 
   @Override
   public void writeFoldingState(@NotNull CodeFoldingState state, @NotNull Element element) throws WriteExternalException {
-    ((DocumentFoldingInfo)state).writeExternal(element);
+    if (state instanceof DocumentFoldingInfo) {
+      ((DocumentFoldingInfo)state).writeExternal(element);
+    }
+    else {
+      throw new WriteExternalException();
+    }
   }
 
   @Override
@@ -350,13 +404,20 @@
   }
 
   private static void resetFoldingInfo(@NotNull final Document document) {
-    final Boolean foldingInfoStatus = document.getUserData(FOLDING_STATE_INFO_IN_DOCUMENT_KEY);
-    if (Boolean.TRUE.equals(foldingInfoStatus)) {
+    if (isFoldingsInitializedInDocument(document)) {
       final Editor[] editors = EditorFactory.getInstance().getEditors(document);
       for(Editor editor:editors) {
         EditorFoldingInfo.resetInfo(editor);
       }
-      document.putUserData(FOLDING_STATE_INFO_IN_DOCUMENT_KEY, null);
+      document.putUserData(FOLDING_STATE_KEY, null);
     }
   }
+
+  static boolean isFoldingsInitializedInDocument(@NotNull Document document) {
+    return Boolean.TRUE.equals(document.getUserData(FOLDING_STATE_KEY));
+  }
+
+  static boolean isFoldingsInitializedInEditor(@NotNull Editor editor) {
+    return Boolean.TRUE.equals(editor.getUserData(FOLDING_STATE_KEY));
+  }
 }
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/DocumentFoldingInfo.java b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/DocumentFoldingInfo.java
index 9294f10..5e14a9f 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/DocumentFoldingInfo.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/DocumentFoldingInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -29,6 +29,7 @@
 import com.intellij.openapi.editor.RangeMarker;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.fileEditor.impl.text.CodeFoldingState;
+import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.*;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -48,7 +49,16 @@
   @NotNull private final Project myProject;
   private final VirtualFile myFile;
 
+  private static class SerializedPsiElement {
+    private final String mySerializedElement;
+    private final FoldingInfo myFoldingInfo;
+    public SerializedPsiElement(@NotNull String serialized, @NotNull FoldingInfo foldingInfo) {
+      mySerializedElement = serialized;
+      myFoldingInfo = foldingInfo;
+    }
+  }
   @NotNull private final List<SmartPsiElementPointer<PsiElement>> myPsiElements = ContainerUtil.createLockFreeCopyOnWriteList();
+  @NotNull private final List<SerializedPsiElement> mySerializedElements = ContainerUtil.createLockFreeCopyOnWriteList();
   @NotNull private final List<RangeMarker> myRangeMarkers = ContainerUtil.createLockFreeCopyOnWriteList();
   private static final String DEFAULT_PLACEHOLDER = "...";
   @NonNls private static final String ELEMENT_TAG = "element";
@@ -64,7 +74,7 @@
   }
 
   void loadFromEditor(@NotNull Editor editor) {
-    assertDispatchThread(editor);
+    assertDispatchThread();
     LOG.assertTrue(!editor.isDisposed());
     clear();
 
@@ -95,12 +105,13 @@
     }
   }
 
-  private static void assertDispatchThread(@NotNull Editor editor) {
-    ApplicationManagerEx.getApplicationEx().assertIsDispatchThread(editor.getComponent());
+  private static void assertDispatchThread() {
+    ApplicationManagerEx.getApplicationEx().assertIsDispatchThread();
   }
 
-  void setToEditor(@NotNull final Editor editor) {
-    assertDispatchThread(editor);
+  @Override
+  public void setToEditor(@NotNull final Editor editor) {
+    assertDispatchThread();
     final PsiManager psiManager = PsiManager.getInstance(myProject);
     if (psiManager.isDisposed()) return;
 
@@ -108,6 +119,19 @@
     final PsiFile psiFile = psiManager.findFile(myFile);
     if (psiFile == null) return;
 
+    if (!mySerializedElements.isEmpty()) {
+      // Restore postponed state
+      assert myPsiElements.isEmpty() : "Sequential deserialization";
+      for (SerializedPsiElement entry : mySerializedElements) {
+        PsiElement restoredElement = FoldingPolicy.restoreBySignature(psiFile, entry.mySerializedElement);
+        if (restoredElement != null && restoredElement.isValid()) {
+          myPsiElements.add(SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(restoredElement));
+          restoredElement.putUserData(FOLDING_INFO_KEY, entry.myFoldingInfo);
+        }
+      }
+      mySerializedElements.clear();
+    }
+
     Map<PsiElement, FoldingDescriptor> ranges = null;
     for (SmartPsiElementPointer<PsiElement> ptr: myPsiElements) {
       PsiElement element = ptr.getElement();
@@ -174,41 +198,53 @@
       if (!(marker instanceof FoldRegion)) marker.dispose();
     }
     myRangeMarkers.clear();
+    mySerializedElements.clear();
   }
 
   @Override
   public void writeExternal(Element element) throws WriteExternalException {
     PsiDocumentManager.getInstance(myProject).commitAllDocuments();
 
-    if (myPsiElements.isEmpty() && myRangeMarkers.isEmpty()){
+    if (myPsiElements.isEmpty() && myRangeMarkers.isEmpty() && mySerializedElements.isEmpty()){
       throw new WriteExternalException();
     }
 
-    for (SmartPsiElementPointer<PsiElement> ptr : myPsiElements) {
-      PsiElement psiElement = ptr.getElement();
-      if (psiElement == null || !psiElement.isValid()) {
-        continue;
-      }
-      FoldingInfo fi = psiElement.getUserData(FOLDING_INFO_KEY);
-      boolean state = fi != null && fi.expanded;
-      String signature = FoldingPolicy.getSignature(psiElement);
-      if (signature == null) {
-        continue;
-      }
+    if (mySerializedElements.isEmpty()) {
+      for (SmartPsiElementPointer<PsiElement> ptr : myPsiElements) {
+        PsiElement psiElement = ptr.getElement();
+        if (psiElement == null || !psiElement.isValid()) {
+          continue;
+        }
+        FoldingInfo fi = psiElement.getUserData(FOLDING_INFO_KEY);
+        boolean state = fi != null && fi.expanded;
+        String signature = FoldingPolicy.getSignature(psiElement);
+        if (signature == null) {
+          continue;
+        }
 
-      PsiElement restoredElement = FoldingPolicy.restoreBySignature(psiElement.getContainingFile(), signature);
-      if (!psiElement.equals(restoredElement)) {
-        StringBuilder trace = new StringBuilder();
-        PsiElement restoredAgain = FoldingPolicy.restoreBySignature(psiElement.getContainingFile(), signature, trace);
-        LOG.error("element: " + psiElement + "(" + psiElement.getText() + "); restoredElement: " + restoredElement
-                  + "; signature: '" + signature + "'; file: " + psiElement.getContainingFile() + "; restored again: "
-                  + restoredAgain + "; restore produces same results: " + (restoredAgain == restoredElement) + "; trace:\n" + trace);
-      }
+        PsiElement restoredElement = FoldingPolicy.restoreBySignature(psiElement.getContainingFile(), signature);
+        if (!psiElement.equals(restoredElement)) {
+          StringBuilder trace = new StringBuilder();
+          PsiElement restoredAgain = FoldingPolicy.restoreBySignature(psiElement.getContainingFile(), signature, trace);
+          LOG.error("element: " + psiElement + "(" + psiElement.getText() + "); restoredElement: " + restoredElement
+                    + "; signature: '" + signature + "'; file: " + psiElement.getContainingFile() + "; restored again: "
+                    + restoredAgain + "; restore produces same results: " + (restoredAgain == restoredElement) + "; trace:\n" + trace);
+        }
 
-      Element e = new Element(ELEMENT_TAG);
-      e.setAttribute(SIGNATURE_ATT, signature);
-      e.setAttribute(EXPANDED_ATT, Boolean.toString(state));
-      element.addContent(e);
+        Element e = new Element(ELEMENT_TAG);
+        e.setAttribute(SIGNATURE_ATT, signature);
+        e.setAttribute(EXPANDED_ATT, Boolean.toString(state));
+        element.addContent(e);
+      }
+    }
+    else {
+      // get back postponed state (before folding initialization)
+      for (SerializedPsiElement entry : mySerializedElements) {
+        Element e = new Element(ELEMENT_TAG);
+        e.setAttribute(SIGNATURE_ATT, entry.mySerializedElement);
+        e.setAttribute(EXPANDED_ATT, Boolean.toString(entry.myFoldingInfo.getExpanded()));
+        element.addContent(e);
+      }
     }
     String date = null;
     for (RangeMarker marker : myRangeMarkers) {
@@ -249,6 +285,7 @@
         if (psiFile == null || !psiFile.getViewProvider().isPhysical()) return;
 
         String date = null;
+        boolean canRestoreElement = !DumbService.getInstance(myProject).isDumb() || FoldingUpdate.supportsDumbModeFolding(psiFile);
         for (final Object o : element.getChildren()) {
           Element e = (Element)o;
           Boolean expanded = Boolean.valueOf(e.getAttributeValue(EXPANDED_ATT));
@@ -257,11 +294,17 @@
             if (signature == null) {
               continue;
             }
-            PsiElement restoredElement = FoldingPolicy.restoreBySignature(psiFile, signature);
-            if (restoredElement != null && restoredElement.isValid()) {
-              myPsiElements.add(SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(restoredElement));
-              FoldingInfo fi = new FoldingInfo(DEFAULT_PLACEHOLDER, expanded);
-              restoredElement.putUserData(FOLDING_INFO_KEY, fi);
+            FoldingInfo fi = new FoldingInfo(DEFAULT_PLACEHOLDER, expanded);
+            if (canRestoreElement) {
+              PsiElement restoredElement = FoldingPolicy.restoreBySignature(psiFile, signature);
+              if (restoredElement != null && restoredElement.isValid()) {
+                myPsiElements.add(SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(restoredElement));
+                restoredElement.putUserData(FOLDING_INFO_KEY, fi);
+              }
+            }
+            else {
+              // Postponed initialization
+              mySerializedElements.add(new SerializedPsiElement(signature, fi));
             }
           }
           else if (MARKER_TAG.equals(e.getName())) {
@@ -306,6 +349,7 @@
     result = 31 * result + (myFile != null ? myFile.hashCode() : 0);
     result = 31 * result + myPsiElements.hashCode();
     result = 31 * result + myRangeMarkers.hashCode();
+    result = 31 * result + mySerializedElements.hashCode();
     return result;
   }
 
@@ -323,7 +367,9 @@
     if (myFile != null ? !myFile.equals(info.myFile) : info.myFile != null) {
       return false;
     }
-    if (!myProject.equals(info.myProject) || !myPsiElements.equals(info.myPsiElements)) {
+    if (!myProject.equals(info.myProject)
+        || !myPsiElements.equals(info.myPsiElements)
+        || !mySerializedElements.equals(info.mySerializedElements)) {
       return false;
     }
 
@@ -372,5 +418,9 @@
       result = 31 * result + (expanded ? 1 : 0);
       return result;
     }
+
+    public boolean getExpanded() {
+      return expanded;
+    }
   }
 }
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/FoldingUpdate.java b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/FoldingUpdate.java
index d4fdfce..4f7f332 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/FoldingUpdate.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/FoldingUpdate.java
@@ -30,6 +30,7 @@
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.fileTypes.ContentBasedFileSubstitutor;
+import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Couple;
 import com.intellij.openapi.util.Key;
@@ -103,7 +104,7 @@
           PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(document);
           return getUpdateResult(file, document, param.first, project, editor, param.second);
         }
-      }, false, Couple.newOne(quick, applyDefaultState));
+      }, false, Couple.of(quick, applyDefaultState));
   }
 
   private static CachedValueProvider.Result<Runnable> getUpdateResult(PsiFile file,
@@ -113,11 +114,7 @@
                                                                       final Editor editor,
                                                                       final boolean applyDefaultState) {
 
-    final FoldingMap elementsToFoldMap = new FoldingMap();
-    if (!isContentSubstituted(file, project)) {
-      getFoldingsFor(file instanceof PsiCompiledFile ? ((PsiCompiledFile)file).getDecompiledPsiFile() : file, document, elementsToFoldMap, quick);
-    }
-
+    final FoldingMap elementsToFoldMap = getFoldingsFor(project, file, document, quick);
     final UpdateFoldRegionsOperation operation = new UpdateFoldRegionsOperation(project, editor, file, elementsToFoldMap, applyDefaultState, false);
     Runnable runnable = new Runnable() {
       @Override
@@ -192,6 +189,48 @@
     };
   }
 
+  /**
+   * Checks the ability to initialize folding in the Dumb Mode. Due to language injections it may depend on
+   * edited file and active injections (not yet implemented).
+   *
+   * @param editor the editor that holds file view
+   * @return true  if folding initialization available in the Dumb Mode
+   */
+  public static boolean supportsDumbModeFolding(@NotNull Editor editor) {
+    Project project = editor.getProject();
+    if (project != null) {
+      PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
+      if (file != null) {
+        return supportsDumbModeFolding(file);
+      }
+    }
+    return true;
+  }
+
+  /**
+   * Checks the ability to initialize folding in the Dumb Mode for file.
+   *
+   * @param file the file to test
+   * @return true  if folding initialization available in the Dumb Mode
+   */
+  public static boolean supportsDumbModeFolding(@NotNull PsiFile file) {
+    final FileViewProvider viewProvider = file.getViewProvider();
+    for (final Language language : viewProvider.getLanguages()) {
+      final FoldingBuilder foldingBuilder = LanguageFolding.INSTANCE.forLanguage(language);
+      if(foldingBuilder != null && !DumbService.isDumbAware(foldingBuilder))
+        return false;
+    }
+    return true;
+  }
+
+  static FoldingMap getFoldingsFor(@NotNull Project project, @NotNull PsiFile file, @NotNull Document document, boolean quick) {
+    FoldingMap foldingMap = new FoldingMap();
+    if (!isContentSubstituted(file, project)) {
+      getFoldingsFor(file instanceof PsiCompiledFile ? ((PsiCompiledFile)file).getDecompiledPsiFile() : file, document, foldingMap, quick);
+    }
+    return foldingMap;
+  }
+
   private static void getFoldingsFor(@NotNull PsiFile file,
                                      @NotNull Document document,
                                      @NotNull FoldingMap elementsToFoldMap,
@@ -221,11 +260,13 @@
   }
 
   public static class FoldingMap extends MultiMap<PsiElement, FoldingDescriptor>{
+    @NotNull
     @Override
     protected Map<PsiElement, Collection<FoldingDescriptor>> createMap() {
       return new TreeMap<PsiElement, Collection<FoldingDescriptor>>(COMPARE_BY_OFFSET);
     }
 
+    @NotNull
     @Override
     protected Collection<FoldingDescriptor> createCollection() {
       return new ArrayList<FoldingDescriptor>(1);
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByBlockCommentHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByBlockCommentHandler.java
index ba0841f..ca91511 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByBlockCommentHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByBlockCommentHandler.java
@@ -639,7 +639,7 @@
       end = new TextRange(range.getEndOffset(), range.getEndOffset());
     }
 
-    return Couple.newOne(start, end);
+    return Couple.of(start, end);
   }
 
   public void uncommentRange(TextRange range, String commentPrefix, String commentSuffix, Commenter commenter) {
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceHighlightingHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceHighlightingHandler.java
index c128653..b28fa48 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceHighlightingHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceHighlightingHandler.java
@@ -97,23 +97,22 @@
 
     myPsiFile = psiFile;
     myCodeInsightSettings = CodeInsightSettings.getInstance();
-    // myFileType = myPsiFile == null ? null : myPsiFile.getFileType();
   }
 
   static void lookForInjectedAndMatchBracesInOtherThread(@NotNull final Editor editor,
                                                          @NotNull final Alarm alarm,
                                                          @NotNull final Processor<BraceHighlightingHandler> processor) {
-    // TODO it really should be .assertIsDispatchThread() with no editor. Dmitry promised he'll revert this shortly
-    ApplicationManagerEx.getApplicationEx().assertIsDispatchThread(editor.getComponent());
-    final Project project = editor.getProject();
-    if (project == null || project.isDisposed()) return;
+    ApplicationManagerEx.getApplicationEx().assertIsDispatchThread();
+    if (!isValidEditor(editor)) return;
     if (!PROCESSED_EDITORS.add(editor)) {
       // Skip processing if that is not really necessary.
       // Assuming to be in EDT here.
       return;
     }
     final int offset = editor.getCaretModel().getOffset();
+    final Project project = editor.getProject();
     final PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(editor, project);
+    if (!isValidFile(psiFile)) return;
     ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
       @Override
       public void run() {
@@ -125,7 +124,8 @@
               injected = psiFile == null ||
                          psiFile instanceof PsiCompiledElement ||
                          psiFile instanceof PsiBinaryFile ||
-                         isReallyDisposed(editor, project)
+                         !isValidEditor(editor) ||
+                         !isValidFile(psiFile)
                          ? null : getInjectedFileIfAny(editor, project, offset, psiFile, alarm);
             }
             catch (RuntimeException e) {
@@ -142,7 +142,7 @@
               @Override
               public void run() {
                 try {
-                  if (!isReallyDisposed(editor, project)) {
+                  if (isValidEditor(editor) && isValidFile(injected)) {
                     Editor newEditor = InjectedLanguageUtil.getInjectedEditorForInjectedFile(editor, injected);
                     BraceHighlightingHandler handler = new BraceHighlightingHandler(project, newEditor, alarm, injected);
                     processor.process(handler);
@@ -168,10 +168,13 @@
     });
   }
 
-  private static boolean isReallyDisposed(@NotNull Editor editor, @NotNull Project project) {
+  private static boolean isValidFile(PsiFile file) {
+    return file != null && file.isValid() && !file.getProject().isDisposed();
+  }
+
+  private static boolean isValidEditor(@NotNull Editor editor) {
     Project editorProject = editor.getProject();
-    return editorProject == null ||
-           editorProject.isDisposed() || project.isDisposed() || !editor.getComponent().isShowing() || editor.isViewer();
+    return editorProject != null && !editorProject.isDisposed() && !editor.isDisposed() && editor.getComponent().isShowing() && !editor.isViewer();
   }
 
   @NotNull
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoComponent.java
index 237d551..4e1a8e9 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoComponent.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoComponent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -76,8 +76,14 @@
 
   @TestOnly
   public static ParameterInfoUIContextEx createContext(Object[] objects, Editor editor, @NotNull ParameterInfoHandler handler, int currentParameterIndex) {
+    return createContext(objects, editor, handler, currentParameterIndex, null);
+  }
+
+  @TestOnly
+  public static ParameterInfoUIContextEx createContext(Object[] objects, Editor editor, @NotNull ParameterInfoHandler handler, int currentParameterIndex, @Nullable PsiElement parameterOwner) {
     final ParameterInfoComponent infoComponent = new ParameterInfoComponent(objects, editor, handler);
     infoComponent.setCurrentParameterIndex(currentParameterIndex);
+    infoComponent.setParameterOwner(parameterOwner);
     return infoComponent.new MyParameterContext();
   } 
   
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java
index ed0419e..9a7a724 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java
@@ -51,10 +51,7 @@
 import javax.swing.border.EmptyBorder;
 import javax.swing.event.TreeSelectionEvent;
 import javax.swing.event.TreeSelectionListener;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreeNode;
-import javax.swing.tree.TreePath;
+import javax.swing.tree.*;
 import java.awt.*;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -573,6 +570,7 @@
     };
     myTree.setRootVisible(false);
     myTree.setShowsRootHandles(true);
+    myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
 
     myTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener(){
       @Override
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesCheckboxTree.java b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesCheckboxTree.java
index a03bdf5..b6a507e 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesCheckboxTree.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesCheckboxTree.java
@@ -17,6 +17,7 @@
 
 import com.intellij.codeInsight.template.postfix.templates.PostfixTemplate;
 import com.intellij.ide.util.treeView.TreeState;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.ui.CheckboxTree;
 import com.intellij.ui.CheckedTreeNode;
 import com.intellij.ui.JBColor;
@@ -80,13 +81,17 @@
       public void customizeRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
         if (!(value instanceof CheckedTreeNode)) return;
         CheckedTreeNode node = (CheckedTreeNode)value;
-        SimpleTextAttributes attributes = node instanceof PostfixTemplateCheckedTreeNode
-                                          ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES;
-        final String text = value.toString();
-        final Color background = selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground();
 
-        if (text != null) {
-          getTextRenderer().append(text, new SimpleTextAttributes(background, attributes.getFgColor(), JBColor.RED, attributes.getStyle()));
+        final Color background = selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground();
+        boolean isPostfixTemplate = node instanceof PostfixTemplateCheckedTreeNode;
+        SimpleTextAttributes attributes = isPostfixTemplate
+                                          ? SimpleTextAttributes.REGULAR_ATTRIBUTES
+                                          : SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES;
+        getTextRenderer().append(StringUtil.notNullize(value.toString()),
+                                 new SimpleTextAttributes(background, attributes.getFgColor(), JBColor.RED, attributes.getStyle()));
+        if (isPostfixTemplate) {
+          getTextRenderer()
+            .append(" (" + ((PostfixTemplateCheckedTreeNode)node).getTemplate().getExample() + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
         }
       }
     }, new CheckedTreeNode(null));
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/templates/StringBasedPostfixTemplate.java b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/templates/StringBasedPostfixTemplate.java
index 1c31734..4d6582f 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/templates/StringBasedPostfixTemplate.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/template/postfix/templates/StringBasedPostfixTemplate.java
@@ -15,13 +15,16 @@
  */
 package com.intellij.codeInsight.template.postfix.templates;
 
+import com.intellij.codeInsight.template.Template;
 import com.intellij.codeInsight.template.TemplateManager;
+import com.intellij.codeInsight.template.impl.TextExpression;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Condition;
 import com.intellij.psi.PsiElement;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 public abstract class StringBasedPostfixTemplate extends TypedPostfixTemplate {
 
@@ -38,10 +41,48 @@
     assert expr != null;
     Project project = context.getProject();
     Document document = editor.getDocument();
-    document.deleteString(expr.getTextRange().getStartOffset(), expr.getTextRange().getEndOffset());
+    PsiElement elementForRemoving = shouldRemoveParent() ? expr.getParent() : expr;
+    document.deleteString(elementForRemoving.getTextRange().getStartOffset(), elementForRemoving.getTextRange().getEndOffset());
     TemplateManager manager = TemplateManager.getInstance(project);
-    expandWithTemplateManager(manager, expr, editor);
+
+    String templateString = getTemplateString(expr);
+    if (templateString == null) {
+      PostfixTemplatesUtils.showErrorHint(expr.getProject(), editor);
+      return;
+    }
+
+
+    Template template = createTemplate(manager, templateString);
+
+    if (shouldAddExpressionToContext()) {
+      template.addVariable("expr", new TextExpression(expr.getText()), false);
+    }
+
+    setVariables(template, expr);
+    manager.startTemplate(editor, template);
   }
 
-  public abstract void expandWithTemplateManager(TemplateManager manager, PsiElement expression, Editor editor);
+  public Template createTemplate(TemplateManager manager, String templateString) {
+    Template template = manager.createTemplate("", "", templateString);
+    template.setToReformat(shouldReformat());
+    return template;
+  }
+
+  public void setVariables(@NotNull Template template, @NotNull PsiElement element) {
+  }
+
+  @Nullable
+  public abstract String getTemplateString(@NotNull PsiElement element);
+
+  protected boolean shouldAddExpressionToContext() {
+    return true;
+  }
+
+  protected boolean shouldReformat() {
+    return true;
+  }
+
+  protected boolean shouldRemoveParent() {
+    return true;
+  }
 }
diff --git a/platform/lang-impl/src/com/intellij/codeInspection/actions/CodeCleanupAction.java b/platform/lang-impl/src/com/intellij/codeInspection/actions/CodeCleanupAction.java
index 783ea34..0eebb7a 100644
--- a/platform/lang-impl/src/com/intellij/codeInspection/actions/CodeCleanupAction.java
+++ b/platform/lang-impl/src/com/intellij/codeInspection/actions/CodeCleanupAction.java
@@ -37,7 +37,7 @@
     final InspectionProfile profile = myExternalProfile != null ? myExternalProfile : InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
     final InspectionManager managerEx = InspectionManager.getInstance(project);
     final GlobalInspectionContextBase globalContext = (GlobalInspectionContextBase)managerEx.createNewGlobalContext(false);
-    globalContext.codeCleanup(project, scope, profile, getTemplatePresentation().getText(), null);
+    globalContext.codeCleanup(project, scope, profile, getTemplatePresentation().getText(), null, false);
   }
 
   @Override
diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java
index 8551542..f109d0d 100644
--- a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java
+++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java
@@ -48,6 +48,7 @@
 import com.intellij.openapi.ui.MessageType;
 import com.intellij.openapi.util.JDOMUtil;
 import com.intellij.openapi.util.NotNullLazyValue;
+import com.intellij.openapi.util.TextRange;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -55,6 +56,7 @@
 import com.intellij.openapi.wm.ToolWindowManager;
 import com.intellij.psi.*;
 import com.intellij.psi.search.LocalSearchScope;
+import com.intellij.psi.search.SearchScope;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.ui.content.*;
 import com.intellij.util.Processor;
@@ -612,75 +614,114 @@
                           final AnalysisScope scope,
                           final InspectionProfile profile,
                           final String commandName,
-                          final Runnable postRunnable) {
+                          final Runnable postRunnable, 
+                          final boolean modal) {
+    Task task;
+    if (modal) {
+      task = new Task.Modal(project, "Inspect code...", true) {
+        @Override
+        public void run(@NotNull ProgressIndicator indicator) {
+          cleanup(scope, profile, project, postRunnable, commandName);
+        }
+      };
+    } else {
+      task = new Task.Backgroundable(project, "Inspect code...", true) {
+        @Override
+        public void run(@NotNull ProgressIndicator indicator) {
+          cleanup(scope, profile, project, postRunnable, commandName);
+        }
+      }; 
+    }
+    ProgressManager.getInstance().run(task);
+  }
+
+  private void cleanup(final AnalysisScope scope,
+                       final InspectionProfile profile,
+                       final Project project,
+                       final Runnable postRunnable,
+                       final String commandName) {
     final List<LocalInspectionToolWrapper> lTools = new ArrayList<LocalInspectionToolWrapper>();
 
     final LinkedHashMap<PsiFile, List<HighlightInfo>> results = new LinkedHashMap<PsiFile, List<HighlightInfo>>();
-    ProgressManager.getInstance().run(new Task.Backgroundable(project, "Inspect code...", true) {
+
+    final SearchScope searchScope = scope.toSearchScope();
+    final TextRange range;
+    if (searchScope instanceof LocalSearchScope) {
+      final PsiElement[] elements = ((LocalSearchScope)searchScope).getScope();
+      range = elements.length == 1 ? elements[0].getTextRange() : null;
+    }
+    else {
+      range = null;
+    }
+    scope.accept(new PsiElementVisitor() {
       @Override
-      public void run(@NotNull ProgressIndicator indicator) {
-        scope.accept(new PsiElementVisitor() {
-          @Override
-          public void visitFile(PsiFile file) {
-            final VirtualFile virtualFile = file.getVirtualFile();
-            if (virtualFile == null || virtualFile.getFileType().isBinary()) return;
-            for (final Tools tools : profile.getAllEnabledInspectionTools(project)) {
-              if (tools.getTool().getTool() instanceof CleanupLocalInspectionTool) {
-                final InspectionToolWrapper tool = tools.getEnabledTool(file);
-                if (tool instanceof LocalInspectionToolWrapper) {
-                  lTools.add((LocalInspectionToolWrapper)tool);
-                  tool.initialize(GlobalInspectionContextImpl.this);
-                }
-              }
-            }
-
-            if (!lTools.isEmpty()) {
-              final LocalInspectionsPass pass = new LocalInspectionsPass(file, PsiDocumentManager.getInstance(project).getDocument(file), 0,
-                                                                         file.getTextLength(), LocalInspectionsPass.EMPTY_PRIORITY_RANGE, true,
-                                                                         HighlightInfoProcessor.getEmpty());
-              Runnable runnable = new Runnable() {
-                public void run() {
-                  pass.doInspectInBatch(GlobalInspectionContextImpl.this, (InspectionManagerEx)InspectionManager.getInstance(project), lTools);
-                }
-              };
-              ApplicationManager.getApplication().runReadAction(runnable);
-              results.put(file, pass.getInfos());
+      public void visitFile(PsiFile file) {
+        final VirtualFile virtualFile = file.getVirtualFile();
+        if (virtualFile == null || virtualFile.getFileType().isBinary()) return;
+        for (final Tools tools : profile.getAllEnabledInspectionTools(project)) {
+          if (tools.getTool().getTool() instanceof CleanupLocalInspectionTool) {
+            final InspectionToolWrapper tool = tools.getEnabledTool(file);
+            if (tool instanceof LocalInspectionToolWrapper) {
+              lTools.add((LocalInspectionToolWrapper)tool);
+              tool.initialize(GlobalInspectionContextImpl.this);
             }
           }
-        });
+        }
 
-        Runnable runnable = new Runnable() {
-          @Override
-          public void run() {
-            if (!FileModificationService.getInstance().preparePsiElementsForWrite(results.keySet())) return;
-
-            final SequentialModalProgressTask progressTask = new SequentialModalProgressTask(project, "Code Cleanup", true);
-            progressTask.setMinIterationTime(200);
-            progressTask.setTask(new SequentialCleanupTask(project, results, progressTask));
-            CommandProcessor.getInstance().executeCommand(project, new Runnable() {
-              @Override
-              public void run() {
-                CommandProcessor.getInstance().markCurrentCommandAsGlobal(project);
-                ApplicationManager.getApplication().runWriteAction(new Runnable() {
-                  @Override
-                  public void run() {
-                    ProgressManager.getInstance().run(progressTask);
-                  }
-                });
-                if (postRunnable != null) {
-                  ApplicationManager.getApplication().invokeLater(postRunnable);
-                }
+        if (!lTools.isEmpty()) {
+          final LocalInspectionsPass pass = new LocalInspectionsPass(file, PsiDocumentManager.getInstance(project).getDocument(file), range != null ? range.getStartOffset() : 0,
+                                                                     range != null ? range.getEndOffset() : file.getTextLength(), LocalInspectionsPass.EMPTY_PRIORITY_RANGE, true,
+                                                                     HighlightInfoProcessor.getEmpty());
+          Runnable runnable = new Runnable() {
+            public void run() {
+              pass.doInspectInBatch(GlobalInspectionContextImpl.this, (InspectionManagerEx)InspectionManager.getInstance(project), lTools);
+            }
+          };
+          ApplicationManager.getApplication().runReadAction(runnable);
+          final List<HighlightInfo> infos = pass.getInfos();
+          if (searchScope instanceof LocalSearchScope) {
+            for (Iterator<HighlightInfo> iterator = infos.iterator(); iterator.hasNext(); ) {
+              final HighlightInfo info = iterator.next();
+              final TextRange infoRange = new TextRange(info.getStartOffset(), info.getEndOffset());
+              if (!((LocalSearchScope)searchScope).containsRange(file, infoRange)) {
+                iterator.remove();
               }
-            }, commandName, null);
+            }
           }
-        };
-        if (ApplicationManager.getApplication().isUnitTestMode()) {
-          runnable.run();
-        } else {
-          ApplicationManager.getApplication().invokeLater(runnable);
+          results.put(file, infos);
         }
       }
-
     });
+
+    Runnable runnable = new Runnable() {
+      @Override
+      public void run() {
+        if (!FileModificationService.getInstance().preparePsiElementsForWrite(results.keySet())) return;
+
+        final SequentialModalProgressTask progressTask = new SequentialModalProgressTask(project, "Code Cleanup", true);
+        progressTask.setMinIterationTime(200);
+        progressTask.setTask(new SequentialCleanupTask(project, results, progressTask));
+        CommandProcessor.getInstance().executeCommand(project, new Runnable() {
+          @Override
+          public void run() {
+            CommandProcessor.getInstance().markCurrentCommandAsGlobal(project);
+            ApplicationManager.getApplication().runWriteAction(new Runnable() {
+              @Override
+              public void run() {
+                ProgressManager.getInstance().run(progressTask);
+              }
+            });
+            if (postRunnable != null) {
+              ApplicationManager.getApplication().invokeLater(postRunnable);
+            }
+          }
+        }, commandName, null);
+      }
+    };
+    if (ApplicationManager.getApplication().isUnitTestMode()) {
+      runnable.run();
+    } else {
+      ApplicationManager.getApplication().invokeLater(runnable);
+    }
   }
 }
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java
index 5fc2fe2..605d073 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java
@@ -74,6 +74,7 @@
 import com.intellij.util.EditorPopupHandler;
 import com.intellij.util.SystemProperties;
 import com.intellij.util.text.CharArrayUtil;
+import com.intellij.util.ui.UIUtil;
 import gnu.trove.TIntObjectHashMap;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -297,6 +298,7 @@
         }
       }
     }
+    myFilters.setForceUseAllFilters(true);
     myHeavyUpdateTicket = 0;
     myHeavyAlarm = myFilters.isAnyHeavy() ? new Alarm(Alarm.ThreadToUse.SHARED_THREAD, this) : null;
 
@@ -537,9 +539,14 @@
   }
 
   protected void disposeEditor() {
-    if (!myEditor.isDisposed()) {
-      EditorFactory.getInstance().releaseEditor(myEditor);
-    }
+    UIUtil.invokeAndWaitIfNeeded(new Runnable() {
+      @Override
+      public void run() {
+        if (!myEditor.isDisposed()) {
+          EditorFactory.getInstance().releaseEditor(myEditor);
+        }
+      }
+    });
   }
 
   @Override
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/SingleConfigurationConfigurable.java b/platform/lang-impl/src/com/intellij/execution/impl/SingleConfigurationConfigurable.java
index 4e7c251..930fc28 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/SingleConfigurationConfigurable.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/SingleConfigurationConfigurable.java
@@ -145,8 +145,9 @@
   private ValidationResult getValidationResult() {
     if (!myValidationResultValid) {
       myLastValidationResult = null;
+      RunnerAndConfigurationSettings snapshot = null;
       try {
-        RunnerAndConfigurationSettings snapshot = getSnapshot();
+        snapshot = getSnapshot();
         if (snapshot != null) {
           snapshot.setName(getNameText());
           snapshot.checkSettings(myExecutor);
@@ -161,8 +162,23 @@
         }
       }
       catch (RuntimeConfigurationException exception) {
-        myLastValidationResult =
-            exception != null ? new ValidationResult(exception.getLocalizedMessage(), exception.getTitle(), exception.getQuickFix()) : null;
+        final Runnable quickFix = exception.getQuickFix();
+        Runnable resultQuickFix;
+        if (quickFix != null && snapshot != null) {
+          final RunnerAndConfigurationSettings fixedSettings = snapshot;
+          resultQuickFix = new Runnable() {
+
+            @Override
+            public void run() {
+              quickFix.run();
+              getEditor().resetFrom(fixedSettings);
+            }
+          };
+        }
+        else {
+          resultQuickFix = quickFix;
+        }
+        myLastValidationResult = new ValidationResult(exception.getLocalizedMessage(), exception.getTitle(), resultQuickFix);
       }
       catch (ConfigurationException e) {
         myLastValidationResult = new ValidationResult(e.getLocalizedMessage(), ExecutionBundle.message("invalid.data.dialog.title"), null);
diff --git a/platform/lang-impl/src/com/intellij/execution/rmi/RemoteProcessSupport.java b/platform/lang-impl/src/com/intellij/execution/rmi/RemoteProcessSupport.java
index aa2ec91..8d2d422 100644
--- a/platform/lang-impl/src/com/intellij/execution/rmi/RemoteProcessSupport.java
+++ b/platform/lang-impl/src/com/intellij/execution/rmi/RemoteProcessSupport.java
@@ -151,9 +151,9 @@
   public void release(@NotNull Target target, @Nullable Parameters configuration) {
     ArrayList<ProcessHandler> handlers = new ArrayList<ProcessHandler>();
     synchronized (myProcMap) {
-      for (Pair<Target, Parameters> pair : myProcMap.keySet()) {
-        if (pair.first == target && (configuration == null || pair.second == configuration)) {
-          ContainerUtil.addIfNotNull(myProcMap.get(pair).handler, handlers);
+      for (Pair<Target, Parameters> key : myProcMap.keySet()) {
+        if (key.first == target && (configuration == null || key.second == configuration)) {
+          ContainerUtil.addIfNotNull(myProcMap.get(key).handler, handlers);
         }
       }
     }
@@ -164,7 +164,7 @@
     fireModificationCountChanged();
   }
 
-  private void startProcess(Target target, Parameters configuration, Pair<Target, Parameters> key) {
+  private void startProcess(Target target, Parameters configuration, @NotNull Pair<Target, Parameters> key) {
     ProgramRunner runner = new DefaultProgramRunner() {
       @Override
       @NotNull
@@ -196,7 +196,7 @@
   protected abstract RunProfileState getRunProfileState(Target target, Parameters configuration, Executor executor)
     throws ExecutionException;
 
-  private boolean getExistingInfo(Ref<RunningInfo> ref, Pair<Target, Parameters> key) {
+  private boolean getExistingInfo(@NotNull Ref<RunningInfo> ref, @NotNull Pair<Target, Parameters> key) {
     Info info;
     synchronized (myProcMap) {
       info = myProcMap.get(key);
@@ -254,7 +254,7 @@
     return (T)(to.isInstance(remote) ? remote : PortableRemoteObject.narrow(remote, to));
   }
 
-  private ProcessListener getProcessListener(final Pair<Target, Parameters> key) {
+  private ProcessListener getProcessListener(@NotNull final Pair<Target, Parameters> key) {
     return new ProcessListener() {
       @Override
       public void startNotified(ProcessEvent event) {
diff --git a/platform/lang-impl/src/com/intellij/execution/runners/RunContentBuilder.java b/platform/lang-impl/src/com/intellij/execution/runners/RunContentBuilder.java
index 4dad34e..ab9433e 100644
--- a/platform/lang-impl/src/com/intellij/execution/runners/RunContentBuilder.java
+++ b/platform/lang-impl/src/com/intellij/execution/runners/RunContentBuilder.java
@@ -18,10 +18,13 @@
 import com.intellij.diagnostic.logging.LogConsoleManagerBase;
 import com.intellij.diagnostic.logging.LogFilesManager;
 import com.intellij.diagnostic.logging.OutputFileUtil;
-import com.intellij.execution.*;
-import com.intellij.execution.configurations.ModuleRunProfile;
+import com.intellij.execution.DefaultExecutionResult;
+import com.intellij.execution.ExecutionManager;
+import com.intellij.execution.ExecutionResult;
+import com.intellij.execution.Executor;
 import com.intellij.execution.configurations.RunConfigurationBase;
 import com.intellij.execution.configurations.RunProfile;
+import com.intellij.execution.configurations.SearchScopeProvider;
 import com.intellij.execution.impl.ConsoleViewImpl;
 import com.intellij.execution.process.ProcessHandler;
 import com.intellij.execution.ui.*;
@@ -32,7 +35,6 @@
 import com.intellij.openapi.Disposable;
 import com.intellij.openapi.actionSystem.*;
 import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Disposer;
 import com.intellij.psi.search.GlobalSearchScope;
@@ -74,7 +76,7 @@
   public RunContentBuilder(ProgramRunner runner,
                            ExecutionResult executionResult,
                            @NotNull ExecutionEnvironment environment) {
-    super(environment.getProject(), createSearchScope(environment.getProject(), environment.getRunProfile()));
+    super(environment.getProject(), SearchScopeProvider.createSearchScope(environment.getProject(), environment.getRunProfile()));
     myRunner = runner;
     myExecutor = environment.getExecutor();
     myManager = new LogFilesManager(environment.getProject(), this, this);
@@ -92,23 +94,10 @@
     myManager = new LogFilesManager(project, this, this);
   }
 
+  @Deprecated
   @NotNull
   public static GlobalSearchScope createSearchScope(Project project, RunProfile runProfile) {
-    Module[] modules = null;
-    if (runProfile instanceof ModuleRunProfile) {
-      modules = ((ModuleRunProfile)runProfile).getModules();
-    }
-    if (modules == null || modules.length == 0) {
-      return GlobalSearchScope.allScope(project);
-    }
-    else {
-      GlobalSearchScope scope = GlobalSearchScope.moduleRuntimeScope(modules[0], true);
-      for (int idx = 1; idx < modules.length; idx++) {
-        Module module = modules[idx];
-        scope = scope.uniteWith(GlobalSearchScope.moduleRuntimeScope(module, true));
-      }
-      return scope;
-    }
+    return SearchScopeProvider.createSearchScope(project, runProfile);
   }
 
   public ExecutionResult getExecutionResult() {
@@ -271,7 +260,12 @@
    */
   public RunContentDescriptor showRunContent(final RunContentDescriptor reuseContent) {
     final RunContentDescriptor descriptor = createDescriptor();
-    if(reuseContent != null) descriptor.setAttachedContent(reuseContent.getAttachedContent());
+    if (reuseContent != null) {
+      descriptor.setAttachedContent(reuseContent.getAttachedContent());
+      if (reuseContent.isReuseToolWindowActivation()) {
+        descriptor.setActivateToolWindowWhenAdded(reuseContent.isActivateToolWindowWhenAdded());
+      }
+    }
     return descriptor;
   }
 
diff --git a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java
index 4c9425d..fa3b64c 100644
--- a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java
+++ b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java
@@ -521,9 +521,11 @@
     for (Content content : contents) {
       getStateFor(content).setWindow(0);
     }
-    for (Content content : contents) {
-      myOriginal.myManager.addContent(content);
-      myOriginal.findCellFor(content).minimize(content);
+    if (myOriginal != null) {
+      for (Content content : contents) {
+        myOriginal.myManager.addContent(content);
+        myOriginal.findCellFor(content).minimize(content);
+      }
     }
     myManager.removeAllContents(false);
   }
diff --git a/platform/lang-impl/src/com/intellij/find/actions/FindUsagesAction.java b/platform/lang-impl/src/com/intellij/find/actions/FindUsagesAction.java
index 3da2b2e..56a2101 100644
--- a/platform/lang-impl/src/com/intellij/find/actions/FindUsagesAction.java
+++ b/platform/lang-impl/src/com/intellij/find/actions/FindUsagesAction.java
@@ -67,6 +67,8 @@
         if (element != null) {
           startFindUsages(element);
         }
+      } else {
+        target.findUsages();
       }
     }
   }
diff --git a/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java b/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java
index f720fe9..f84fed5 100644
--- a/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java
+++ b/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java
@@ -46,6 +46,7 @@
 import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.wm.IdeFocusManager;
+import com.intellij.pom.Navigatable;
 import com.intellij.psi.PsiDocumentManager;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.search.GlobalSearchScope;
@@ -584,7 +585,7 @@
     }
 
     builder.setMovable(true).setResizable(true);
-    final AtomicReference<UsageInfo> selectedUsage = new AtomicReference<UsageInfo>();
+    final AtomicReference<Object> selectedUsage = new AtomicReference<Object>();
     final AtomicBoolean moreUsages = new AtomicBoolean();
     table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
       @Override
@@ -601,7 +602,7 @@
             }
             else {
               moreUsages.set(false);
-              selectedUsage.set(usage instanceof UsageInfo2UsageAdapter ? ((UsageInfo2UsageAdapter)usage).getUsageInfo().copy() : null);
+              selectedUsage.set(usage instanceof UsageInfo2UsageAdapter ? ((UsageInfo2UsageAdapter)usage).getUsageInfo().copy() : usage);
             }
             break;
           }
@@ -616,9 +617,12 @@
           appendMoreUsages(editor, popupPosition, handler, maxUsages, options);
           return;
         }
-        UsageInfo usage = selectedUsage.get();
-        if (usage != null) {
-          UsageViewUtil.navigateTo(usage, true);
+        Object usage = selectedUsage.get();
+        if (usage instanceof UsageInfo) {
+          UsageViewUtil.navigateTo((UsageInfo)usage, true);
+        }
+        else if (usage instanceof Navigatable) {
+          ((Navigatable)usage).navigate(true);
         }
       }
     });
diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindInProjectTask.java b/platform/lang-impl/src/com/intellij/find/impl/FindInProjectTask.java
index 1b8f6ec..aa344c4 100644
--- a/platform/lang-impl/src/com/intellij/find/impl/FindInProjectTask.java
+++ b/platform/lang-impl/src/com/intellij/find/impl/FindInProjectTask.java
@@ -238,6 +238,8 @@
       @Override
       public boolean processFile(@NotNull final VirtualFile virtualFile) {
         ApplicationManager.getApplication().runReadAction(new Runnable() {
+          final boolean hasTrigrams = hasTrigrams(myFindModel.getStringToFind());
+
           @Override
           public void run() {
             ProgressManager.checkCanceled();
@@ -247,7 +249,10 @@
               return;
             }
 
-            if (skipIndexed && isCoveredByIdIndex(virtualFile) && 
+            if (virtualFile.getFileType().isBinary()) {
+              return;
+            }
+            if (skipIndexed && isCoveredByIndex(virtualFile) &&
                 (fileIndex.isInContent(virtualFile) || fileIndex.isInLibraryClasses(virtualFile) || fileIndex.isInLibrarySource(virtualFile))) {
               return;
             }
@@ -259,6 +264,16 @@
               myFiles.add(psiFile);
             }
           }
+
+          final FileBasedIndexImpl fileBasedIndex = (FileBasedIndexImpl)FileBasedIndex.getInstance();
+
+          private boolean isCoveredByIndex(VirtualFile file) {
+            FileType fileType = file.getFileType();
+            if (hasTrigrams) {
+              return TrigramIndex.isIndexable(fileType) && fileBasedIndex.isIndexingCandidate(file, TrigramIndex.INDEX_ID);
+            }
+            return IdIndex.isIndexable(fileType) && fileBasedIndex.isIndexingCandidate(file, IdIndex.NAME);
+          }
         });
         return true;
       }
@@ -304,12 +319,6 @@
     return iterator.getFiles();
   }
 
-  private static boolean isCoveredByIdIndex(VirtualFile file) {
-    FileBasedIndexImpl fileBasedIndex = (FileBasedIndexImpl)FileBasedIndex.getInstance();
-    FileType fileType = file.getFileType();
-    return IdIndex.isIndexable(fileType) && fileBasedIndex.isIndexingCandidate(file, IdIndex.NAME);
-  }
-
   private static boolean iterateAll(@NotNull VirtualFile[] files, @NotNull final GlobalSearchScope searchScope, @NotNull final ContentIterator iterator) {
     final FileTypeManager fileTypeManager = FileTypeManager.getInstance();
     final VirtualFileFilter contentFilter = new VirtualFileFilter() {
@@ -361,6 +370,15 @@
     String text = myFindModel.getStringToFind();
     if (StringUtil.isEmptyOrSpaces(text)) return false;
 
+    if (hasTrigrams(text)) return true;
+
+    // $ is used to separate words when indexing plain-text files but not when indexing
+    // Java identifiers, so we can't consistently break a string containing $ characters into words
+
+    return myFindModel.isWholeWordsOnly() && text.indexOf('$') < 0 && !StringUtil.getWordsInStringLongestFirst(text).isEmpty();
+  }
+
+  private static boolean hasTrigrams(String text) {
     if (TrigramIndex.ENABLED) {
       return !TrigramBuilder.processTrigrams(text, new TrigramBuilder.TrigramProcessor() {
         @Override
@@ -369,11 +387,7 @@
         }
       });
     }
-
-    // $ is used to separate words when indexing plain-text files but not when indexing
-    // Java identifiers, so we can't consistently break a string containing $ characters into words
-
-    return myFindModel.isWholeWordsOnly() && text.indexOf('$') < 0 && !StringUtil.getWordsInStringLongestFirst(text).isEmpty();
+    return false;
   }
 
 
diff --git a/platform/lang-impl/src/com/intellij/find/ngrams/TrigramIndex.java b/platform/lang-impl/src/com/intellij/find/ngrams/TrigramIndex.java
index 9025357..bd8ced5 100644
--- a/platform/lang-impl/src/com/intellij/find/ngrams/TrigramIndex.java
+++ b/platform/lang-impl/src/com/intellij/find/ngrams/TrigramIndex.java
@@ -19,6 +19,7 @@
  */
 package com.intellij.find.ngrams;
 
+import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.util.ThreadLocalCachedIntArray;
 import com.intellij.openapi.util.text.TrigramBuilder;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -48,15 +49,13 @@
   private static final FileBasedIndex.InputFilter INPUT_FILTER = new FileBasedIndex.InputFilter() {
     @Override
     public boolean acceptInput(@NotNull VirtualFile file) {
-      return !file.getFileType().isBinary();
+      return isIndexable(file.getFileType());
     }
   };
-  private static final FileBasedIndex.InputFilter NO_FILES = new FileBasedIndex.InputFilter() {
-    @Override
-    public boolean acceptInput(@NotNull VirtualFile file) {
-      return false;
-    }
-  };
+
+  public static boolean isIndexable(FileType fileType) {
+    return ENABLED && !fileType.isBinary();
+  }
 
   @NotNull
   @Override
@@ -88,12 +87,7 @@
   @NotNull
   @Override
   public FileBasedIndex.InputFilter getInputFilter() {
-    if (ENABLED) {
-      return INPUT_FILTER;
-    }
-    else {
-      return NO_FILES;
-    }
+    return INPUT_FILTER;
   }
 
   @Override
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/CopyReferenceAction.java b/platform/lang-impl/src/com/intellij/ide/actions/CopyReferenceAction.java
index 4d53182..a83d51b 100644
--- a/platform/lang-impl/src/com/intellij/ide/actions/CopyReferenceAction.java
+++ b/platform/lang-impl/src/com/intellij/ide/actions/CopyReferenceAction.java
@@ -41,7 +41,10 @@
 import com.intellij.openapi.wm.WindowManager;
 import com.intellij.openapi.wm.ex.StatusBarEx;
 import com.intellij.psi.*;
-import com.intellij.util.*;
+import com.intellij.util.ArrayUtilRt;
+import com.intellij.util.LogicalRoot;
+import com.intellij.util.LogicalRootsManager;
+import com.intellij.util.ObjectUtils;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -242,14 +245,12 @@
   private static String getVirtualFileFqn(@NotNull VirtualFile virtualFile, @NotNull Project project) {
     final LogicalRoot logicalRoot = LogicalRootsManager.getLogicalRootsManager(project).findLogicalRoot(virtualFile);
     if (logicalRoot != null && logicalRoot.getVirtualFile() != null) {
-      String logical = FileUtil.toSystemIndependentName(VfsUtilCore.virtualToIoFile(logicalRoot.getVirtualFile()).getPath());
-      String path = FileUtil.toSystemIndependentName(VfsUtilCore.virtualToIoFile(virtualFile).getPath());
-      return ObjectUtils.assertNotNull(FileUtil.getRelativePath(logical, path, '/'));
+      return ObjectUtils.assertNotNull(VfsUtilCore.getRelativePath(virtualFile, logicalRoot.getVirtualFile(), '/'));
     }
 
     final VirtualFile contentRoot = ProjectRootManager.getInstance(project).getFileIndex().getContentRootForFile(virtualFile);
     if (contentRoot != null) {
-      return ObjectUtils.assertNotNull(FileUtil.getRelativePath(VfsUtilCore.virtualToIoFile(contentRoot), VfsUtilCore.virtualToIoFile(virtualFile)));
+      return ObjectUtils.assertNotNull(VfsUtilCore.getRelativePath(virtualFile, contentRoot, '/'));
     }
     return virtualFile.getPath();
   }
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/CreateTemplateInPackageAction.java b/platform/lang-impl/src/com/intellij/ide/actions/CreateTemplateInPackageAction.java
index 51d36e7..737297a 100644
--- a/platform/lang-impl/src/com/intellij/ide/actions/CreateTemplateInPackageAction.java
+++ b/platform/lang-impl/src/com/intellij/ide/actions/CreateTemplateInPackageAction.java
@@ -20,7 +20,6 @@
 import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.actionSystem.LangDataKeys;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.roots.ProjectFileIndex;
 import com.intellij.openapi.roots.ProjectRootManager;
@@ -83,12 +82,7 @@
   @Nullable
   private T checkOrCreate(String newName, PsiDirectory directory, String templateName) throws IncorrectOperationException {
     PsiDirectory dir = directory;
-    String className = newName;
-
-    final String extension = StringUtil.getShortName(templateName);
-    if (StringUtil.isNotEmpty(extension)) {
-      className = StringUtil.trimEnd(className, "." + extension);
-    }
+    String className = removeExtension(templateName, newName);
 
     if (className.contains(".")) {
       String[] names = className.split("\\.");
@@ -110,6 +104,14 @@
     return doCreate(dir, className, templateName);
   }
 
+  protected String removeExtension(String templateName, String className) {
+    final String extension = StringUtil.getShortName(templateName);
+    if (StringUtil.isNotEmpty(extension)) {
+      className = StringUtil.trimEnd(className, "." + extension);
+    }
+    return className;
+  }
+
   @Nullable
   protected abstract T doCreate(final PsiDirectory dir, final String className, String templateName) throws IncorrectOperationException;
 
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/GotoActionBase.java b/platform/lang-impl/src/com/intellij/ide/actions/GotoActionBase.java
index 0f0027c..c109de7 100644
--- a/platform/lang-impl/src/com/intellij/ide/actions/GotoActionBase.java
+++ b/platform/lang-impl/src/com/intellij/ide/actions/GotoActionBase.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -27,6 +27,8 @@
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.fileEditor.FileEditorManager;
 import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
+import com.intellij.openapi.keymap.KeymapUtil;
+import com.intellij.openapi.project.DumbAwareAction;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.text.StringUtil;
@@ -34,13 +36,18 @@
 import com.intellij.psi.PsiDocumentManager;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiFile;
+import com.intellij.ui.DocumentAdapter;
 import com.intellij.ui.speedSearch.SpeedSearchSupply;
 import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
+import javax.swing.event.DocumentEvent;
 import java.awt.*;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -51,14 +58,17 @@
 
   protected static Class myInAction = null;
   private static final Map<Class, Pair<String, Integer>> ourLastStrings = ContainerUtil.newHashMap();
-
+  private static final Map<Class, List<String>> ourHistory = ContainerUtil.newHashMap();
+  private int myHistoryIndex = 0;
 
   @Override
   public void actionPerformed(AnActionEvent e) {
-    LOG.assertTrue (!getClass ().equals (myInAction));
+    LOG.assertTrue(!getClass().equals(myInAction));
     try {
       myInAction = getClass();
-      gotoActionPerformed (e);
+      List<String> strings = ourHistory.get(myInAction);
+      myHistoryIndex = strings == null || strings.size() <= 1 || !ourLastStrings.containsKey(myInAction) ? 0 : 1;
+      gotoActionPerformed(e);
     }
     catch (Throwable t) {
       LOG.error(t);
@@ -200,13 +210,21 @@
     popup.setFindUsagesTitle(findUsagesTitle);
     final ChooseByNameFilter<T> filter = callback.createFilter(popup);
 
-    popup.invoke(new ChooseByNamePopupComponent.Callback() {
+    if (historyEnabled() && popup.getAdText() == null) {
+      popup.setAdText("Press " +
+                      KeymapUtil.getKeystrokeText(KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.CTRL_MASK)) + " or " +
+                      KeymapUtil.getKeystrokeText(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_MASK)) +
+                      " to navigate through the history");
+    }
 
+    popup.invoke(new ChooseByNamePopupComponent.Callback() {
       @Override
       public void onClose() {
-        ourLastStrings.put(myInAction, Pair.create(popup.getEnteredText(), popup.getSelectedIndex()));
         //noinspection ConstantConditions
         if (startedAction != null && startedAction.equals(myInAction)) {
+          String text = popup.getEnteredText();
+          ourLastStrings.put(myInAction, Pair.create(text, popup.getSelectedIndex()));
+          updateHistory(text);
           myInAction = null;
         }
         if (filter != null) {
@@ -214,11 +232,70 @@
         }
       }
 
+      private void updateHistory(@Nullable String text) {
+        if (!StringUtil.isEmptyOrSpaces(text)) {
+          List<String> history = ourHistory.get(myInAction);
+          if (history == null) history = ContainerUtil.newArrayList();
+          if (!text.equals(ContainerUtil.getFirstItem(history))) {
+            history.add(0, text);
+          }
+          ourHistory.put(myInAction, history);
+        }
+      }
+
       @Override
       public void elementChosen(Object element) {
         callback.elementChosen(popup, element);
       }
     }, ModalityState.current(), allowMultipleSelection);
+
+    final JTextField editor = popup.getTextField();
+
+    final DocumentAdapter historyResetListener = new DocumentAdapter() {
+      @Override
+      protected void textChanged(DocumentEvent e) {
+        myHistoryIndex = 0;
+      }
+    };
+
+    abstract class HistoryAction extends DumbAwareAction {
+      @Override
+      public void update(AnActionEvent e) {
+        e.getPresentation().setEnabled(historyEnabled());
+      }
+
+      void setText(@NotNull List<String> strings) {
+        javax.swing.text.Document document = editor.getDocument();
+        document.removeDocumentListener(historyResetListener);
+        editor.setText(strings.get(myHistoryIndex));
+        document.addDocumentListener(historyResetListener);
+        editor.selectAll();
+      }
+    }
+
+    editor.getDocument().addDocumentListener(historyResetListener);
+
+    new HistoryAction() {
+      @Override
+      public void actionPerformed(AnActionEvent e) {
+        List<String> strings = ourHistory.get(myInAction);
+        setText(strings);
+        myHistoryIndex = myHistoryIndex >= strings.size() - 1 ? 0 : myHistoryIndex + 1;
+      }
+
+    }.registerCustomShortcutSet(CustomShortcutSet.fromString("ctrl UP"), editor);
+
+    new HistoryAction() {
+      @Override
+      public void actionPerformed(AnActionEvent e) {
+        List<String> strings = ourHistory.get(myInAction);
+        setText(strings);
+        myHistoryIndex = myHistoryIndex <= 0 ? strings.size() - 1 : myHistoryIndex - 1;
+      }
+    }.registerCustomShortcutSet(CustomShortcutSet.fromString("ctrl DOWN"), editor);
   }
 
+  private static boolean historyEnabled() {
+    return !ContainerUtil.isEmpty(ourHistory.get(myInAction));
+  }
 }
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedFileAction.java b/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedFileAction.java
index f594b6b..83c4261 100644
--- a/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedFileAction.java
+++ b/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedFileAction.java
@@ -18,8 +18,10 @@
 import com.intellij.ide.util.DefaultPsiElementCellRenderer;
 import com.intellij.navigation.GotoRelatedItem;
 import com.intellij.navigation.GotoRelatedProvider;
-import com.intellij.openapi.actionSystem.*;
-import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.CommonDataKeys;
+import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.ui.popup.JBPopup;
@@ -36,6 +38,7 @@
 import com.intellij.ui.popup.list.ListPopupImpl;
 import com.intellij.ui.popup.list.PopupListElementRenderer;
 import com.intellij.util.Processor;
+import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -52,24 +55,27 @@
 public class GotoRelatedFileAction extends AnAction {
 
   @Override
+  public void update(AnActionEvent e) {
+    PsiFile file = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
+    PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(e.getDataContext());
+    e.getPresentation().setEnabled(element != null || file != null);
+  }
+
+  @Override
   public void actionPerformed(AnActionEvent e) {
+    DataContext dataContext = e.getDataContext();
+    PsiFile file = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
+    Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext());
+    PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
+    if (element == null && file == null) return;
 
-    DataContext context = e.getDataContext();
-    Editor editor = CommonDataKeys.EDITOR.getData(context);
-    PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(context);
-    if (psiFile == null) return;
-
-    List<GotoRelatedItem> items = getItems(psiFile, editor, context);
+    List<GotoRelatedItem> items = element == null? getItems(file, editor, dataContext) : getItems(element, dataContext);
     if (items.isEmpty()) return;
     if (items.size() == 1 && items.get(0).getElement() != null) {
       items.get(0).navigate();
       return;
     }
-    if (ApplicationManager.getApplication().isUnitTestMode()) {
-      //noinspection UseOfSystemOutOrSystemErr
-      System.out.println(items);
-    }
-    createPopup(items, "Go to Related Files").showInBestPositionFor(context);
+    createPopup(items, "Choose Target").showInBestPositionFor(dataContext);
   }
 
   public static JBPopup createPopup(final List<? extends GotoRelatedItem> items, final String title) {
@@ -102,8 +108,6 @@
                                            final String title, final Processor<Object> processor) {
 
     final Ref<Boolean> hasMnemonic = Ref.create(false);
-    final Ref<ListCellRenderer> rendererRef = Ref.create(null);
-
     final DefaultPsiElementCellRenderer renderer = new DefaultPsiElementCellRenderer() {
       {
         setFocusBorderEnabled(false);
@@ -273,9 +277,12 @@
         contextElement = element;
       }
     }
+    return getItems(contextElement, dataContext);
+  }
 
-    Set<GotoRelatedItem> items = new LinkedHashSet<GotoRelatedItem>();
-
+  @NotNull
+  public static List<GotoRelatedItem> getItems(@NotNull PsiElement contextElement, @Nullable DataContext dataContext) {
+    Set<GotoRelatedItem> items = ContainerUtil.newLinkedHashSet();
     for (GotoRelatedProvider provider : Extensions.getExtensions(GotoRelatedProvider.EP_NAME)) {
       items.addAll(provider.getItems(contextElement));
       if (dataContext != null) {
@@ -308,11 +315,6 @@
     }
   }
 
-  @Override
-  public void update(AnActionEvent e) {
-    e.getPresentation().setEnabled(CommonDataKeys.PSI_FILE.getData(e.getDataContext()) != null);
-  }
-
   private static Action createNumberAction(final int mnemonic,
                                            final ListPopupImpl listPopup,
                                            final Map<PsiElement, GotoRelatedItem> itemsMap,
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/NonProjectScopeDisablerEP.java b/platform/lang-impl/src/com/intellij/ide/actions/NonProjectScopeDisablerEP.java
new file mode 100644
index 0000000..ce3e085
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/ide/actions/NonProjectScopeDisablerEP.java
@@ -0,0 +1,37 @@
+/*
+ * 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.ide.actions;
+
+import com.intellij.openapi.extensions.AbstractExtensionPointBean;
+import com.intellij.openapi.extensions.ExtensionPointName;
+import com.intellij.util.xmlb.annotations.Attribute;
+
+/**
+ * @author Konstantin Bulenkov
+ */
+public class NonProjectScopeDisablerEP extends AbstractExtensionPointBean {
+  public static final ExtensionPointName<NonProjectScopeDisablerEP> EP_NAME = ExtensionPointName.create("com.intellij.goto.nonProjectScopeDisabler");
+
+  @Attribute("disable")
+  public boolean disable = true;
+
+  public static boolean isSearchInNonProjectDisabled() {
+    for (NonProjectScopeDisablerEP ep : EP_NAME.getExtensions()) {
+      if (ep.disable) return true;
+    }
+    return false;
+  }
+}
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java
index 297a7cc..87ff26c 100644
--- a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java
+++ b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywhereAction.java
@@ -126,6 +126,7 @@
   private static final int MAX_ACTIONS = 5;
   private static final int MAX_RECENT_FILES = 10;
   public static final int MAX_SEARCH_EVERYWHERE_HISTORY = 50;
+  private static final int POPUP_MAX_WIDTH = 600;
 
   private SearchEverywhereAction.MyListRenderer myRenderer;
   MySearchTextField myPopupField;
@@ -152,8 +153,8 @@
   private Component myContextComponent;
   private CalcThread myCalcThread;
   private static AtomicBoolean ourShiftIsPressed = new AtomicBoolean(false);
-  private final static Couple<AtomicBoolean> ourPressed = Couple.newOne(new AtomicBoolean(false), new AtomicBoolean(false));
-  private final static Couple<AtomicBoolean> ourReleased = Couple.newOne(new AtomicBoolean(false), new AtomicBoolean(false));
+  private final static Couple<AtomicBoolean> ourPressed = Couple.of(new AtomicBoolean(false), new AtomicBoolean(false));
+  private final static Couple<AtomicBoolean> ourReleased = Couple.of(new AtomicBoolean(false), new AtomicBoolean(false));
   private static AtomicBoolean ourOtherKeyWasPressed = new AtomicBoolean(false);
   private static AtomicLong ourLastTimePressed = new AtomicLong(0);
   private static AtomicBoolean showAll = new AtomicBoolean(false);
@@ -346,7 +347,7 @@
       @Override
       public Dimension getPreferredSize() {
         final Dimension size = super.getPreferredSize();
-        return new Dimension(Math.min(size.width, 800), size.height);
+        return new Dimension(Math.min(size.width - 2, POPUP_MAX_WIDTH), size.height);
       }
     };
     myList.setCellRenderer(myRenderer);
@@ -711,7 +712,12 @@
         ((Graphics2D)g).setPaint(new GradientPaint(0, 0, gradient.getStartColor(), 0, getHeight(), gradient.getEndColor()));
         g.fillRect(0, 0, getWidth(), getHeight());
       }
-   };
+
+      @Override
+      public Dimension getPreferredSize() {
+        return new Dimension(410, super.getPreferredSize().height);
+      }
+    };
     final JLabel title = new JLabel(" Search Everywhere:       ");
     final JPanel topPanel = new NonOpaquePanel(new BorderLayout());
     title.setForeground(new JBColor(Gray._240, Gray._200));
@@ -723,7 +729,9 @@
     topPanel.add(title, BorderLayout.WEST);
     myNonProjectCheckBox.setForeground(new JBColor(Gray._240, Gray._200));
     myNonProjectCheckBox.setText("Include non-project items (" + getShortcut() + ")");
-    topPanel.add(myNonProjectCheckBox, BorderLayout.EAST);
+    if (!NonProjectScopeDisablerEP.isSearchInNonProjectDisabled()) {
+      topPanel.add(myNonProjectCheckBox, BorderLayout.EAST);
+    }
     panel.add(myPopupField, BorderLayout.CENTER);
     panel.add(topPanel, BorderLayout.NORTH);
     panel.setBorder(IdeBorderFactory.createEmptyBorder(3, 5, 4, 5));
@@ -939,6 +947,8 @@
         setIcon(myLocationIcon);
       }
     };
+    GotoFileCellRenderer myFileRenderer = new GotoFileCellRenderer(400);
+
     private String myLocationString;
     private DefaultPsiElementCellRenderer myPsiRenderer = new DefaultPsiElementCellRenderer() {
       {setFocusBorderEnabled(false);}
@@ -971,8 +981,7 @@
                  && myProject != null
                  && (((VirtualFile)value).isDirectory()
                      || (file = PsiManager.getInstance(myProject).findFile((VirtualFile)value)) != null)) {
-        cmp = new GotoFileCellRenderer(Math.min(800, list.getWidth()))
-          .getListCellRendererComponent(list, file == null ? value : file, index, isSelected, cellHasFocus);
+        cmp = myFileRenderer.getListCellRendererComponent(list, file == null ? value : file, index, isSelected, cellHasFocus);
       } else if (value instanceof PsiElement) {
         cmp = myPsiRenderer.getListCellRendererComponent(list, value, index, isSelected, isSelected);
       } else {
@@ -1251,6 +1260,7 @@
       finally {
         if (!myProgressIndicator.isCanceled()) {
           myList.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT);
+          updatePopup();
         }
         if (!myDone.isProcessed()) {
           myDone.setDone();
@@ -1740,6 +1750,9 @@
           myList.repaint();
 
           myRenderer.recalculateWidth();
+          if (myBalloon == null || myBalloon.isDisposed()) {
+            return;
+          }
           if (myPopup == null || !myPopup.isVisible()) {
             final ActionCallback callback = ListDelegationUtil.installKeyboardDelegation(getField().getTextEditor(), myList);
             final ComponentPopupBuilder builder = JBPopupFactory.getInstance()
@@ -1903,25 +1916,26 @@
     }
     final Container parent = getField().getParent();
     final Dimension size = myList.getParent().getParent().getPreferredSize();
-    size.width = myPopupActualWidth;
-    if (size.width < parent.getWidth()) {
+    size.width = myPopupActualWidth - 2;
+    if (size.width + 2 < parent.getWidth()) {
       size.width = parent.getWidth();
     }
     if (myList.getItemsCount() == 0) {
       size.height = 70;
     }
     Dimension sz = new Dimension(size.width, myList.getPreferredSize().height);
-    if (sz.width > 800 || sz.height > 800) {
+    if (sz.width > POPUP_MAX_WIDTH || sz.height > POPUP_MAX_WIDTH) {
       final JBScrollPane pane = new JBScrollPane();
       final int extraWidth = pane.getVerticalScrollBar().getWidth() + 1;
       final int extraHeight = pane.getHorizontalScrollBar().getHeight() + 1;
-      sz = new Dimension(Math.min(800, Math.max(getField().getWidth(), sz.width + extraWidth)), Math.min(800, sz.height + extraHeight));
+      sz = new Dimension(Math.min(POPUP_MAX_WIDTH, Math.max(getField().getWidth(), sz.width + extraWidth)), Math.min(POPUP_MAX_WIDTH, sz.height + extraHeight));
       sz.width += 20;
       sz.height+=2;
     } else {
       sz.width+=2;
       sz.height+=2;
     }
+    sz.width = Math.max(sz.width, myPopup.getSize().width);
     myPopup.setSize(sz);
     if (myActionEvent != null && myActionEvent.getInputEvent() == null) {
       final Point p = parent.getLocationOnScreen();
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/TemplateKindCombo.java b/platform/lang-impl/src/com/intellij/ide/actions/TemplateKindCombo.java
index d79d52b..5a76d4b 100644
--- a/platform/lang-impl/src/com/intellij/ide/actions/TemplateKindCombo.java
+++ b/platform/lang-impl/src/com/intellij/ide/actions/TemplateKindCombo.java
@@ -23,6 +23,7 @@
 import com.intellij.ui.ComboboxSpeedSearch;
 import com.intellij.ui.ComboboxWithBrowseButton;
 import com.intellij.ui.ListCellRendererWrapper;
+import com.intellij.ui.SpeedSearchComparator;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -52,7 +53,7 @@
         }
         return null;
       }
-    };
+    }.setComparator(new SpeedSearchComparator(true));
     setButtonListener(null);
   }
 
diff --git a/platform/lang-impl/src/com/intellij/ide/bookmarks/Bookmark.java b/platform/lang-impl/src/com/intellij/ide/bookmarks/Bookmark.java
index 9a42f3c..e6cd53e 100644
--- a/platform/lang-impl/src/com/intellij/ide/bookmarks/Bookmark.java
+++ b/platform/lang-impl/src/com/intellij/ide/bookmarks/Bookmark.java
@@ -26,16 +26,20 @@
 import com.intellij.navigation.NavigationItem;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.RangeMarker;
+import com.intellij.openapi.editor.colors.CodeInsightColors;
+import com.intellij.openapi.editor.colors.EditorColorsManager;
 import com.intellij.openapi.editor.ex.MarkupModelEx;
 import com.intellij.openapi.editor.ex.RangeHighlighterEx;
 import com.intellij.openapi.editor.impl.DocumentMarkupModel;
 import com.intellij.openapi.editor.markup.GutterIconRenderer;
 import com.intellij.openapi.editor.markup.HighlighterLayer;
 import com.intellij.openapi.editor.markup.RangeHighlighter;
+import com.intellij.openapi.editor.markup.TextAttributes;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.fileEditor.OpenFileDescriptor;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.pom.Navigatable;
@@ -43,7 +47,6 @@
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiManager;
 import com.intellij.ui.JBColor;
-import com.intellij.ui.LightColors;
 import com.intellij.util.PlatformIcons;
 import com.intellij.util.Processor;
 import org.jetbrains.annotations.NotNull;
@@ -53,7 +56,8 @@
 import java.awt.*;
 
 public class Bookmark implements Navigatable {
-  public static final Icon DEFAULT_ICON = PlatformIcons.CHECK_ICON;
+  private static final JBColor ICON_BACKGROUND_COLOR = new JBColor(new Color(0xffffcc), new Color(0x675133));
+  public static final Icon DEFAULT_ICON = new MyDefaultIcon();
 
   private final VirtualFile myFile;
   @NotNull private final OpenFileDescriptor myTarget;
@@ -70,6 +74,15 @@
 
     myTarget = new OpenFileDescriptor(project, file, line, -1, true);
 
+    addHighlighter();
+  }
+
+  public void updateHighlighter() {
+    release();
+    addHighlighter();
+  }
+
+  private void addHighlighter() {
     Document document = FileDocumentManager.getInstance().getCachedDocument(getFile());
     if (document != null) {
       createHighlighter((MarkupModelEx)DocumentMarkupModel.forDocument(document, myProject, true));
@@ -77,15 +90,27 @@
   }
 
   public RangeHighlighter createHighlighter(@NotNull MarkupModelEx markup) {
-    final RangeHighlighter myHighlighter;
+    final RangeHighlighterEx myHighlighter;
     int line = getLine();
     if (line >= 0) {
       myHighlighter = markup.addPersistentLineHighlighter(line, HighlighterLayer.ERROR + 1, null);
       if (myHighlighter != null) {
         myHighlighter.setGutterIconRenderer(new MyGutterIconRenderer(this));
 
-        myHighlighter.setErrorStripeMarkColor(Color.black);
+        TextAttributes textAttributes =
+          EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.BOOKMARKS_ATTRIBUTES);
+
+        Color stripeColor = textAttributes.getErrorStripeColor();
+        myHighlighter.setErrorStripeMarkColor(stripeColor != null ? stripeColor : Color.black);
         myHighlighter.setErrorStripeTooltip(getBookmarkTooltip());
+
+        TextAttributes attributes = myHighlighter.getTextAttributes();
+        if (attributes == null) {
+          attributes = new TextAttributes();
+        }
+        attributes.setBackgroundColor(textAttributes.getBackgroundColor());
+        attributes.setForegroundColor(textAttributes.getForegroundColor());
+        myHighlighter.setTextAttributes(attributes);
       }
     }
     else {
@@ -111,19 +136,19 @@
     final int startOffset = markupDocument.getLineStartOffset(line);
     final int endOffset = markupDocument.getLineEndOffset(line);
 
-    final RangeHighlighterEx[] found = new RangeHighlighterEx[1];
+    final Ref<RangeHighlighterEx> found = new Ref<RangeHighlighterEx>();
     markup.processRangeHighlightersOverlappingWith(startOffset, endOffset, new Processor<RangeHighlighterEx>() {
       @Override
       public boolean process(RangeHighlighterEx highlighter) {
         GutterMark renderer = highlighter.getGutterIconRenderer();
         if (renderer instanceof MyGutterIconRenderer && ((MyGutterIconRenderer)renderer).myBookmark == Bookmark.this) {
-          found[0] = highlighter;
+          found.set(highlighter);
           return false;
         }
         return true;
       }
     });
-    if (found[0] != null) found[0].dispose();
+    if (!found.isNull()) found.get().dispose();
   }
 
   public Icon getIcon() {
@@ -265,18 +290,17 @@
 
     @Override
     public void paintIcon(Component c, Graphics g, int x, int y) {
-      x++;
-      g.setColor(new JBColor(LightColors.YELLOW, new Color(103, 81, 51)));
-      g.fillRect(x, y, getIconWidth() - 2, getIconHeight());
+      g.setColor(ICON_BACKGROUND_COLOR);
+      g.fillRect(x, y, getIconWidth(), getIconHeight());
 
       g.setColor(JBColor.GRAY);
-      g.drawRect(x, y, getIconWidth() - 2, getIconHeight());
+      g.drawRect(x, y, getIconWidth(), getIconHeight());
 
       g.setColor(JBColor.foreground());
       final Font oldFont = g.getFont();
       g.setFont(MNEMONIC_FONT);
 
-      g.drawString(Character.toString(myMnemonic), x + 2, y + getIconHeight() - 2);
+      ((Graphics2D)g).drawString(Character.toString(myMnemonic), x + 3, y + getIconHeight() - 1.5F);
       g.setFont(oldFont);
     }
 
@@ -306,6 +330,29 @@
     }
   }
 
+  private static class MyDefaultIcon implements Icon {
+    private static final Icon myIcon = PlatformIcons.CHECK_ICON;
+
+    @Override
+    public void paintIcon(Component c, Graphics g, int x, int y) {
+      g.setColor(ICON_BACKGROUND_COLOR);
+      g.fillRect(x, y, getIconWidth(), getIconHeight());
+      g.setColor(JBColor.GRAY);
+      g.drawRect(x, y, getIconWidth(), getIconHeight());
+      myIcon.paintIcon(c, g, x, y);
+    }
+
+    @Override
+    public int getIconWidth() {
+      return myIcon.getIconWidth();
+    }
+
+    @Override
+    public int getIconHeight() {
+      return myIcon.getIconHeight();
+    }
+  }
+
   private static class MyGutterIconRenderer extends GutterIconRenderer {
     private final Bookmark myBookmark;
 
diff --git a/platform/lang-impl/src/com/intellij/ide/bookmarks/BookmarkManager.java b/platform/lang-impl/src/com/intellij/ide/bookmarks/BookmarkManager.java
index 4301363..9953203 100644
--- a/platform/lang-impl/src/com/intellij/ide/bookmarks/BookmarkManager.java
+++ b/platform/lang-impl/src/com/intellij/ide/bookmarks/BookmarkManager.java
@@ -409,6 +409,12 @@
     myBus.syncPublisher(BookmarksListener.TOPIC).bookmarkChanged(bookmark);
   }
 
+  public void colorsChanged() {
+    for (Bookmark bookmark : myBookmarks) {
+      bookmark.updateHighlighter();
+    }
+  }
+
 
   private class MyEditorMouseListener extends EditorMouseAdapter {
     @Override
diff --git a/platform/lang-impl/src/com/intellij/ide/impl/dataRules/VirtualFileArrayRule.java b/platform/lang-impl/src/com/intellij/ide/impl/dataRules/VirtualFileArrayRule.java
index e2a5d09..35e758e 100644
--- a/platform/lang-impl/src/com/intellij/ide/impl/dataRules/VirtualFileArrayRule.java
+++ b/platform/lang-impl/src/com/intellij/ide/impl/dataRules/VirtualFileArrayRule.java
@@ -109,7 +109,23 @@
       }
     }
 
-    return result == null ? null : VfsUtilCore.toVirtualFileArray(result);
+    if (result == null) {
+      final Object[] objects = (Object[])dataProvider.getData(PlatformDataKeys.SELECTED_ITEMS.getName());
+      if (objects != null) {
+        final VirtualFile[] files = new VirtualFile[objects.length];
+        for (int i = 0, objectsLength = objects.length; i < objectsLength; i++) {
+          Object object = objects[i];
+          if (!(object instanceof VirtualFile)) return null;
+          files[i] = (VirtualFile)object;
+        }
+
+        return files;
+      }
+      return null;
+    }
+    else {
+      return VfsUtilCore.toVirtualFileArray(result);
+    }
   }
 
 
diff --git a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarUpdateQueue.java b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarUpdateQueue.java
index 22a670b..a599be5 100644
--- a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarUpdateQueue.java
+++ b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarUpdateQueue.java
@@ -308,7 +308,7 @@
     protected void after() {}
   }
 
-  public static enum ID {
+  public enum ID {
     MODEL(0),
     UI(1),
     REVALIDATE(2),
diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkRootActionBase.java b/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkRootActionBase.java
index 20570cd..815c3e8 100644
--- a/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkRootActionBase.java
+++ b/platform/lang-impl/src/com/intellij/ide/projectView/actions/MarkRootActionBase.java
@@ -38,7 +38,7 @@
 public abstract class MarkRootActionBase extends DumbAwareAction {
   @Override
   public void actionPerformed(AnActionEvent e) {
-    Module module = e.getData(LangDataKeys.MODULE);
+    final Module module = e.getData(LangDataKeys.MODULE);
     VirtualFile[] vFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
     if (module == null || vFiles == null) {
       return;
@@ -61,6 +61,7 @@
       @Override
       public void run() {
         model.commit();
+        module.getProject().save();
       }
     });
   }
diff --git a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java
index 4ff25f8..3e09811 100644
--- a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java
+++ b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java
@@ -1235,7 +1235,9 @@
 
     private MyTextField() {
       super(40);
-      setUI((DarculaTextFieldUI)DarculaTextFieldUI.createUI(this));
+      if (!(getUI() instanceof DarculaTextFieldUI)) {
+        setUI((DarculaTextFieldUI)DarculaTextFieldUI.createUI(this));
+      }
       setBorder(new DarculaTextBorder());
       enableEvents(AWTEvent.KEY_EVENT_MASK);
       myCompletionKeyStroke = getShortcut(IdeActions.ACTION_CODE_COMPLETION);
@@ -1325,6 +1327,7 @@
       }
       int position = myTextField.getCaretPosition();
       int code = keyStroke.getKeyCode();
+      int modifiers = keyStroke.getModifiers();
       try {
         super.processKeyEvent(e);
       }
@@ -1334,7 +1337,7 @@
         }
       }
       finally {
-        if (code == KeyEvent.VK_UP || code == KeyEvent.VK_DOWN) {
+        if ((code == KeyEvent.VK_UP || code == KeyEvent.VK_DOWN) && modifiers == 0) {
           myTextField.setCaretPosition(position);
         }
       }
@@ -1797,4 +1800,8 @@
 
     public abstract Object[][] getElements();
   }
+
+  public JTextField getTextField() {
+    return myTextField;
+  }
 }
diff --git a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java
index 2e375b7..ccd5f23 100644
--- a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java
+++ b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java
@@ -39,6 +39,7 @@
 import com.intellij.openapi.util.SystemInfo;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.PsiFile;
+import com.intellij.ui.ColorUtil;
 import com.intellij.ui.IdeBorderFactory;
 import com.intellij.ui.LayeredIcon;
 import com.intellij.ui.LightColors;
@@ -171,9 +172,10 @@
         final JPanel panel = new JPanel(new BorderLayout());
         panel.setBorder(IdeBorderFactory.createEmptyBorder(2));
         panel.setOpaque(true);
-        final Color bg = isSelected ? UIUtil.getListSelectionBackground() : UIUtil.getListBackground();
+        Color bg = UIUtil.getListBackground(isSelected);
         panel.setBackground(bg);
 
+        Color groupFg = isSelected ? UIUtil.getListForeground() : UIUtil.getLabelDisabledForeground();
 
         if (value instanceof ActionWrapper) {
 
@@ -197,32 +199,30 @@
           if (groupName != null) {
             final JLabel groupLabel = new JLabel(groupName);
             groupLabel.setBackground(bg);
-            groupLabel.setForeground(fg);
+            groupLabel.setForeground(groupFg);
             panel.add(groupLabel, BorderLayout.EAST);
           }
         }
         else if (value instanceof OptionDescription) {
-          if (!isSelected && !UIUtil.isUnderDarcula()) {
-            panel.setBackground(LightColors.SLIGHTLY_GRAY);
+          if (!isSelected) {
+            panel.setBackground(UIUtil.isUnderDarcula() ? ColorUtil.brighter(UIUtil.getListBackground(), 1) : LightColors.SLIGHTLY_GRAY);
           }
           String hit = ((OptionDescription)value).getHit();
           if (hit == null) {
             hit = ((OptionDescription)value).getOption();
           }
           hit = StringUtil.unescapeXml(hit);
-          if (hit.length() > 50) {
-            hit = hit.substring(0, 50) + "...";
-          }
+          hit = StringUtil.first(hit, 50, true);
           hit = hit.replace("  ", " "); //avoid extra spaces from mnemonics and xml conversion
 
-          final Color fg = isSelected ? UIUtil.getListSelectionForeground() : UIUtil.getListForeground();
+          final Color fg = UIUtil.getListForeground(isSelected);
           final JLabel label = new JLabel(hit.trim());
           label.setIcon(EMPTY_ICON);
           label.setForeground(fg);
           label.setBackground(bg);
           panel.add(label, BorderLayout.WEST);
           final JLabel settingsLabel = new JLabel(getGroupName((OptionDescription)value));
-          settingsLabel.setForeground(fg);
+          settingsLabel.setForeground(groupFg);
           settingsLabel.setBackground(bg);
           panel.add(settingsLabel, BorderLayout.EAST);
         }
@@ -538,7 +538,7 @@
     NONE, INTENTION, NAME, DESCRIPTION, GROUP, NON_MENU
   }
 
-  private String convertPattern(String pattern) {
+  private static String convertPattern(String pattern) {
     final int eol = pattern.indexOf('\n');
     if (eol != -1) {
       pattern = pattern.substring(0, eol);
@@ -666,7 +666,7 @@
     }
 
     @Override
-    public int compareTo(ActionWrapper o) {
+    public int compareTo(@NotNull ActionWrapper o) {
       final int compared = myMode.compareTo(o.getMode());
       return compared != 0
              ? compared
diff --git a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoFileModel.java b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoFileModel.java
index de43de5..8ba19a8 100644
--- a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoFileModel.java
+++ b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoFileModel.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.
@@ -17,6 +17,7 @@
 package com.intellij.ide.util.gotoByName;
 
 import com.intellij.ide.IdeBundle;
+import com.intellij.ide.actions.NonProjectScopeDisablerEP;
 import com.intellij.ide.util.PropertiesComponent;
 import com.intellij.ide.util.PsiElementListCellRenderer;
 import com.intellij.navigation.ChooseByNameContributor;
@@ -80,6 +81,9 @@
 
   @Override
   public String getCheckBoxName() {
+    if (NonProjectScopeDisablerEP.isSearchInNonProjectDisabled()) {
+      return null;
+    }
     return IdeBundle.message("checkbox.include.non.project.files");
   }
 
diff --git a/platform/lang-impl/src/com/intellij/lang/parser/GeneratedParserUtilBase.java b/platform/lang-impl/src/com/intellij/lang/parser/GeneratedParserUtilBase.java
index 5243b0d..ecda31d 100644
--- a/platform/lang-impl/src/com/intellij/lang/parser/GeneratedParserUtilBase.java
+++ b/platform/lang-impl/src/com/intellij/lang/parser/GeneratedParserUtilBase.java
@@ -360,7 +360,7 @@
     add = add && length > 1 && !(text.charAt(0) == '<' && text.charAt(length - 1) == '>') &&
           !(text.charAt(0) == '\'' && text.charAt(length - 1) == '\'' && length < 5);
     if (add) {
-      completionState.items.add(text);
+      completionState.addItem(builder_, text);
     }
   }
 
@@ -656,6 +656,10 @@
     public String fun(Object o) {
       return o.toString();
     }
+
+    public void addItem(PsiBuilder builder, String text) {
+      items.add(text);
+    }
   }
 
   public static class Builder extends PsiBuilderAdapter {
diff --git a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/PsiAwareFileEditorManagerImpl.java b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/PsiAwareFileEditorManagerImpl.java
index 807d0ac..7713734 100644
--- a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/PsiAwareFileEditorManagerImpl.java
+++ b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/PsiAwareFileEditorManagerImpl.java
@@ -60,8 +60,9 @@
                                        final PsiManager psiManager,
                                        final WolfTheProblemSolver problemSolver,
                                        DockManager dockManager,
-                                       MessageBus messageBus) {
-    super(project, dockManager);
+                                       MessageBus messageBus,
+                                       EditorHistoryManager editorHistoryManager) {
+    super(project, dockManager, editorHistoryManager);
     myPsiManager = psiManager;
     myProblemSolver = problemSolver;
     myPsiTreeChangeListener = new MyPsiTreeChangeListener();
diff --git a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/UniqueNameEditorTabTitleProvider.java b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/UniqueNameEditorTabTitleProvider.java
index 183183e..374c5b7 100644
--- a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/UniqueNameEditorTabTitleProvider.java
+++ b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/UniqueNameEditorTabTitleProvider.java
@@ -30,7 +30,7 @@
     if (!UISettings.getInstance().SHOW_DIRECTORY_FOR_NON_UNIQUE_FILENAMES || DumbService.isDumb(project)) {
       return null;
     }
-    final String uniqueName = UniqueVFilePathBuilder.getInstance().getUniqueVirtualFilePath(project, file);
+    final String uniqueName = UniqueVFilePathBuilder.getInstance().getUniqueVirtualFilePathWithinOpenedFileEditors(project, file);
     return uniqueName.equals(file.getName()) ? null : uniqueName;
   }
 }
diff --git a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/UniqueVFilePathBuilderImpl.java b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/UniqueVFilePathBuilderImpl.java
index 00f8835..bdc0b0e 100644
--- a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/UniqueVFilePathBuilderImpl.java
+++ b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/UniqueVFilePathBuilderImpl.java
@@ -30,6 +30,7 @@
 
 import java.io.File;
 import java.util.Collection;
+import java.util.Collections;
 
 /**
  * @author yole
@@ -38,12 +39,22 @@
   @NotNull
   @Override
   public String getUniqueVirtualFilePath(Project project, VirtualFile file) {
+    return getUniqueVirtualFilePath(project, file, false);
+  }
+
+  @NotNull
+  @Override
+  public String getUniqueVirtualFilePathWithinOpenedFileEditors(Project project, VirtualFile vFile) {
+    return getUniqueVirtualFilePath(project, vFile, true);
+  }
+
+  private String getUniqueVirtualFilePath(Project project, VirtualFile file, boolean skipNonOpenedFiles) {
     String fileName = file.getName();
-    Collection<VirtualFile> filesWithSameName = FilenameIndex.getVirtualFilesByName(project, fileName,
-                                                                                          ProjectScope.getProjectScope(project));
+    Collection<VirtualFile> filesWithSameName = skipNonOpenedFiles ? Collections.<VirtualFile>emptySet() :
+                                                FilenameIndex.getVirtualFilesByName(project, fileName, ProjectScope.getProjectScope(project));
     THashSet<VirtualFile> setOfFilesWithTheSameName = new THashSet<VirtualFile>(filesWithSameName);
     // add open files out of project scope
-    for(VirtualFile openFile:FileEditorManager.getInstance(project).getOpenFiles()) {
+    for(VirtualFile openFile: FileEditorManager.getInstance(project).getOpenFiles()) {
       if (openFile.getName().equals(fileName)) {
         setOfFilesWithTheSameName.add(openFile);
       }
diff --git a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorImpl.java b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorImpl.java
index c915753..7c4ba49 100644
--- a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorImpl.java
+++ b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorImpl.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.
@@ -26,7 +26,6 @@
 import com.intellij.codeInsight.lookup.impl.LookupImpl;
 import com.intellij.openapi.actionSystem.LangDataKeys;
 import com.intellij.openapi.actionSystem.PlatformDataKeys;
-import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.module.ModuleUtilCore;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -46,15 +45,6 @@
   }
 
   @Override
-  public void initFolding() {
-    ApplicationManager.getApplication().runReadAction(new Runnable() {
-      public void run() {
-        CodeFoldingManager.getInstance(myProject).buildInitialFoldings(getEditor());
-      }
-    });
-  }
-
-  @Override
   public BackgroundEditorHighlighter getBackgroundHighlighter() {
     if (myBackgroundHighlighter == null) {
       myBackgroundHighlighter = new TextEditorBackgroundHighlighter(myProject, getEditor());
diff --git a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorProvider.java b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorProvider.java
index 91743c2..6dcceff 100644
--- a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorProvider.java
+++ b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorProvider.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -25,10 +25,7 @@
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.fileEditor.FileEditor;
-import com.intellij.openapi.fileEditor.FileEditorState;
-import com.intellij.openapi.fileEditor.FileEditorStateLevel;
+import com.intellij.openapi.fileEditor.*;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.WriteExternalException;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -39,18 +36,44 @@
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 
-public class PsiAwareTextEditorProvider extends TextEditorProvider {
+public class PsiAwareTextEditorProvider extends TextEditorProvider implements AsyncFileEditorProvider {
   private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorProvider");
   @NonNls
   private static final String FOLDING_ELEMENT = "folding";
 
   @Override
   @NotNull
-  public FileEditor createEditor(@NotNull Project project, @NotNull final VirtualFile file) {
+  public FileEditor createEditor(@NotNull final Project project, @NotNull final VirtualFile file) {
+    return createEditorAsync(project, file).build();
+  }
+
+  @NotNull
+  @Override
+  public Builder createEditorAsync(@NotNull final Project project, @NotNull final VirtualFile file) {
     if (!accept(project, file)) {
       LOG.error("Cannot open text editor for " + file);
     }
-    return new PsiAwareTextEditorImpl(project, file, this);
+    CodeFoldingState state = null;
+    try {
+      Document document = FileDocumentManager.getInstance().getDocument(file);
+      if (document != null) {
+        state = CodeFoldingManager.getInstance(project).buildInitialFoldings(document);
+      }
+    }
+    catch (Exception e) {
+      LOG.error("Error building initial foldings", e);
+    }
+    final CodeFoldingState finalState = state;
+    return new Builder() {
+      @Override
+      public FileEditor build() {
+        final PsiAwareTextEditorImpl editor = new PsiAwareTextEditorImpl(project, file, PsiAwareTextEditorProvider.this);
+        if (finalState != null) {
+          finalState.setToEditor(editor.getEditor());
+        }
+        return editor;
+      }
+    };
   }
 
   @Override
diff --git a/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/GeneralColorsPage.java b/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/GeneralColorsPage.java
index 5db72dc..18b02d0 100644
--- a/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/GeneralColorsPage.java
+++ b/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/GeneralColorsPage.java
@@ -91,6 +91,7 @@
     new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.unmatched.brace"), CodeInsightColors.UNMATCHED_BRACE_ATTRIBUTES),
 
     new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.todo.defaults"), CodeInsightColors.TODO_DEFAULT_ATTRIBUTES),
+    new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.bookmarks"), CodeInsightColors.BOOKMARKS_ATTRIBUTES),
 
     new AttributesDescriptor(OptionsBundle.message("options.java.color.descriptor.full.coverage"), CodeInsightColors.LINE_FULL_COVERAGE),
     new AttributesDescriptor(OptionsBundle.message("options.java.color.descriptor.partial.coverage"),
diff --git a/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java b/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java
index 4288279..f1e8b92 100644
--- a/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java
+++ b/platform/lang-impl/src/com/intellij/openapi/util/registry/RegistryUi.java
@@ -43,6 +43,8 @@
 import javax.swing.table.TableColumn;
 import java.awt.*;
 import java.awt.event.ActionEvent;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
 import java.awt.image.BufferedImage;
 import java.util.*;
 import java.util.List;
@@ -131,10 +133,25 @@
     tb.setTargetComponent(myTable);
 
     myContent.add(tb.getComponent(), BorderLayout.NORTH);
-    new TableSpeedSearch(myTable).setComparator(new SpeedSearchComparator(false));
+    final TableSpeedSearch search = new TableSpeedSearch(myTable);
+    search.setComparator(new SpeedSearchComparator(false));
+    myTable.addKeyListener(new KeyAdapter() {
+      @Override
+      public void keyPressed(KeyEvent e) {
+        if (e.getKeyCode() == KeyEvent.VK_SPACE) {
+          int row = myTable.getSelectedRow();
+          RegistryValue rv = myModel.getRegistryValue(row);
+          if (rv.isBoolean()) {
+            rv.setValue(!rv.asBoolean());
+            for (int i : new int[]{0, 1, 2}) myModel.fireTableCellUpdated(row, i);
+            revaliateActions();
+            if (search.isPopupActive()) search.hidePopup();
+          }
+        }
+      }
+    });
   }
 
-
   private class RevertAction extends AnAction {
 
     private RevertAction() {
@@ -256,6 +273,8 @@
         revaliateActions();
       }
 
+      private AbstractAction myCloseAction;
+
       @Override
       protected JComponent createCenterPanel() {
         return myContent;
@@ -281,13 +300,20 @@
       @NotNull
       @Override
       protected Action[] createActions() {
-        return new Action[]{myRestoreDefaultsAction, new AbstractAction("Close") {
+        return new Action[]{myRestoreDefaultsAction, myCloseAction};
+      }
+
+      @Override
+      protected void createDefaultActions() {
+        super.createDefaultActions();
+        myCloseAction = new AbstractAction("Close") {
           @Override
           public void actionPerformed(ActionEvent e) {
             processClose();
             doOKAction();
           }
-        }};
+        };
+        myCloseAction.putValue(DialogWrapper.DEFAULT_ACTION, true);
       }
 
       @Override
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/MultiHostRegistrarImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/MultiHostRegistrarImpl.java
index 25b367f..183af73 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/MultiHostRegistrarImpl.java
+++ b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/MultiHostRegistrarImpl.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.
@@ -39,9 +39,8 @@
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.CodeStyleManager;
 import com.intellij.psi.impl.DebugUtil;
-import com.intellij.psi.impl.DocumentCommitThread;
+import com.intellij.psi.impl.DocumentCommitProcessor;
 import com.intellij.psi.impl.PsiDocumentManagerImpl;
 import com.intellij.psi.impl.source.PsiFileImpl;
 import com.intellij.psi.impl.source.resolve.FileContextUtil;
@@ -448,14 +447,7 @@
           public void run() {
             //todo
             final DiffLog diffLog = BlockSupportImpl.mergeTrees(oldFile, oldFileNode, injectedNode, new DaemonProgressIndicator());
-            CodeStyleManager.getInstance(hostPsiFile.getProject()).performActionWithFormatterDisabled(new Runnable() {
-              @Override
-              public void run() {
-                synchronized (PsiLock.LOCK) {
-                  DocumentCommitThread.doActualPsiChange(oldFile, diffLog);
-                }
-              }
-            });
+            DocumentCommitProcessor.doActualPsiChange(oldFile, diffLog);
           }
         });
         assert shreds.isValid();
diff --git a/platform/lang-impl/src/com/intellij/refactoring/actions/BasePlatformRefactoringAction.java b/platform/lang-impl/src/com/intellij/refactoring/actions/BasePlatformRefactoringAction.java
index 92eae30..8867ea9 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/actions/BasePlatformRefactoringAction.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/actions/BasePlatformRefactoringAction.java
@@ -113,12 +113,10 @@
   protected RefactoringActionHandler getHandler(@NotNull Language language, PsiElement element) {
     List<RefactoringSupportProvider> providers = LanguageRefactoringSupport.INSTANCE.allForLanguage(language);
     if (providers.isEmpty()) return null;
-    if (element == null && !providers.isEmpty()) return getRefactoringHandler(providers.get(0));
-    if (element != null) {
-      for (RefactoringSupportProvider provider : providers) {
-        if (provider.isAvailable(element)) {
-          return getRefactoringHandler(provider, element);
-        }
+    if (element == null) return getRefactoringHandler(providers.get(0));
+    for (RefactoringSupportProvider provider : providers) {
+      if (provider.isAvailable(element)) {
+        return getRefactoringHandler(provider, element);
       }
     }
     return null;
diff --git a/platform/lang-impl/src/com/intellij/refactoring/actions/ChangeSignatureAction.java b/platform/lang-impl/src/com/intellij/refactoring/actions/ChangeSignatureAction.java
index 328768c..f07419a 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/actions/ChangeSignatureAction.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/actions/ChangeSignatureAction.java
@@ -17,21 +17,22 @@
 
 import com.intellij.lang.Language;
 import com.intellij.lang.LanguageRefactoringSupport;
-import com.intellij.openapi.actionSystem.CommonDataKeys;
+import com.intellij.lang.refactoring.RefactoringSupportProvider;
 import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.actionSystem.LangDataKeys;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.ScrollType;
 import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiNameIdentifierOwner;
+import com.intellij.psi.PsiReference;
 import com.intellij.refactoring.RefactoringActionHandler;
 import com.intellij.refactoring.changeSignature.ChangeSignatureHandler;
 import com.intellij.refactoring.util.CommonRefactoringUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-public class ChangeSignatureAction extends BaseRefactoringAction {
+public class ChangeSignatureAction extends BasePlatformRefactoringAction {
 
   public ChangeSignatureAction() {
     setInjectedContext(true);
@@ -49,7 +50,7 @@
 
   @Override
   protected boolean isAvailableOnElementInEditorAndFile(@NotNull final PsiElement element, @NotNull final Editor editor, @NotNull PsiFile file, @NotNull DataContext context) {
-    PsiElement targetMember = findTargetMember(file, editor);
+    PsiElement targetMember = findTargetMember(element);
     if (targetMember == null) {
       final ChangeSignatureHandler targetHandler = getChangeSignatureHandler(file.getLanguage());
       if (targetHandler != null) {
@@ -63,17 +64,6 @@
   }
 
   @Nullable
-  private static PsiElement findTargetMember(PsiFile file, Editor editor) {
-    final PsiElement element = file.findElementAt(editor.getCaretModel().getOffset());
-    final PsiElement targetMember = findTargetMember(element);
-    if (targetMember != null) return targetMember;
-
-    final PsiReference reference = file.findReferenceAt(editor.getCaretModel().getOffset());
-    if (reference == null) return null;
-    return reference.resolve();
-  }
-
-  @Nullable
   private static PsiElement findTargetMember(@Nullable PsiElement element) {
     if (element == null) return null;
     final ChangeSignatureHandler fileHandler = getChangeSignatureHandler(element.getLanguage());
@@ -91,71 +81,45 @@
     return null;
   }
 
+  @Nullable
   @Override
-  protected boolean hasAvailableHandler(@NotNull DataContext dataContext) {
-    final Project project = CommonDataKeys.PROJECT.getData(dataContext);
-    if (project == null) return false;
-    final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
-    final PsiElement targetMember;
-    if (editor != null) {
-      final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
-      if (file == null) return false;
-      targetMember = findTargetMember(file, editor);
-    } else {
-      final PsiElement[] elements = getPsiElementArray(dataContext);
-      if (elements.length != 1) return false;
-      targetMember = findTargetMember(elements[0]);
-    }
-    return targetMember != null && getChangeSignatureHandler(targetMember.getLanguage()) != null;
+  protected RefactoringActionHandler getRefactoringHandler(@NotNull RefactoringSupportProvider provider) {
+    return provider.getChangeSignatureHandler();
   }
 
+  @Nullable
   @Override
-  public RefactoringActionHandler getHandler(@NotNull DataContext dataContext) {
-    Language language = LangDataKeys.LANGUAGE.getData(dataContext);
-    if (language == null) {
-      PsiElement psiElement = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
-      if (psiElement != null) {
-        language = psiElement.getLanguage();
-      }
-    }
-    if (language != null) {
-      return new RefactoringActionHandler() {
-        @Override
-        public void invoke(@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) {
-          editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
-          final PsiElement targetMember = findTargetMember(file, editor);
-          if (targetMember == null) {
-            final ChangeSignatureHandler handler = getChangeSignatureHandler(file.getLanguage());
-            if (handler != null) {
-              final String notFoundMessage = handler.getTargetNotFoundMessage();
-              if (notFoundMessage != null) {
-                CommonRefactoringUtil.showErrorHint(project, editor, notFoundMessage, ChangeSignatureHandler.REFACTORING_NAME, null);
-              }
+  protected RefactoringActionHandler getRefactoringHandler(@NotNull RefactoringSupportProvider provider, final PsiElement element) {
+    return new RefactoringActionHandler() {
+      @Override
+      public void invoke(@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) {
+        editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
+        final PsiElement targetMember = findTargetMember(element);
+        if (targetMember == null) {
+          final ChangeSignatureHandler handler = getChangeSignatureHandler(file.getLanguage());
+          if (handler != null) {
+            final String notFoundMessage = handler.getTargetNotFoundMessage();
+            if (notFoundMessage != null) {
+              CommonRefactoringUtil.showErrorHint(project, editor, notFoundMessage, ChangeSignatureHandler.REFACTORING_NAME, null);
             }
-            return;
           }
-          final ChangeSignatureHandler handler = getChangeSignatureHandler(targetMember.getLanguage());
-          if (handler == null) return;
-          handler.invoke(project, new PsiElement[]{targetMember}, dataContext);
+          return;
         }
+        final ChangeSignatureHandler handler = getChangeSignatureHandler(targetMember.getLanguage());
+        if (handler == null) return;
+        handler.invoke(project, new PsiElement[]{targetMember}, dataContext);
+      }
 
-        @Override
-        public void invoke(@NotNull Project project, @NotNull PsiElement[] elements, DataContext dataContext) {
-          if (elements.length != 1) return;
-          final PsiElement targetMember = findTargetMember(elements[0]);
-          if (targetMember == null) return;
-          final ChangeSignatureHandler handler = getChangeSignatureHandler(targetMember.getLanguage());
-          if (handler == null) return;
-          handler.invoke(project, new PsiElement[]{targetMember}, dataContext);
-        }
-      };
-    }
-    return null;
-  }
-
-  @Override
-  protected boolean isAvailableForLanguage(Language language) {
-    return getChangeSignatureHandler(language) != null;
+      @Override
+      public void invoke(@NotNull Project project, @NotNull PsiElement[] elements, DataContext dataContext) {
+        if (elements.length != 1) return;
+        final PsiElement targetMember = findTargetMember(elements[0]);
+        if (targetMember == null) return;
+        final ChangeSignatureHandler handler = getChangeSignatureHandler(targetMember.getLanguage());
+        if (handler == null) return;
+        handler.invoke(project, new PsiElement[]{targetMember}, dataContext);
+      }
+    };
   }
 
   @Nullable
diff --git a/platform/lang-impl/src/com/intellij/refactoring/actions/ExtractIncludeAction.java b/platform/lang-impl/src/com/intellij/refactoring/actions/ExtractIncludeAction.java
index 6625316..5e8133e 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/actions/ExtractIncludeAction.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/actions/ExtractIncludeAction.java
@@ -18,20 +18,19 @@
 
 import com.intellij.ide.TitledHandler;
 import com.intellij.lang.Language;
+import com.intellij.lang.refactoring.RefactoringSupportProvider;
 import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.actionSystem.LangDataKeys;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiFile;
 import com.intellij.refactoring.RefactoringActionHandler;
 import com.intellij.refactoring.lang.LanguageExtractInclude;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 /**
  * @author ven
  */
-public class ExtractIncludeAction extends BaseRefactoringAction {
+public class ExtractIncludeAction extends BasePlatformRefactoringAction {
   @Override
   public boolean isAvailableInEditorOnly() {
     return true;
@@ -65,9 +64,15 @@
     return LanguageExtractInclude.INSTANCE.forLanguage(baseLanguage) != null;
   }
 
+  @Nullable
   @Override
-  public RefactoringActionHandler getHandler(@NotNull DataContext dataContext) {
-    PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
+  protected RefactoringActionHandler getRefactoringHandler(@NotNull RefactoringSupportProvider provider) {
+    return null;
+  }
+
+  @Nullable
+  protected RefactoringActionHandler getRefactoringHandler(@NotNull RefactoringSupportProvider provider, PsiElement element) {
+    PsiFile file = element.getContainingFile();
     if (file == null) return null;
     return LanguageExtractInclude.INSTANCE.forLanguage(file.getViewProvider().getBaseLanguage());
   }
diff --git a/platform/lang-impl/src/com/intellij/refactoring/changeSignature/MethodSignatureEditor.java b/platform/lang-impl/src/com/intellij/refactoring/changeSignature/MethodSignatureEditor.java
deleted file mode 100644
index d5d4812..0000000
--- a/platform/lang-impl/src/com/intellij/refactoring/changeSignature/MethodSignatureEditor.java
+++ /dev/null
@@ -1,215 +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.refactoring.changeSignature;
-
-import com.intellij.lang.Language;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.editor.EditorFactory;
-import com.intellij.openapi.editor.LogicalPosition;
-import com.intellij.openapi.editor.event.*;
-import com.intellij.openapi.editor.impl.CaretModelImpl;
-import com.intellij.openapi.editor.impl.EditorImpl;
-import com.intellij.openapi.util.Key;
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.CodeStyleManager;
-import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.ui.EditorTextField;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.awt.*;
-
-/**
- * @author Konstantin Bulenkov
- */
-public abstract class MethodSignatureEditor<M extends PsiElement> extends EditorTextField {
-  private static final String MARKER_START = "\n\n\n\n\n\n\n\n/*marker_start*/\n\n\n\n\n\n\n";
-  private static final String MARKER_END = "\n\n\n\n\n\n\n\n/*marker_end*/\n\n\n\n\n\n\n";
-  private final M myMethod;
-
-  private final Class<? extends M> myClass;
-  private final PsiFile myFile;
-  private final String myStartMarker;
-  private String myEndMarker;
-  public static final Key<Integer> OLD_PARAMETER_INDEX = Key.create("change.signature.parameter.index");
-  public static final ParameterIndexer INDEXER = new ParameterIndexer() {
-    @Override
-    public void setIndex(@NotNull PsiElement element, int index) {
-      element.putCopyableUserData(OLD_PARAMETER_INDEX, index);
-    }
-
-    @Override
-    public int getIndex(@NotNull PsiElement element) {
-      final Integer index = element.getCopyableUserData(OLD_PARAMETER_INDEX);
-      return index == null ? -1 : index.intValue();
-    }
-  };
-
-
-  public MethodSignatureEditor(@NotNull M method, Class<? extends M> genericInterface) {
-    super(EditorFactory.getInstance().createDocument(""), method.getProject(), method.getContainingFile().getFileType(), false, false);
-    myStartMarker = getStartMarker();
-    myEndMarker = getEndMarker();
-    myMethod = method;
-    myFile = method.getContainingFile();
-    myClass = genericInterface;
-    final Document document = createDocument();
-    assert document != null : "Can't create document";
-    setDocument(document);
-  }
-
-  protected final TextRange getCurrentSignatureTextRange() {
-    final String text = getDocument().getText();
-    return TextRange.create(text.indexOf(myStartMarker) + myStartMarker.length(), text.indexOf(myEndMarker));
-  }
-
-  public abstract TextRange getSignatureTextRange();
-
-  protected abstract String formatMethod();
-
-  protected abstract void indexParameters(M method, @NotNull ParameterIndexer indexer);
-
-  protected String getStartMarker() {
-    return MARKER_START;
-  }
-
-  protected String getEndMarker() {
-    return MARKER_END;
-  }
-
-  @Nullable
-  protected M createFromString() {
-    final PsiFile file = PsiDocumentManager.getInstance(getProject()).getPsiFile(getDocument());
-    if (file == null) return null;
-
-    final int startOffset = getCurrentSignatureTextRange().getStartOffset();
-    final int endOffset = file.getTextLength();
-    PsiTreeUtil.findElementOfClassAtRange(file, startOffset , endOffset, myClass);
-
-    final FileViewProvider viewProvider = file.getViewProvider();
-    M result = null;
-    for (Language lang : viewProvider.getLanguages()) {
-      PsiElement elementAt = viewProvider.findElementAt(startOffset, lang);
-      M run = PsiTreeUtil.getParentOfType(elementAt, myClass, false);
-      M prev = run;
-      while (run != null && run.getTextRange().getStartOffset() == startOffset &&
-             run.getTextRange().getEndOffset() <= endOffset) {
-        prev = run;
-        run = PsiTreeUtil.getParentOfType(run, myClass);
-      }
-
-      if (prev == null) continue;
-      final int elementStartOffset = prev.getTextRange().getStartOffset();
-      final int elementEndOffset = prev.getTextRange().getEndOffset();
-      return startOffset >= elementStartOffset && elementEndOffset <= endOffset ? prev : null;
-    }
-
-    return result;
-
-  }
-
-
-  public M getMethod() {
-    return myMethod;
-  }
-
-  @Nullable
-  private Document createDocument() {
-    final StringBuilder text = new StringBuilder(myFile.getText());
-    final TextRange range = getSignatureTextRange();
-    text.insert(range.getEndOffset(), myEndMarker);
-    text.insert(range.getStartOffset(), myStartMarker);
-    text.replace(range.getStartOffset() + myStartMarker.length(), range.getEndOffset() + myStartMarker.length(), formatMethod());
-    final PsiFile newFile = PsiFileFactory.getInstance(myMethod.getProject())
-      .createFileFromText(myFile.getName(), myFile.getFileType(), text, System.currentTimeMillis(), true);
-    return PsiDocumentManager.getInstance(myMethod.getProject()).getDocument(newFile);
-  }
-
-  @Override
-  public void addNotify() {
-    super.addNotify();
-    final Editor editor = getEditor();
-    if (editor instanceof EditorImpl) {
-      editor.putUserData(EditorImpl.EDITABLE_AREA_MARKER, Pair.create(myStartMarker, myEndMarker));
-
-      indexParameters(createFromString(), INDEXER);
-
-      ((EditorImpl)editor).setScrollToCaret(false);
-      ((CaretModelImpl)editor.getCaretModel()).setIgnoreWrongMoves(true);
-      final TextRange range = getCurrentSignatureTextRange();
-      ApplicationManager.getApplication().runWriteAction(new Runnable() {
-        @Override
-        public void run() {
-          CodeStyleManager.getInstance(getProject()).reformatText(myFile, range.getStartOffset(), range.getEndOffset());
-        }
-      });
-      editor.getCaretModel().addCaretListener(new CaretAdapter() {
-        @Override
-        public void caretPositionChanged(CaretEvent e) {
-          createFromString();
-          final LogicalPosition newPosition = e.getNewPosition();
-          final Editor ed = e.getEditor();
-          final int pos = ed.logicalPositionToOffset(newPosition);
-          final TextRange range = getCurrentSignatureTextRange();
-          final int start = range.getStartOffset();
-          final int end = range.getEndOffset();
-          if (pos < start) {
-            e.getEditor().getCaretModel().moveToOffset(start);
-            updateUI(ed, false);
-          }
-          else if (end < pos) {
-            e.getEditor().getCaretModel().moveToOffset(end);
-            updateUI(ed, false);
-          }
-        }
-      });
-      editor.getSettings().setUseSoftWraps(false);
-      updateUI(editor, true);
-      editor.getDocument().addDocumentListener(new DocumentAdapter() {
-        @Override
-        public void documentChanged(DocumentEvent e) {
-          updateUI(getEditor(), false);
-        }
-      });
-    }
-  }
-
-  private void updateUI(final Editor editor, boolean moveCaretToStart) {
-    final TextRange range = getCurrentSignatureTextRange();
-    final int start = range.getStartOffset();
-    final int end = range.getEndOffset();
-    final int startLine = ((EditorImpl)editor).offsetToLogicalPosition(start, false).line;
-    final int endLine = ((EditorImpl)editor).offsetToLogicalPosition(end, false).line;
-    final int lineCount = Math.max(1, endLine - startLine);
-    final Dimension old = getSize();
-    final Dimension size = new Dimension(getWidth(), editor.getLineHeight() * (lineCount + 2) + 4);
-    if (!old.equals(size)) {
-      setSize(size);
-      setPreferredSize(size);
-      revalidate();
-      repaint();
-    }
-    if (moveCaretToStart) {
-      editor.getCaretModel().moveToOffset(start);
-    }
-
-    editor.getScrollingModel().scrollVertically((startLine - 1)* editor.getLineHeight() + 2);
-  }
-}
diff --git a/platform/lang-impl/src/com/intellij/refactoring/changeSignature/ParameterIndexer.java b/platform/lang-impl/src/com/intellij/refactoring/changeSignature/ParameterIndexer.java
deleted file mode 100644
index d8e3d7c..0000000
--- a/platform/lang-impl/src/com/intellij/refactoring/changeSignature/ParameterIndexer.java
+++ /dev/null
@@ -1,28 +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.refactoring.changeSignature;
-
-import com.intellij.psi.PsiElement;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Konstantin Bulenkov
- */
-public interface ParameterIndexer {
-  void setIndex(@NotNull PsiElement element, int index);
-
-  int getIndex(@NotNull PsiElement element);
-}
diff --git a/platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesHandler.java b/platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesHandler.java
index 66505d9..277e8fa 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesHandler.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesHandler.java
@@ -50,11 +50,6 @@
       }
     }
 
-    PsiElement[] filteredElements = PsiTreeUtil.filterAncestors(elements);
-    if (filteredElements.length != elements.length) {
-      // there are nested dirs
-      return false;
-    }
     return super.canMove(elements, targetContainer);
   }
 
@@ -72,13 +67,23 @@
     doMove(project, elements, targetContainer, null);
   }
 
+
+  @Nullable
+  @Override
+  public PsiElement[] adjustForMove(Project project, PsiElement[] sourceElements, PsiElement targetElement) {
+    return PsiTreeUtil.filterAncestors(sourceElements);
+  }
+
   @Override
   public void doMove(final Project project, final PsiElement[] elements, final PsiElement targetContainer, @Nullable final MoveCallback callback) {
     if (!LOG.assertTrue(targetContainer == null || targetContainer instanceof PsiDirectory || targetContainer instanceof PsiDirectoryContainer,
                         "container: " + targetContainer + "; elements: " + Arrays.toString(elements) + "; working handler: " + toString())) {
       return;
     }
-    MoveFilesOrDirectoriesUtil.doMove(project, adjustForMove(project, elements, targetContainer), new PsiElement[] {targetContainer}, callback);
+    final PsiElement[] adjustedElements = adjustForMove(project, elements, targetContainer);
+    if (adjustedElements != null) {
+      MoveFilesOrDirectoriesUtil.doMove(project, adjustedElements, new PsiElement[] {targetContainer}, callback);
+    }
   }
 
   @Override
diff --git a/platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesProcessor.java b/platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesProcessor.java
index 86924b2..5217b57 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesProcessor.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/move/moveFilesOrDirectories/MoveFilesOrDirectoriesProcessor.java
@@ -26,6 +26,7 @@
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiReference;
 import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReference;
+import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.search.searches.ReferencesSearch;
 import com.intellij.refactoring.BaseRefactoringProcessor;
 import com.intellij.refactoring.RefactoringBundle;
@@ -99,7 +100,7 @@
     for (int i = 0; i < myElementsToMove.length; i++) {
       PsiElement element = myElementsToMove[i];
       if (mySearchForReferences) {
-        for (PsiReference reference : ReferencesSearch.search(element)) {
+        for (PsiReference reference : ReferencesSearch.search(element, GlobalSearchScope.projectScope(myProject))) {
           result.add(new MyUsageInfo(reference.getElement(), i, reference));
         }
       }
diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/RenamePsiElementProcessor.java b/platform/lang-impl/src/com/intellij/refactoring/rename/RenamePsiElementProcessor.java
index 1f13391..3400f0b 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/rename/RenamePsiElementProcessor.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/rename/RenamePsiElementProcessor.java
@@ -26,6 +26,7 @@
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiFileSystemItem;
 import com.intellij.psi.PsiReference;
+import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.search.SearchScope;
 import com.intellij.psi.search.searches.ReferencesSearch;
 import com.intellij.refactoring.RefactoringSettings;
@@ -66,7 +67,7 @@
 
   @NotNull
   public Collection<PsiReference> findReferences(final PsiElement element) {
-    return ReferencesSearch.search(element).findAll();
+    return ReferencesSearch.search(element, GlobalSearchScope.projectScope(element.getProject())).findAll();
   }
 
   @Nullable
diff --git a/platform/lang-impl/src/com/intellij/refactoring/ui/ComboBoxVisibilityGroup.java b/platform/lang-impl/src/com/intellij/refactoring/ui/ComboBoxVisibilityGroup.java
deleted file mode 100644
index e8dfc32..0000000
--- a/platform/lang-impl/src/com/intellij/refactoring/ui/ComboBoxVisibilityGroup.java
+++ /dev/null
@@ -1,67 +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.refactoring.ui;
-
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.DefaultActionGroup;
-import com.intellij.openapi.actionSystem.ex.ComboBoxAction;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Konstantin Bulenkov
- */
-class ComboBoxVisibilityGroup extends ComboBoxAction {
-  private String myValue;
-  private final DefaultActionGroup myGroup;
-  private final Map<String, String> myMap = new HashMap<String, String>();
-
-  protected ComboBoxVisibilityGroup(final String[] options, String[] presentableNames, final Runnable run) {
-    final AnAction[] myActions = new AnAction[options.length];
-    for (int i = 0; i < options.length; i++) {
-      final String value = options[i];
-      final String name = presentableNames[i];
-      myMap.put(value, name);
-      myActions[i] = new AnAction(name) {
-        @Override
-        public void actionPerformed(AnActionEvent e) {
-          setValue(value);
-          run.run();
-        }
-      };
-    }
-    myGroup = new DefaultActionGroup(myActions);
-  }
-
-  public String getValue() {
-    return myValue;
-  }
-
-  @NotNull
-  @Override
-  protected DefaultActionGroup createPopupActionGroup(JComponent button) {
-    return myGroup;
-  }
-
-  public void setValue(String value) {
-    getTemplatePresentation().setText(myMap.get(value));
-    myValue = value;
-  }
-}
diff --git a/platform/lang-impl/src/com/intellij/testIntegration/GotoTestOrCodeHandler.java b/platform/lang-impl/src/com/intellij/testIntegration/GotoTestOrCodeHandler.java
index 2bba6e9..d739373 100644
--- a/platform/lang-impl/src/com/intellij/testIntegration/GotoTestOrCodeHandler.java
+++ b/platform/lang-impl/src/com/intellij/testIntegration/GotoTestOrCodeHandler.java
@@ -19,8 +19,8 @@
 import com.intellij.codeInsight.CodeInsightBundle;
 import com.intellij.codeInsight.navigation.GotoTargetHandler;
 import com.intellij.codeInsight.navigation.NavigationUtil;
+import com.intellij.execution.executors.DefaultRunExecutor;
 import com.intellij.icons.AllIcons;
-import com.intellij.openapi.actionSystem.IdeActions;
 import com.intellij.openapi.actionSystem.Shortcut;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.keymap.Keymap;
@@ -124,7 +124,7 @@
   protected String getAdText(PsiElement source, int length) {
     if (length > 0 && !TestFinderHelper.isTest(source)) {
       final Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
-      final Shortcut[] shortcuts = keymap.getShortcuts(IdeActions.ACTION_DEFAULT_RUNNER);
+      final Shortcut[] shortcuts = keymap.getShortcuts(DefaultRunExecutor.getRunExecutorInstance().getContextActionId());
       if (shortcuts.length > 0) {
         return ("Press " + KeymapUtil.getShortcutText(shortcuts[0]) + " to run selected tests");
       }
diff --git a/platform/lang-impl/src/com/intellij/testIntegration/GotoTestRelatedProvider.java b/platform/lang-impl/src/com/intellij/testIntegration/GotoTestRelatedProvider.java
index 3177bfc..5cb0e7d 100644
--- a/platform/lang-impl/src/com/intellij/testIntegration/GotoTestRelatedProvider.java
+++ b/platform/lang-impl/src/com/intellij/testIntegration/GotoTestRelatedProvider.java
@@ -19,12 +19,12 @@
 import com.intellij.navigation.GotoRelatedProvider;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.actionSystem.LangDataKeys;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiFile;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -35,11 +35,14 @@
   @Override
   public List<? extends GotoRelatedItem> getItems(@NotNull DataContext context) {
     final PsiFile file = CommonDataKeys.PSI_FILE.getData(context);
+    if (file == null) return Collections.emptyList();
+
     List<PsiElement> result;
     final boolean isTest = TestFinderHelper.isTest(file);
     if (isTest) {
       result = TestFinderHelper.findClassesForTest(file);
-    } else {
+    }
+    else {
       result = TestFinderHelper.findTestsForClass(file);
     }
 
@@ -50,6 +53,6 @@
       }
       return items;
     }
-    return super.getItems(context);
+    return Collections.emptyList();
   }
 }
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/ChangeTrackingValueContainer.java b/platform/lang-impl/src/com/intellij/util/indexing/ChangeTrackingValueContainer.java
index 913f57e..913faae 100644
--- a/platform/lang-impl/src/com/intellij/util/indexing/ChangeTrackingValueContainer.java
+++ b/platform/lang-impl/src/com/intellij/util/indexing/ChangeTrackingValueContainer.java
@@ -18,6 +18,7 @@
 
 import com.intellij.openapi.util.Computable;
 import com.intellij.util.io.DataExternalizer;
+import com.intellij.util.io.DataInputOutputUtil;
 import gnu.trove.TIntHashSet;
 import gnu.trove.TIntProcedure;
 import org.jetbrains.annotations.NotNull;
@@ -88,11 +89,6 @@
     return getMergedData().toValueList();
   }
 
-  @Override
-  public boolean isAssociated(final Value value, final int inputId) {
-    return getMergedData().isAssociated(value, inputId);
-  }
-
   @NotNull
   @Override
   public IntPredicate getValueAssociationPredicate(Value value) {
@@ -168,10 +164,6 @@
     return myAdded;
   }
 
-  public @Nullable TIntHashSet getInvalidated() {
-    return myInvalidated;
-  }
-
   @Override
   public void saveTo(DataOutput out, DataExternalizer<Value> externalizer) throws IOException {
     if (needsCompacting()) {
@@ -180,7 +172,7 @@
       final TIntHashSet set = myInvalidated;
       if (set != null && set.size() > 0) {
         for (int inputId : set.toArray()) {
-          ValueContainerImpl.saveInvalidateCommand(out, inputId);
+          DataInputOutputUtil.writeINT(out, -inputId); // mark inputId as invalid, to be processed on load in ValueContainerImpl.readFrom
         }
       }
 
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java
index f357f2b..a9856a4 100644
--- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java
+++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java
@@ -257,8 +257,8 @@
   public static boolean isProjectOrWorkspaceFile(@NotNull VirtualFile file, @Nullable FileType fileType) {
     if (fileType instanceof InternalFileType) return true;
     VirtualFile parent = file.isDirectory() ? file: file.getParent();
-    while(parent instanceof VirtualFileSystemEntry) {
-      if (((VirtualFileSystemEntry)parent).compareNameTo(ProjectCoreUtil.DIRECTORY_BASED_PROJECT_DIR, !SystemInfoRt.isFileSystemCaseSensitive) == 0) return true;
+    while (parent != null) {
+      if (Comparing.equal(parent.getNameSequence(), ProjectCoreUtil.DIRECTORY_BASED_PROJECT_DIR, SystemInfoRt.isFileSystemCaseSensitive)) return true;
       parent = parent.getParent();
     }
     return false;
@@ -965,7 +965,7 @@
               final int restrictedFileId = getFileId(restrictToFile);
               for (final Iterator<V> valueIt = container.getValueIterator(); valueIt.hasNext(); ) {
                 final V value = valueIt.next();
-                if (container.isAssociated(value, restrictedFileId)) {
+                if (container.getValueAssociationPredicate(value).contains(restrictedFileId)) {
                   shouldContinue = processor.process(restrictToFile, value);
                   if (!shouldContinue) {
                     break;
@@ -1310,7 +1310,10 @@
 
   @NotNull
   private Set<Document> getUnsavedDocuments() {
-    return new THashSet<Document>(Arrays.asList(myFileDocumentManager.getUnsavedDocuments()));
+    Document[] documents = myFileDocumentManager.getUnsavedDocuments();
+    if (documents.length == 0) return Collections.emptySet();
+    if (documents.length == 1) return Collections.singleton(documents[0]);
+    return new THashSet<Document>(Arrays.asList(documents));
   }
 
   @NotNull
@@ -1329,7 +1332,12 @@
     Set<Document> documents = getUnsavedDocuments();
     boolean psiBasedIndex = myPsiDependentIndices.contains(indexId);
     if(psiBasedIndex) {
-      documents.addAll(getTransactedDocuments());
+      Set<Document> transactedDocuments = getTransactedDocuments();
+      if (documents.size() == 0) documents = transactedDocuments;
+      else if (transactedDocuments.size() > 0) {
+        documents = new THashSet<Document>(documents);
+        documents.addAll(transactedDocuments);
+      }
     }
 
     if (!documents.isEmpty()) {
@@ -1800,6 +1808,16 @@
     return !myNotRequiringContentIndices.contains(indexId);
   }
 
+  private @Nullable IndexableFileSet getIndexableSetForFile(VirtualFile file) {
+    for (IndexableFileSet set : myIndexableSets) {
+      if (set.isInSet(file)) {
+        return set;
+      }
+    }
+    return null;
+  }
+
+
   private abstract static class InvalidationTask implements Runnable {
     private final VirtualFile mySubj;
 
@@ -2043,8 +2061,8 @@
               }
             }
           });
-          // the file is for sure not a dir and it was previously indexed by at least one index
-          if (!isTooLarge(file)) scheduleForUpdate(file);
+          // the file is for sure not a dir and it was previously indexed by at least one index AND it belongs to some update set
+          if (!isTooLarge(file) && getIndexableSetForFile(file) != null) scheduleForUpdate(file);
         }
       }
       else if (!fileIndexedStatesToUpdate.isEmpty()) { // file was removed, its data should be (lazily) wiped for every index
@@ -2135,12 +2153,7 @@
         }
       }
       else {
-        for (IndexableFileSet set : myIndexableSets) {
-          if (set.isInSet(file)) {
-            processor.process(file);
-            break;
-          }
-        }
+        if (getIndexableSetForFile(file) != null) processor.process(file);
       }
     }
 
@@ -2566,7 +2579,7 @@
     VfsUtilCore.visitChildrenRecursively(root, new VirtualFileVisitor() {
       @Override
       public boolean visitFile(@NotNull VirtualFile file) {
-        if (visitedRoots != null && root != file && file.isDirectory() && !visitedRoots.add(file)) {
+        if (visitedRoots != null && !root.equals(file) && file.isDirectory() && !visitedRoots.add(file)) {
           return false; // avoid visiting files more than once, e.g. additional indexed roots intersect sometimes
         }
         if (indicator != null) indicator.checkCanceled();
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/MapReduceIndex.java b/platform/lang-impl/src/com/intellij/util/indexing/MapReduceIndex.java
index 6b04a81..a79517e 100644
--- a/platform/lang-impl/src/com/intellij/util/indexing/MapReduceIndex.java
+++ b/platform/lang-impl/src/com/intellij/util/indexing/MapReduceIndex.java
@@ -268,9 +268,11 @@
     final Lock lock = getReadLock();
     try {
       lock.lock();
+      ValueContainerImpl.ourDebugIndexInfo.set(myIndexId);
       return myStorage.read(key);
     }
     finally {
+      ValueContainerImpl.ourDebugIndexInfo.set(null);
       lock.unlock();
     }
   }
@@ -301,6 +303,7 @@
   }
 
   private static final boolean doReadSavedPersistentData = SystemProperties.getBooleanProperty("idea.read.saved.persistent.index", true);
+
   @NotNull
   @Override
   public final Computable<Boolean> update(final int inputId, @Nullable Input content) {
@@ -317,7 +320,7 @@
       try {
         hashId = getHashOfContent((FileContent)content);
         if (doReadSavedPersistentData) {
-          if (!myContents.isBusyReading()) {
+          if (!myContents.isBusyReading()) { // avoid blocking read, we can calculate index value
             ByteSequence bytes = myContents.get(hashId);
             if (bytes != null) {
               data = deserializeSavedPersistentData(bytes);
@@ -500,12 +503,15 @@
     getWriteLock().lock();
     try {
       try {
+        ValueContainerImpl.ourDebugIndexInfo.set(myIndexId);
         for (Key key : oldKeysGetter.compute()) {
           myStorage.removeAllValues(key, inputId);
         }
       }
       catch (Exception e) {
         throw new StorageException(e);
+      } finally {
+        ValueContainerImpl.ourDebugIndexInfo.set(null);
       }
       // add new values
       if (newData instanceof THashMap) {
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/PsiDependentIndex.java b/platform/lang-impl/src/com/intellij/util/indexing/PsiDependentIndex.java
deleted file mode 100644
index 991c75b..0000000
--- a/platform/lang-impl/src/com/intellij/util/indexing/PsiDependentIndex.java
+++ /dev/null
@@ -1,22 +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.util.indexing;
-
-/**
- * Created by Maxim.Mossienko on 1/4/14.
- */
-public interface PsiDependentIndex {
-}
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/ValueContainer.java b/platform/lang-impl/src/com/intellij/util/indexing/ValueContainer.java
index 3a5864d..14234ad 100644
--- a/platform/lang-impl/src/com/intellij/util/indexing/ValueContainer.java
+++ b/platform/lang-impl/src/com/intellij/util/indexing/ValueContainer.java
@@ -29,23 +29,23 @@
  *         Date: Dec 14, 2007
  */
 public abstract class ValueContainer<Value> {
-  interface IntIterator {
+  public interface IntIterator {
     boolean hasNext();
     
     int next();
 
     int size();
+
+    boolean hasAscendingOrder();
   }
 
-  abstract static class IntPredicate {
-    abstract boolean contains(int id);
+  public interface IntPredicate {
+    boolean contains(int id);
   }
 
   @NotNull
   public abstract IntIterator getInputIdsIterator(Value value);
 
-  public abstract boolean isAssociated(Value value, int inputId);
-
   @NotNull
   public abstract IntPredicate getValueAssociationPredicate(Value value);
 
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/ValueContainerImpl.java b/platform/lang-impl/src/com/intellij/util/indexing/ValueContainerImpl.java
index 8fb895b..d68768f 100644
--- a/platform/lang-impl/src/com/intellij/util/indexing/ValueContainerImpl.java
+++ b/platform/lang-impl/src/com/intellij/util/indexing/ValueContainerImpl.java
@@ -19,18 +19,23 @@
 import com.intellij.openapi.application.impl.ApplicationInfoImpl;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.ThreadLocalCachedIntArray;
-import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.SmartList;
 import com.intellij.util.containers.EmptyIterator;
+import com.intellij.util.indexing.containers.ChangeBufferingList;
+import com.intellij.util.indexing.containers.IdSet;
 import com.intellij.util.io.DataExternalizer;
 import com.intellij.util.io.DataInputOutputUtil;
-import gnu.trove.*;
+import gnu.trove.THashMap;
+import gnu.trove.TObjectObjectProcedure;
 import org.jetbrains.annotations.NotNull;
 
 import java.io.DataInputStream;
 import java.io.DataOutput;
 import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
 
 /**
  * @author Eugene Zhuravlev
@@ -39,7 +44,7 @@
 class ValueContainerImpl<Value> extends UpdatableValueContainer<Value> implements Cloneable{
   private static final Logger LOG = Logger.getInstance("#com.intellij.util.indexing.ValueContainerImpl");
   private final static Object myNullValue = new Object();
-  private static final int MAX_FILES = 20000;
+
   // there is no volatile as we modify under write lock and read under read lock
   // Most often (80%) we store 0 or one mapping, then we store them in two fields: myInputIdMapping, myInputIdMappingValue
   // when there are several value mapped, myInputIdMapping is THashMap<Value, Data>, myInputIdMappingValue = null
@@ -53,24 +58,14 @@
     if (input == null) {
       attachFileSetForNewValue(value, inputId);
     }
+    else if (input instanceof Integer) {
+      ChangeBufferingList list = new ChangeBufferingList();
+      list.add(((Integer)input).intValue());
+      list.add(inputId);
+      resetFileSetForValue(value, list);
+    }
     else {
-      final TIntHashSet idSet;
-      if (input instanceof Integer) {
-        idSet = new IdSet(3);
-        idSet.add(((Integer)input).intValue());
-        idSet.add(inputId);
-        resetFileSetForValue(value, idSet);
-      }
-      else if (input instanceof TIntHashSet) {
-        idSet = (TIntHashSet)input;
-        idSet.add(inputId);
-
-        if (idSet.size() > MAX_FILES) {
-          resetFileSetForValue(value, new IdBitSet(idSet));
-        }
-      } else if (input instanceof IdBitSet) {
-        ((IdBitSet)input).set(inputId);
-      }
+      ((ChangeBufferingList)input).add(inputId);
     }
   }
 
@@ -84,16 +79,18 @@
     return myInputIdMapping != null ? myInputIdMapping instanceof THashMap ? ((THashMap)myInputIdMapping).size(): 1 : 0;
   }
 
+  static final ThreadLocal<ID> ourDebugIndexInfo = new ThreadLocal<ID>();
+
   @Override
   public void removeAssociatedValue(int inputId) {
     if (myInputIdMapping == null) return;
     List<Value> toRemove = null;
     for (final Iterator<Value> valueIterator = getValueIterator(); valueIterator.hasNext();) {
       final Value value = valueIterator.next();
-      if (isAssociated(value, inputId)) {
+      if (getValueAssociationPredicate(value).contains(inputId)) {
         if (toRemove == null) toRemove = new SmartList<Value>();
         else if (ApplicationInfoImpl.getShadowInstance().isEAP()) {
-          LOG.error("Expected only one value per-inputId", String.valueOf(toRemove.get(0)), String.valueOf(value));
+          LOG.error("Expected only one value per-inputId for " + ourDebugIndexInfo.get(), String.valueOf(toRemove.get(0)), String.valueOf(value));
         }
         toRemove.add(value);
       }
@@ -106,30 +103,21 @@
     }
   }
 
-  public boolean removeValue(int inputId, Value value) {
+  private void removeValue(int inputId, Value value) {
     final Object input = getInput(value);
     if (input == null) {
-      return false;
+      return;
     }
 
-    if (input instanceof TIntHashSet) {
-      final TIntHashSet idSet = (TIntHashSet)input;
-      final boolean reallyRemoved = idSet.remove(inputId);
-      if (reallyRemoved) {
-        idSet.compact();
-      }
-      if (!idSet.isEmpty()) {
-        return reallyRemoved;
-      }
+    if (input instanceof ChangeBufferingList) {
+      final ChangeBufferingList changesList = (ChangeBufferingList)input;
+      changesList.remove(inputId);
+      if (!changesList.isEmpty()) return;
     }
     else if (input instanceof Integer) {
       if (((Integer)input).intValue() != inputId) {
-        return false;
+        return;
       }
-    } else if (input instanceof IdBitSet) {
-      IdBitSet bitSet = (IdBitSet)input;
-      boolean removed = bitSet.remove(inputId);
-      if (bitSet.numberOfBitsSet() > 0) return removed;
     }
 
     if (!(myInputIdMapping instanceof THashMap)) {
@@ -143,8 +131,6 @@
         myInputIdMappingValue = mapping.get((Value)myInputIdMapping);
       }
     }
-
-    return true;
   }
 
   @NotNull
@@ -211,90 +197,35 @@
     }
   }
 
-  @Override
-  public boolean isAssociated(Value value, final int inputId) {
-    final Object input = getInput(value);
-    if (input instanceof TIntHashSet) {
-      return ((TIntHashSet)input).contains(inputId);
-    }
-    if (input instanceof Integer ){
-      return inputId == ((Integer)input).intValue();
-    }
-    if (input instanceof IdBitSet) {
-      return ((IdBitSet)input).get(inputId);
-    }
-    return false;
-  }
-
   @NotNull
   @Override
   public IntPredicate getValueAssociationPredicate(Value value) {
-    final Object input = getInput(value);
+    Object input = getInput(value);
     if (input == null) return EMPTY_PREDICATE;
+
     if (input instanceof Integer) {
+      final int singleId = (Integer)input;
+
       return new IntPredicate() {
-        final int myId = (Integer)input;
         @Override
         public boolean contains(int id) {
-          return id == myId;
+          return id == singleId;
         }
       };
     }
-    if (input instanceof IdBitSet) {
-      return new IntPredicate() {
-        final IdBitSet myIdBitSet = (IdBitSet)input;
-        @Override
-        boolean contains(int id) {
-          return myIdBitSet.get(id);
-        }
-      };
-    }
-    return new IntPredicate() {
-      final TIntHashSet mySet = (TIntHashSet)input;
-      @Override
-      boolean contains(int id) {
-        return mySet.contains(id);
-      }
-    };
+    return ((ChangeBufferingList)input).intPredicate();
   }
 
   @NotNull
   @Override
   public IntIterator getInputIdsIterator(Value value) {
-    final Object input = getInput(value);
-    final IntIterator it;
-    if (input instanceof TIntHashSet) {
-      it = new IntSetIterator((TIntHashSet)input);
+    Object input = getInput(value);
+    if (input == null) return EMPTY_ITERATOR;
+    if (input instanceof Integer){
+      return new SingleValueIterator(((Integer)input).intValue());
+    } else {
+      return ((ChangeBufferingList)input).intIterator();
     }
-    else if (input instanceof Integer ){
-      it = new SingleValueIterator(((Integer)input).intValue());
-    } else if (input instanceof IdBitSet) {
-      it = new IntIterator() {
-        private final IdBitSet myIdBitSet = (IdBitSet)input;
-        private int nextSetBit = myIdBitSet.nextSetBit(0);
-
-        @Override
-        public boolean hasNext() {
-          return nextSetBit != -1;
-        }
-
-        @Override
-        public int next() {
-          int setBit = nextSetBit;
-          nextSetBit = myIdBitSet.nextSetBit(setBit + 1);
-          return setBit;
-        }
-
-        @Override
-        public int size() {
-          return myIdBitSet.numberOfBitsSet();
-        }
-      };
-    }
-    else {
-      it = EMPTY_ITERATOR;
-    }
-    return it;
   }
 
   private Object getInput(Value value) {
@@ -318,10 +249,8 @@
       final ValueContainerImpl clone = (ValueContainerImpl)super.clone();
       if (myInputIdMapping instanceof THashMap) {
         clone.myInputIdMapping = mapCopy((THashMap<Value, Object>)myInputIdMapping);
-      } else if (myInputIdMappingValue instanceof TIntHashSet) {
-        clone.myInputIdMappingValue = ((TIntHashSet)myInputIdMappingValue).clone();
-      } else if (myInputIdMappingValue instanceof IdBitSet) {
-        clone.myInputIdMappingValue = ((IdBitSet)myInputIdMappingValue).clone();
+      } else if (myInputIdMappingValue instanceof ChangeBufferingList) {
+        clone.myInputIdMappingValue = ((ChangeBufferingList)myInputIdMappingValue).clone();
       }
       return clone;
     }
@@ -330,7 +259,7 @@
     }
   }
 
-  public static final IntIterator EMPTY_ITERATOR = new IntIterator() {
+  private static final IntIterator EMPTY_ITERATOR = new IntIterator() {
     @Override
     public boolean hasNext() {
       return false;
@@ -345,6 +274,11 @@
     public int size() {
       return 0;
     }
+
+    @Override
+    public boolean hasAscendingOrder() {
+      return true;
+    }
   };
 
   @NotNull
@@ -359,12 +293,9 @@
       mapping.forEachEntry(new TObjectObjectProcedure<Value, Object>() {
         @Override
         public boolean execute(Value key, Object val) {
-          if (val instanceof TIntHashSet) {
-            newMapping.put(key, ((TIntHashSet)val).clone());
-          } else if (val instanceof IdBitSet) {
-            newMapping.put(key, ((IdBitSet)val).clone());
-          }
-          else {
+          if (val instanceof ChangeBufferingList) {
+            newMapping.put(key, ((ChangeBufferingList)val).clone());
+          } else {
             newMapping.put(key, val);
           }
           return true;
@@ -372,35 +303,30 @@
       });
     } else {
       container.myInputIdMapping = myInputIdMapping;
-      container.myInputIdMappingValue = myInputIdMappingValue instanceof TIntHashSet ?
-                                        ((TIntHashSet)myInputIdMappingValue).clone():
-                                        myInputIdMappingValue instanceof IdBitSet ?
-                                        ((IdBitSet)myInputIdMappingValue).clone():myInputIdMappingValue;
+      container.myInputIdMappingValue = myInputIdMappingValue instanceof ChangeBufferingList ?
+                                        ((ChangeBufferingList)myInputIdMappingValue).clone():
+                                        myInputIdMappingValue;
     }
     return container;
   }
 
-  void ensureFileSetCapacityForValue(Value value, int count) {
+  private void ensureFileSetCapacityForValue(Value value, int count) {
     if (count <= 1) return;
     Object input = getInput(value);
 
     if (input != null) {
       if (input instanceof Integer) {
-        IdSet idSet = new IdSet(count + 1);
-        idSet.add(((Integer)input).intValue());
-        resetFileSetForValue(value, idSet);
-      } else if (input instanceof IdSet) {
-        IdSet idSet = (IdSet)input;
-        int nextSize = idSet.size() + count;
-        if (nextSize <= MAX_FILES) idSet.ensureCapacity(count);
-        else {
-          resetFileSetForValue(value, new IdBitSet(idSet));
-        }
+        ChangeBufferingList list = new ChangeBufferingList(count + 1);
+        list.add(((Integer)input).intValue());
+        resetFileSetForValue(value, list);
+      } else if (input instanceof ChangeBufferingList) {
+        ChangeBufferingList list = (ChangeBufferingList)input;
+        list.ensureCapacity(count);
       }
       return;
     }
 
-    final Object fileSet = count > MAX_FILES ? new IdBitSet(count): new IdSet(count);
+    final Object fileSet = new ChangeBufferingList(count);
     attachFileSetForNewValue(value, fileSet);
   }
 
@@ -454,38 +380,48 @@
       if (input instanceof Integer) {
         DataInputOutputUtil.writeINT(out, (Integer)input); // most common 90% case during index building
       } else {
-        // serialize positive file ids with delta encoding after sorting numbers via bitset
+        // serialize positive file ids with delta encoding
+        ChangeBufferingList originalInput = (ChangeBufferingList)input;
+        IntIterator intIterator = originalInput.intIterator();
+        DataInputOutputUtil.writeINT(out, -intIterator.size());
 
-        if (input instanceof TIntHashSet) {
-          TIntHashSet set = (TIntHashSet)input;
-          DataInputOutputUtil.writeINT(out, -set.size());
-          // todo it would be nice to have compressed random access serializable bitset or at least file ids sorted
-          final int[] max = {0}, min = {Integer.MAX_VALUE};
+        if (intIterator.hasAscendingOrder()) {
+          IdSet checkSet = originalInput.getCheckSet();
+          if (checkSet != null && checkSet.size() != intIterator.size()) {  // debug code
+            int a = 1; assert false;
+          }
+          int prev = 0;
 
-          set.forEach(new TIntProcedure() {
-            @Override
-            public boolean execute(int value) {
-              max[0] = Math.max(max[0], value);
-              min[0] = Math.min(min[0], value);
-              return true;
+          while (intIterator.hasNext()) {
+            int fileId = intIterator.next();
+            if (checkSet != null && !checkSet.contains(fileId)) { // debug code
+              int a = 1; assert false;
             }
-          });
+            DataInputOutputUtil.writeINT(out, fileId - prev);
+            prev = fileId;
+          }
+        } else {
+          // sorting numbers via bitset before writing deltas
+          int max = 0, min = Integer.MAX_VALUE;
 
-          assert min[0] > 0;
+          while(intIterator.hasNext()) {
+            int nextInt = intIterator.next();
+            max = Math.max(max, nextInt);
+            min = Math.min(min, nextInt);
+          }
 
-          final int offset = (min[0] >> INT_BITS_SHIFT) << INT_BITS_SHIFT;
-          final int bitsLength = ((max[0] - offset) >> INT_BITS_SHIFT) + 1;
+          assert min > 0;
+
+          final int offset = (min >> INT_BITS_SHIFT) << INT_BITS_SHIFT;
+          final int bitsLength = ((max - offset) >> INT_BITS_SHIFT) + 1;
           final int[] bits = ourSpareBuffer.getBuffer(bitsLength);
           for(int i = 0; i < bitsLength; ++i) bits[i] = 0;
 
-          set.forEach(new TIntProcedure() {
-            @Override
-            public boolean execute(int value) {
-              final int id = value - offset;
-              bits[id >> INT_BITS_SHIFT] |= (1 << (id));
-              return true;
-            }
-          });
+          intIterator = originalInput.intIterator();
+          while(intIterator.hasNext()) {
+            final int id = intIterator.next() - offset;
+            bits[id >> INT_BITS_SHIFT] |= (1 << (id));
+          }
 
           int pos = nextSetBit(0, bits, bitsLength);
           int prev = 0;
@@ -495,35 +431,16 @@
             prev = pos + offset;
             pos = nextSetBit(pos + 1, bits, bitsLength);
           }
-        } else if (input instanceof IdBitSet) {
-          IdBitSet idBitSet = (IdBitSet)input;
-
-          DataInputOutputUtil.writeINT(out, -idBitSet.numberOfBitsSet());
-
-          int pos = idBitSet.nextSetBit(0);
-          int prev = 0;
-
-          while (pos != -1) {
-            DataInputOutputUtil.writeINT(out, pos - prev);
-            prev = pos;
-            pos = idBitSet.nextSetBit(pos + 1);
-          }
-        } else {
-          throw new IncorrectOperationException("Unexpected else");
         }
       }
     }
   }
 
-  static void saveInvalidateCommand(DataOutput out, int inputId) throws IOException {
-    DataInputOutputUtil.writeINT(out, -inputId);
-  }
-
   public void readFrom(DataInputStream stream, DataExternalizer<Value> externalizer) throws IOException {
     while (stream.available() > 0) {
       final int valueCount = DataInputOutputUtil.readINT(stream);
       if (valueCount < 0) {
-        removeAssociatedValue(-valueCount);
+        removeAssociatedValue(-valueCount); // ChangeTrackingValueContainer marked inputId as invalidated, see ChangeTrackingValueContainer.saveTo
         setNeedsCompacting(true);
       }
       else {
@@ -571,30 +488,10 @@
     public int size() {
       return 1;
     }
-  }
-
-  private static class IntSetIterator implements IntIterator {
-    private final TIntIterator mySetIterator;
-    private final int mySize;
-
-    public IntSetIterator(final TIntHashSet set) {
-      mySetIterator = set.iterator();
-      mySize = set.size();
-    }
 
     @Override
-    public boolean hasNext() {
-      return mySetIterator.hasNext();
-    }
-
-    @Override
-    public int next() {
-      return mySetIterator.next();
-    }
-
-    @Override
-    public int size() {
-      return mySize;
+    public boolean hasAscendingOrder() {
+      return true;
     }
   }
 
@@ -606,10 +503,8 @@
     cloned.forEachEntry(new TObjectObjectProcedure<Value, Object>() {
       @Override
       public boolean execute(Value key, Object val) {
-        if (val instanceof TIntHashSet) {
-          cloned.put(key, ((TIntHashSet)val).clone());
-        } else if (val instanceof IdBitSet) {
-          cloned.put(key, ((IdBitSet)val).clone());
+        if (val instanceof ChangeBufferingList) {
+          cloned.put(key, ((ChangeBufferingList)val).clone());
         }
         return true;
       }
@@ -624,136 +519,4 @@
       return false;
     }
   };
-
-  private static class IdSet extends TIntHashSet {
-
-    private IdSet(final int initialCapacity) {
-      super(initialCapacity, 0.98f);
-    }
-
-    @Override
-    public void compact() {
-      if (((int)(capacity() * _loadFactor)/ Math.max(1, size())) >= 3) {
-        super.compact();
-      }
-    }
-  }
-
-  private static class IdBitSet implements Cloneable {
-    private static final int SHIFT = 6;
-    private static final int BITS_PER_WORD = 1 << SHIFT;
-    private static final int MASK = BITS_PER_WORD - 1;
-    private long[] myBitMask;
-    private int myBitsSet;
-    private int myLastUsedSlot;
-
-    public IdBitSet(TIntHashSet set) {
-      this(calcMax(set));
-      set.forEach(new TIntProcedure() {
-        @Override
-        public boolean execute(int value) {
-          set(value);
-          return true;
-        }
-      });
-    }
-
-    private static int calcMax(TIntHashSet set) {
-      final int[] minMax = new int[2];
-      minMax[0] = set.iterator().next();
-      minMax[1] = minMax[0];
-      set.forEach(new TIntProcedure() {
-        @Override
-        public boolean execute(int value) {
-          minMax[0] = Math.min(minMax[0], value);
-          minMax[1] = Math.max(minMax[1], value);
-          return true;
-        }
-      });
-      return minMax[1];
-    }
-
-    public IdBitSet(int max) {
-      myBitMask = new long[(calcCapacity(max) >> SHIFT) + 1];
-    }
-
-    public void set(int bitIndex) {
-      boolean set = get(bitIndex);
-      if (!set) {
-        ++myBitsSet;
-        int wordIndex = bitIndex >> SHIFT;
-        if (wordIndex >= myBitMask.length) {
-          long[] n = new long[Math.max(calcCapacity(myBitMask.length), wordIndex + 1)];
-          System.arraycopy(myBitMask, 0, n, 0, myBitMask.length);
-          myBitMask = n;
-        }
-        myBitMask[wordIndex] |= 1L << (bitIndex & MASK);
-        myLastUsedSlot = Math.max(myLastUsedSlot, wordIndex);
-      }
-    }
-
-    private static int calcCapacity(int length) {
-      return length + 3 * (length / 5);
-    }
-
-    int numberOfBitsSet() {
-      return myBitsSet;
-    }
-
-    boolean remove(int bitIndex) {
-      if (!get(bitIndex)) return false;
-      --myBitsSet;
-      int wordIndex = bitIndex >> SHIFT;
-      myBitMask[wordIndex] &= ~(1L << (bitIndex & MASK));
-      if (wordIndex == myLastUsedSlot) {
-        while(myLastUsedSlot >= 0 && myBitMask[myLastUsedSlot] == 0) --myLastUsedSlot;
-      }
-      return true;
-    }
-
-    boolean get(int bitIndex) {
-      int wordIndex = bitIndex >> SHIFT;
-      boolean result = false;
-      if (wordIndex < myBitMask.length) {
-        result = (myBitMask[wordIndex] & (1L << (bitIndex & MASK))) != 0;
-      }
-
-      return result;
-    }
-
-    public IdBitSet clone() {
-      try {
-        IdBitSet clone = (IdBitSet)super.clone();
-        if (myBitMask.length != myLastUsedSlot + 1) { // trim to size
-          long[] longs = new long[myLastUsedSlot + 1];
-          System.arraycopy(myBitMask, 0, longs, 0, longs.length);
-          myBitMask = longs;
-        }
-        clone.myBitMask = myBitMask.clone();
-        return clone;
-      } catch (CloneNotSupportedException ex) {
-        LOG.error(ex);
-        return null;
-      }
-    }
-
-    public int nextSetBit(int bitIndex) {
-      int wordIndex = bitIndex >> SHIFT;
-      if (wordIndex >= myBitMask.length) {
-        return -1;
-      }
-
-      long word = myBitMask[wordIndex] & (-1L << bitIndex);
-
-      while (true) {
-        if (word != 0) {
-          return (wordIndex * BITS_PER_WORD) + Long.numberOfTrailingZeros(word);
-        }
-        if (++wordIndex == myBitMask.length) {
-          return -1;
-        }
-        word = myBitMask[wordIndex];
-      }
-    }
-  }
 }
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/containers/ChangeBufferingList.java b/platform/lang-impl/src/com/intellij/util/indexing/containers/ChangeBufferingList.java
new file mode 100644
index 0000000..bbf2832
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/util/indexing/containers/ChangeBufferingList.java
@@ -0,0 +1,274 @@
+/*
+ * 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.util.indexing.containers;
+
+import com.intellij.util.indexing.ValueContainer;
+import gnu.trove.TIntProcedure;
+
+import java.util.Arrays;
+
+/**
+ * Class buffers changes in 2 modes:
+ * - Accumulating up to MAX_FILES changes appending them *sequentially* to changes array
+ * - Adding changes to randomAccessContainer once it is available: later happens if we accumulated many changes or external client queried
+ * state of the changes: asked for predicate, iterator, isEmpty, etc. We are trying hard to delay transformation of state upon 2nd reason for
+ * performance reasons.
+ * It is assumed that add / remove operations as well as read only operations are externally synchronized, the only synchronization is
+ * performed upon transforming changes array into randomAccessContainer because it can be done during read only operations in several threads
+ */
+public class ChangeBufferingList implements Cloneable {
+  static final int MAX_FILES = 20000; // less than Short.MAX_VALUE
+  //static final int MAX_FILES = 100;
+  private volatile int[] changes;
+  private short length;
+  private short removals;
+  private volatile RandomAccessIntContainer randomAccessContainer;
+
+  private static final boolean DEBUG = false;
+  //private static final boolean DEBUG = false;
+  private IdSet checkSet;
+
+  public ChangeBufferingList() { this(3); }
+  public ChangeBufferingList(int length) {
+    if (length > MAX_FILES) {
+      randomAccessContainer = new IdBitSet(length);
+    } else {
+      changes = new int[length];
+    }
+    checkSet = DEBUG ? new IdSet(length) : null;
+  }
+
+  static int[] calcMinMax(int[] set, int length) {
+    int max = Integer.MIN_VALUE;
+    int min = Integer.MAX_VALUE;
+    for(int i = 0; i < length; ++i) {
+      max = Math.max(max, set[i]);
+      min = Math.min(min, set[i]);
+    }
+    return new int[] {min, max};
+  }
+
+  public void add(int value) {
+    ensureCapacity(1);
+    if (DEBUG) checkSet.add(value);
+    RandomAccessIntContainer intContainer = randomAccessContainer;
+    if (intContainer == null) {
+      addChange(value);
+    } else {
+      intContainer.add(value);
+    }
+  }
+
+  private void addChange(int value) {
+    changes[length++] = value;
+    if (value < 0) ++removals;
+  }
+
+  public void remove(int value) {
+    if (DEBUG) checkSet.remove(value);
+    RandomAccessIntContainer intContainer = randomAccessContainer;
+    if (intContainer == null) {
+      ensureCapacity(1);
+      addChange(-value);
+    }
+    else {
+      boolean removed = intContainer.remove(value);
+      if (removed) intContainer.compact();
+    }
+  }
+
+  @Override
+  public Object clone() {
+    try {
+      ChangeBufferingList clone = (ChangeBufferingList)super.clone();
+      if (changes != null) clone.changes = changes.clone();
+      if (randomAccessContainer != null) {
+        clone.randomAccessContainer = (RandomAccessIntContainer)randomAccessContainer.clone();
+      }
+      if (checkSet != null) clone.checkSet = (IdSet)checkSet.clone();
+      return clone;
+    }
+    catch (CloneNotSupportedException e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  private RandomAccessIntContainer getRandomAccessContainer() {
+    int[] currentChanges = changes;
+    if (currentChanges == null) return randomAccessContainer;
+
+    synchronized (currentChanges) {
+      currentChanges = changes;
+      if (currentChanges == null) return randomAccessContainer;
+      boolean copyChanges = true;
+      RandomAccessIntContainer idSet;
+
+      if (randomAccessContainer == null) {
+        int someElementsNumberEstimation = length - removals;
+        int[] minMax = calcMinMax(changes, length);
+
+        // todo we can check these lengths instead of only relying upon reaching MAX_FILES
+        int lengthOfBitSet = IdBitSet.sizeInBytes(minMax[1], minMax[0]);
+        int lengthOfIntSet = 4 * length;
+
+        if (someElementsNumberEstimation < MAX_FILES) {
+          if (removals == 0) {
+            Arrays.sort(currentChanges, 0, length);
+            idSet = new SortedIdSet(currentChanges, length);
+            copyChanges = false;
+          } else {
+            idSet = new SortedIdSet(Math.max(someElementsNumberEstimation, 3));
+          }
+        }
+        else if (removals == 0) {
+          if (lengthOfBitSet > lengthOfIntSet) {
+            int a = 1;
+          }
+          idSet = new IdBitSet(changes, length, 0);
+          copyChanges = false;
+        } else {
+          idSet = new IdBitSet(minMax, 0);
+        }
+      } else if (DEBUG) {
+        idSet = (RandomAccessIntContainer)randomAccessContainer.clone();
+      } else {
+        idSet = randomAccessContainer;
+      }
+
+      assert idSet != null;
+
+      if (copyChanges) {
+        for(int i = 0, len = length; i < len; ++i) {
+          int id = currentChanges[i];
+          if (id > 0) {
+            idSet.add(id);
+          } else {
+            idSet.remove(-id);
+          }
+        }
+      }
+
+      if (DEBUG) {
+        if(checkSet.size() != idSet.size()) {
+          int a = 1; assert false;
+        }
+        final RandomAccessIntContainer finalIdSet = idSet;
+        checkSet.forEach(new TIntProcedure() {
+          @Override
+          public boolean execute(int value) {
+            if (!finalIdSet.contains(value)) {
+              int a = 1; assert false;
+            }
+            return true;
+          }
+        });
+      }
+
+      length = 0;
+      removals = 0;
+      randomAccessContainer = idSet;
+      changes = null;
+      return randomAccessContainer;
+    }
+  }
+
+  public void ensureCapacity(int diff) {
+    RandomAccessIntContainer intContainer = randomAccessContainer;
+    if (length == MAX_FILES) {
+      intContainer = getRandomAccessContainer(); // transform into more compact storage
+    }
+    if (intContainer != null) {
+      randomAccessContainer = intContainer.ensureContainerCapacity(diff);
+      return;
+    }
+    if (changes == null) {
+      changes = new int[Math.max(3, diff)];
+    } else if (length + diff > changes.length) {
+      int[] newChanges = new int[calcNextArraySize(changes.length, length + diff)];
+      System.arraycopy(changes, 0, newChanges, 0, length);
+      changes = newChanges;
+    }
+  }
+
+  static int calcNextArraySize(int currentSize, int wantedSize) {
+    return Math.min(
+          Math.max(currentSize < 1024 ? currentSize << 1 : currentSize + currentSize / 5, wantedSize),
+          MAX_FILES
+        );
+  }
+
+  public boolean isEmpty() {
+    if (randomAccessContainer == null) {
+      if (changes == null) return true;
+      if (removals == 0) return length == 0;
+    }
+    // todo we can calculate isEmpty in more cases (without container)
+    RandomAccessIntContainer intContainer = getRandomAccessContainer();
+    return intContainer.size() == 0;
+  }
+
+  public ValueContainer.IntPredicate intPredicate() {
+    final ValueContainer.IntPredicate predicate = getRandomAccessContainer().intPredicate();
+    if (DEBUG) {
+      return new ValueContainer.IntPredicate() {
+        @Override
+        public boolean contains(int id) {
+          boolean answer = predicate.contains(id);
+          if (answer != checkSet.contains(id)) {
+            int a = 1; assert false;
+          }
+          return answer;
+        }
+      };
+    }
+    return predicate;
+  }
+
+  public ValueContainer.IntIterator intIterator() {
+    RandomAccessIntContainer intContainer = randomAccessContainer;
+    if (intContainer == null && removals == 0) {
+      return new ValueContainer.IntIterator() {
+        int cursor;
+        @Override
+        public boolean hasNext() {
+          return cursor < length;
+        }
+
+        @Override
+        public int next() {
+          int current = cursor;
+          ++cursor;
+          return changes[current];
+        }
+
+        @Override
+        public int size() {
+          return length;
+        }
+
+        @Override
+        public boolean hasAscendingOrder() {
+          return false;
+        }
+      };
+    }
+    return getRandomAccessContainer().intIterator();
+  }
+
+  public IdSet getCheckSet() {
+    return checkSet;
+  }
+}
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/containers/IdBitSet.java b/platform/lang-impl/src/com/intellij/util/indexing/containers/IdBitSet.java
new file mode 100644
index 0000000..be70286
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/util/indexing/containers/IdBitSet.java
@@ -0,0 +1,224 @@
+/*
+ * 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.util.indexing.containers;
+
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.util.indexing.ValueContainer;
+
+/**
+* Created by Maxim.Mossienko on 5/27/2014.
+*/
+class IdBitSet implements Cloneable, RandomAccessIntContainer {
+  private static final int SHIFT = 6;
+  private static final int BITS_PER_WORD = 1 << SHIFT;
+  private static final int MASK = BITS_PER_WORD - 1;
+  private long[] myBitMask;
+  private int myBitsSet;
+  private int myLastUsedSlot;
+  private int myBase = -1;
+
+  public IdBitSet(int capacity) {
+    myBitMask = new long[(calcCapacity(capacity) >> SHIFT) + 1];
+  }
+
+  public IdBitSet(int[] set, int count, int additional) {
+    this(ChangeBufferingList.calcMinMax(set, count), additional);
+    for(int i = 0; i < count; ++i) add(set[i]);
+  }
+
+  public IdBitSet(RandomAccessIntContainer set, int additionalCount) {
+    this(calcMax(set), additionalCount);
+    ValueContainer.IntIterator iterator = set.intIterator();
+    while(iterator.hasNext()) {
+      add(iterator.next());
+    }
+  }
+
+  private static int[] calcMax(RandomAccessIntContainer set) {
+    int min = Integer.MAX_VALUE;
+    int max = Integer.MIN_VALUE;
+    ValueContainer.IntIterator iterator = set.intIterator();
+    while(iterator.hasNext()) {
+      int next = iterator.next();
+      min = Math.min(min, next);
+      max = Math.max(max, next);
+    }
+
+    return new int[] {min, max};
+  }
+
+  IdBitSet(int[] minMax, int additionalCount) {
+    int min = minMax[0];
+    int base = roundToNearest(min);
+    myBase = base;
+    myBitMask = new long[((calcCapacity(minMax[1] - base) + additionalCount) >> SHIFT) + 1];
+  }
+
+  static int roundToNearest(int min) {
+    return (min >> SHIFT) << SHIFT;
+  }
+
+  public boolean add(int bitIndex) {
+    boolean set = contains(bitIndex);
+    if (!set) {
+      if (myBase < 0) {
+        myBase = roundToNearest(bitIndex);
+      } else if (bitIndex < myBase) {
+        int newBase = roundToNearest(bitIndex);
+        int wordDiff = (myBase - newBase) >> SHIFT;
+        long[] n = new long[wordDiff + myBitMask.length];
+        System.arraycopy(myBitMask, 0, n, wordDiff, myBitMask.length);
+        myBitMask = n;
+        myBase = newBase;
+        myLastUsedSlot += wordDiff;
+      }
+      ++myBitsSet;
+      bitIndex -= myBase;
+      int wordIndex = bitIndex >> SHIFT;
+      if (wordIndex >= myBitMask.length) {
+        long[] n = new long[Math.max(calcCapacity(myBitMask.length), wordIndex + 1)];
+        System.arraycopy(myBitMask, 0, n, 0, myBitMask.length);
+        myBitMask = n;
+      }
+      myBitMask[wordIndex] |= 1L << (bitIndex & MASK);
+      myLastUsedSlot = Math.max(myLastUsedSlot, wordIndex);
+    }
+    return !set;
+  }
+
+  private static int calcCapacity(int length) {
+    return length + 3 * (length / 5);
+  }
+
+  public int size() {
+    return myBitsSet;
+  }
+
+  public boolean remove(int bitIndex) {
+    if (bitIndex < myBase || myBase < 0) return false;
+    if (!contains(bitIndex)) return false;
+    --myBitsSet;
+    bitIndex -= myBase;
+    int wordIndex = bitIndex >> SHIFT;
+    myBitMask[wordIndex] &= ~(1L << (bitIndex & MASK));
+    if (wordIndex == myLastUsedSlot) {
+      while(myLastUsedSlot >= 0 && myBitMask[myLastUsedSlot] == 0) --myLastUsedSlot;
+    }
+    return true;
+  }
+
+  @Override
+  public ValueContainer.IntIterator intIterator() {
+    return new Iterator();
+  }
+
+  @Override
+  public ValueContainer.IntPredicate intPredicate() {
+    return new ValueContainer.IntPredicate() {
+      @Override
+      public boolean contains(int id) {
+        return IdBitSet.this.contains(id);
+      }
+    };
+  }
+
+  @Override
+  public void compact() {}
+
+  public boolean contains(int bitIndex) {
+    if (bitIndex < myBase || myBase < 0) return false;
+    bitIndex -= myBase;
+    int wordIndex = bitIndex >> SHIFT;
+    boolean result = false;
+    if (wordIndex < myBitMask.length) {
+      result = (myBitMask[wordIndex] & (1L << (bitIndex & MASK))) != 0;
+    }
+
+    return result;
+  }
+
+  @Override
+  public RandomAccessIntContainer ensureContainerCapacity(int diff) {
+    return this; // todo
+  }
+
+  public IdBitSet clone() {
+    try {
+      IdBitSet clone = (IdBitSet)super.clone();
+      if (myBitMask.length != myLastUsedSlot + 1) { // trim to size
+        long[] longs = new long[myLastUsedSlot + 1];
+        System.arraycopy(myBitMask, 0, longs, 0, longs.length);
+        myBitMask = longs;
+      }
+      clone.myBitMask = myBitMask.clone();
+      return clone;
+    } catch (CloneNotSupportedException ex) {
+      Logger.getInstance(getClass().getName()).error(ex);
+      return null;
+    }
+  }
+
+  private int nextSetBit(int bitIndex) {
+    assert myBase >= 0;
+    if (bitIndex >= myBase) bitIndex -= myBase;
+    int wordIndex = bitIndex >> SHIFT;
+    if (wordIndex > myLastUsedSlot) {
+      return -1;
+    }
+
+    long word = myBitMask[wordIndex] & (-1L << bitIndex);
+
+    while (true) {
+      if (word != 0) {
+        return (wordIndex * BITS_PER_WORD) + Long.numberOfTrailingZeros(word) + myBase;
+      }
+      if (++wordIndex > myLastUsedSlot) {
+        return -1;
+      }
+      word = myBitMask[wordIndex];
+    }
+  }
+
+  public static int sizeInBytes(int max, int min) {
+    return calcCapacity(((roundToNearest(max) - roundToNearest(min)) >> SHIFT) + 1) * 8;
+  }
+
+  private class Iterator implements ValueContainer.IntIterator {
+    private int nextSetBit = nextSetBit(0);
+
+    @Override
+    public boolean hasNext() {
+      return nextSetBit != -1;
+    }
+
+    @Override
+    public int next() {
+      int setBit = nextSetBit;
+      nextSetBit = nextSetBit(setBit + 1);
+      return setBit;
+    }
+
+    @Override
+    public int size() {
+      return IdBitSet.this.size();
+    }
+
+    @Override
+    public boolean hasAscendingOrder() {
+      return true;
+    }
+  }
+}
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/containers/IdSet.java b/platform/lang-impl/src/com/intellij/util/indexing/containers/IdSet.java
new file mode 100644
index 0000000..f09dea8
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/util/indexing/containers/IdSet.java
@@ -0,0 +1,83 @@
+/*
+ * 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.util.indexing.containers;
+
+import com.intellij.util.indexing.ValueContainer;
+import gnu.trove.TIntHashSet;
+import gnu.trove.TIntIterator;
+
+public class IdSet extends TIntHashSet implements RandomAccessIntContainer {
+  public IdSet(final int initialCapacity) {
+    super(initialCapacity, 0.98f);
+  }
+
+  @Override
+  public void compact() {
+    if (((int)(capacity() * _loadFactor)/ Math.max(1, size())) >= 3) {
+      super.compact();
+    }
+  }
+
+  @Override
+  public RandomAccessIntContainer ensureContainerCapacity(int diff) {
+    return this; // todo
+  }
+
+  @Override
+  public ValueContainer.IntPredicate intPredicate() {
+    return new ValueContainer.IntPredicate() {
+      @Override
+      public boolean contains(int id) {
+        return IdSet.this.contains(id);
+      }
+    };
+  }
+
+  @Override
+  public ValueContainer.IntIterator intIterator() {
+    return new IntSetIterator();
+  }
+
+  private class IntSetIterator implements ValueContainer.IntIterator {
+    private final TIntIterator mySetIterator;
+    private final int mySize;
+
+    public IntSetIterator() {
+      mySetIterator = iterator();
+      mySize = IdSet.this.size();
+    }
+
+    @Override
+    public boolean hasNext() {
+      return mySetIterator.hasNext();
+    }
+
+    @Override
+    public int next() {
+      return mySetIterator.next();
+    }
+
+    @Override
+    public int size() {
+      return mySize;
+    }
+
+    @Override
+    public boolean hasAscendingOrder() {
+      return false;
+    }
+  }
+}
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/containers/RandomAccessIntContainer.java b/platform/lang-impl/src/com/intellij/util/indexing/containers/RandomAccessIntContainer.java
new file mode 100644
index 0000000..3618cb9
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/util/indexing/containers/RandomAccessIntContainer.java
@@ -0,0 +1,35 @@
+/*
+ * 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.util.indexing.containers;
+
+import com.intellij.util.indexing.ValueContainer;
+
+/**
+* Created by Maxim.Mossienko on 5/27/2014.
+*/
+interface RandomAccessIntContainer {
+  Object clone();
+  boolean add(int value);
+  boolean remove(int value);
+  ValueContainer.IntIterator intIterator();
+  ValueContainer.IntPredicate intPredicate();
+  void compact();
+  int size();
+
+  boolean contains(int value);
+
+  RandomAccessIntContainer ensureContainerCapacity(int diff);
+}
diff --git a/platform/lang-impl/src/com/intellij/util/indexing/containers/SortedIdSet.java b/platform/lang-impl/src/com/intellij/util/indexing/containers/SortedIdSet.java
new file mode 100644
index 0000000..5405bbc
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/util/indexing/containers/SortedIdSet.java
@@ -0,0 +1,233 @@
+/*
+ * 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.util.indexing.containers;
+
+import com.intellij.util.indexing.ValueContainer;
+import gnu.trove.TIntProcedure;
+
+/**
+* Created by Maxim.Mossienko on 5/27/2014.
+*/
+public class SortedIdSet implements Cloneable, RandomAccessIntContainer {
+  private int[] mySet;
+  private int mySetLength;
+  private int mySize;
+
+  public SortedIdSet(final int initialCapacity) {
+    assert initialCapacity < Short.MAX_VALUE;
+    mySet = new int[initialCapacity]; // todo slightly increase size
+  }
+
+  public SortedIdSet(final int[] array, int size) {
+    mySet = array;
+    mySetLength = mySize = size;
+  }
+
+  public boolean isEmpty() {
+    return mySize == 0;
+  }
+
+  public int size() {
+    return mySize;
+  }
+
+  public boolean add(int value) {
+    assert value > 0;
+    int pos;
+
+    if (mySetLength == 0 || (mySetLength > 0 && Math.abs(mySet[mySetLength -1]) < value)) {
+      pos = -mySetLength-1; // most of the time during bulk indexing we add near the end
+    }
+    else {
+      pos = binarySearch(mySet, 0, mySetLength, value);
+    }
+    if (pos >= 0) {
+      if (mySet[pos] > 0) return false;
+      pos = -pos - 1; // found removed
+    }
+    if (mySetLength == mySet.length) {
+      int nextArraySize = mySet.length < 1024 ? mySet.length << 1 : mySet.length + mySet.length / 5;
+      int[] newSet = new int[nextArraySize];
+      System.arraycopy(mySet, 0, newSet, 0, mySet.length);
+      mySet = newSet;
+    }
+    pos = -pos - 1;
+
+    boolean lengthIsIncreased = pos == mySetLength;  // insert at end
+    if (!lengthIsIncreased && Math.abs(mySet[pos]) != value) { // todo we can shift until first removed
+      System.arraycopy(mySet, pos, mySet, pos + 1, mySetLength - pos);
+      lengthIsIncreased = true;
+    }
+    mySet[pos] = value;
+    ++mySize;
+    if (lengthIsIncreased) ++mySetLength;
+    return true;
+  }
+
+  public boolean remove(int value) {
+    assert value > 0;
+    int pos = binarySearch(mySet, 0, mySetLength, value);
+    if (pos < 0 || mySet[pos] < 0) return false;
+    mySet[pos] = -value;
+    //if (pos != mySetLength - 1) System.arraycopy(mySet, pos + 1, mySet, pos, mySetLength - pos - 1);
+    --mySize;
+    //--mySetLength;
+    return true;
+  }
+
+  @Override
+  public ValueContainer.IntIterator intIterator() {
+    return new Iterator();
+  }
+
+  @Override
+  public ValueContainer.IntPredicate intPredicate() {
+    return new ValueContainer.IntPredicate() {
+
+      @Override
+      public boolean contains(int id) {
+        return SortedIdSet.this.contains(id);
+      }
+    };
+  }
+
+  private class Iterator implements ValueContainer.IntIterator {
+    private int myCursor;
+
+    Iterator() {
+      myCursor = findNext(0);
+    }
+
+    @Override
+    public boolean hasNext() {
+      return myCursor != -1;
+    }
+
+    @Override
+    public int next() {
+      int result = get(myCursor);
+      myCursor = findNext(myCursor + 1);
+      return result;
+    }
+
+    @Override
+    public int size() {
+      return SortedIdSet.this.size();
+    }
+
+    @Override
+    public boolean hasAscendingOrder() {
+      return true;
+    }
+  }
+
+  private static int binarySearch(int[] set, int off, int length, int key) {
+    int low = off;
+    int high = length - 1;
+
+    while (low <= high) {
+      int mid = (low + high) >>> 1;
+      int midVal = Math.abs(set[mid]);
+
+      if (midVal < key)
+        low = mid + 1;
+      else if (midVal > key)
+        high = mid - 1;
+      else
+        return mid; // key found
+    }
+    return -(low + 1);  // key not found.
+  }
+
+  public void forEach(TIntProcedure procedure) {
+    for(int i = 0; i < mySetLength; ++i) {
+      int value = mySet[i];
+      if (value > 0 && !procedure.execute(value)) break;
+    }
+  }
+
+  public boolean contains(int value) {
+    assert value > 0;
+    int pos = binarySearch(mySet, 0, mySetLength, value);
+    return pos >= 0 && mySet[pos] > 0;
+  }
+
+  @Override
+  public Object clone() {
+    try {
+      SortedIdSet set = (SortedIdSet)super.clone();
+      set.mySet = mySet.clone();
+      return set;
+    }
+    catch (CloneNotSupportedException e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  public void compact() {
+    if(2 * mySize < mySetLength && mySetLength > 5) {
+      int positivePosition = -1;
+      for(int i = 0; i < mySetLength; ++i) {
+        if (mySet[i] < 0) {
+          while(i < mySetLength && mySet[i] < 0) ++i;
+
+          if (i == mySetLength) {
+            break;
+          } else {
+            mySet[++positivePosition] = mySet[i];
+          }
+        } else {
+          ++positivePosition;
+          if (i != positivePosition) mySet[positivePosition] = mySet[i];
+        }
+      }
+      // todo slightly decrease size
+      mySetLength = (short)(positivePosition + 1);
+    }
+  }
+
+  public RandomAccessIntContainer ensureContainerCapacity(int count) {
+    int newSize = mySetLength + count;
+    if (newSize < mySet.length) return this;
+    if (newSize > ChangeBufferingList.MAX_FILES) {
+      return new IdBitSet(this, count);
+    }
+
+    newSize = ChangeBufferingList.calcNextArraySize(mySet.length, newSize);
+    assert newSize < Short.MAX_VALUE;
+
+    int[] newSet = new int[newSize]; // todo slightly increase size and compact
+    System.arraycopy(mySet, 0, newSet, 0, mySetLength);
+    mySet = newSet;
+
+    return this;
+  }
+
+  public int findNext(int i) {
+    while(i < mySetLength) {
+      if (mySet[i] > 0) return i;
+      ++i;
+    }
+    return -1;
+  }
+
+  public int get(int cursor) {
+    assert cursor < mySetLength;
+    int value = mySet[cursor];
+    assert value > 0;
+    return value;
+  }
+}
diff --git a/platform/lang-impl/src/com/intellij/webcore/packaging/PackagesNotificationPanel.java b/platform/lang-impl/src/com/intellij/webcore/packaging/PackagesNotificationPanel.java
index 0795c48..cb281cb 100644
--- a/platform/lang-impl/src/com/intellij/webcore/packaging/PackagesNotificationPanel.java
+++ b/platform/lang-impl/src/com/intellij/webcore/packaging/PackagesNotificationPanel.java
@@ -141,4 +141,8 @@
       return dimension;
     }
   }
+
+  public void removeLinkHandler(String key) {
+    myLinkHandlers.remove(key);
+  }
 }
diff --git a/platform/lvcs-impl/src/com/intellij/history/integration/ui/views/HistoryDialog.java b/platform/lvcs-impl/src/com/intellij/history/integration/ui/views/HistoryDialog.java
index b00cb32..8cbace1 100644
--- a/platform/lvcs-impl/src/com/intellij/history/integration/ui/views/HistoryDialog.java
+++ b/platform/lvcs-impl/src/com/intellij/history/integration/ui/views/HistoryDialog.java
@@ -196,7 +196,7 @@
     myToolBar = createRevisionsToolbar(actions);
     myRevisionsList = new RevisionsList(new RevisionsList.SelectionListener() {
       public void revisionsSelected(final int first, final int last) {
-        scheduleDiffUpdate(Couple.newOne(first, last));
+        scheduleDiffUpdate(Couple.of(first, last));
       }
     });
     addPopupMenuToComponent(myRevisionsList.getComponent(), actions);
diff --git a/platform/platform-api/src/com/intellij/execution/configurations/EncodingEnvironmentUtil.java b/platform/platform-api/src/com/intellij/execution/configurations/EncodingEnvironmentUtil.java
index 7463b8b..e8999b1 100644
--- a/platform/platform-api/src/com/intellij/execution/configurations/EncodingEnvironmentUtil.java
+++ b/platform/platform-api/src/com/intellij/execution/configurations/EncodingEnvironmentUtil.java
@@ -27,6 +27,7 @@
 import org.jetbrains.annotations.Nullable;
 
 import java.nio.charset.Charset;
+import java.util.Locale;
 import java.util.Map;
 
 public class EncodingEnvironmentUtil {
@@ -74,12 +75,23 @@
   }
 
   private static void setLocaleEnvironment(@NotNull Map<String, String> env, @NotNull Charset charset) {
-    env.put(LC_CTYPE, charset.name());
+    env.put(LC_CTYPE, formatLocaleValue(charset));
     if (LOG.isDebugEnabled()) {
       LOG.debug("Fixed mac locale: " + charset.name());
     }
   }
 
+  @NotNull
+  private static String formatLocaleValue(@NotNull Charset charset) {
+    Locale locale = Locale.getDefault();
+    String language = locale.getLanguage();
+    String country = locale.getCountry();
+    if (language.isEmpty() || country.isEmpty()) {
+      return "en_US." + charset.name();
+    }
+    return language + "_" + country + "." + charset.name();
+  }
+
   /**
    * Sets default encoding on Mac if it's undefined. <br/>
    * @deprecated Use {@link #setLocaleEnvironmentIfMac(java.util.Map, java.nio.charset.Charset)} instead. To be removed in IDEA 15.
diff --git a/platform/platform-api/src/com/intellij/ide/browsers/BrowserLauncherAppless.java b/platform/platform-api/src/com/intellij/ide/browsers/BrowserLauncherAppless.java
index c1f0c8b..0c34152 100644
--- a/platform/platform-api/src/com/intellij/ide/browsers/BrowserLauncherAppless.java
+++ b/platform/platform-api/src/com/intellij/ide/browsers/BrowserLauncherAppless.java
@@ -31,7 +31,7 @@
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.ui.Messages;
-import com.intellij.openapi.util.Couple;
+import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.util.SystemInfo;
 import com.intellij.openapi.util.io.FileUtil;
@@ -198,7 +198,7 @@
         url = url.substring(0, sharpPos);
       }
 
-      Couple<String> pair = URLUtil.splitJarUrl(url);
+      Pair<String, String> pair = URLUtil.splitJarUrl(url);
       if (pair == null) return null;
 
       File jarFile = new File(FileUtil.toSystemDependentName(pair.first));
diff --git a/platform/platform-api/src/com/intellij/openapi/fileEditor/AsyncFileEditorProvider.java b/platform/platform-api/src/com/intellij/openapi/fileEditor/AsyncFileEditorProvider.java
new file mode 100644
index 0000000..1967fa7
--- /dev/null
+++ b/platform/platform-api/src/com/intellij/openapi/fileEditor/AsyncFileEditorProvider.java
@@ -0,0 +1,33 @@
+/*
+ * 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.openapi.fileEditor;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vfs.VirtualFile;
+import org.jetbrains.annotations.NotNull;
+
+public interface AsyncFileEditorProvider extends FileEditorProvider {
+  /**
+   * This method is intended to be called from background thread. It should perform all time-consuming tasks required to build an editor,
+   * and return a builder instance that will be called in EDT to create UI for the editor.
+   */
+  @NotNull
+  Builder createEditorAsync(@NotNull Project project, @NotNull VirtualFile file);
+
+  abstract class Builder {
+    public abstract FileEditor build();
+  }
+}
diff --git a/platform/platform-api/src/com/intellij/openapi/fileEditor/UniqueVFilePathBuilder.java b/platform/platform-api/src/com/intellij/openapi/fileEditor/UniqueVFilePathBuilder.java
index 7ecc0ea..281fa26 100644
--- a/platform/platform-api/src/com/intellij/openapi/fileEditor/UniqueVFilePathBuilder.java
+++ b/platform/platform-api/src/com/intellij/openapi/fileEditor/UniqueVFilePathBuilder.java
@@ -30,6 +30,12 @@
     public String getUniqueVirtualFilePath(Project project, VirtualFile vFile) {
       return vFile.getPresentableName();
     }
+
+    @NotNull
+    @Override
+    public String getUniqueVirtualFilePathWithinOpenedFileEditors(Project project, VirtualFile vFile) {
+      return vFile.getPresentableName();
+    }
   };
 
   public static UniqueVFilePathBuilder getInstance() {
@@ -42,4 +48,7 @@
 
   @NotNull
   public abstract String getUniqueVirtualFilePath(Project project, VirtualFile vFile);
+
+  @NotNull
+  public abstract String getUniqueVirtualFilePathWithinOpenedFileEditors(Project project, VirtualFile vFile);
 }
diff --git a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java
index 0144cf4..188618e 100644
--- a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java
+++ b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java
@@ -1569,33 +1569,17 @@
   }
 
   private void registerKeyboardShortcuts() {
-    ActionListener cancelKeyboardAction = new ActionListener() {
-      @Override
-      public void actionPerformed(ActionEvent e) {
-        MenuSelectionManager menuSelectionManager = MenuSelectionManager.defaultManager();
-        MenuElement[] selectedPath = menuSelectionManager.getSelectedPath();
-        if (selectedPath.length > 0) { // hide popup menu if any
-          menuSelectionManager.clearSelectedPath();
-        }
-        else {
-          if (ApplicationManager.getApplication() == null) {
-            doCancelAction(e);
-            return;
-          }
-          final StackingPopupDispatcher popupDispatcher = StackingPopupDispatcher.getInstance();
-          if (popupDispatcher != null && !popupDispatcher.isPopupFocused()) {
-            doCancelAction(e);
-          }
-        }
-      }
-    };
 
     final JRootPane rootPane = getRootPane();
 
     if (rootPane == null) return;
 
-    rootPane.registerKeyboardAction(cancelKeyboardAction, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
-    registerForEveryKeyboardShortcut(cancelKeyboardAction, CommonShortcuts.getCloseActiveWindow());
+    ActionListener cancelKeyboardAction = createCancelAction();
+    if (cancelKeyboardAction != null) {
+      rootPane
+        .registerKeyboardAction(cancelKeyboardAction, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
+      registerForEveryKeyboardShortcut(cancelKeyboardAction, CommonShortcuts.getCloseActiveWindow());
+    }
 
     if (ApplicationInfo.contextHelpAvailable()) {
       ActionListener helpAction = new ActionListener() {
@@ -1633,6 +1617,34 @@
     }
   }
 
+  /**
+   *
+   * @return null if we should ignore <Esc> for window closing
+   */
+  @Nullable
+  protected ActionListener createCancelAction() {
+    return new ActionListener() {
+        @Override
+        public void actionPerformed(ActionEvent e) {
+          MenuSelectionManager menuSelectionManager = MenuSelectionManager.defaultManager();
+          MenuElement[] selectedPath = menuSelectionManager.getSelectedPath();
+          if (selectedPath.length > 0) { // hide popup menu if any
+            menuSelectionManager.clearSelectedPath();
+          }
+          else {
+            if (ApplicationManager.getApplication() == null) {
+              doCancelAction(e);
+              return;
+            }
+            final StackingPopupDispatcher popupDispatcher = StackingPopupDispatcher.getInstance();
+            if (popupDispatcher != null && !popupDispatcher.isPopupFocused()) {
+              doCancelAction(e);
+            }
+          }
+        }
+      };
+  }
+
   private void registerForEveryKeyboardShortcut(ActionListener action, @NotNull ShortcutSet shortcuts) {
     for (Shortcut shortcut : shortcuts.getShortcuts()) {
       if (shortcut instanceof KeyboardShortcut) {
diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/VfsUtil.java b/platform/platform-api/src/com/intellij/openapi/vfs/VfsUtil.java
index f244155..3cd4670 100644
--- a/platform/platform-api/src/com/intellij/openapi/vfs/VfsUtil.java
+++ b/platform/platform-api/src/com/intellij/openapi/vfs/VfsUtil.java
@@ -26,11 +26,12 @@
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
-import com.intellij.util.*;
+import com.intellij.util.ArrayUtil;
+import com.intellij.util.Function;
+import com.intellij.util.Processor;
+import com.intellij.util.SystemProperties;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.Convertor;
-import com.intellij.util.io.fs.FileSystem;
-import com.intellij.util.io.fs.IFile;
 import com.intellij.util.lang.UrlClassLoader;
 import gnu.trove.THashSet;
 import org.jetbrains.annotations.NonNls;
@@ -288,11 +289,6 @@
     }
   }
 
-  @NotNull
-  public static IFile virtualToIFile(@NotNull VirtualFile file) {
-    return FileSystem.FILE_SYSTEM.createFile(PathUtil.toPresentableUrl(file.getUrl()));
-  }
-
   public static VirtualFile copyFileRelative(Object requestor, @NotNull VirtualFile file, @NotNull VirtualFile toDir, @NotNull String relativePath) throws IOException {
     StringTokenizer tokenizer = new StringTokenizer(relativePath,"/");
     VirtualFile curDir = toDir;
diff --git a/platform/platform-api/src/com/intellij/ui/TableScrollingUtil.java b/platform/platform-api/src/com/intellij/ui/TableScrollingUtil.java
index 724e128..3d81600 100644
--- a/platform/platform-api/src/com/intellij/ui/TableScrollingUtil.java
+++ b/platform/platform-api/src/com/intellij/ui/TableScrollingUtil.java
@@ -92,7 +92,7 @@
 
   public static Couple<Integer> getVisibleRows(JTable list) {
     Rectangle visibleRect = list.getVisibleRect();
-    return Couple.newOne(getLeadingRow(list, visibleRect) + 1, getTrailingRow(list, visibleRect));
+    return Couple.of(getLeadingRow(list, visibleRect) + 1, getTrailingRow(list, visibleRect));
   }
 
   private static int getLeadingRow(JTable table,Rectangle visibleRect) {
diff --git a/platform/platform-api/src/com/intellij/ui/components/JBList.java b/platform/platform-api/src/com/intellij/ui/components/JBList.java
index fbcdb61..6d14c60 100644
--- a/platform/platform-api/src/com/intellij/ui/components/JBList.java
+++ b/platform/platform-api/src/com/intellij/ui/components/JBList.java
@@ -192,7 +192,7 @@
     return myEmptyText;
   }
 
-  public void setEmptyText(String text) {
+  public void setEmptyText(@NotNull String text) {
     myEmptyText.setText(text);
   }
 
diff --git a/platform/platform-api/src/com/intellij/ui/docking/DockContainer.java b/platform/platform-api/src/com/intellij/ui/docking/DockContainer.java
index d2201cd..6c1328f 100644
--- a/platform/platform-api/src/com/intellij/ui/docking/DockContainer.java
+++ b/platform/platform-api/src/com/intellij/ui/docking/DockContainer.java
@@ -45,6 +45,9 @@
 
   void add(@NotNull DockableContent content, RelativePoint dropTarget);
 
+  /**
+   * Closes all contained editors.
+   */
   void closeAll();
 
   void addListener(Listener listener, Disposable parent);
diff --git a/platform/platform-impl/src/com/intellij/application/options/SaveSchemeDialog.java b/platform/platform-impl/src/com/intellij/application/options/SaveSchemeDialog.java
index 5433b27..bfc4b07 100644
--- a/platform/platform-impl/src/com/intellij/application/options/SaveSchemeDialog.java
+++ b/platform/platform-impl/src/com/intellij/application/options/SaveSchemeDialog.java
@@ -23,19 +23,22 @@
 import com.intellij.openapi.application.ApplicationBundle;
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.ui.Messages;
+import com.intellij.util.text.UniqueNameGenerator;
+import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
 import java.awt.*;
-import java.util.ArrayList;
+import java.util.List;
 
 public class SaveSchemeDialog extends DialogWrapper {
   private final JTextField mySchemeName = new JTextField();
-  private final ArrayList myInvalidNames;
+  private final List<String> myExistingNames;
 
-  public SaveSchemeDialog(Component parent, String title, ArrayList invalidNames){
+  public SaveSchemeDialog(@NotNull Component parent, String title, @NotNull List<String> existingNames, @NotNull String selectedName) {
     super(parent, false);
-    myInvalidNames = invalidNames;
+    myExistingNames = existingNames;
     setTitle(title);
+    mySchemeName.setText(UniqueNameGenerator.generateUniqueName(selectedName + " copy", existingNames));
     init();
   }
 
@@ -73,13 +76,12 @@
                                  CommonBundle.getErrorTitle(), Messages.getErrorIcon());
       return;
     }
-    else
-    //noinspection HardCodedStringLiteral
-    if ("default".equals(getSchemeName())) {
-      Messages.showMessageDialog(getContentPane(),ApplicationBundle.message("error.illegal.scheme.name"),
+    else if ("default".equals(getSchemeName())) {
+      Messages.showMessageDialog(getContentPane(), ApplicationBundle.message("error.illegal.scheme.name"),
                                  CommonBundle.getErrorTitle(), Messages.getErrorIcon());
       return;
-    } else if (myInvalidNames.contains(getSchemeName())) {
+    }
+    else if (myExistingNames.contains(getSchemeName())) {
       Messages.showMessageDialog(
         getContentPane(),
         ApplicationBundle.message("error.a.scheme.with.this.name.already.exists.or.was.deleted.without.applying.the.changes"),
diff --git a/platform/platform-impl/src/com/intellij/application/options/pathMacros/PathMacroTable.java b/platform/platform-impl/src/com/intellij/application/options/pathMacros/PathMacroTable.java
index b79b20d..15ca7bd 100644
--- a/platform/platform-impl/src/com/intellij/application/options/pathMacros/PathMacroTable.java
+++ b/platform/platform-impl/src/com/intellij/application/options/pathMacros/PathMacroTable.java
@@ -90,7 +90,7 @@
     macroEditor.show();
     if (macroEditor.isOK()) {
       final String name = macroEditor.getName();
-      myMacros.add(Couple.newOne(name, macroEditor.getValue()));
+      myMacros.add(Couple.of(name, macroEditor.getValue()));
       Collections.sort(myMacros, MACRO_COMPARATOR);
       final int index = indexOfMacroWithName(name);
       LOG.assertTrue(index >= 0);
@@ -171,12 +171,12 @@
     macros.clear();
     final Set<String> macroNames = myPathMacros.getUserMacroNames();
     for (String name : macroNames) {
-      macros.add(Couple.newOne(name, myPathMacros.getValue(name).replace('/', File.separatorChar)));
+      macros.add(Couple.of(name, myPathMacros.getValue(name).replace('/', File.separatorChar)));
     }
 
     if (myUndefinedMacroNames != null) {
       for (String undefinedMacroName : myUndefinedMacroNames) {
-        macros.add(Couple.newOne(undefinedMacroName, ""));
+        macros.add(Couple.of(undefinedMacroName, ""));
       }
     }
     Collections.sort(macros, MACRO_COMPARATOR);
@@ -194,7 +194,7 @@
     macroEditor.show();
     if (macroEditor.isOK()) {
       myMacros.remove(selectedRow);
-      myMacros.add(Couple.newOne(macroEditor.getName(), macroEditor.getValue()));
+      myMacros.add(Couple.of(macroEditor.getName(), macroEditor.getValue()));
       Collections.sort(myMacros, MACRO_COMPARATOR);
       myTableModel.fireTableDataChanged();
     }
diff --git a/platform/platform-impl/src/com/intellij/codeInsight/hint/EditorFragmentComponent.java b/platform/platform-impl/src/com/intellij/codeInsight/hint/EditorFragmentComponent.java
index f057b7a..1f8715d 100644
--- a/platform/platform-impl/src/com/intellij/codeInsight/hint/EditorFragmentComponent.java
+++ b/platform/platform-impl/src/com/intellij/codeInsight/hint/EditorFragmentComponent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -73,7 +73,6 @@
 
     int savedScrollOffset = editor.getScrollingModel().getHorizontalScrollOffset();
     if (savedScrollOffset > 0) {
-      editor.stopOptimizedScrolling();
       editor.getScrollingModel().scrollHorizontally(0);
     }
 
@@ -118,7 +117,6 @@
     }
 
     if (savedScrollOffset > 0) {
-      editor.stopOptimizedScrolling();
       editor.getScrollingModel().scrollHorizontally(savedScrollOffset);
     }
 
diff --git a/platform/platform-impl/src/com/intellij/designer/propertyTable/PropertyTable.java b/platform/platform-impl/src/com/intellij/designer/propertyTable/PropertyTable.java
index 84768c9..41a72cc 100644
--- a/platform/platform-impl/src/com/intellij/designer/propertyTable/PropertyTable.java
+++ b/platform/platform-impl/src/com/intellij/designer/propertyTable/PropertyTable.java
@@ -1104,7 +1104,7 @@
 
     int afterIcon = Math.max(0, nodeIndent - leftIconOffset - icon.getIconWidth());
 
-    return Couple.newOne(beforeIcon, afterIcon);
+    return Couple.of(beforeIcon, afterIcon);
   }
 
   private class PropertyCellEditorListener implements PropertyEditorListener {
diff --git a/platform/platform-impl/src/com/intellij/diagnostic/DefaultIdeaErrorLogger.java b/platform/platform-impl/src/com/intellij/diagnostic/DefaultIdeaErrorLogger.java
index 164403a..901da17 100644
--- a/platform/platform-impl/src/com/intellij/diagnostic/DefaultIdeaErrorLogger.java
+++ b/platform/platform-impl/src/com/intellij/diagnostic/DefaultIdeaErrorLogger.java
@@ -23,6 +23,7 @@
 import com.intellij.openapi.diagnostic.ErrorLogger;
 import com.intellij.openapi.diagnostic.ErrorReportSubmitter;
 import com.intellij.openapi.diagnostic.IdeaLoggingEvent;
+import com.intellij.openapi.updateSettings.impl.UpdateChecker;
 import com.intellij.openapi.util.SystemInfo;
 import com.intellij.util.io.MappingFailedException;
 import org.jetbrains.annotations.NonNls;
@@ -47,6 +48,8 @@
     if (ourLoggerBroken) return false;
 
     try {
+      UpdateChecker.checkForUpdate(event);
+
       boolean notificationEnabled = !DISABLED_VALUE.equals(System.getProperty(FATAL_ERROR_NOTIFICATION_PROPERTY, ENABLED_VALUE));
 
       ErrorReportSubmitter submitter = IdeErrorsDialog.getSubmitter(event.getThrowable());
diff --git a/platform/platform-impl/src/com/intellij/diagnostic/DropAnErrorAction.java b/platform/platform-impl/src/com/intellij/diagnostic/DropAnErrorAction.java
index 2af93ee..a24907c 100644
--- a/platform/platform-impl/src/com/intellij/diagnostic/DropAnErrorAction.java
+++ b/platform/platform-impl/src/com/intellij/diagnostic/DropAnErrorAction.java
@@ -15,9 +15,9 @@
  */
 package com.intellij.diagnostic;
 
-import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.project.DumbAwareAction;
 
 /**
  * Created by IntelliJ IDEA.
@@ -27,7 +27,7 @@
  * To change this template use Options | File Templates.
  */
 @SuppressWarnings({"HardCodedStringLiteral"})
-public class DropAnErrorAction extends AnAction {
+public class DropAnErrorAction extends DumbAwareAction {
   public DropAnErrorAction() {
     super ("Drop an error");
   }
diff --git a/platform/platform-impl/src/com/intellij/diagnostic/DropAnErrorWithAttachmentsAction.java b/platform/platform-impl/src/com/intellij/diagnostic/DropAnErrorWithAttachmentsAction.java
index 6e74aed..151f98ea 100644
--- a/platform/platform-impl/src/com/intellij/diagnostic/DropAnErrorWithAttachmentsAction.java
+++ b/platform/platform-impl/src/com/intellij/diagnostic/DropAnErrorWithAttachmentsAction.java
@@ -15,15 +15,15 @@
  */
 package com.intellij.diagnostic;
 
-import com.intellij.openapi.diagnostic.Attachment;
-import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.diagnostic.Attachment;
 import com.intellij.openapi.diagnostic.IdeaLoggingEvent;
+import com.intellij.openapi.project.DumbAwareAction;
 
 import java.awt.event.InputEvent;
 
 @SuppressWarnings({"HardCodedStringLiteral"})
-public class DropAnErrorWithAttachmentsAction extends AnAction {
+public class DropAnErrorWithAttachmentsAction extends DumbAwareAction {
   public DropAnErrorWithAttachmentsAction() {
     super("Drop an error with attachments", "Hold down SHIFT for multiple attachments", null);
   }
diff --git a/platform/platform-impl/src/com/intellij/diagnostic/DropAnOutOfMemoryErrorAction.java b/platform/platform-impl/src/com/intellij/diagnostic/DropAnOutOfMemoryErrorAction.java
index 44f86c6..f8a7a79 100644
--- a/platform/platform-impl/src/com/intellij/diagnostic/DropAnOutOfMemoryErrorAction.java
+++ b/platform/platform-impl/src/com/intellij/diagnostic/DropAnOutOfMemoryErrorAction.java
@@ -17,9 +17,10 @@
 
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.project.DumbAwareAction;
 
 @SuppressWarnings({"HardCodedStringLiteral"})
-public class DropAnOutOfMemoryErrorAction extends AnAction {
+public class DropAnOutOfMemoryErrorAction extends DumbAwareAction {
   public DropAnOutOfMemoryErrorAction() {
     super ("Drop an OutOfMemoryError");
   }
diff --git a/platform/platform-impl/src/com/intellij/diagnostic/DropAnOutOfPermGenMemoryErrorAction.java b/platform/platform-impl/src/com/intellij/diagnostic/DropAnOutOfPermGenMemoryErrorAction.java
index fa40af6..3930352 100644
--- a/platform/platform-impl/src/com/intellij/diagnostic/DropAnOutOfPermGenMemoryErrorAction.java
+++ b/platform/platform-impl/src/com/intellij/diagnostic/DropAnOutOfPermGenMemoryErrorAction.java
@@ -15,11 +15,11 @@
  */
 package com.intellij.diagnostic;
 
-import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.project.DumbAwareAction;
 
 @SuppressWarnings({"HardCodedStringLiteral"})
-public class DropAnOutOfPermGenMemoryErrorAction extends AnAction {
+public class DropAnOutOfPermGenMemoryErrorAction extends DumbAwareAction {
   public DropAnOutOfPermGenMemoryErrorAction() {
     super ("Drop an perm gen OutOfMemoryError");
   }
diff --git a/platform/platform-impl/src/com/intellij/diagnostic/IdeErrorsDialog.java b/platform/platform-impl/src/com/intellij/diagnostic/IdeErrorsDialog.java
index d9ef2be..dfe5e63 100644
--- a/platform/platform-impl/src/com/intellij/diagnostic/IdeErrorsDialog.java
+++ b/platform/platform-impl/src/com/intellij/diagnostic/IdeErrorsDialog.java
@@ -111,7 +111,7 @@
   private AttachmentsTabForm myAttachmentsTabForm;
 
   private ClearFatalsAction myClearAction = new ClearFatalsAction();
-  private BlameAction myBlameAction = new BlameAction();
+  private BlameAction myBlameAction;
   @Nullable
   private AnalyzeAction myAnalyzeAction;
   private boolean myMute;
@@ -219,7 +219,8 @@
   @Override
   protected void createDefaultActions() {
     super.createDefaultActions();
-    getCancelAction().putValue(DEFAULT_ACTION, Boolean.TRUE);
+    myBlameAction = new BlameAction();
+    myBlameAction.putValue(DialogWrapper.DEFAULT_ACTION, true);
   }
 
   private class ForwardAction extends AnAction implements DumbAware {
diff --git a/platform/platform-impl/src/com/intellij/errorreport/itn/ITNProxy.java b/platform/platform-impl/src/com/intellij/errorreport/itn/ITNProxy.java
index 299e646..142b392 100644
--- a/platform/platform-impl/src/com/intellij/errorreport/itn/ITNProxy.java
+++ b/platform/platform-impl/src/com/intellij/errorreport/itn/ITNProxy.java
@@ -116,48 +116,48 @@
                                                                 UpdateSettings updateSettings) {
     @NonNls List<Couple<String>> params = new ArrayList<Couple<String>>();
 
-    params.add(Couple.newOne("protocol.version", "1"));
+    params.add(Couple.of("protocol.version", "1"));
 
-    params.add(Couple.newOne("user.login", login));
-    params.add(Couple.newOne("user.password", password));
+    params.add(Couple.of("user.login", login));
+    params.add(Couple.of("user.password", password));
 
-    params.add(Couple.newOne("os.name", SystemProperties.getOsName()));
+    params.add(Couple.of("os.name", SystemProperties.getOsName()));
 
-    params.add(Couple.newOne("java.version", SystemProperties.getJavaVersion()));
-    params.add(Couple.newOne("java.vm.vendor", SystemProperties.getJavaVmVendor()));
+    params.add(Couple.of("java.version", SystemProperties.getJavaVersion()));
+    params.add(Couple.of("java.vm.vendor", SystemProperties.getJavaVmVendor()));
 
-    params.add(Couple.newOne("app.name", namesInfo.getProductName()));
-    params.add(Couple.newOne("app.name.full", namesInfo.getFullProductName()));
-    params.add(Couple.newOne("app.name.version", appInfo.getVersionName()));
-    params.add(Couple.newOne("app.eap", Boolean.toString(appInfo.isEAP())));
-    params.add(Couple.newOne("app.internal", Boolean.toString(application.isInternal())));
-    params.add(Couple.newOne("app.build", appInfo.getBuild().asString()));
-    params.add(Couple.newOne("app.version.major", appInfo.getMajorVersion()));
-    params.add(Couple.newOne("app.version.minor", appInfo.getMinorVersion()));
-    params.add(Couple.newOne("app.build.date", format(appInfo.getBuildDate())));
-    params.add(Couple.newOne("app.build.date.release", format(appInfo.getMajorReleaseBuildDate())));
-    params.add(Couple.newOne("app.compilation.timestamp", compilationTimestamp));
+    params.add(Couple.of("app.name", namesInfo.getProductName()));
+    params.add(Couple.of("app.name.full", namesInfo.getFullProductName()));
+    params.add(Couple.of("app.name.version", appInfo.getVersionName()));
+    params.add(Couple.of("app.eap", Boolean.toString(appInfo.isEAP())));
+    params.add(Couple.of("app.internal", Boolean.toString(application.isInternal())));
+    params.add(Couple.of("app.build", appInfo.getBuild().asString()));
+    params.add(Couple.of("app.version.major", appInfo.getMajorVersion()));
+    params.add(Couple.of("app.version.minor", appInfo.getMinorVersion()));
+    params.add(Couple.of("app.build.date", format(appInfo.getBuildDate())));
+    params.add(Couple.of("app.build.date.release", format(appInfo.getMajorReleaseBuildDate())));
+    params.add(Couple.of("app.compilation.timestamp", compilationTimestamp));
 
-    params.add(Couple.newOne("update.channel.status", updateSettings.getSelectedChannelStatus().getCode()));
-    params.add(Couple.newOne("update.ignored.builds", StringUtil.join(updateSettings.getIgnoredBuildNumbers(), ",")));
+    params.add(Couple.of("update.channel.status", updateSettings.getSelectedChannelStatus().getCode()));
+    params.add(Couple.of("update.ignored.builds", StringUtil.join(updateSettings.getIgnoredBuildNumbers(), ",")));
 
-    params.add(Couple.newOne("plugin.name", error.getPluginName()));
-    params.add(Couple.newOne("plugin.version", error.getPluginVersion()));
+    params.add(Couple.of("plugin.name", error.getPluginName()));
+    params.add(Couple.of("plugin.version", error.getPluginVersion()));
 
-    params.add(Couple.newOne("last.action", error.getLastAction()));
-    params.add(Couple.newOne("previous.exception",
-                             error.getPreviousException() == null ? null : Integer.toString(error.getPreviousException())));
+    params.add(Couple.of("last.action", error.getLastAction()));
+    params.add(Couple.of("previous.exception",
+                         error.getPreviousException() == null ? null : Integer.toString(error.getPreviousException())));
 
-    params.add(Couple.newOne("error.message", error.getMessage()));
-    params.add(Couple.newOne("error.stacktrace", error.getStackTrace()));
+    params.add(Couple.of("error.message", error.getMessage()));
+    params.add(Couple.of("error.stacktrace", error.getStackTrace()));
 
-    params.add(Couple.newOne("error.description", error.getDescription()));
+    params.add(Couple.of("error.description", error.getDescription()));
 
-    params.add(Couple.newOne("assignee.id", error.getAssigneeId() == null ? null : Integer.toString(error.getAssigneeId())));
+    params.add(Couple.of("assignee.id", error.getAssigneeId() == null ? null : Integer.toString(error.getAssigneeId())));
 
     for (Attachment attachment : error.getAttachments()) {
-      params.add(Couple.newOne("attachment.name", attachment.getName()));
-      params.add(Couple.newOne("attachment.value", attachment.getEncodedBytes()));
+      params.add(Couple.of("attachment.name", attachment.getName()));
+      params.add(Couple.of("attachment.value", attachment.getEncodedBytes()));
     }
 
     return params;
diff --git a/platform/platform-impl/src/com/intellij/execution/impl/EditorHyperlinkSupport.java b/platform/platform-impl/src/com/intellij/execution/impl/EditorHyperlinkSupport.java
index d99a38c..26429fc 100644
--- a/platform/platform-impl/src/com/intellij/execution/impl/EditorHyperlinkSupport.java
+++ b/platform/platform-impl/src/com/intellij/execution/impl/EditorHyperlinkSupport.java
@@ -265,11 +265,11 @@
       Filter.Result result = customFilter.applyFilter(text, endOffset);
       if (result != null) {
         for (Filter.ResultItem resultItem : result.getResultItems()) {
-          if (resultItem.hyperlinkInfo != null) {
-            createHyperlink(resultItem.highlightStartOffset, resultItem.highlightEndOffset, resultItem.highlightAttributes, resultItem.hyperlinkInfo);
+          if (resultItem.getHyperlinkInfo() != null) {
+            createHyperlink(resultItem.getHighlightStartOffset(), resultItem.getHighlightEndOffset(), resultItem.getHighlightAttributes(), resultItem.getHyperlinkInfo());
           }
-          else if (resultItem.highlightAttributes != null) {
-            addHighlighter(resultItem.highlightStartOffset, resultItem.highlightEndOffset, resultItem.highlightAttributes);
+          else if (resultItem.getHighlightAttributes() != null) {
+            addHighlighter(resultItem.getHighlightStartOffset(), resultItem.getHighlightEndOffset(), resultItem.getHighlightAttributes());
           }
         }
       }
diff --git a/platform/platform-impl/src/com/intellij/ide/ClipboardSynchronizer.java b/platform/platform-impl/src/com/intellij/ide/ClipboardSynchronizer.java
index 562afc3..e909ea0 100644
--- a/platform/platform-impl/src/com/intellij/ide/ClipboardSynchronizer.java
+++ b/platform/platform-impl/src/com/intellij/ide/ClipboardSynchronizer.java
@@ -20,11 +20,11 @@
 import com.intellij.openapi.components.ApplicationComponent;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.util.SystemInfo;
 import com.intellij.openapi.util.registry.Registry;
 import com.intellij.ui.mac.foundation.Foundation;
 import com.intellij.ui.mac.foundation.ID;
+import com.intellij.util.concurrency.FutureResult;
 import com.sun.jna.IntegerType;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -38,6 +38,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
 
 /**
  * <p>This class is used to workaround the problem with getting clipboard contents (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4818143).
@@ -251,7 +252,7 @@
 
     @Nullable
     private static Transferable getContentsSafe() {
-      final Ref<Transferable> result = new Ref<Transferable>();
+      final FutureResult<Transferable> result = new FutureResult<Transferable>();
 
       Foundation.executeOnMainThread(new Runnable() {
         @Override
@@ -261,9 +262,14 @@
             result.set(transferable);
           }
         }
-      }, true, true);
+      }, true, false);
 
-      return result.get();
+      try {
+        return result.get(10, TimeUnit.MILLISECONDS);
+      }
+      catch (Exception ignored) {
+        return null;
+      }
     }
 
     @Nullable
diff --git a/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java b/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java
index 960c498..f8c4e3c 100644
--- a/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java
+++ b/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java
@@ -62,6 +62,7 @@
   public void initComponent() {
     checkJvm();
     startDiskSpaceMonitoring();
+    checkPowerSaveMode();
   }
 
   private void checkJvm() {
@@ -75,6 +76,16 @@
 
   private void notifyUnsupportedJvm(@PropertyKey(resourceBundle = "messages.IdeBundle") final String key) {
     final String ignoreKey = "ignore." + key;
+    final String message = IdeBundle.message(key) + IdeBundle.message("unsupported.jvm.link");
+    showNotification(ignoreKey, message, new HyperlinkAdapter() {
+      @Override
+      protected void hyperlinkActivated(HyperlinkEvent e) {
+        myProperties.setValue(ignoreKey, "true");
+      }
+    });
+  }
+
+  private void showNotification(final String ignoreKey, final String message, final HyperlinkAdapter hyperlinkAdapter) {
     if (myProperties.isValueSet(ignoreKey)) {
       return;
     }
@@ -85,18 +96,11 @@
       public void appFrameCreated(String[] commandLineArgs, @NotNull Ref<Boolean> willOpenProject) {
         app.invokeLater(new Runnable() {
           public void run() {
-            String message = IdeBundle.message(key) + IdeBundle.message("unsupported.jvm.link");
-
             JComponent component = WindowManager.getInstance().findVisibleFrame().getRootPane();
             if (component != null) {
               Rectangle rect = component.getVisibleRect();
               JBPopupFactory.getInstance()
-                .createHtmlTextBalloonBuilder(message, MessageType.WARNING, new HyperlinkAdapter() {
-                  @Override
-                  protected void hyperlinkActivated(HyperlinkEvent e) {
-                    myProperties.setValue(ignoreKey, "true");
-                  }
-                })
+                .createHtmlTextBalloonBuilder(message, MessageType.WARNING, hyperlinkAdapter)
                 .setFadeoutTime(-1)
                 .setHideOnFrameResize(false)
                 .setHideOnLinkClick(true)
@@ -205,4 +209,26 @@
       }
     }, 1, TimeUnit.SECONDS);
   }
+
+  private void checkPowerSaveMode() {
+    if (PowerSaveMode.isEnabled()) {
+      final String ignoreKey = "ignore.power.save.mode";
+      String message = "Power save mode is on. Code insight and other background tasks are disabled." +
+                       "<br/><a href=\"ignore\">Do not show again</a>" +
+                       "<br/><a href=\"turnOff\">Disable Power Save Mode</a>";
+
+      showNotification(ignoreKey, message, new HyperlinkAdapter() {
+        @Override
+        protected void hyperlinkActivated(HyperlinkEvent e) {
+          final String description = e.getDescription();
+          if ("ignore".equals(description)) {
+            myProperties.setValue(ignoreKey, "true");
+          }
+          else if ("turnOff".equals(description)) {
+            PowerSaveMode.setEnabled(false);
+          }
+        }
+      });
+    }
+  }
 }
diff --git a/platform/platform-impl/src/com/intellij/ide/actionMacro/ActionMacro.java b/platform/platform-impl/src/com/intellij/ide/actionMacro/ActionMacro.java
index da5a536..386a8c3 100644
--- a/platform/platform-impl/src/com/intellij/ide/actionMacro/ActionMacro.java
+++ b/platform/platform-impl/src/com/intellij/ide/actionMacro/ActionMacro.java
@@ -125,7 +125,7 @@
         TypedDescriptor typedDescriptor = (TypedDescriptor)action;
         actionNode.setText(typedDescriptor.getText().replaceAll(" ", "&#x20;"));
         actionNode.setAttribute(ATTRIBUTE_KEY_CODES, unparseKeyCodes(
-          Couple.newOne(typedDescriptor.getKeyCodes(), typedDescriptor.getKeyModifiers())));
+          Couple.of(typedDescriptor.getKeyCodes(), typedDescriptor.getKeyModifiers())));
       }
       else if (action instanceof IdActionDescriptor) {
         actionNode = new Element(ELEMENT_ACTION);
diff --git a/platform/platform-impl/src/com/intellij/ide/actionMacro/ActionMacroConfigurationPanel.java b/platform/platform-impl/src/com/intellij/ide/actionMacro/ActionMacroConfigurationPanel.java
index 6101622..d945e63 100644
--- a/platform/platform-impl/src/com/intellij/ide/actionMacro/ActionMacroConfigurationPanel.java
+++ b/platform/platform-impl/src/com/intellij/ide/actionMacro/ActionMacroConfigurationPanel.java
@@ -165,7 +165,7 @@
               while (!canRenameMacro(newName));
 
               if (myRenamingList == null) myRenamingList = new ArrayList<Couple<String>>();
-              myRenamingList.add(Couple.newOne(macro.getName(), newName));
+              myRenamingList.add(Couple.of(macro.getName(), newName));
               macro.setName(newName);
               myMacrosList.repaint();
             }
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/MacWindowActionBase.java b/platform/platform-impl/src/com/intellij/ide/actions/MacWindowActionBase.java
new file mode 100644
index 0000000..feb0aea
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/ide/actions/MacWindowActionBase.java
@@ -0,0 +1,53 @@
+/*
+ * 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.ide.actions;
+
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.CommonDataKeys;
+import com.intellij.openapi.actionSystem.Presentation;
+import com.intellij.openapi.project.DumbAware;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.SystemInfo;
+import com.intellij.openapi.wm.WindowManager;
+import com.intellij.ui.mac.MacMainFrameDecorator;
+
+import javax.swing.*;
+
+/**
+ * @author ignatov
+ */
+public abstract class MacWindowActionBase extends AnAction implements DumbAware {
+  @Override
+  public void update(final AnActionEvent e) {
+    Presentation p = e.getPresentation();
+    p.setVisible(SystemInfo.isMac);
+
+    if (SystemInfo.isMac) {
+      Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
+      if (project != null) {
+        JFrame frame = WindowManager.getInstance().getFrame(project);
+        if (frame != null) {
+          JRootPane pane = frame.getRootPane();
+          p.setEnabled(pane != null && pane.getClientProperty(MacMainFrameDecorator.FULL_SCREEN) == null);
+        }
+      }
+    }
+    else {
+      p.setEnabled(false);
+    }
+  }
+}
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/MinimizeCurrentWindowAction.java b/platform/platform-impl/src/com/intellij/ide/actions/MinimizeCurrentWindowAction.java
index 98d13b1..246ce31 100644
--- a/platform/platform-impl/src/com/intellij/ide/actions/MinimizeCurrentWindowAction.java
+++ b/platform/platform-impl/src/com/intellij/ide/actions/MinimizeCurrentWindowAction.java
@@ -15,17 +15,8 @@
  */
 package com.intellij.ide.actions;
 
-import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
-import com.intellij.openapi.actionSystem.Presentation;
-import com.intellij.openapi.project.DumbAware;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.SystemInfo;
 import com.intellij.openapi.wm.IdeFocusManager;
-import com.intellij.openapi.wm.WindowManager;
-import com.intellij.ui.mac.MacMainFrameDecorator;
 
 import javax.swing.*;
 import java.awt.*;
@@ -33,8 +24,7 @@
 /**
  * User: spLeaner
  */
-public class MinimizeCurrentWindowAction extends AnAction implements DumbAware {
-
+public class MinimizeCurrentWindowAction extends MacWindowActionBase {
   @Override
   public void actionPerformed(final AnActionEvent e) {
     final Component focusOwner = IdeFocusManager.getGlobalInstance().getFocusOwner();
@@ -45,24 +35,4 @@
       }
     }
   }
-
-  @Override
-  public void update(final AnActionEvent e) {
-    final Presentation p = e.getPresentation();
-    p.setVisible(SystemInfo.isMac);
-
-    if (SystemInfo.isMac) {
-      Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
-      if (project != null) {
-        JFrame frame = WindowManager.getInstance().getFrame(project);
-        if (frame != null) {
-          JRootPane pane = frame.getRootPane();
-          p.setEnabled(pane != null && pane.getClientProperty(MacMainFrameDecorator.FULL_SCREEN) == null);
-        }
-      }
-    }
-    else {
-      p.setEnabled(false);
-    }
-  }
 }
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/SendFeedbackAction.java b/platform/platform-impl/src/com/intellij/ide/actions/SendFeedbackAction.java
index c700091..7244977 100644
--- a/platform/platform-impl/src/com/intellij/ide/actions/SendFeedbackAction.java
+++ b/platform/platform-impl/src/com/intellij/ide/actions/SendFeedbackAction.java
@@ -90,6 +90,11 @@
     return sb.toString();
   }
 
+  @Override
+  public void update(AnActionEvent e) {
+    e.getPresentation().setEnabled(ApplicationInfoEx.getInstanceEx() != null);
+  }
+
   private static boolean isEvaluationLicense() {
     final LicensingFacade provider = LicensingFacade.getInstance();
     return provider != null && provider.isEvaluationLicense();
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ShowFilePathAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ShowFilePathAction.java
index e7a3f23..59fdfc2 100644
--- a/platform/platform-impl/src/com/intellij/ide/actions/ShowFilePathAction.java
+++ b/platform/platform-impl/src/com/intellij/ide/actions/ShowFilePathAction.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -21,6 +21,8 @@
 import com.intellij.execution.util.ExecUtil;
 import com.intellij.ide.DataManager;
 import com.intellij.ide.IdeBundle;
+import com.intellij.notification.Notification;
+import com.intellij.notification.NotificationListener;
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
@@ -50,6 +52,7 @@
 import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
+import javax.swing.event.HyperlinkEvent;
 import javax.swing.filechooser.FileSystemView;
 import java.awt.*;
 import java.awt.event.MouseEvent;
@@ -57,6 +60,7 @@
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -64,6 +68,15 @@
 public class ShowFilePathAction extends AnAction {
   private static final Logger LOG = Logger.getInstance("#com.intellij.ide.actions.ShowFilePathAction");
 
+  public static final NotificationListener FILE_SELECTING_LISTENER = new NotificationListener.Adapter() {
+    @Override
+    protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
+      URL url = e.getURL();
+      if (url != null) openFile(new File(url.getPath()));
+      notification.expire();
+    }
+  };
+
   private static NotNullLazyValue<Boolean> canUseNautilus = new NotNullLazyValue<Boolean>() {
     @NotNull
     @Override
diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ZoomCurrentWindowAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ZoomCurrentWindowAction.java
new file mode 100644
index 0000000..09104ec
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/ide/actions/ZoomCurrentWindowAction.java
@@ -0,0 +1,44 @@
+/*
+ * 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.ide.actions;
+
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.wm.IdeFocusManager;
+
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * @author ignatov
+ */
+public class ZoomCurrentWindowAction extends MacWindowActionBase {
+  @Override
+  public void actionPerformed(final AnActionEvent e) {
+    final Component focusOwner = IdeFocusManager.getGlobalInstance().getFocusOwner();
+    if (focusOwner != null) {
+      final Window window = focusOwner instanceof JFrame ? (Window)focusOwner : SwingUtilities.getWindowAncestor(focusOwner);
+      if (window instanceof JFrame) {
+        JFrame frame = (JFrame)window;
+        if (frame.getExtendedState() == Frame.NORMAL) {
+          frame.setExtendedState(Frame.MAXIMIZED_BOTH);
+        }
+        else if (frame.getExtendedState() == Frame.MAXIMIZED_BOTH) {
+          frame.setExtendedState(Frame.NORMAL);
+        }
+      }
+    }
+  }
+}
diff --git a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeIDEWizardDialog.java b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeIDEWizardDialog.java
index 0d62d30..1b0644a 100644
--- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeIDEWizardDialog.java
+++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeIDEWizardDialog.java
@@ -21,6 +21,7 @@
 import com.intellij.openapi.util.SystemInfo;
 import com.intellij.ui.JBCardLayout;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
 import java.awt.*;
@@ -148,9 +149,10 @@
     }
   }
 
+  @Nullable
   @Override
-  public void doCancelAction() {
-    // lets pretend it is the wind..
+  protected ActionListener createCancelAction() {
+    return null;//Prevent closing by <Esc>
   }
 
   @Override
diff --git a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeKeyboardSchemeStepPanel.java b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeKeyboardSchemeStepPanel.java
index 2dbbc54..2b35ebe 100644
--- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeKeyboardSchemeStepPanel.java
+++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeKeyboardSchemeStepPanel.java
@@ -79,7 +79,7 @@
     ButtonGroup group = new ButtonGroup();
     group.add(macRadioButton);
     group.add(defaultRadioButton);
-    defaultRadioButton.setSelected(true);
+    macRadioButton.setSelected(true);
   }
 
   @Override
diff --git a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeUIThemeStepPanel.java b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeUIThemeStepPanel.java
index ea0ff86..204abba 100644
--- a/platform/platform-impl/src/com/intellij/ide/customize/CustomizeUIThemeStepPanel.java
+++ b/platform/platform-impl/src/com/intellij/ide/customize/CustomizeUIThemeStepPanel.java
@@ -90,7 +90,7 @@
       });
       panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
       panel.add(radioButton, myColumnMode ? BorderLayout.WEST : BorderLayout.NORTH);
-      final JLabel label = new JLabel(myColumnMode ? IconUtil.scale(icon, .33) : icon);
+      final JLabel label = new JLabel(myColumnMode ? IconUtil.scale(IconUtil.cropIcon(icon, icon.getIconWidth() * 2 / 3, icon.getIconHeight() * 2 / 3), .75) : icon);
       label.setVerticalAlignment(SwingConstants.TOP);
       label.setHorizontalAlignment(SwingConstants.RIGHT);
       panel.add(label, BorderLayout.CENTER);
diff --git a/platform/platform-impl/src/com/intellij/ide/customize/IdSet.java b/platform/platform-impl/src/com/intellij/ide/customize/IdSet.java
index af4da53..47f8863 100644
--- a/platform/platform-impl/src/com/intellij/ide/customize/IdSet.java
+++ b/platform/platform-impl/src/com/intellij/ide/customize/IdSet.java
@@ -16,7 +16,6 @@
 package com.intellij.ide.customize;
 
 import com.intellij.openapi.util.Condition;
-import com.intellij.util.ArrayUtil;
 import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.Nullable;
 
@@ -36,11 +35,6 @@
       description = description.substring(i + 1, description.length());
     }
     myIds = description.split(",");
-    for (String id : myIds) {
-      if (PluginGroups.getInstance().findPlugin(id) == null) {
-        myIds = ArrayUtil.remove(myIds, id);
-      }
-    }
     myIds = ContainerUtil.filter(myIds, new Condition<String>() {
       @Override
       public boolean value(String id) {
@@ -65,7 +59,7 @@
 
   @Override
   public String toString() {
-    return String.valueOf(myTitle) + ": " + myIds.length;
+    return String.valueOf(myTitle) + ": " + (myIds != null ? myIds.length : 0);
   }
 
   @Nullable
diff --git a/platform/platform-impl/src/com/intellij/ide/customize/PluginGroups.java b/platform/platform-impl/src/com/intellij/ide/customize/PluginGroups.java
index 3712905..8a38865 100644
--- a/platform/platform-impl/src/com/intellij/ide/customize/PluginGroups.java
+++ b/platform/platform-impl/src/com/intellij/ide/customize/PluginGroups.java
@@ -83,9 +83,8 @@
       "org.intellij.grails",
       "com.intellij.gwt",
       "com.intellij.vaadin",
-      "JBoss",
-      "Seam:com.intellij.seam,com.intellij.seam.pages,com.intellij.seam.pageflow",
-      "JBPM",
+      "JBoss Seam:com.intellij.seam,com.intellij.seam.pages,com.intellij.seam.pageflow",
+      "JBoss jBPM:JBPM",
       "Struts:StrutsAssistant,com.intellij.struts2",
       "com.intellij.hibernate",
       "Spring:com.intellij.spring.batch," +
diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/config/PasswordSafeConfigurable.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/config/PasswordSafeConfigurable.java
index 70c6688..47379a5 100644
--- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/config/PasswordSafeConfigurable.java
+++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/config/PasswordSafeConfigurable.java
@@ -24,7 +24,7 @@
   /**
    * The option panel to use
    */
-  PasswordSafeOptionsPanel myPanel = null;
+  PasswordSafeOptionsPanel myPanel;
 
   /**
    * The constructor
@@ -56,7 +56,7 @@
    */
   public JComponent createComponent() {
     myPanel = new PasswordSafeOptionsPanel(myPasswordSafe);
-    myPanel.load(mySettings);
+    myPanel.reset(mySettings);
     return myPanel.getRoot();  //To change body of implemented methods use File | Settings | File Templates.
   }
 
@@ -71,14 +71,14 @@
    * {@inheritDoc}
    */
   public void apply() throws ConfigurationException {
-    myPanel.save(mySettings);
+    myPanel.apply(mySettings);
   }
 
   /**
    * {@inheritDoc}
    */
   public void reset() {
-    myPanel.load(mySettings);
+    myPanel.reset(mySettings);
   }
 
   /**
diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/config/PasswordSafeOptionsPanel.form b/platform/platform-impl/src/com/intellij/ide/passwordSafe/config/PasswordSafeOptionsPanel.form
index 1fef2dd..b2db444 100644
--- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/config/PasswordSafeOptionsPanel.form
+++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/config/PasswordSafeOptionsPanel.form
@@ -3,7 +3,7 @@
   <grid id="27dc6" binding="myRoot" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
     <margin top="0" left="0" bottom="0" right="0"/>
     <constraints>
-      <xy x="20" y="20" width="445" height="185"/>
+      <xy x="20" y="20" width="509" height="269"/>
     </constraints>
     <properties/>
     <border type="none"/>
@@ -13,30 +13,6 @@
           <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
         </constraints>
       </hspacer>
-      <grid id="9d0fb" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-        <margin top="10" 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="97bd4" class="javax.swing.JButton" binding="myManagePasswordButton">
-            <constraints>
-              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-            </constraints>
-            <properties>
-              <text value="&amp;Master Password"/>
-              <toolTipText value="Reset or specify a password for the password database"/>
-            </properties>
-          </component>
-          <hspacer id="a66d3">
-            <constraints>
-              <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-            </constraints>
-          </hspacer>
-        </children>
-      </grid>
       <grid id="62956" 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>
@@ -46,7 +22,7 @@
         <clientProperties>
           <BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
         </clientProperties>
-        <border type="etched" title="Remembering passwords"/>
+        <border type="etched" title="Password storage policy"/>
         <children>
           <component id="496c6" class="javax.swing.JRadioButton" binding="myDoNotRememberPasswordsRadioButton" default-binding="true">
             <constraints>
@@ -66,13 +42,13 @@
               <toolTipText value="The passwords are stored only in the memory. They will be forgotten when application terminates."/>
             </properties>
           </component>
-          <component id="4e7bb" class="javax.swing.JRadioButton" binding="myRememberOnDiskProtectedRadioButton" default-binding="true">
+          <component id="4e7bb" class="javax.swing.JRadioButton" binding="mySaveOnDiskRadioButton" default-binding="true">
             <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>
               <selected value="true"/>
-              <text value="Remember on &amp;disk (protected with master password)"/>
+              <text value="Save on &amp;disk with master password protection"/>
               <toolTipText value="The passwords are saved on disk and after restart only master password will be asked."/>
             </properties>
           </component>
@@ -83,6 +59,39 @@
           <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>
+      <grid id="432a0" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+        <margin top="0" 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/>
+        <clientProperties>
+          <BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
+        </clientProperties>
+        <border type="etched" title="Disk storage protection"/>
+        <children>
+          <component id="97bd4" class="javax.swing.JButton" binding="myManagePasswordButton">
+            <constraints>
+              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+            </constraints>
+            <properties>
+              <text value="&amp;Master Password"/>
+              <toolTipText value="Reset or specify a password for the password database"/>
+            </properties>
+          </component>
+          <hspacer id="cb744">
+            <constraints>
+              <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+            </constraints>
+          </hspacer>
+          <component id="6fe55" class="com.intellij.ui.components.JBLabel" binding="myMasterPasswordStateLabel">
+            <constraints>
+              <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
+            </constraints>
+            <properties/>
+          </component>
+        </children>
+      </grid>
     </children>
   </grid>
   <buttonGroups>
diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/config/PasswordSafeOptionsPanel.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/config/PasswordSafeOptionsPanel.java
index 1907029..a623506 100644
--- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/config/PasswordSafeOptionsPanel.java
+++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/config/PasswordSafeOptionsPanel.java
@@ -3,10 +3,10 @@
 import com.intellij.ide.passwordSafe.PasswordSafe;
 import com.intellij.ide.passwordSafe.impl.PasswordSafeImpl;
 import com.intellij.ide.passwordSafe.impl.providers.masterKey.MasterPasswordDialog;
+import com.intellij.ui.JBColor;
+import com.intellij.ui.components.JBLabel;
 
 import javax.swing.*;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 
@@ -14,6 +14,7 @@
  * The option panel for password safe
  */
 public class PasswordSafeOptionsPanel {
+  private final PasswordSafeImpl myPasswordSafe;
   /**
    * The password storage policy option
    */
@@ -25,7 +26,7 @@
   /**
    * The password storage policy option
    */
-  private JRadioButton myRememberOnDiskProtectedRadioButton;
+  private JRadioButton mySaveOnDiskRadioButton;
   /**
    * The change password button
    */
@@ -34,6 +35,7 @@
    * The root panel
    */
   private JPanel myRoot;
+  private JBLabel myMasterPasswordStateLabel;
 
   /**
    * The constructor
@@ -41,45 +43,30 @@
    * @param passwordSafe the password safe service instance
    */
   public PasswordSafeOptionsPanel(PasswordSafe passwordSafe) {
-    final PasswordSafeImpl ps = (PasswordSafeImpl)passwordSafe;
-    final ChangeListener listener = new ChangeListener() {
-      public void stateChanged(ChangeEvent e) {
-        boolean isDisk = myRememberOnDiskProtectedRadioButton.isSelected();
-        myManagePasswordButton.setEnabled(isDisk);
-      }
-    };
-    myRememberOnDiskProtectedRadioButton.addChangeListener(listener);
-    listener.stateChanged(null);
+    myPasswordSafe = (PasswordSafeImpl)passwordSafe;
+    myMasterPasswordStateLabel.setForeground(JBColor.BLUE);
+    updateMasterPasswordState();
     myManagePasswordButton.addActionListener(new ActionListener() {
       public void actionPerformed(ActionEvent e) {
-        if (isMasterKeyEmpty(ps)) {
-          MasterPasswordDialog.resetMasterPasswordDialog(null, ps.getMasterKeyProvider(), PasswordSafeOptionsPanel.class).show();
+        if (myPasswordSafe.getMasterKeyProvider().isEmpty()) {
+          MasterPasswordDialog.resetMasterPasswordDialog(null, myPasswordSafe.getMasterKeyProvider(), PasswordSafeOptionsPanel.class).show();
         }
         else {
-          MasterPasswordDialog.changeMasterPasswordDialog(null, ps.getMasterKeyProvider(), PasswordSafeOptionsPanel.class).show();
+          MasterPasswordDialog.changeMasterPasswordDialog(null, myPasswordSafe.getMasterKeyProvider(), PasswordSafeOptionsPanel.class).show();
         }
-        listener.stateChanged(null);
+        updateMasterPasswordState();
       }
     });
   }
 
-  /**
-   * Check if master key provider is empty
-   *
-   * @param ps the password safe component
-   * @return true if the provider is empty
-   */
-  private static boolean isMasterKeyEmpty(PasswordSafeImpl ps) {
-    return ps.getMasterKeyProvider().isEmpty();
+  private void updateMasterPasswordState() {
+    boolean empty = myPasswordSafe.getMasterKeyProvider().isMasterPasswordEnabled();
+    myMasterPasswordStateLabel.setText(empty ? "Disabled" : "Enabled");
   }
 
-  /**
-   * Load component state from settings
-   *
-   * @param settings the settings to use
-   */
-  public void load(PasswordSafeSettings settings) {
+  public void reset(PasswordSafeSettings settings) {
     PasswordSafeSettings.ProviderType t = settings.getProviderType();
+    updateMasterPasswordState();
     switch (t) {
       case DO_NOT_STORE:
         myDoNotRememberPasswordsRadioButton.setSelected(true);
@@ -88,16 +75,13 @@
         myRememberPasswordsUntilClosingRadioButton.setSelected(true);
         break;
       case MASTER_PASSWORD:
-        myRememberOnDiskProtectedRadioButton.setSelected(true);
+        mySaveOnDiskRadioButton.setSelected(true);
         break;
       default:
         throw new IllegalStateException("Unknown provider type: " + t);
     }
   }
 
-  /**
-   * @return the provider type
-   */
   private PasswordSafeSettings.ProviderType getProviderType() {
     if (myDoNotRememberPasswordsRadioButton.isSelected()) {
       return PasswordSafeSettings.ProviderType.DO_NOT_STORE;
@@ -123,7 +107,7 @@
    *
    * @param settings the settings to use
    */
-  public void save(PasswordSafeSettings settings) {
+  public void apply(PasswordSafeSettings settings) {
     settings.setProviderType(getProviderType());
   }
 
diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterKeyPasswordSafe.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterKeyPasswordSafe.java
index 9fee5cc..c8e0e02 100644
--- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterKeyPasswordSafe.java
+++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterKeyPasswordSafe.java
@@ -183,24 +183,26 @@
     if (!isTestMode() && application.isHeadlessEnvironment()) {
       throw new MasterPasswordUnavailableException("The provider is not available in headless environment");
     }
-    if (key.get().get() == null) {
+    final Ref<byte[]> result = Ref.create(key.get().get());
+    if (result.isNull()) {
       if (isPasswordEncrypted()) {
         try {
-          String s = decryptPassword(database.getPasswordInfo());
-          setMasterPassword(s);
+          setMasterPassword(decryptPassword(database.getPasswordInfo()));
+          result.set(key.get().get());
         }
         catch (PasswordSafeException e) {
           // ignore exception and ask password
         }
       }
-      if (key.get().get() == null) {
+      if (result.isNull()) {
         final Ref<PasswordSafeException> ex = new Ref<PasswordSafeException>();
         if (application.holdsReadLock()) {
           throw new IllegalStateException("Access from read action is not allowed, because it might lead to a deadlock.");
         }
         application.invokeAndWait(new Runnable() {
           public void run() {
-            if (key.get().get() == null) {
+            result.set(key.get().get());
+            if (result.isNull()) {
               try {
                 if (isTestMode()) {
                   throw new MasterPasswordUnavailableException("Master password must be specified in test mode.");
@@ -212,6 +214,7 @@
                 }
                 else {
                   MasterPasswordDialog.askPassword(project, MasterKeyPasswordSafe.this, requestor);
+                  result.set(key.get().get());
                 }
               }
               catch (PasswordSafeException e) {
@@ -230,7 +233,7 @@
         }
       }
     }
-    return key.get().get();
+    return result.get();
   }
 
   /**
@@ -304,6 +307,11 @@
     return "Master Key PasswordSafe";
   }
 
+
+  public boolean isMasterPasswordEnabled() {
+    return setMasterPassword("");
+  }
+
   /**
    * @return true, if OS protected passwords are supported for the current platform
    */
@@ -336,7 +344,8 @@
    *          if decryption fails
    */
   private static String decryptPassword(byte[] pw) throws MasterPasswordUnavailableException {
-    assert SystemInfo.isWindows;
+    if (!SystemInfo.isWindows) throw new AssertionError("Windows OS expected");
+
     try {
       return new String(WindowsCryptUtils.unprotect(pw), "UTF-8");
     }
@@ -349,6 +358,8 @@
    * @return true, if the password is currently encrypted in the database
    */
   public boolean isPasswordEncrypted() {
+    if (!isOsProtectedPasswordSupported()) return false;
+
     byte[] i = database.getPasswordInfo();
     return i != null && i.length > 0;
   }
diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/PasswordComponentBase.form b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/PasswordComponentBase.form
index 083237a..d1a28d2 100644
--- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/PasswordComponentBase.form
+++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/PasswordComponentBase.form
@@ -89,7 +89,7 @@
                 </constraints>
                 <properties>
                   <selected value="true"/>
-                  <text value="&amp;Encrypt with user credentials"/>
+                  <text value="&amp;Encrypt with OS user credentials"/>
                   <toolTipText value="The master password will be stored in password database &#10;encrypted with user credentials using OS-specific mechanisms.&#10;If this checkbox is selected, the master password will not be asked&#10;from user, on new session."/>
                 </properties>
               </component>
diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsTableModel.java b/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsTableModel.java
index 741824e..44d9606 100644
--- a/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsTableModel.java
+++ b/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsTableModel.java
@@ -269,7 +269,7 @@
   }
 
   private static void updateExistingPluginInfo(IdeaPluginDescriptor descr, IdeaPluginDescriptor existing) {
-    int state = StringUtil.compareVersionNumbers(descr.getVersion(), existing.getVersion());
+    int state = PluginDownloader.compareVersionsSkipBroken(existing, descr.getVersion());
     final PluginId pluginId = existing.getPluginId();
     final String idString = pluginId.getIdString();
     final JDOMExternalizableStringList installedPlugins = PluginManagerUISettings.getInstance().getInstalledPlugins();
diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginInstaller.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginInstaller.java
index 3f5e43c..7919d1f 100644
--- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginInstaller.java
+++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginInstaller.java
@@ -83,6 +83,7 @@
         PluginId depPluginId = pluginNode.getDepends().get(i);
 
         if (PluginManager.isPluginInstalled(depPluginId) || PluginManagerCore.isModuleDependency(depPluginId) ||
+            PluginManagerUISettings.getInstance().getInstalledPlugins().contains(depPluginId.getIdString()) ||
             (pluginIds != null && pluginIds.contains(depPluginId))) {
           // ignore installed or installing plugins
           continue;
diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManager.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManager.java
index 46bda9c..a1ea238 100644
--- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManager.java
+++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManager.java
@@ -178,6 +178,8 @@
 
           myPlugins2Enable = null;
           myPlugins2Disable = null;
+
+          PluginManagerMain.notifyPluginsWereUpdated("Changes were applied", null);
         }
       }));
       myPluginError = null;
diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurable.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurable.java
index 534ade3..1fcf23e 100644
--- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurable.java
+++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurable.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -74,20 +74,20 @@
 
   public void reset() {
     myPluginManagerMain.reset();
-    if (myAvailable) {
-      final int column = myUISettings.AVAILABLE_SORT_MODE;
-      if (column >= 0) {
-        for (final SortOrder sortOrder : SortOrder.values()) {
-          if (sortOrder.ordinal() == myUISettings.AVAILABLE_SORT_COLUMN_ORDER) {
-            myPluginManagerMain.pluginsModel.setSortKey(new RowSorter.SortKey(column, sortOrder));
-            break;
-          }
-        }
-      }
-      myPluginManagerMain.pluginsModel.setSortByStatus(myUISettings.AVAILABLE_SORT_BY_STATUS);
-    } else {
-      myPluginManagerMain.pluginsModel.setSortByStatus(myUISettings.INSTALLED_SORT_BY_STATUS);
-    }
+    //if (myAvailable) {
+    //  final int column = myUISettings.AVAILABLE_SORT_MODE;
+    //  if (column >= 0) {
+    //    for (final SortOrder sortOrder : SortOrder.values()) {
+    //      if (sortOrder.ordinal() == myUISettings.AVAILABLE_SORT_COLUMN_ORDER) {
+    //        myPluginManagerMain.pluginsModel.setSortKey(new RowSorter.SortKey(column, sortOrder));
+    //        break;
+    //      }
+    //    }
+    //  }
+    //  myPluginManagerMain.pluginsModel.setSortByStatus(myUISettings.AVAILABLE_SORT_BY_STATUS);
+    //} else {
+    //  myPluginManagerMain.pluginsModel.setSortByStatus(myUISettings.INSTALLED_SORT_BY_STATUS);
+    //}
     myPluginManagerMain.pluginsModel.sort();
     getSplitterProportions().restoreSplitterProportions(myPluginManagerMain.getMainPanel());
   }
diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java
index 456e7fc..a697e02 100644
--- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java
+++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerMain.java
@@ -272,11 +272,6 @@
   protected void modifyPluginsList(List<IdeaPluginDescriptor> list) {
     IdeaPluginDescriptor[] selected = pluginTable.getSelectedObjects();
     pluginsModel.updatePluginsList(list);
-    final RowSorter.SortKey key = pluginsModel.getDefaultSortKey();
-    if (key != null) {
-      pluginTable.getRowSorter().setSortKeys(Collections.singletonList(key));
-    }
-    //pluginsModel.sort();
     pluginsModel.filter(myFilter.getFilter().toLowerCase());
     if (selected != null) {
       select(selected);
@@ -633,7 +628,7 @@
                              : "Plugins were installed", project);
   }
 
-  public static void notifyPluginsWereUpdated(final String title, final Project project) {
+  public static void notifyPluginsWereUpdated(final String title, @Nullable final Project project) {
     final ApplicationEx app = ApplicationManagerEx.getApplicationEx();
     final boolean restartCapable = app.isRestartCapable();
     String message =
diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginTable.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginTable.java
index 847cad1..df91497 100644
--- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginTable.java
+++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginTable.java
@@ -29,10 +29,7 @@
 import javax.swing.*;
 import javax.swing.table.TableCellRenderer;
 import javax.swing.table.TableColumn;
-import javax.swing.table.TableModel;
-import javax.swing.table.TableRowSorter;
 import java.awt.datatransfer.Transferable;
-import java.util.List;
 
 /**
  * Created by IntelliJ IDEA.
@@ -99,19 +96,6 @@
   }
 
   @Override
-  protected TableRowSorter<TableModel> createRowSorter(TableModel model) {
-    return new DefaultColumnInfoBasedRowSorter(model){
-      @Override
-      public void setSortKeys(List<? extends SortKey> sortKeys) {
-        if (sortKeys != null && !sortKeys.isEmpty()) {
-          ((PluginTableModel)getModel()).setSortKey(sortKeys.get(0));
-        }
-        super.setSortKeys(sortKeys);
-      }
-    };
-  }
-
-  @Override
   protected boolean isSortOnUpdates() {
     return false;
   }
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/customization/ActionUrl.java b/platform/platform-impl/src/com/intellij/ide/ui/customization/ActionUrl.java
index aa9ea80..ef2f111 100644
--- a/platform/platform-impl/src/com/intellij/ide/ui/customization/ActionUrl.java
+++ b/platform/platform-impl/src/com/intellij/ide/ui/customization/ActionUrl.java
@@ -80,6 +80,10 @@
   public String getParentGroup(){
     return myGroupPath.get(myGroupPath.size() - 1);
   }
+  
+  public String getRootGroup() {
+    return myGroupPath.size() >= 1 ? myGroupPath.get(1) : "";
+  }
 
   public Object getComponent() {
     return myComponent;
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomActionsSchema.java b/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomActionsSchema.java
index c52f297..ed56542 100644
--- a/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomActionsSchema.java
+++ b/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomActionsSchema.java
@@ -204,7 +204,7 @@
         if (pair.first.equals(id)){
           final ActionGroup actionGroup = (ActionGroup)ActionManager.getInstance().getAction(id);
           if (actionGroup != null) { //J2EE/Commander plugin was disabled
-            myIdToActionGroup.put(id, CustomizationUtil.correctActionGroup(actionGroup, this, pair.second));
+            myIdToActionGroup.put(id, CustomizationUtil.correctActionGroup(actionGroup, this, pair.second, pair.second));
           }
         }
       }
@@ -216,7 +216,7 @@
     for (Pair pair : myIdToNameList) {
       final ActionGroup actionGroup = (ActionGroup)ActionManager.getInstance().getAction(pair.first);
       if (actionGroup != null) { //J2EE/Commander plugin was disabled
-        myIdToActionGroup.put(pair.first, CustomizationUtil.correctActionGroup(actionGroup, this, pair.second));
+        myIdToActionGroup.put(pair.first, CustomizationUtil.correctActionGroup(actionGroup, this, pair.second, pair.second));
       }
     }
   }
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomisedActionGroup.java b/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomisedActionGroup.java
index 655f8bc..b31e444 100644
--- a/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomisedActionGroup.java
+++ b/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomisedActionGroup.java
@@ -15,10 +15,7 @@
  */
 package com.intellij.ide.ui.customization;
 
-import com.intellij.openapi.actionSystem.ActionGroup;
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.DefaultActionGroup;
+import com.intellij.openapi.actionSystem.*;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -31,28 +28,31 @@
   private AnAction[] myChildren;
   private final CustomActionsSchema mySchema;
   private final String myDefaultGroupName;
+  private final String myRootGroupName;
 
   public CustomisedActionGroup(String shortName,
                                boolean popup,
                                final ActionGroup group,
                                CustomActionsSchema schema,
-                               String defaultGroupName) {
+                               String defaultGroupName, 
+                               String name) {
     super(shortName, popup);
     myGroup = group;
     mySchema = schema;
     myDefaultGroupName = defaultGroupName;
+    myRootGroupName = name;
     myForceUpdate = true;
   }
 
   @NotNull
   public AnAction[] getChildren(@Nullable final AnActionEvent e) {
     if (myForceUpdate){
-      myChildren = CustomizationUtil.getReordableChildren(myGroup, mySchema, myDefaultGroupName, e);
+      myChildren = CustomizationUtil.getReordableChildren(myGroup, mySchema, myDefaultGroupName, myRootGroupName, e);
       myForceUpdate = false;
       return myChildren;
     } else {
       if (!(myGroup instanceof DefaultActionGroup) || myChildren == null){
-        myChildren = CustomizationUtil.getReordableChildren(myGroup, mySchema, myDefaultGroupName, e);
+        myChildren = CustomizationUtil.getReordableChildren(myGroup, mySchema, myDefaultGroupName, myRootGroupName, e);
       }
       return myChildren;
     }
@@ -67,6 +67,16 @@
     return myGroup.isDumbAware();
   }
 
+  @Override
+  public boolean canBePerformed(DataContext context) {
+    return myGroup.canBePerformed(context);
+  }
+
+  @Override
+  public void actionPerformed(AnActionEvent e) {
+    myGroup.actionPerformed(e);
+  }
+
   @Nullable
   public AnAction getFirstAction() {
     final AnAction[] children = getChildren(null);
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomizationUtil.java b/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomizationUtil.java
index 31feb9f..136c08f 100644
--- a/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomizationUtil.java
+++ b/platform/platform-impl/src/com/intellij/ide/ui/customization/CustomizationUtil.java
@@ -50,7 +50,10 @@
   private CustomizationUtil() {
   }
 
-  public static ActionGroup correctActionGroup(final ActionGroup group, final CustomActionsSchema schema, final String defaultGroupName) {
+  public static ActionGroup correctActionGroup(final ActionGroup group,
+                                               final CustomActionsSchema schema,
+                                               final String defaultGroupName,
+                                               final String rootGroupName) {
     if (!schema.isCorrectActionGroup(group, defaultGroupName)){
        return group;
      }
@@ -65,11 +68,15 @@
       }
     }
 
-    return new CustomisedActionGroup(text, group.isPopup(), group, schema, defaultGroupName);
+    return new CustomisedActionGroup(text, group.isPopup(), group, schema, defaultGroupName, rootGroupName);
   }
 
 
-  static AnAction [] getReordableChildren(ActionGroup group, CustomActionsSchema schema, String defaultGroupName, AnActionEvent e) {
+  static AnAction [] getReordableChildren(ActionGroup group,
+                                          CustomActionsSchema schema,
+                                          String defaultGroupName,
+                                          String rootGroupName,
+                                          AnActionEvent e) {
     String text = group.getTemplatePresentation().getText();
     ActionManager actionManager = ActionManager.getInstance();
     final ArrayList<AnAction> reorderedChildren = new ArrayList<AnAction>();
@@ -78,7 +85,7 @@
     for (ActionUrl actionUrl : actions) {
       if ((actionUrl.getParentGroup().equals(text) ||
            actionUrl.getParentGroup().equals(defaultGroupName) ||
-           actionUrl.getParentGroup().equals(actionManager.getId(group)))) {
+           actionUrl.getParentGroup().equals(actionManager.getId(group)) && actionUrl.getRootGroup().equals(rootGroupName))) {
         AnAction componentAction = actionUrl.getComponentAction();
         if (componentAction != null) {
           if (actionUrl.getActionType() == ActionUrl.ADDED) {
@@ -109,7 +116,7 @@
     for (int i = 0; i < reorderedChildren.size(); i++) {
       if (reorderedChildren.get(i) instanceof ActionGroup) {
         final ActionGroup groupToCorrect = (ActionGroup)reorderedChildren.get(i);
-        final AnAction correctedAction = correctActionGroup(groupToCorrect, schema, "");
+        final AnAction correctedAction = correctActionGroup(groupToCorrect, schema, "", rootGroupName);
         reorderedChildren.set(i, correctedAction);
       }
     }
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/LafManagerImpl.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/LafManagerImpl.java
index 0c57604..e624990 100644
--- a/platform/platform-impl/src/com/intellij/ide/ui/laf/LafManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/LafManagerImpl.java
@@ -20,6 +20,7 @@
 import com.intellij.ide.ui.LafManager;
 import com.intellij.ide.ui.LafManagerListener;
 import com.intellij.ide.ui.UISettings;
+import com.intellij.ide.ui.laf.darcula.DarculaInstaller;
 import com.intellij.ide.ui.laf.darcula.DarculaLaf;
 import com.intellij.ide.ui.laf.darcula.DarculaLookAndFeelInfo;
 import com.intellij.idea.StartupUtil;
@@ -216,7 +217,16 @@
     if (myCurrentLaf != null) {
       final UIManager.LookAndFeelInfo laf = findLaf(myCurrentLaf.getClassName());
       if (laf != null) {
+        boolean needUninstall = UIUtil.isUnderDarcula();
         setCurrentLookAndFeel(laf); // setup default LAF or one specified by readExternal.
+        if (StartupUtil.getWizardLAF() != null) {
+          if (UIUtil.isUnderDarcula()) {
+            DarculaInstaller.install();
+          }
+          else if (needUninstall) {
+            DarculaInstaller.uninstall();
+          }
+        }
       }
     }
 
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTextBorder.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTextBorder.java
index fbecb60..3c6a69d 100644
--- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTextBorder.java
+++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTextBorder.java
@@ -18,6 +18,7 @@
 import com.intellij.ide.ui.laf.darcula.DarculaUIUtil;
 import com.intellij.openapi.ui.GraphicsConfig;
 import com.intellij.ui.Gray;
+import com.intellij.util.ui.UIUtil;
 
 import javax.swing.*;
 import javax.swing.border.Border;
@@ -61,10 +62,18 @@
       DarculaUIUtil.paintFocusRing(g, 2, 2, width-4, height-4);
     } else {
       boolean editable = !(c instanceof JTextComponent) || (((JTextComponent)c).isEditable());
-      g.setColor(c.isEnabled() && editable ? Gray._100 : Gray._83);
+      g.setColor(getBorderColor(c.isEnabled() && editable));
       g.drawRect(1, 1, width - 2, height - 2);
     }
     g.translate(-x, -y);
     config.restore();
   }
+
+  private static Color getBorderColor(boolean enabled) {
+    if (UIUtil.isUnderDarcula()) {
+      return enabled ? Gray._100 : Gray._83;
+    }
+    // disabled color is the same as ComboBox's border has
+    return enabled ? Gray._100 : Gray._150;
+  }
 }
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf.properties b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf.properties
index e773a44..5cfb19b 100644
--- a/platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf.properties
+++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/intellijlaf.properties
@@ -6,7 +6,7 @@
 intellijlaf.textForeground=000000
 intellijlaf.caretForeground=000000
 intellijlaf.inactiveBackground=ffffff
-intellijlaf.inactiveForeground=000000
+intellijlaf.inactiveForeground=777777
 intellijlaf.selectionForeground=ffffff
 intellijlaf.selectionBackgroundInactive=27384C
 intellijlaf.selectionInactiveBackground=27384C
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/search/DefaultSearchableConfigurable.java b/platform/platform-impl/src/com/intellij/ide/ui/search/DefaultSearchableConfigurable.java
deleted file mode 100644
index 503d875..0000000
--- a/platform/platform-impl/src/com/intellij/ide/ui/search/DefaultSearchableConfigurable.java
+++ /dev/null
@@ -1,90 +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.ide.ui.search;
-
-import com.intellij.openapi.options.Configurable;
-import com.intellij.openapi.options.ConfigurationException;
-import com.intellij.openapi.options.SearchableConfigurable;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.*;
-
-/**
- * User: anna
- * Date: 17-Mar-2006
- */
-public class DefaultSearchableConfigurable implements Configurable {
-  private final SearchableConfigurable myDelegate;
-  private JComponent myComponent;
-
-  public DefaultSearchableConfigurable(final SearchableConfigurable delegate) {
-    myDelegate = delegate;
-  }
-
-  @NonNls
-  public String getId() {
-    return myDelegate.getId();
-  }
-
-  public void clearSearch() {
-  }
-
-  public void enableSearch(String option) {
-    Runnable runnable = myDelegate.enableSearch(option);
-    if (runnable != null){
-      runnable.run();
-    }
-  }
-
-  public String getDisplayName() {
-    return myDelegate.getDisplayName();
-  }
-
-  @Nullable
-  @NonNls
-  public String getHelpTopic() {
-    return myDelegate.getHelpTopic();
-  }
-
-  public JComponent createComponent() {
-    myComponent = myDelegate.createComponent();
-    return myComponent;
-  }
-
-  public boolean isModified() {
-    return myDelegate.isModified();
-  }
-
-  public void apply() throws ConfigurationException {
-    myDelegate.apply();
-  }
-
-  public void reset() {
-    myDelegate.reset();
-  }
-
-  public void disposeUIResources() {
-    myComponent = null;
-    myDelegate.disposeUIResources();
-  }
-
-  public Configurable getDelegate() {
-    return myDelegate;
-  }
-
-}
diff --git a/platform/platform-impl/src/com/intellij/ide/ui/search/SearchableOptionsRegistrarImpl.java b/platform/platform-impl/src/com/intellij/ide/ui/search/SearchableOptionsRegistrarImpl.java
index b57a443..2daae1a 100644
--- a/platform/platform-impl/src/com/intellij/ide/ui/search/SearchableOptionsRegistrarImpl.java
+++ b/platform/platform-impl/src/com/intellij/ide/ui/search/SearchableOptionsRegistrarImpl.java
@@ -152,7 +152,7 @@
               for (String word : words) {
                 putOptionWithHelpId(word, id, groupName, synonym, null);
               }
-              final Couple<String> key = Couple.newOne(option, id);
+              final Couple<String> key = Couple.of(option, id);
               Set<String> foundSynonyms = myHighlightOption2Synonym.get(key);
               if (foundSynonyms == null) {
                 foundSynonyms = new THashSet<String>();
@@ -370,7 +370,7 @@
   @Override
   public Set<String> getSynonym(final String option, @NotNull final SearchableConfigurable configurable) {
     loadHugeFilesIfNecessary();
-    return myHighlightOption2Synonym.get(Couple.newOne(option, configurable.getId()));
+    return myHighlightOption2Synonym.get(Couple.of(option, configurable.getId()));
   }
 
   @Override
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java
index 36451e4..73aea37 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java
@@ -174,14 +174,14 @@
    */
   private static Couple<String> loadFile(@Nullable final VirtualFile file) throws IOException {
     if (file == null || !file.exists()) {
-      return Couple.newOne(null, SystemProperties.getLineSeparator());
+      return Couple.of(null, SystemProperties.getLineSeparator());
     }
 
     String fileText = new String(file.contentsToByteArray(), CharsetToolkit.UTF8);
     final int index = fileText.indexOf('\n');
-    return Couple.newOne(fileText, index == -1
-                                   ? SystemProperties.getLineSeparator()
-                                   : index - 1 >= 0 ? fileText.charAt(index - 1) == '\r' ? "\r\n" : "\n" : "\n");
+    return Couple.of(fileText, index == -1
+                               ? SystemProperties.getLineSeparator()
+                               : index - 1 >= 0 ? fileText.charAt(index - 1) == '\r' ? "\r\n" : "\n" : "\n");
   }
 
   public static boolean contentEquals(@NotNull final Document document, @NotNull final VirtualFile file) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/highlighting/FragmentBoundRenderer.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/highlighting/FragmentBoundRenderer.java
index f957ffe..14cc9fa 100644
--- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/highlighting/FragmentBoundRenderer.java
+++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/highlighting/FragmentBoundRenderer.java
@@ -191,7 +191,7 @@
     public void ensureLastX(final int x) {
       if (myPoints.isEmpty() || myPoints.get(myPoints.size() - 1).getFirst() < x) {
         if (myPoints.isEmpty()) {
-          myPoints.add(Couple.newOne(0, 0));
+          myPoints.add(Couple.of(0, 0));
           myPoints.addAll(generateLine(0,0,x,0,myYDiff,0));
         } else {
           final Couple<Integer> lastPoint = myPoints.get(myPoints.size() - 1);
@@ -229,7 +229,7 @@
       int newX = xCurrent + 4 + xRnd.nextInt(xVariation);
       newX = Math.min(newX, finalX);
       
-      result.add(Couple.newOne(newX, newY));
+      result.add(Couple.of(newX, newY));
       xCurrent = newX;
     }
 
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/BackspaceAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/BackspaceAction.java
index 5a378d4..3b1af62 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/BackspaceAction.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/BackspaceAction.java
@@ -88,10 +88,8 @@
     int offset = editor.getCaretModel().getOffset();
     if(colNumber > 0) {
       if(EditorModificationUtil.calcAfterLineEnd(editor) > 0) {
-        if (EditorActionUtil.canEditAtOffset(editor, offset - 1)) {
-          int columnShift = -1;
-          editor.getCaretModel().moveCaretRelatively(columnShift, 0, false, false, true);
-        }
+        int columnShift = -1;
+        editor.getCaretModel().moveCaretRelatively(columnShift, 0, false, false, true);
       }
       else {
         editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
@@ -99,40 +97,32 @@
 
         FoldRegion region = editor.getFoldingModel().getCollapsedRegionAtOffset(offset - 1);
         if (region != null && region.shouldNeverExpand()) {
-          if (EditorActionUtil.canEditAtOffset(editor, region.getStartOffset())) {
-            document.deleteString(region.getStartOffset(), region.getEndOffset());
-            editor.getCaretModel().moveToOffset(region.getStartOffset());
-          }
+          document.deleteString(region.getStartOffset(), region.getEndOffset());
+          editor.getCaretModel().moveToOffset(region.getStartOffset());
         }
         else {
-          if (EditorActionUtil.canEditAtOffset(editor, offset - 1)) {
-           document.deleteString(offset - 1, offset);
-           editor.getCaretModel().moveToOffset(offset - 1, true);
-          }
+          document.deleteString(offset - 1, offset);
+          editor.getCaretModel().moveToOffset(offset - 1, true);
         }
       }
     }
     else if(lineNumber > 0) {
       int separatorLength = document.getLineSeparatorLength(lineNumber - 1);
       int lineEnd = document.getLineEndOffset(lineNumber - 1) + separatorLength;
-      if (EditorActionUtil.canEditAtOffset(editor, lineEnd - separatorLength)) {
-        document.deleteString(lineEnd - separatorLength, lineEnd);
-        editor.getCaretModel().moveToOffset(lineEnd - separatorLength);
-        editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
-        editor.getSelectionModel().removeSelection();
-        // Do not group delete newline and other deletions.
-        CommandProcessor commandProcessor = CommandProcessor.getInstance();
-        commandProcessor.setCurrentCommandGroupId(null);
-      }
+      document.deleteString(lineEnd - separatorLength, lineEnd);
+      editor.getCaretModel().moveToOffset(lineEnd - separatorLength);
+      editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
+      editor.getSelectionModel().removeSelection();
+      // Do not group delete newline and other deletions.
+      CommandProcessor commandProcessor = CommandProcessor.getInstance();
+      commandProcessor.setCurrentCommandGroupId(null);
     }
   }
 
   static void doBackspaceAction(@NotNull Editor editor) {
     int newOffset = editor.getSelectionModel().getSelectionStart();
-    if (EditorActionUtil.canEditAtOffset(editor, newOffset)) {
-      editor.getCaretModel().moveToOffset(newOffset);
-      editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
-      EditorModificationUtil.deleteSelectedText(editor);
-    }
+    editor.getCaretModel().moveToOffset(newOffset);
+    editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
+    EditorModificationUtil.deleteSelectedText(editor);
   }
 }
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteAction.java
index cdd239a..2b9b2e1 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteAction.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteAction.java
@@ -111,7 +111,6 @@
     int afterLineEnd = EditorModificationUtil.calcAfterLineEnd(editor);
     Document document = editor.getDocument();
     int offset = editor.getCaretModel().getOffset();
-    if (!EditorActionUtil.canEditAtOffset(editor, offset + 1)) return;
     if (afterLineEnd < 0
         // There is a possible case that caret is located right before the soft wrap position at the last logical line
         // (popular use case with the soft wraps at the commit message dialog).
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/DuplicateAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/DuplicateAction.java
index 85d070e..d2c3df5 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/DuplicateAction.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/DuplicateAction.java
@@ -31,6 +31,7 @@
 import com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler;
 import com.intellij.openapi.editor.ex.util.EditorUtil;
 import com.intellij.openapi.util.Couple;
+import com.intellij.openapi.util.Pair;
 import org.jetbrains.annotations.Nullable;
 
 public class DuplicateAction extends EditorAction {
@@ -75,7 +76,7 @@
 
   @Nullable
   static Couple<Integer> duplicateLinesRange(Editor editor, Document document, VisualPosition rangeStart, VisualPosition rangeEnd) {
-    Couple<LogicalPosition> lines = EditorUtil.calcSurroundingRange(editor, rangeStart, rangeEnd);
+    Pair<LogicalPosition, LogicalPosition> lines = EditorUtil.calcSurroundingRange(editor, rangeStart, rangeEnd);
     int offset = editor.getCaretModel().getOffset();
 
     LogicalPosition lineStart = lines.first;
@@ -100,7 +101,7 @@
 
     editor.getCaretModel().moveToOffset(newOffset);
     editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
-    return Couple.newOne(end, end+s.length()-1);   // don't include separator of last line in range to select
+    return Couple.of(end, end + s.length() - 1);   // don't include separator of last line in range to select
   }
 
   @Override
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java
index ce992c9..8b77910 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java
@@ -40,7 +40,6 @@
 import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Key;
-import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.EditorPopupHandler;
@@ -680,7 +679,6 @@
   }
 
   public static void moveCaretPageUp(@NotNull Editor editor, boolean isWithSelection) {
-    ((EditorEx)editor).stopOptimizedScrolling();
     int lineHeight = editor.getLineHeight();
     Rectangle visibleArea = editor.getScrollingModel().getVisibleArea();
     int linesIncrement = visibleArea.height / lineHeight;
@@ -690,7 +688,6 @@
   }
 
   public static void moveCaretPageDown(@NotNull Editor editor, boolean isWithSelection) {
-    ((EditorEx)editor).stopOptimizedScrolling();
     int lineHeight = editor.getLineHeight();
     Rectangle visibleArea = editor.getScrollingModel().getVisibleArea();
     int linesIncrement = visibleArea.height / lineHeight;
@@ -751,17 +748,6 @@
     };
   }
 
-  public static boolean canEditAtOffset(@NotNull Editor editor, int offset) {
-    final Pair<String,String> markers = editor.getUserData(EditorImpl.EDITABLE_AREA_MARKER);
-    if (markers != null) {
-      final String text = editor.getDocument().getText();
-      final int start = text.indexOf(markers.first) + markers.first.length();
-      final int end = text.indexOf(markers.second);
-      return start <= offset && offset < end;
-    }
-    return true;
-  }
-
   public static boolean isHumpBound(@NotNull CharSequence editorText, int offset, boolean start) {
     final char prevChar = editorText.charAt(offset - 1);
     final char curChar = editorText.charAt(offset);
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/EditorEx.java b/platform/platform-impl/src/com/intellij/openapi/editor/ex/EditorEx.java
index 287f23c..62064a0 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/ex/EditorEx.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/ex/EditorEx.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -108,6 +108,9 @@
 
   int getMaxWidthInRange(int startOffset, int endOffset);
 
+  /**
+   * @deprecated Does nothing currently. To be removed in IDEA 15.
+   */
   void stopOptimizedScrolling();
 
   boolean setCaretVisible(boolean b);
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/util/EditorUtil.java b/platform/platform-impl/src/com/intellij/openapi/editor/ex/util/EditorUtil.java
index 1de8afb..caadfc8 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/ex/util/EditorUtil.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/ex/util/EditorUtil.java
@@ -29,7 +29,6 @@
 import com.intellij.openapi.editor.impl.IterationState;
 import com.intellij.openapi.fileEditor.impl.text.TextEditorImpl;
 import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider;
-import com.intellij.openapi.util.Couple;
 import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.SystemInfo;
 import com.intellij.openapi.util.TextRange;
@@ -714,11 +713,14 @@
    * @param start     target start coordinate
    * @param end       target end coordinate
    * @return          pair of the closest surrounding non-soft-wrapped logical positions for the visual line start and end
+   *
+   * @see #getNotFoldedLineStartOffset(com.intellij.openapi.editor.Editor, int)
+   * @see #getNotFoldedLineEndOffset(com.intellij.openapi.editor.Editor, int)
    */
   @SuppressWarnings("AssignmentToForLoopParameter")
-  public static Couple<LogicalPosition> calcSurroundingRange(@NotNull Editor editor,
-                                                             @NotNull VisualPosition start,
-                                                             @NotNull VisualPosition end) {
+  public static Pair<LogicalPosition, LogicalPosition> calcSurroundingRange(@NotNull Editor editor,
+                                                                            @NotNull VisualPosition start,
+                                                                            @NotNull VisualPosition end) {
     final Document document = editor.getDocument();
     final FoldingModel foldingModel = editor.getFoldingModel();
 
@@ -726,8 +728,7 @@
     for (
       int line = first.line, offset = document.getLineStartOffset(line);
       offset >= 0;
-      offset = document.getLineStartOffset(line))
-    {
+      offset = document.getLineStartOffset(line)) {
       final FoldRegion foldRegion = foldingModel.getCollapsedRegionAtOffset(offset);
       if (foldRegion == null) {
         first = new LogicalPosition(line, 0);
@@ -746,8 +747,7 @@
     for (
       int line = second.line, offset = document.getLineEndOffset(line);
       offset <= document.getTextLength();
-      offset = document.getLineEndOffset(line))
-    {
+      offset = document.getLineEndOffset(line)) {
       final FoldRegion foldRegion = foldingModel.getCollapsedRegionAtOffset(offset);
       if (foldRegion == null) {
         second = new LogicalPosition(line + 1, 0);
@@ -764,7 +764,53 @@
     if (second.line >= document.getLineCount()) {
       second = editor.offsetToLogicalPosition(document.getTextLength());
     }
-    return Couple.newOne(first, second);
+    return Pair.create(first, second);
+  }
+
+  /**
+   * Finds the start offset of visual line at which given offset is located, not taking soft wraps into account.
+   */
+  public static int getNotFoldedLineStartOffset(@NotNull Editor editor, int offset) {
+    while(true) {
+      offset = getLineStartOffset(offset, editor.getDocument());
+      FoldRegion foldRegion = editor.getFoldingModel().getCollapsedRegionAtOffset(offset - 1);
+      if (foldRegion == null || foldRegion.getStartOffset() >= offset) {
+        break;
+      }
+      offset = foldRegion.getStartOffset();
+    }
+    return offset;
+  }
+
+  /**
+   * Finds the end offset of visual line at which given offset is located, not taking soft wraps into account.
+   */
+  public static int getNotFoldedLineEndOffset(@NotNull Editor editor, int offset) {
+    while(true) {
+      offset = getLineEndOffset(offset, editor.getDocument());
+      FoldRegion foldRegion = editor.getFoldingModel().getCollapsedRegionAtOffset(offset);
+      if (foldRegion == null || foldRegion.getEndOffset() <= offset) {
+        break;
+      }
+      offset = foldRegion.getEndOffset();
+    }
+    return offset;
+  }
+
+  private static int getLineStartOffset(int offset, Document document) {
+    if (offset > document.getTextLength()) {
+      return offset;
+    }
+    int lineNumber = document.getLineNumber(offset);
+    return document.getLineStartOffset(lineNumber);
+  }
+
+  private static int getLineEndOffset(int offset, Document document) {
+    if (offset >= document.getTextLength()) {
+      return offset;
+    }
+    int lineNumber = document.getLineNumber(offset);
+    return document.getLineEndOffset(lineNumber);
   }
 
   public static void scrollToTheEnd(@NotNull Editor editor) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java
index f8e2b86..b0f5935 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java
@@ -33,7 +33,6 @@
 import com.intellij.openapi.editor.impl.softwrap.SoftWrapHelper;
 import com.intellij.openapi.ide.CopyPasteManager;
 import com.intellij.openapi.util.Disposer;
-import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.UserDataHolderBase;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.util.diff.FilesTooBigForDiffException;
@@ -1158,46 +1157,18 @@
     doSetSelection(startPositionToUse, startOffset, endPositionToUse, endOffset, true);
   }
 
-  private void doSetSelection(@NotNull final VisualPosition _startPosition,
+  private void doSetSelection(@NotNull final VisualPosition startPosition,
                               final int _startOffset,
-                              @NotNull final VisualPosition _endPosition,
+                              @NotNull final VisualPosition endPosition,
                               final int _endOffset,
                               final boolean visualPositionAware)
   {
     myEditor.getCaretModel().doWithCaretMerging(new Runnable() {
       public void run() {
-        VisualPosition startPosition = _startPosition;
         int startOffset = _startOffset;
-        VisualPosition endPosition = _endPosition;
         int endOffset = _endOffset;
         myUnknownDirection = false;
         final Document doc = myEditor.getDocument();
-        final Pair<String, String> markers = myEditor.getUserData(EditorImpl.EDITABLE_AREA_MARKER);
-        if (markers != null) {
-          final String text = doc.getText();
-          final int start = text.indexOf(markers.first) + markers.first.length();
-          final int end = text.indexOf(markers.second);
-          if (startOffset < endOffset) {
-            if (startOffset < start) {
-              startOffset = start;
-              startPosition = myEditor.offsetToVisualPosition(startOffset);
-            }
-            if (endOffset > end) {
-              endOffset = end;
-              endPosition = myEditor.offsetToVisualPosition(endOffset);
-            }
-          }
-          else {
-            if (endOffset < start) {
-              endOffset = start;
-              endPosition = myEditor.offsetToVisualPosition(startOffset);
-            }
-            if (startOffset > end) {
-              startOffset = end;
-              startPosition = myEditor.offsetToVisualPosition(endOffset);
-            }
-          }
-        }
 
         validateContext(true);
 
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
index 5e0920d..83bb738 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java
@@ -133,7 +133,6 @@
   @NonNls public static final Object IGNORE_MOUSE_TRACKING = "ignore_mouse_tracking";
   public static final Key<JComponent> PERMANENT_HEADER = Key.create("PERMANENT_HEADER");
   public static final Key<Boolean> DO_DOCUMENT_UPDATE_TEST = Key.create("DoDocumentUpdateTest");
-  public static final Key<Pair<String, String>> EDITABLE_AREA_MARKER = Key.create("editable.area.marker");
   private static final boolean HONOR_CAMEL_HUMPS_ON_TRIPLE_CLICK =
     Boolean.parseBoolean(System.getProperty("idea.honor.camel.humps.on.triple.click"));
   private static final Key<BufferedImage> BUFFER = Key.create("buffer");
@@ -812,9 +811,7 @@
     myScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
     myScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
 
-
     myScrollPane.setRowHeaderView(myGutterComponent);
-    stopOptimizedScrolling();
 
     myEditorComponent.setTransferHandler(new MyTransferHandler());
     myEditorComponent.setAutoscrolls(true);
@@ -1679,7 +1676,6 @@
 
     clearTextWidthCache();
 
-    stopOptimizedScrolling();
     mySelectionModel.removeBlockSelection();
     setMouseSelectionState(MOUSE_SELECTION_STATE_NONE);
 
@@ -1714,7 +1710,6 @@
     if (myScrollPane == null || myDocument.isInBulkUpdate()) return;
 
     clearTextWidthCache();
-    stopOptimizedScrolling();
     mySelectionModel.removeBlockSelection();
     setMouseSelectionState(MOUSE_SELECTION_STATE_NONE);
 
@@ -1810,7 +1805,6 @@
       }
       myPreferredSize = dim;
 
-      stopOptimizedScrolling();
       myGutterComponent.setLineNumberAreaWidth(new TIntFunction() {
         @Override
         public int execute(int lineNumber) {
@@ -1936,8 +1930,6 @@
       }
     }
 
-    startOptimizedScrolling();
-
     if (myUpdateCursor) {
       setCursorPosition();
       myUpdateCursor = false;
@@ -4376,10 +4368,6 @@
   }
 
   void updateCaretCursor() {
-    if (!ourIsUnitTestMode && !IJSwingUtilities.hasFocus(getContentComponent())) {
-      stopOptimizedScrolling();
-    }
-
     myUpdateCursor = true;
   }
 
@@ -4466,11 +4454,6 @@
 
   @Override
   public void stopOptimizedScrolling() {
-    //myEditorComponent.setOpaque(false);
-  }
-
-  private void startOptimizedScrolling() {
-    //myEditorComponent.setOpaque(true);
   }
 
   private static class CaretRectangle {
@@ -5015,7 +4998,7 @@
   }
 
   void assertIsDispatchThread() {
-    ApplicationManagerEx.getApplicationEx().assertIsDispatchThread(myEditorComponent);
+    ApplicationManagerEx.getApplicationEx().assertIsDispatchThread();
   }
 
   private static void assertReadAccess() {
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java
index d750a2f..c721a5a 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java
@@ -376,8 +376,8 @@
     repaintVerticalScrollBar();
   }
 
-  private void assertIsDispatchThread() {
-    ApplicationManagerEx.getApplicationEx().assertIsDispatchThread(myEditor.getComponent());
+  private static void assertIsDispatchThread() {
+    ApplicationManagerEx.getApplicationEx().assertIsDispatchThread();
   }
 
   @Override
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldRegionsTree.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldRegionsTree.java
index e998706..6c959e3 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldRegionsTree.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldRegionsTree.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.
@@ -40,7 +40,11 @@
   private int[] myCachedStartOffsets;
   private int[] myCachedFoldedLines;
   int myCachedLastIndex = -1;
-  private ArrayList<FoldRegion> myRegions = ContainerUtil.newArrayList();  //sorted in tree left-to-right topdown traversal order
+
+  //sorted using RangeMarker.BY_START_OFFSET comparator
+  //i.e., first by start offset, then, if start offsets are equal, by end offset
+  private ArrayList<FoldRegion> myRegions = ContainerUtil.newArrayList();
+
   private static final Comparator<FoldRegion> BY_END_OFFSET = new Comparator<FoldRegion>() {
     @Override
     public int compare(FoldRegion r1, FoldRegion r2) {
@@ -89,13 +93,15 @@
       }
 
       allValid.add(region);
-      
+
+      if (!region.isExpanded()) {
+        removeRegionsWithSameStartOffset(visible, region);
+        removeRegionsWithSameStartOffset(topLevels, region);
+      }
+
       if (currentCollapsed == null || !contains(currentCollapsed, region)) {
         visible.add(region);
-      }
-      
-      if (!region.isExpanded()) {
-        if (currentCollapsed == null || currentCollapsed.getEndOffset() < region.getStartOffset()) {
+        if (!region.isExpanded()) {
           currentCollapsed = region;
           topLevels.add(region);
         }
@@ -115,6 +121,17 @@
     updateCachedOffsets();
   }
 
+  private static void removeRegionsWithSameStartOffset(List<FoldRegion> regions, FoldRegion region) {
+    for (int i = regions.size() - 1; i >= 0 ; i--) {
+      if (regions.get(i).getStartOffset() == region.getStartOffset()) {
+        regions.remove(i);
+      }
+      else {
+        break;
+      }
+    }
+  }
+
   @NotNull
   private static FoldRegion[] toFoldArray(@NotNull List<FoldRegion> topLevels) {
     return topLevels.isEmpty() ? FoldRegion.EMPTY_ARRAY : topLevels.toArray(new FoldRegion[topLevels.size()]);
@@ -164,31 +181,25 @@
   boolean addRegion(FoldRegion range) {
     // During batchProcessing elements are inserted in ascending order,
     // binary search find acceptable insertion place first time
-    final boolean canUseCachedValue;
-    if (myCachedLastIndex >= myRegions.size()) {
-      // todo this happens after removeRegion()... myCachedListIndex must die!
-      canUseCachedValue = false;
+    boolean canUseCachedValue = false;
+    if (isBatchFoldingProcessing() && myCachedLastIndex >= 0 && myCachedLastIndex < myRegions.size()) {
+      FoldRegion lastRegion = myRegions.get(myCachedLastIndex);
+      if (RangeMarker.BY_START_OFFSET.compare(lastRegion, range) < 0) {
+        canUseCachedValue = myCachedLastIndex == (myRegions.size() - 1)
+                            || RangeMarker.BY_START_OFFSET.compare(range, myRegions.get(myCachedLastIndex + 1)) <= 0;
+      }
     }
-    else {
-      canUseCachedValue =
-        myCachedLastIndex != -1 && isBatchFoldingProcessing() && myRegions.get(myCachedLastIndex).getStartOffset() <= range.getStartOffset();
-    }
-    int fastIndex = canUseCachedValue ? myCachedLastIndex + 1 : Collections.binarySearch(myRegions, range, RangeMarker.BY_START_OFFSET);
-    if (fastIndex < 0) fastIndex = -fastIndex - 1;
-    
-    // There is a possible case that given range is the first at the current batch iteration. It's also possible that it
-    // range with the same bounds is already registered (e.g. particular range is registered during 'build initial fold regions' phase
-    // and given range has the same offsets but different 'expanded' status.
-    // We explicitly check for such situation, remove existing region and add the given one instead.
-    if (fastIndex < myRegions.size()) {
-      FoldRegion foldRegion = myRegions.get(fastIndex);
+    int index = canUseCachedValue ? myCachedLastIndex + 1 : Collections.binarySearch(myRegions, range, RangeMarker.BY_START_OFFSET);
+    if (index < 0) index = -index - 1;
+
+    if (index < myRegions.size()) {
+      FoldRegion foldRegion = myRegions.get(index);
       if (TextRange.areSegmentsEqual(foldRegion, range)) {
-        removeRegion(foldRegion);
-        return addRegion(range);
-      } 
+        return false;
+      }
     } 
     
-    for (int i = fastIndex - 1; i >=0; --i) {
+    for (int i = index - 1; i >=0; --i) {
       final FoldRegion region = myRegions.get(i);
       if (region.getEndOffset() < range.getStartOffset()) break;
       if (region.isValid() && intersects(region, range)) {
@@ -196,28 +207,15 @@
       }
     }
 
-    for (int i = fastIndex; i < myRegions.size(); i++) {
+    for (int i = index; i < myRegions.size(); i++) {
       final FoldRegion region = myRegions.get(i);
-
-      if (range.getStartOffset() < region.getStartOffset() ||
-          range.getStartOffset() == region.getStartOffset() && range.getEndOffset() > region.getEndOffset()) {
-        for (int j = i + 1; j < myRegions.size(); j++) {
-          final FoldRegion next = myRegions.get(j);
-          if (next.getEndOffset() >= range.getEndOffset() && next.isValid()) {
-            if (next.getStartOffset() < range.getStartOffset()) {
-              return false;
-            }
-            else {
-              break;
-            }
-          }
-        }
-
-        myRegions.add(myCachedLastIndex = i, range);
-        return true;
+      if (region.getStartOffset() > range.getEndOffset()) break;
+      if (region.isValid() && intersects(region, range)) {
+        return false;
       }
     }
-    myRegions.add(myCachedLastIndex = myRegions.size(),range);
+
+    myRegions.add(myCachedLastIndex = index,range);
     return true;
   }
 
@@ -274,7 +272,7 @@
   }
 
   private static boolean contains(FoldRegion outer, FoldRegion inner) {
-    return outer.getStartOffset() < inner.getStartOffset() && outer.getEndOffset() > inner.getStartOffset();
+    return outer.getStartOffset() <= inner.getStartOffset() && outer.getEndOffset() >= inner.getEndOffset();
   }
 
   private static boolean intersects(FoldRegion r1, FoldRegion r2) {
@@ -282,7 +280,7 @@
     final int s2 = r2.getStartOffset();
     final int e1 = r1.getEndOffset();
     final int e2 = r2.getEndOffset();
-    return s1 == s2 && e1 == e2 || s1 < s2 && s2 < e1 && e1 < e2 || s2 < s1 && s1 < e2 && e2 < e1;
+    return s1 < s2 && s2 < e1 && e1 < e2 || s2 < s1 && s1 < e2 && e2 < e1;
   }
 
   static boolean contains(FoldRegion region, int offset) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java
index 8349aac..0621ff4 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldingModelImpl.java
@@ -138,8 +138,8 @@
     return getCollapsedRegionAtOffset(offset) != null;
   }
 
-  private void assertIsDispatchThreadForEditor() {
-    ApplicationManagerEx.getApplicationEx().assertIsDispatchThread(myEditor.getComponent());
+  private static void assertIsDispatchThreadForEditor() {
+    ApplicationManagerEx.getApplicationEx().assertIsDispatchThread();
   }
   private static void assertReadAccess() {
     ApplicationManagerEx.getApplicationEx().assertReadAccessAllowed();
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/ScrollingModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/ScrollingModelImpl.java
index 175889d..2942baf 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/ScrollingModelImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/ScrollingModelImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -155,8 +155,8 @@
     scrollToOffsets(p.x, p.y);
   }
 
-  private void assertIsDispatchThread() {
-    ApplicationManagerEx.getApplicationEx().assertIsDispatchThread(myEditor.getComponent());
+  private static void assertIsDispatchThread() {
+    ApplicationManagerEx.getApplicationEx().assertIsDispatchThread();
   }
 
   @Override
@@ -294,13 +294,7 @@
     myEditor.validateSize();
     JScrollBar scrollbar = myEditor.getScrollPane().getVerticalScrollBar();
 
-    if (scrollbar.getVisibleAmount() < Math.abs(scrollOffset - scrollbar.getValue()) + 50) {
-      myEditor.stopOptimizedScrolling();
-    }
-
     scrollbar.setValue(scrollOffset);
-
-    //System.out.println("scrolled vertically to: " + scrollOffset);
   }
 
   @Override
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java
index 819a057..9bec057 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/SoftWrapModelImpl.java
@@ -85,7 +85,7 @@
   private final SoftWrapFoldBasedApplianceStrategy myFoldBasedApplianceStrategy;
   private final CachingSoftWrapDataMapper          myDataMapper;
   private final SoftWrapsStorage                   myStorage;
-  private final SoftWrapPainter                    myPainter;
+  private       SoftWrapPainter                    myPainter;
   private final SoftWrapApplianceManager           myApplianceManager;
   private final SoftWrapAwareVisualSizeManager     myVisualSizeManager;
 
@@ -128,39 +128,18 @@
   private boolean myForceAdditionalColumns;
 
   public SoftWrapModelImpl(@NotNull EditorEx editor) {
-    this(editor, new SoftWrapsStorage(), new CompositeSoftWrapPainter(editor));
-  }
-
-  public SoftWrapModelImpl(@NotNull final EditorEx editor, @NotNull SoftWrapsStorage storage, @NotNull SoftWrapPainter painter) {
-    this(editor, storage, painter, new DefaultEditorTextRepresentationHelper(editor));
-  }
-
-  public SoftWrapModelImpl(@NotNull final EditorEx editor, @NotNull SoftWrapsStorage storage, @NotNull SoftWrapPainter painter,
-                           @NotNull EditorTextRepresentationHelper representationHelper) {
-    this(editor, storage, painter, representationHelper, new CachingSoftWrapDataMapper(editor, storage, representationHelper));
-    myApplianceManager.addListener(myDataMapper);
-  }
-
-  public SoftWrapModelImpl(@NotNull final EditorEx editor, @NotNull SoftWrapsStorage storage, @NotNull SoftWrapPainter painter,
-                           @NotNull EditorTextRepresentationHelper representationHelper, @NotNull CachingSoftWrapDataMapper dataMapper)
-  {
-    this(editor, storage, painter, new SoftWrapApplianceManager(storage, editor, painter, representationHelper, dataMapper), dataMapper);
-  }
-
-  public SoftWrapModelImpl(@NotNull EditorEx editor, @NotNull SoftWrapsStorage storage, @NotNull SoftWrapPainter painter,
-                           @NotNull SoftWrapApplianceManager applianceManager, @NotNull CachingSoftWrapDataMapper dataMapper)
-  {
     myEditor = editor;
-    myStorage = storage;
-    myPainter = painter;
-    myApplianceManager = applianceManager;
-    myDataMapper = dataMapper;
+    myStorage = new SoftWrapsStorage();
+    myPainter = new CompositeSoftWrapPainter(editor);
+    DefaultEditorTextRepresentationHelper representationHelper = new DefaultEditorTextRepresentationHelper(editor);
+    myDataMapper = new CachingSoftWrapDataMapper(editor, myStorage, representationHelper);
+    myApplianceManager = new SoftWrapApplianceManager(myStorage, editor, myPainter, representationHelper, myDataMapper);
     myFoldBasedApplianceStrategy = new SoftWrapFoldBasedApplianceStrategy(editor);
-    myVisualSizeManager = new SoftWrapAwareVisualSizeManager(painter);
+    myVisualSizeManager = new SoftWrapAwareVisualSizeManager(myPainter);
 
     myDocumentListeners.add(myApplianceManager);
-    applianceManager.addListener(myVisualSizeManager);
-    applianceManager.addListener(new SoftWrapAwareDocumentParsingListenerAdapter() {
+    myApplianceManager.addListener(myVisualSizeManager);
+    myApplianceManager.addListener(new SoftWrapAwareDocumentParsingListenerAdapter() {
       @Override
       public void recalculationEnds() {
         for (SoftWrapChangeListener listener : mySoftWrapListeners) {
@@ -174,6 +153,8 @@
     editor.addPropertyChangeListener(this);
 
     ApplicationManager.getApplication().getMessageBus().connect(this).subscribe(DocumentBulkUpdateListener.TOPIC, this);
+
+    myApplianceManager.addListener(myDataMapper);
   }
 
   /**
@@ -451,7 +432,7 @@
                              && myFoldBasedApplianceStrategy.processSoftWraps();
 
     if (!useSoftWraps) {
-      return useSoftWraps;
+      return false;
     }
 
     if (myDirty) {
@@ -716,6 +697,13 @@
     }
   }
 
+  // for testing purposes
+  public void setSoftWrapPainter(SoftWrapPainter painter) {
+    myPainter = painter;
+    myApplianceManager.setSoftWrapPainter(painter);
+    myVisualSizeManager.setSoftWrapPainter(painter);
+  }
+
   @NotNull
   @Override
   public String dumpState() {
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/IncrementalCacheUpdateEvent.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/IncrementalCacheUpdateEvent.java
index 2c9450c..dee985f 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/IncrementalCacheUpdateEvent.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/IncrementalCacheUpdateEvent.java
@@ -16,10 +16,10 @@
 package com.intellij.openapi.editor.impl.softwrap.mapping;
 
 import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.FoldRegion;
-import com.intellij.openapi.editor.FoldingModel;
+import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.event.DocumentEvent;
 import com.intellij.openapi.editor.ex.FoldingModelEx;
+import com.intellij.openapi.editor.ex.util.EditorUtil;
 import org.jetbrains.annotations.NotNull;
 
 /**
@@ -53,32 +53,31 @@
    * 
    * @param event   object that describes document change that caused cache update
    */
-  public IncrementalCacheUpdateEvent(@NotNull DocumentEvent event, @NotNull FoldingModel foldingModel) {
-    this(event.getDocument(),
+  public IncrementalCacheUpdateEvent(@NotNull DocumentEvent event, @NotNull Editor editor) {
+    this(editor,
          event.getOffset(),
          event.getOffset() + event.getOldLength(),
-         event.getOffset() + event.getNewLength(),
-         foldingModel);
+         event.getOffset() + event.getNewLength());
   }
 
   /**
    * Creates new <code>IncrementalCacheUpdateEvent</code> object for the event not changing document length
    * (like expansion of folded region).
    */
-  public IncrementalCacheUpdateEvent(@NotNull Document document, int startOffset, int endOffset, @NotNull FoldingModel foldingModel) {
-    this(document, startOffset, endOffset, endOffset, foldingModel);
+  public IncrementalCacheUpdateEvent(@NotNull Editor editor, int startOffset, int endOffset) {
+    this(editor, startOffset, endOffset, endOffset);
   }
 
-  private IncrementalCacheUpdateEvent(@NotNull Document document, int startOffset, int oldEndOffset, int newEndOffset,
-                                      @NotNull FoldingModel foldingModel) {
+  private IncrementalCacheUpdateEvent(@NotNull Editor editor, int startOffset, int oldEndOffset, int newEndOffset) {
+    Document document = editor.getDocument();
     myExactStartOffset = startOffset;
     myOldExactEndOffset = oldEndOffset;
     myNewExactEndOffset = newEndOffset;
     myStartLogicalLine = getLine(myExactStartOffset, document);
     myOldLogicalLinesDiff = getLine(myOldExactEndOffset, document) - myStartLogicalLine;
 
-    myOldStartOffset = getNotFoldedLineStartOffset(myExactStartOffset, document, foldingModel);
-    myOldEndOffset = getNotFoldedLineEndOffset(myOldExactEndOffset, document, foldingModel);
+    myOldStartOffset = EditorUtil.getNotFoldedLineStartOffset(editor, myExactStartOffset);
+    myOldEndOffset = EditorUtil.getNotFoldedLineEndOffset(editor, myOldExactEndOffset);
   }
 
   /**
@@ -116,10 +115,11 @@
    * @param document      document which change caused current cache update event construction
    * @param foldingModel  fold model to use
    */
-  public void updateNewOffsetsIfNecessary(@NotNull Document document, @NotNull FoldingModelEx foldingModel) {
+  public void updateNewOffsetsIfNecessary(@NotNull Editor editor) {
+    Document document = editor.getDocument();
     myNewLogicalLinesDiff = document.getLineNumber(myNewExactEndOffset) - document.getLineNumber(myExactStartOffset);
-    myNewStartOffset = getNotFoldedLineStartOffset(myExactStartOffset, document, foldingModel);
-    myNewEndOffset = getNotFoldedLineEndOffset(myNewExactEndOffset, document, foldingModel);
+    myNewStartOffset = EditorUtil.getNotFoldedLineStartOffset(editor, myExactStartOffset);
+    myNewEndOffset = EditorUtil.getNotFoldedLineEndOffset(editor, myNewExactEndOffset);
   }
 
   /**
@@ -216,46 +216,6 @@
     return document.getLineNumber(offset);
   }
   
-  private static int getLineStartOffset(int offset, Document document) {
-    if (offset > document.getTextLength()) {
-      return offset;
-    }
-    int lineNumber = document.getLineNumber(offset);
-    return document.getLineStartOffset(lineNumber);
-  }
-
-  private static int getLineEndOffset(int offset, Document document) {
-    if (offset >= document.getTextLength()) {
-      return offset;
-    }
-    int lineNumber = document.getLineNumber(offset);
-    return document.getLineEndOffset(lineNumber);
-  }
-
-  private static int getNotFoldedLineStartOffset(int offset, Document document, FoldingModel foldingModel) {
-    while(true) {
-      offset = getLineStartOffset(offset, document);
-      FoldRegion foldRegion = foldingModel.getCollapsedRegionAtOffset(offset);
-      if (foldRegion == null || foldRegion.getStartOffset() >= offset) {
-        break;
-      }
-      offset = foldRegion.getStartOffset();
-    }
-    return offset;
-  }
-
-  private static int getNotFoldedLineEndOffset(int offset, Document document, FoldingModel foldingModel) {
-    while(true) {
-      offset = getLineEndOffset(offset, document);
-      FoldRegion foldRegion = foldingModel.getCollapsedRegionAtOffset(offset);
-      if (foldRegion == null || foldRegion.getEndOffset() <= offset) {
-        break;
-      }
-      offset = foldRegion.getEndOffset();
-    }
-    return offset;
-  }
-
   @Override
   public String toString() {
     return String.format(
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java
index 11d31dc..a617ce9 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceManager.java
@@ -28,10 +28,12 @@
 import com.intellij.openapi.editor.ex.EditorEx;
 import com.intellij.openapi.editor.ex.ScrollingModelEx;
 import com.intellij.openapi.editor.ex.util.EditorUtil;
-import com.intellij.openapi.editor.impl.*;
+import com.intellij.openapi.editor.impl.EditorImpl;
+import com.intellij.openapi.editor.impl.EditorTextRepresentationHelper;
+import com.intellij.openapi.editor.impl.IterationState;
+import com.intellij.openapi.editor.impl.TextChangeImpl;
 import com.intellij.openapi.editor.impl.softwrap.*;
 import com.intellij.openapi.editor.markup.TextAttributes;
-import com.intellij.openapi.util.registry.Registry;
 import com.intellij.openapi.util.text.StringUtil;
 import org.intellij.lang.annotations.JdkConstants;
 import org.jetbrains.annotations.NotNull;
@@ -81,7 +83,7 @@
 
   private final SoftWrapsStorage               myStorage;
   private final EditorEx                       myEditor;
-  private final SoftWrapPainter myPainter;
+  private       SoftWrapPainter                myPainter;
   private final SoftWrapDataMapper myDataMapper;
 
   /**
@@ -210,7 +212,7 @@
   }
 
   private void recalculateSoftWraps(IncrementalCacheUpdateEvent event) {
-    event.updateNewOffsetsIfNecessary(myEditor.getDocument(), myEditor.getFoldingModel());
+    event.updateNewOffsetsIfNecessary(myEditor);
     
     //CachingSoftWrapDataMapper.log("xxxxxxxxxxxxxx Processing soft wraps for " + event + ". Document length: " + myEditor.getDocument().getTextLength() 
     //                              + ", document: " + System.identityHashCode(myEditor.getDocument()));
@@ -336,8 +338,7 @@
     
     notifyListenersOnVisualLineStart(myContext.lineStartPosition);
     
-    if (!myContext.exceedsVisualEdge(newX)
-        || (myContext.currentPosition.offset == myContext.lineStartPosition.offset) && !Registry.is("editor.wrap.collapsed.region.at.line.start")) {
+    if (!myContext.exceedsVisualEdge(newX) || myContext.currentPosition.offset == myContext.lineStartPosition.offset) {
       myContext.advance(foldRegion, placeholderWidthInPixels);
       return true;
     }
@@ -984,7 +985,7 @@
   public void onFoldRegionStateChange(int startOffset, int endOffset) {
     assert ApplicationManagerEx.getApplicationEx().isDispatchThread();
 
-    myEventsStorage.add(myEditor.getDocument(), new IncrementalCacheUpdateEvent(myEditor.getDocument(), startOffset, endOffset, myEditor.getFoldingModel()));
+    myEventsStorage.add(myEditor.getDocument(), new IncrementalCacheUpdateEvent(myEditor, startOffset, endOffset));
   }
 
   public void onFoldProcessingEnd() {
@@ -994,7 +995,7 @@
 
   @Override
   public void beforeDocumentChange(DocumentEvent event) {
-    myEventsStorage.add(event.getDocument(), new IncrementalCacheUpdateEvent(event, myEditor.getFoldingModel()));
+    myEventsStorage.add(event.getDocument(), new IncrementalCacheUpdateEvent(event, myEditor));
   }
 
   @Override
@@ -1026,6 +1027,11 @@
     return dumpState();
   }
 
+  // for testing purposes
+  public void setSoftWrapPainter(SoftWrapPainter painter) {
+    myPainter = painter;
+  }
+
   /**
    * We need to use correct indent for soft-wrapped lines, i.e. they should be indented to the start of the logical line.
    * This class stores information about logical line start indent. 
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapAwareVisualSizeManager.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapAwareVisualSizeManager.java
index c90e1be..e0b6060 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapAwareVisualSizeManager.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapAwareVisualSizeManager.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.
@@ -37,7 +37,7 @@
   private final List<VisualSizeChangeListener> myListeners  = new ArrayList<VisualSizeChangeListener>();
   private final TIntIntHashMap                 myLineWidths = new TIntIntHashMap();
 
-  private final SoftWrapPainter myPainter;
+  private SoftWrapPainter myPainter;
 
   /**
    * There is a possible case that particular recalculation finished abruptly
@@ -99,4 +99,9 @@
       myLineWidths.put(line, width);
     }
   }
+
+  // for testing purposes
+  public void setSoftWrapPainter(SoftWrapPainter painter) {
+    myPainter = painter;
+  }
 }
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/ex/FileEditorManagerEx.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/ex/FileEditorManagerEx.java
index eca89ca..9520834 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/ex/FileEditorManagerEx.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/ex/FileEditorManagerEx.java
@@ -122,6 +122,12 @@
   @Nullable
   public abstract Pair <FileEditor, FileEditorProvider> getSelectedEditorWithProvider(@NotNull VirtualFile file);
 
+  /**
+   * Closes all files IN ACTIVE SPLITTER (window).
+   *
+   * @see com.intellij.ui.docking.DockManager#getContainers()
+   * @see com.intellij.ui.docking.DockContainer#closeAll()
+   */
   public abstract void closeAllFiles();
 
   @NotNull
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorEmptyTextPainter.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorEmptyTextPainter.java
index f440155..4807812 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorEmptyTextPainter.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorEmptyTextPainter.java
@@ -62,7 +62,7 @@
       @Override
       public Couple<Integer> fun(Integer width, Integer height) {
         Dimension s = splitters.getSize();
-        return Couple.newOne((s.width - width) / 2, (s.height - height) / 2);
+        return Couple.of((s.width - width) / 2, (s.height - height) / 2);
       }
     });
   }
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java
index 34cff44..1b990b5 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorWindow.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -282,7 +282,7 @@
     final VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(info.getFirst());
     final Integer second = info.getSecond();
     if (file != null) {
-      getManager().openFileImpl4(this, file, true, null, true, second == null ? -1 : second.intValue());
+      getManager().openFileImpl4(this, file, null, true, true, null, second == null ? -1 : second.intValue());
     }
   }
 
@@ -644,6 +644,10 @@
   }
 
   public void setEditor(@Nullable final EditorWithProviderComposite editor, final boolean focusEditor) {
+    setEditor(editor, true, focusEditor);
+  }
+
+  public void setEditor(@Nullable final EditorWithProviderComposite editor, final boolean selectEditor, final boolean focusEditor) {
     if (editor != null) {
       if (myTabbedPane == null) {
         myPanel.removeAll ();
@@ -654,7 +658,9 @@
 
       final int index = findEditorIndex(editor);
       if (index != -1) {
-        setSelectedEditor(editor, focusEditor);
+        if (selectEditor) {
+          setSelectedEditor(editor, focusEditor);
+        }
       }
       else {
         Integer initialIndex = editor.getFile().getUserData(INITIAL_INDEX_KEY);
@@ -672,7 +678,9 @@
         final Icon template = AllIcons.FileTypes.Text;
         myTabbedPane.insertTab(file, new EmptyIcon(template.getIconWidth(), template.getIconHeight()), new TComp(this, editor), null, indexToInsert);
         trimToSize(UISettings.getInstance().EDITOR_TAB_LIMIT, file, false);
-        setSelectedEditor(editor, focusEditor);
+        if (selectEditor) {
+          setSelectedEditor(editor, focusEditor);
+        }
         myOwner.updateFileIcon(file);
         myOwner.updateFileColor(file);
       }
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorsSplitters.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorsSplitters.java
index b8d1940..c46684a 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorsSplitters.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorsSplitters.java
@@ -15,24 +15,26 @@
  */
 package com.intellij.openapi.fileEditor.impl;
 
+import com.intellij.ide.IdeBundle;
 import com.intellij.ide.ui.UISettings;
 import com.intellij.ide.ui.UISettingsListener;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.ModalityState;
 import com.intellij.openapi.components.ServiceManager;
 import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.fileEditor.FileEditor;
 import com.intellij.openapi.fileEditor.impl.text.FileDropHandler;
 import com.intellij.openapi.keymap.Keymap;
 import com.intellij.openapi.keymap.KeymapManager;
 import com.intellij.openapi.keymap.KeymapManagerListener;
+import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.openapi.progress.ProgressManager;
 import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.Splitter;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.Disposer;
-import com.intellij.openapi.util.InvalidDataException;
-import com.intellij.openapi.util.Ref;
+import com.intellij.openapi.util.*;
 import com.intellij.openapi.vfs.VfsUtilCore;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.wm.FocusWatcher;
@@ -70,6 +72,9 @@
 public class EditorsSplitters extends IdePanePanel implements UISettingsListener {
   private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.fileEditor.impl.EditorsSplitters");
   private static final String PINNED = "pinned";
+  private static final String CURRENT_IN_TAB = "current-in-tab";
+
+  private static final Key<Object> DUMMY_KEY = Key.create("EditorsSplitters.dummy.key");
 
   private final static EditorEmptyTextPainter ourPainter = ServiceManager.getService(EditorEmptyTextPainter.class);
 
@@ -82,6 +87,7 @@
   private final MyFocusWatcher myFocusWatcher;
   private final Alarm myIconUpdaterAlarm = new Alarm();
   private final KeymapManagerListener myKeymapListener;
+  private final UIBuilder myUIBuilder = new UIBuilder();
 
   public EditorsSplitters(final FileEditorManagerImpl manager, DockManager dockManager, boolean createOwnDockableContainer) {
     super(new BorderLayout());
@@ -228,122 +234,80 @@
     final HistoryEntry entry = composite.currentStateAsHistoryEntry();
     entry.writeExternal(fileElement, getManager().getProject());
     fileElement.setAttribute(PINNED,         Boolean.toString(pinned));
-    fileElement.setAttribute("current",        Boolean.toString(composite.equals (getManager ().getLastSelected ())));
-    fileElement.setAttribute("current-in-tab", Boolean.toString(composite.equals (selectedEditor)));
+    fileElement.setAttribute(CURRENT_IN_TAB, Boolean.toString(composite.equals(selectedEditor)));
     res.addContent(fileElement);
   }
 
   public void openFiles() {
     if (mySplittersElement != null) {
-      Ref<EditorWindow> currentWindow = new Ref<EditorWindow>();
-      final JPanel comp = readExternalPanel(mySplittersElement, getTopPanel(), currentWindow);
-      if (comp != null) {
-        removeAll();
-        add(comp, BorderLayout.CENTER);
-        mySplittersElement = null;
-      }
-      // clear empty splitters
-      for (EditorWindow window : getWindows()) {
-        if (window.getEditors().length == 0) {
-          for (EditorWindow sibling : window.findSiblings()) {
-            sibling.unsplit(false);
+      initializeProgress();
+      final JPanel comp = myUIBuilder.process(mySplittersElement, getTopPanel());
+      UIUtil.invokeAndWaitIfNeeded(new Runnable() {
+        @Override
+        public void run() {
+          if (comp != null) {
+            removeAll();
+            add(comp, BorderLayout.CENTER);
+            mySplittersElement = null;
+          }
+          // clear empty splitters
+          for (EditorWindow window : getWindows()) {
+            if (window.getEditors().length == 0) {
+              for (EditorWindow sibling : window.findSiblings()) {
+                sibling.unsplit(false);
+              }
+            }
           }
         }
-      }
-      if (!currentWindow.isNull()) {
-        setCurrentWindow(currentWindow.get(), true);
-      }
+      });
     }
   }
 
+  private double myProgressMaximum;
+  private int myCurrentProgress;
+
+  private void initializeProgress() {
+    ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
+    if (indicator != null) {
+      indicator.setText(IdeBundle.message("loading.editors"));
+      indicator.setText2("");
+      indicator.setIndeterminate(false);
+      indicator.setFraction(0);
+
+      myProgressMaximum = countFiles(mySplittersElement);
+      myCurrentProgress = 0;
+    }
+  }
+
+  private void updateProgress() {
+    ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
+    if (indicator != null) {
+      myCurrentProgress++;
+      indicator.setFraction(myCurrentProgress / myProgressMaximum);
+    }
+  }
+
+  private static int countFiles(Element element) {
+    Integer value = new ConfigTreeReader<Integer>() {
+      @Override
+      protected Integer processFiles(@NotNull List<Element> fileElements, @Nullable Integer context) {
+        return fileElements.size();
+      }
+
+      @Override
+      protected Integer processSplitter(@NotNull Element element, @Nullable Element firstChild, @Nullable Element secondChild, @Nullable Integer context) {
+        Integer first = process(firstChild, null);
+        Integer second = process(secondChild, null);
+        return (first == null ? 0 : first) + (second == null ? 0 : second);
+      }
+    }.process(element, null);
+    return value == null ? 0 : value;
+  }
+
   public void readExternal(final Element element) {
     mySplittersElement = element;
   }
 
-  @Nullable
-  @SuppressWarnings({"HardCodedStringLiteral"})
-  private JPanel readExternalPanel(final Element element, @Nullable JPanel panel, Ref<EditorWindow> currentWindow) {
-    final Element splitterElement = element.getChild("splitter");
-    if (splitterElement != null) {
-      return readSplitter(panel, splitterElement, currentWindow);
-    }
-
-    final Element leaf = element.getChild("leaf");
-    if (leaf == null) {
-      return null;
-    }
-
-    final EditorWindow window = panel == null ? new EditorWindow(this) : findWindowWith(panel);
-    LOG.assertTrue(window != null);
-
-    @SuppressWarnings("unchecked") final List<Element> children = ContainerUtil.newArrayList(leaf.getChildren("file"));
-
-    // trim to EDITOR_TAB_LIMIT, ignoring CLOSE_NON_MODIFIED_FILES_FIRST policy
-    for (Iterator<Element> iterator = children.iterator(); iterator.hasNext() && UISettings.getInstance().EDITOR_TAB_LIMIT < children.size(); ) {
-      Element child = iterator.next();
-      if (!Boolean.valueOf(child.getAttributeValue(PINNED)).booleanValue()) {
-        iterator.remove();
-      }
-    }
-
-    VirtualFile currentFile = null;
-    for (int i = 0; i < children.size(); i++) {
-      final Element file = children.get(i);
-      try {
-        final FileEditorManagerImpl fileEditorManager = getManager();
-        final HistoryEntry entry = new HistoryEntry(fileEditorManager.getProject(), file.getChild(HistoryEntry.TAG), true);
-        final boolean isCurrent = Boolean.valueOf(file.getAttributeValue("current")).booleanValue();
-        fileEditorManager.openFileImpl4(window, entry.myFile, false, entry, isCurrent, i);
-        if (fileEditorManager.isFileOpen(entry.myFile)) {
-          window.setFilePinned(entry.myFile, Boolean.valueOf(file.getAttributeValue(PINNED)).booleanValue());
-          if (Boolean.valueOf(file.getAttributeValue("current-in-tab")).booleanValue()) {
-            currentFile = entry.myFile;
-          }
-        }
-
-      }
-      catch (InvalidDataException e) {
-        if (ApplicationManager.getApplication().isUnitTestMode()) {
-          LOG.error(e);
-        }
-      }
-    }
-    if (currentFile != null) {
-      final EditorComposite editor = window.findFileComposite(currentFile);
-      if (editor != null) {
-        window.setSelectedEditor(editor, true);
-      }
-    }
-    return window.myPanel;
-  }
-
-  private JPanel readSplitter(JPanel panel, Element splitterElement, Ref<EditorWindow> currentWindow) {
-    final boolean orientation = "vertical".equals(splitterElement.getAttributeValue("split-orientation"));
-    final float proportion = Float.valueOf(splitterElement.getAttributeValue("split-proportion")).floatValue();
-    final Element first = splitterElement.getChild("split-first");
-    final Element second = splitterElement.getChild("split-second");
-
-    Splitter splitter;
-    if (panel == null) {
-      panel = new JPanel(new BorderLayout());
-      panel.setOpaque(false);
-      splitter = new Splitter(orientation, proportion, 0.1f, 0.9f);
-      panel.add(splitter, BorderLayout.CENTER);
-      splitter.setFirstComponent(readExternalPanel(first, null, currentWindow));
-      splitter.setSecondComponent(readExternalPanel(second, null, currentWindow));
-    }
-    else if (panel.getComponent(0) instanceof Splitter) {
-      splitter = (Splitter)panel.getComponent(0);
-      readExternalPanel(first, (JPanel)splitter.getFirstComponent(), currentWindow);
-      readExternalPanel(second, (JPanel)splitter.getSecondComponent(), currentWindow);
-    }
-    else {
-      readExternalPanel(first, panel, currentWindow);
-      readExternalPanel(second, panel, currentWindow);
-    }
-    return panel;
-  }
-
   @NotNull public VirtualFile[] getOpenFiles() {
     final ArrayListSet<VirtualFile> files = new ArrayListSet<VirtualFile>();
     for (final EditorWindow myWindow : myWindows) {
@@ -816,4 +780,129 @@
       return myFileDropHandler.canHandleDrop(transferFlavors);
     }
   }
+
+  private abstract static class ConfigTreeReader<T> {
+    @Nullable
+    public T process(@Nullable Element element, @Nullable T context) {
+      if (element == null) {
+        return null;
+      }
+      final Element splitterElement = element.getChild("splitter");
+      if (splitterElement != null) {
+        final Element first = splitterElement.getChild("split-first");
+        final Element second = splitterElement.getChild("split-second");
+        return processSplitter(splitterElement, first, second, context);
+      }
+
+      final Element leaf = element.getChild("leaf");
+      if (leaf == null) {
+        return null;
+      }
+
+      List<Element> fileElements = leaf.getChildren("file");
+      final List<Element> children = new ArrayList<Element>(fileElements.size());
+
+      // trim to EDITOR_TAB_LIMIT, ignoring CLOSE_NON_MODIFIED_FILES_FIRST policy
+      int toRemove = fileElements.size() - UISettings.getInstance().EDITOR_TAB_LIMIT;
+      for (Element fileElement : fileElements) {
+        if (toRemove <= 0 || Boolean.valueOf(fileElement.getAttributeValue(PINNED)).booleanValue()) {
+          children.add(fileElement);
+        }
+        else {
+          toRemove--;
+        }
+      }
+
+      return processFiles(children, context);
+    }
+
+    protected abstract @Nullable T processFiles(@NotNull List<Element> fileElements, @Nullable T context);
+    protected abstract @Nullable T processSplitter(@NotNull Element element, @Nullable Element firstChild, @Nullable Element secondChild, @Nullable T context);
+  }
+
+  private class UIBuilder extends ConfigTreeReader<JPanel> {
+
+    @Override
+    protected JPanel processFiles(@NotNull List<Element> fileElements, final JPanel context) {
+      final Ref<EditorWindow> windowRef = new Ref<EditorWindow>();
+      UIUtil.invokeAndWaitIfNeeded(new Runnable() {
+        @Override
+        public void run() {
+          windowRef.set(context == null ? new EditorWindow(EditorsSplitters.this) : findWindowWith(context));
+        }
+      });
+      final EditorWindow window = windowRef.get();
+      LOG.assertTrue(window != null);
+
+      for (int i = 0; i < fileElements.size(); i++) {
+        final Element file = fileElements.get(i);
+        try {
+          final FileEditorManagerImpl fileEditorManager = getManager();
+          Element historyElement = file.getChild(HistoryEntry.TAG);
+          VirtualFile virtualFile = HistoryEntry.getVirtualFile(historyElement);
+          Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
+          final HistoryEntry entry = new HistoryEntry(fileEditorManager.getProject(), historyElement);
+          final boolean isCurrentInTab = Boolean.valueOf(file.getAttributeValue(CURRENT_IN_TAB)).booleanValue();
+          Boolean pin = Boolean.valueOf(file.getAttributeValue(PINNED));
+          fileEditorManager.openFileImpl4(window, entry.myFile, entry, isCurrentInTab, isCurrentInTab, pin, i);
+          if (document != null) {
+            // This is just to make sure document reference is kept on stack till this point
+            // so that document is available for folding state deserialization in HistoryEntry constructor
+            // and that document will be created only once during file opening
+            document.putUserData(DUMMY_KEY, null);
+          }
+          updateProgress();
+        }
+        catch (InvalidDataException e) {
+          if (ApplicationManager.getApplication().isUnitTestMode()) {
+            LOG.error(e);
+          }
+        }
+      }
+      return window.myPanel;
+    }
+
+    @Override
+    protected JPanel processSplitter(@NotNull Element splitterElement, Element firstChild, Element secondChild, final JPanel context) {
+      if (context == null) {
+        final boolean orientation = "vertical".equals(splitterElement.getAttributeValue("split-orientation"));
+        final float proportion = Float.valueOf(splitterElement.getAttributeValue("split-proportion")).floatValue();
+        final JPanel firstComponent = process(firstChild, null);
+        final JPanel secondComponent = process(secondChild, null);
+        final Ref<JPanel> panelRef = new Ref<JPanel>();
+        UIUtil.invokeAndWaitIfNeeded(new Runnable() {
+          @Override
+          public void run() {
+            JPanel panel = new JPanel(new BorderLayout());
+            panel.setOpaque(false);
+            Splitter splitter = new Splitter(orientation, proportion, 0.1f, 0.9f);
+            panel.add(splitter, BorderLayout.CENTER);
+            splitter.setFirstComponent(firstComponent);
+            splitter.setSecondComponent(secondComponent);
+            panelRef.set(panel);
+          }
+        });
+        return panelRef.get();
+      }
+      final Ref<JPanel> firstComponent = new Ref<JPanel>();
+      final Ref<JPanel> secondComponent = new Ref<JPanel>();
+      UIUtil.invokeAndWaitIfNeeded(new Runnable() {
+        @Override
+        public void run() {
+          if (context.getComponent(0) instanceof Splitter) {
+            Splitter splitter = (Splitter)context.getComponent(0);
+            firstComponent.set((JPanel)splitter.getFirstComponent());
+            secondComponent.set((JPanel)splitter.getSecondComponent());
+          }
+          else {
+            firstComponent.set(context);
+            secondComponent.set(context);
+          }
+        }
+      });
+      process(firstChild, firstComponent.get());
+      process(secondChild, secondComponent.get());
+      return context;
+    }
+  }
 }
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImpl.java
index 8952137..5def1e1 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImpl.java
@@ -67,6 +67,7 @@
 import com.intellij.util.PairProcessor;
 import com.intellij.util.ThrowableRunnable;
 import com.intellij.util.containers.ConcurrentHashSet;
+import com.intellij.util.containers.ConcurrentWeakValueHashMap;
 import com.intellij.util.messages.MessageBus;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -76,9 +77,6 @@
 import java.awt.*;
 import java.awt.event.ActionEvent;
 import java.io.IOException;
-import java.lang.ref.Reference;
-import java.lang.ref.SoftReference;
-import java.lang.ref.WeakReference;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
@@ -90,11 +88,12 @@
   private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl");
 
   private static final Key<String> LINE_SEPARATOR_KEY = Key.create("LINE_SEPARATOR_KEY");
-  public static final Key<Reference<Document>> DOCUMENT_KEY = Key.create("DOCUMENT_KEY");
+  public static final Key<Document> HARD_REF_TO_DOCUMENT_KEY = Key.create("HARD_REF_TO_DOCUMENT_KEY");
   private static final Key<VirtualFile> FILE_KEY = Key.create("FILE_KEY");
   private static final Key<Boolean> MUST_RECOMPUTE_FILE_TYPE = Key.create("Must recompute file type");
 
   private final Set<Document> myUnsavedDocuments = new ConcurrentHashSet<Document>();
+  private final Map<VirtualFile, Document> myDocuments = new ConcurrentWeakValueHashMap<VirtualFile, Document>();
 
   private final MessageBus myBus;
 
@@ -174,7 +173,7 @@
         document.setModificationStamp(file.getModificationStamp());
         final FileType fileType = file.getFileType();
         document.setReadOnly(!file.isWritable() || fileType.isBinary());
-        file.putUserData(DOCUMENT_KEY, new WeakReference<Document>(document));
+        myDocuments.put(file, document);
         document.putUserData(FILE_KEY, file);
 
         if (!(file instanceof LightVirtualFile || file.getFileSystem() instanceof DummyFileSystem)) {
@@ -223,17 +222,13 @@
   @Override
   @Nullable
   public Document getCachedDocument(@NotNull VirtualFile file) {
-    return com.intellij.reference.SoftReference.dereference(file.getUserData(DOCUMENT_KEY));
+    Document hard = file.getUserData(HARD_REF_TO_DOCUMENT_KEY);
+    return hard != null ? hard : myDocuments.get(file);
   }
 
   public static void registerDocument(@NotNull final Document document, @NotNull VirtualFile virtualFile) {
     synchronized (lock) {
-      virtualFile.putUserData(DOCUMENT_KEY, new SoftReference<Document>(document) {
-        @Override
-        public Document get() {
-          return document;
-        }
-      });
+      virtualFile.putUserData(HARD_REF_TO_DOCUMENT_KEY, document);
       document.putUserData(FILE_KEY, virtualFile);
     }
   }
@@ -550,7 +545,8 @@
       if (document != null) {
         // a file is linked to a document - chances are it is an "unknown text file" now
         if (isBinaryWithoutDecompiler(file)) {
-          file.putUserData(DOCUMENT_KEY, null);
+          myDocuments.remove(file);
+          file.putUserData(HARD_REF_TO_DOCUMENT_KEY, null);
           document.putUserData(FILE_KEY, null);
         }
       }
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java
index 116fce9..6f8a2d0 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java
@@ -31,7 +31,6 @@
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.ScrollType;
-import com.intellij.openapi.editor.ex.EditorEx;
 import com.intellij.openapi.editor.impl.EditorComponentImpl;
 import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.fileEditor.*;
@@ -99,7 +98,6 @@
  */
 public class FileEditorManagerImpl extends FileEditorManagerEx implements ProjectComponent, JDOMExternalizable {
   private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl");
-  private static final Key<LocalFileSystem.WatchRequest> WATCH_REQUEST_KEY = Key.create("WATCH_REQUEST_KEY");
   private static final Key<Boolean> DUMB_AWARE = Key.create("DUMB_AWARE");
 
   private static final FileEditor[] EMPTY_EDITOR_ARRAY = {};
@@ -124,11 +122,13 @@
   private final MyEditorPropertyChangeListener myEditorPropertyChangeListener = new MyEditorPropertyChangeListener();
   private final DockManager myDockManager;
   private DockableEditorContainerFactory myContentFactory;
+  private EditorHistoryManager myEditorHistoryManager;
 
-  public FileEditorManagerImpl(final Project project, DockManager dockManager) {
+  public FileEditorManagerImpl(final Project project, DockManager dockManager, EditorHistoryManager editorHistoryManager) {
 /*    ApplicationManager.getApplication().assertIsDispatchThread(); */
     myProject = project;
     myDockManager = dockManager;
+    myEditorHistoryManager = editorHistoryManager;
     myListenerList =
       new MessageListenerList<FileEditorManagerListener>(myProject.getMessageBus(), FileEditorManagerListener.FILE_EDITOR_MANAGER);
 
@@ -145,7 +145,7 @@
     myQueue.setTrackUiActivity(true);
   }
 
-  void initDockableContentFactory() {
+  public void initDockableContentFactory() {
     if (myContentFactory != null) return;
 
     myContentFactory = new DockableEditorContainerFactory(myProject, this, myDockManager);
@@ -550,13 +550,6 @@
       public void run() {
         if (window.isFileOpen(file)) {
           window.closeFile(file, true, transferFocus);
-          final List<EditorWindow> windows = window.getOwner().findWindows(file);
-          if (windows.isEmpty()) { // no more windows containing this file left
-            final LocalFileSystem.WatchRequest request = file.getUserData(WATCH_REQUEST_KEY);
-            if (request != null) {
-              LocalFileSystem.getInstance().removeWatchedRoot(request);
-            }
-          }
         }
       }
     }, IdeBundle.message("command.close.active.editor"), null);
@@ -578,11 +571,6 @@
   public void closeFile(@NotNull final VirtualFile file, final boolean moveFocus, final boolean closeAllCopies) {
     assertDispatchThread();
 
-    final LocalFileSystem.WatchRequest request = file.getUserData(WATCH_REQUEST_KEY);
-    if (request != null) {
-      LocalFileSystem.getInstance().removeWatchedRoot(request);
-    }
-
     CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
       @Override
       public void run() {
@@ -591,8 +579,6 @@
     }, "", null);
   }
 
-
-
   private void closeFileImpl(@NotNull final VirtualFile file, final boolean moveFocus, boolean closeAllCopies) {
     assertDispatchThread();
     runChange(new FileEditorManagerChange() {
@@ -652,7 +638,7 @@
     return openFileImpl2(wndToOpenIn, file, focusEditor);
   }
 
-  public Pair<FileEditor[], FileEditorProvider[]> openFileInNewWindow(VirtualFile file) {
+  public Pair<FileEditor[], FileEditorProvider[]> openFileInNewWindow(@NotNull VirtualFile file) {
     return ((DockManagerImpl)DockManager.getInstance(getProject())).createNewDockContainerFor(file, this);
   }
 
@@ -735,75 +721,47 @@
                                                          final boolean focusEditor,
                                                          @Nullable final HistoryEntry entry,
                                                          boolean current) {
-    return openFileImpl4(window, file, focusEditor, entry, current, -1);
+    return openFileImpl4(window, file, entry, current, focusEditor, null, -1);
   }
 
+  /**
+   * This method can be invoked from background thread. Of course, UI for returned editors should be accessed from EDT in any case.
+   */
   @NotNull
   Pair<FileEditor[], FileEditorProvider[]> openFileImpl4(@NotNull final EditorWindow window,
                                                          @NotNull final VirtualFile file,
-                                                         final boolean focusEditor,
                                                          @Nullable final HistoryEntry entry,
-                                                         boolean current,
-                                                         int index) {
-    // Open file
-    FileEditor[] editors;
-    FileEditorProvider[] providers;
-    final EditorWithProviderComposite newSelectedComposite;
-    boolean newEditorCreated = false;
+                                                         final boolean current, final boolean focusEditor, final Boolean pin,
+                                                         final int index) {
+    ApplicationManager.getApplication().assertReadAccessAllowed();
 
-    final boolean open = window.isFileOpen(file);
-    if (open) {
-      // File is already opened. In this case we have to just select existing EditorComposite
-      newSelectedComposite = window.findFileComposite(file);
-      LOG.assertTrue(newSelectedComposite != null);
+    final Ref<EditorWithProviderComposite> compositeRef = new Ref<EditorWithProviderComposite>();
 
-      editors = newSelectedComposite.getEditors();
-      providers = newSelectedComposite.getProviders();
-    }
-    else {
-      if (UISettings.getInstance().EDITOR_TAB_PLACEMENT == UISettings.TABS_NONE || UISettings.getInstance().PRESENTATION_MODE) {
-        for (EditorWithProviderComposite composite : window.getEditors()) {
-          Disposer.dispose(composite);
-        }
+    UIUtil.invokeAndWaitIfNeeded(new Runnable() {
+      @Override
+      public void run() {
+        compositeRef.set(window.findFileComposite(file));
       }
+    });
 
+    final FileEditorProvider[] newProviders;
+    final AsyncFileEditorProvider.Builder[] builders;
+    if (compositeRef.isNull()) {
       // File is not opened yet. In this case we have to create editors
       // and select the created EditorComposite.
-      final FileEditorProviderManager editorProviderManager = FileEditorProviderManager.getInstance();
-      providers = editorProviderManager.getProviders(myProject, file);
-      if (DumbService.getInstance(myProject).isDumb()) {
-        final List<FileEditorProvider> dumbAware = ContainerUtil.findAll(providers, new Condition<FileEditorProvider>() {
-          @Override
-          public boolean value(FileEditorProvider fileEditorProvider) {
-            return DumbService.isDumbAware(fileEditorProvider);
-          }
-        });
-        providers = dumbAware.toArray(new FileEditorProvider[dumbAware.size()]);
-      }
-
-      if (providers.length == 0) {
+      newProviders = getAvailableProviders(file);
+      if (newProviders.length == 0) {
         return Pair.create(EMPTY_EDITOR_ARRAY, EMPTY_PROVIDER_ARRAY);
       }
-      newEditorCreated = true;
 
-      getProject().getMessageBus().syncPublisher(FileEditorManagerListener.Before.FILE_EDITOR_MANAGER).beforeFileOpened(this, file);
-
-      editors = new FileEditor[providers.length];
-      for (int i = 0; i < providers.length; i++) {
+      builders = new AsyncFileEditorProvider.Builder[newProviders.length];
+      for (int i = 0; i < newProviders.length; i++) {
         try {
-          final FileEditorProvider provider = providers[i];
-          LOG.assertTrue(provider != null, "Provider for file "+file+" is null. All providers: "+Arrays.asList(providers));
+          final FileEditorProvider provider = newProviders[i];
+          LOG.assertTrue(provider != null, "Provider for file "+file+" is null. All providers: "+Arrays.asList(newProviders));
           LOG.assertTrue(provider.accept(myProject, file), "Provider " + provider + " doesn't accept file " + file);
-          final FileEditor editor = provider.createEditor(myProject, file);
-          LOG.assertTrue(editor != null);
-          LOG.assertTrue(editor.isValid());
-          editors[i] = editor;
-          // Register PropertyChangeListener into editor
-          editor.addPropertyChangeListener(myEditorPropertyChangeListener);
-          editor.putUserData(DUMB_AWARE, DumbService.isDumbAware(provider));
-
-          if (current && editor instanceof TextEditorImpl) {
-            ((TextEditorImpl)editor).initFolding();
+          if ((provider instanceof AsyncFileEditorProvider)) {
+            builders[i] = ((AsyncFileEditorProvider)provider).createEditorAsync(myProject, file);
           }
         }
         catch (Exception e) {
@@ -813,134 +771,186 @@
           LOG.error(e);
         }
       }
-
-      // Now we have to create EditorComposite and insert it into the TabbedEditorComponent.
-      // After that we have to select opened editor.
-      newSelectedComposite = new EditorWithProviderComposite(file, editors, providers, this);
-
-      if (index >= 0) {
-        newSelectedComposite.getFile().putUserData(EditorWindow.INITIAL_INDEX_KEY, index);
-      }
     }
+    else {
+      newProviders = null;
+      builders = null;
+    }
+    UIUtil.invokeAndWaitIfNeeded(new Runnable() {
+      @Override
+      public void run() {
+        if (myProject.isDisposed() || !file.isValid()) {
+          return;
+        }
+        compositeRef.set(window.findFileComposite(file));
+        boolean newEditor = compositeRef.isNull();
+        if (newEditor) {
+          clearWindowIfNeeded(window);
 
-    window.setEditor(newSelectedComposite, focusEditor);
+          getProject().getMessageBus().syncPublisher(FileEditorManagerListener.Before.FILE_EDITOR_MANAGER).beforeFileOpened(FileEditorManagerImpl.this, file);
 
-    final EditorHistoryManager editorHistoryManager = EditorHistoryManager.getInstance(myProject);
-    for (int i = 0; i < editors.length; i++) {
-      final FileEditor editor = editors[i];
-      if (editor instanceof TextEditor) {
-        // hack!!!
-        // This code prevents "jumping" on next repaint.
-        ((EditorEx)((TextEditor)editor).getEditor()).stopOptimizedScrolling();
-      }
+          FileEditor[] newEditors = new FileEditor[newProviders.length];
+          for (int i = 0; i < newProviders.length; i++) {
+            try {
+              final FileEditorProvider provider = newProviders[i];
+              final FileEditor editor = builders[i] == null ? provider.createEditor(myProject, file) : builders[i].build();
+              LOG.assertTrue(editor.isValid());
+              newEditors[i] = editor;
+              // Register PropertyChangeListener into editor
+              editor.addPropertyChangeListener(myEditorPropertyChangeListener);
+              editor.putUserData(DUMB_AWARE, DumbService.isDumbAware(provider));
+            }
+            catch (Exception e) {
+              LOG.error(e);
+            }
+            catch (AssertionError e) {
+              LOG.error(e);
+            }
+          }
 
-      final FileEditorProvider provider = providers[i];//getProvider(editor);
+          // Now we have to create EditorComposite and insert it into the TabbedEditorComponent.
+          // After that we have to select opened editor.
+          EditorWithProviderComposite composite = new EditorWithProviderComposite(file, newEditors, newProviders, FileEditorManagerImpl.this);
 
-      // Restore editor state
-      FileEditorState state = null;
-      if (entry != null) {
-        state = entry.getState(provider);
-      }
-      if (state == null && !open) {
-        // We have to try to get state from the history only in case
-        // if editor is not opened. Otherwise history entry might have a state
-        // out of sync with the current editor state.
-        state = editorHistoryManager.getState(file, provider);
-      }
-      if (state != null) {
-        if (!isDumbAware(editor)) {
-          final FileEditorState finalState = state;
-          DumbService.getInstance(getProject()).runWhenSmart(new Runnable() {
+          if (index >= 0) {
+            composite.getFile().putUserData(EditorWindow.INITIAL_INDEX_KEY, index);
+          }
+
+          compositeRef.set(composite);
+        }
+
+        final EditorWithProviderComposite composite = compositeRef.get();
+        FileEditor[] editors = composite.getEditors();
+        FileEditorProvider[] providers = composite.getProviders();
+
+        window.setEditor(composite, current, focusEditor);
+
+        for (int i = 0; i < editors.length; i++) {
+          restoreEditorState(file, providers[i], editors[i], entry, newEditor);
+        }
+
+        // Restore selected editor
+        final FileEditorProvider selectedProvider;
+        if (entry == null) {
+          selectedProvider = ((FileEditorProviderManagerImpl)FileEditorProviderManager.getInstance())
+            .getSelectedFileEditorProvider(myEditorHistoryManager, file, providers);
+        }
+        else {
+          selectedProvider = entry.mySelectedProvider;
+        }
+        if (selectedProvider != null) {
+          for (int i = editors.length - 1; i >= 0; i--) {
+            final FileEditorProvider provider = providers[i];
+            if (provider.equals(selectedProvider)) {
+              composite.setSelectedEditor(i);
+              break;
+            }
+          }
+        }
+
+        // Notify editors about selection changes
+        window.getOwner().setCurrentWindow(window, focusEditor);
+        window.getOwner().afterFileOpen(file);
+
+        composite.getSelectedEditor().selectNotify();
+
+        final IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject);
+        if (newEditor) {
+          if (window.isShowing()) {
+            window.setPaintBlocked(true);
+          }
+          notifyPublisher(new Runnable() {
             @Override
             public void run() {
-              editor.setState(finalState);
+              window.setPaintBlocked(false);
+              if (isFileOpen(file)) {
+                getProject().getMessageBus().syncPublisher(FileEditorManagerListener.FILE_EDITOR_MANAGER)
+                  .fileOpened(FileEditorManagerImpl.this, file);
+              }
             }
           });
         }
-        else {
-          editor.setState(state);
-        }
-      }
-    }
 
-    // Restore selected editor
-    final FileEditorProvider[] _providers = newSelectedComposite.getProviders();
+        //[jeka] this is a hack to support back-forward navigation
+        // previously here was incorrect call to fireSelectionChanged() with a side-effect
+        ((IdeDocumentHistoryImpl)IdeDocumentHistory.getInstance(myProject)).onSelectionChanged();
 
-    final FileEditorProvider selectedProvider;
-    if (entry == null) {
-      selectedProvider = ((FileEditorProviderManagerImpl)FileEditorProviderManager.getInstance())
-        .getSelectedFileEditorProvider(editorHistoryManager, file, _providers);
-    }
-    else {
-      selectedProvider = entry.mySelectedProvider;
-    }
-    if (selectedProvider != null) {
-      final FileEditor[] _editors = newSelectedComposite.getEditors();
-      for (int i = _editors.length - 1; i >= 0; i--) {
-        final FileEditorProvider provider = _providers[i];//getProvider(_editors[i]);
-        if (provider.equals(selectedProvider)) {
-          newSelectedComposite.setSelectedEditor(i);
-          break;
-        }
-      }
-    }
-
-    // Notify editors about selection changes
-    window.getOwner().setCurrentWindow(window, focusEditor);
-    window.getOwner().afterFileOpen(file);
-
-    UIUtil.invokeLaterIfNeeded(new Runnable() {
-      @Override
-      public void run() {
-        newSelectedComposite.getSelectedEditor().selectNotify();
-      }
-    });
-
-    final IdeFocusManager focusManager = IdeFocusManager.getInstance(myProject);
-    if (newEditorCreated) {
-      if (window.isShowing()) {
-        window.setPaintBlocked(true);
-      }
-      notifyPublisher(new Runnable() {
-        @Override
-        public void run() {
-          window.setPaintBlocked(false);
-          if (isFileOpen(file)) {
-            getProject().getMessageBus().syncPublisher(FileEditorManagerListener.FILE_EDITOR_MANAGER)
-              .fileOpened(FileEditorManagerImpl.this, file);
+        // Transfer focus into editor
+        if (!ApplicationManagerEx.getApplicationEx().isUnitTestMode()) {
+          if (focusEditor) {
+            //myFirstIsActive = myTabbedContainer1.equals(tabbedContainer);
+            window.setAsCurrentWindow(true);
+            ToolWindowManager.getInstance(myProject).activateEditorComponent();
+            focusManager.toFront(window.getOwner());
           }
         }
+
+        // Update frame and tab title
+        updateFileName(file);
+
+        // Make back/forward work
+        IdeDocumentHistory.getInstance(myProject).includeCurrentCommandAsNavigation();
+
+        if (pin != null) {
+          window.setFilePinned(file, pin);
+        }
+      }
+    });
+    return Pair.create(compositeRef.get().getEditors(), compositeRef.get().getProviders());
+  }
+
+  private void clearWindowIfNeeded(EditorWindow window) {
+    if (UISettings.getInstance().EDITOR_TAB_PLACEMENT == UISettings.TABS_NONE || UISettings.getInstance().PRESENTATION_MODE) {
+      for (EditorWithProviderComposite composite : window.getEditors()) {
+        Disposer.dispose(composite);
+      }
+    }
+  }
+
+  private void restoreEditorState(VirtualFile file,
+                                  FileEditorProvider provider,
+                                  final FileEditor editor,
+                                  HistoryEntry entry,
+                                  boolean newEditor) {
+    FileEditorState state = null;
+    if (entry != null) {
+      state = entry.getState(provider);
+    }
+    if (state == null && newEditor) {
+      // We have to try to get state from the history only in case
+      // if editor is not opened. Otherwise history entry might have a state
+      // out of sync with the current editor state.
+      state = myEditorHistoryManager.getState(file, provider);
+    }
+    if (state != null) {
+      if (!isDumbAware(editor)) {
+        final FileEditorState finalState = state;
+        DumbService.getInstance(getProject()).runWhenSmart(new Runnable() {
+          @Override
+          public void run() {
+            editor.setState(finalState);
+          }
+        });
+      }
+      else {
+        editor.setState(state);
+      }
+    }
+  }
+
+  private FileEditorProvider[] getAvailableProviders(VirtualFile file) {
+    final FileEditorProviderManager editorProviderManager = FileEditorProviderManager.getInstance();
+    FileEditorProvider[] providers = editorProviderManager.getProviders(myProject, file);
+    if (DumbService.getInstance(myProject).isDumb()) {
+      final List<FileEditorProvider> dumbAware = ContainerUtil.findAll(providers, new Condition<FileEditorProvider>() {
+        @Override
+        public boolean value(FileEditorProvider fileEditorProvider) {
+          return DumbService.isDumbAware(fileEditorProvider);
+        }
       });
-
-      //Add request to watch this editor's virtual file
-      final VirtualFile parentDir = file.getParent();
-      if (parentDir != null) {
-        final LocalFileSystem.WatchRequest request = LocalFileSystem.getInstance().addRootToWatch(parentDir.getPath(), false);
-        file.putUserData(WATCH_REQUEST_KEY, request);
-      }
+      providers = dumbAware.toArray(new FileEditorProvider[dumbAware.size()]);
     }
-
-    //[jeka] this is a hack to support back-forward navigation
-    // previously here was incorrect call to fireSelectionChanged() with a side-effect
-    ((IdeDocumentHistoryImpl)IdeDocumentHistory.getInstance(myProject)).onSelectionChanged();
-
-    // Transfer focus into editor
-    if (!ApplicationManagerEx.getApplicationEx().isUnitTestMode()) {
-      if (focusEditor) {
-        //myFirstIsActive = myTabbedContainer1.equals(tabbedContainer);
-        window.setAsCurrentWindow(true);
-        ToolWindowManager.getInstance(myProject).activateEditorComponent();
-        focusManager.toFront(window.getOwner());
-      }
-    }
-
-    // Update frame and tab title
-    updateFileName(file);
-
-    // Make back/forward work
-    IdeDocumentHistory.getInstance(myProject).includeCurrentCommandAsNavigation();
-
-    return Pair.create(editors, providers);
+    return providers;
   }
 
   @NotNull
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/HistoryEntry.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/HistoryEntry.java
index 6edf3ea..5f3dd9a 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/HistoryEntry.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/HistoryEntry.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,7 +15,6 @@
  */
 package com.intellij.openapi.fileEditor.impl;
 
-import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.fileEditor.FileEditorProvider;
 import com.intellij.openapi.fileEditor.FileEditorState;
 import com.intellij.openapi.fileEditor.ex.FileEditorProviderManager;
@@ -55,27 +54,8 @@
   }
 
   public HistoryEntry(Project project, Element e) throws InvalidDataException {
-    this(project, e, false);
-  }
-  
-  public HistoryEntry(Project project, Element e, boolean ensureDocumentCreated) throws InvalidDataException{
-    if (!e.getName().equals(TAG)) {
-      throw new IllegalArgumentException("unexpected tag: " + e);
-    }
-
-    String url = e.getAttributeValue(FILE_ATTR);
-    VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
-    if (file == null){
-      throw new InvalidDataException("No file exists: " + url);
-    }
-
-    myFile = file;
+    myFile = getVirtualFile(e);
     myProvider2State = new HashMap<FileEditorProvider, FileEditorState>();
-    if (ensureDocumentCreated) {
-      // May be necessary for correct initialisation. For example, stored fold regions info is not applied if target document
-      // hasn't been initialised yet.
-      FileDocumentManager.getInstance().getDocument(myFile);
-    } 
 
     List providers = e.getChildren(PROVIDER_ELEMENT);
     for (final Object provider1 : providers) {
@@ -95,7 +75,7 @@
         throw new InvalidDataException();
       }
 
-      FileEditorState state = provider.readState(stateElement, project, file);
+      FileEditorState state = provider.readState(stateElement, project, myFile);
       putState(provider, state);
     }
   }
@@ -134,4 +114,18 @@
 
     return e;
   }
+
+  @NotNull
+  public static VirtualFile getVirtualFile(Element historyElement) throws InvalidDataException {
+    if (!historyElement.getName().equals(TAG)) {
+      throw new IllegalArgumentException("unexpected tag: " + historyElement);
+    }
+
+    String url = historyElement.getAttributeValue(FILE_ATTR);
+    VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
+    if (file == null){
+      throw new InvalidDataException("No file exists: " + url);
+    }
+    return file;
+  }
 }
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/OpenFilesActivity.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/OpenFilesActivity.java
index 62866d3..2fbe394 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/OpenFilesActivity.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/OpenFilesActivity.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.
@@ -19,8 +19,6 @@
 import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.startup.StartupActivity;
-import com.intellij.openapi.util.registry.Registry;
-import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
 
 /**
@@ -33,20 +31,9 @@
   public void runActivity(@NotNull Project project) {
     final FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
     if (fileEditorManager instanceof FileEditorManagerImpl) {
-      Runnable runnable = new Runnable() {
-        @Override
-        public void run() {
-          FileEditorManagerImpl manager = (FileEditorManagerImpl)fileEditorManager;
-          manager.getMainSplitters().openFiles();
-          manager.initDockableContentFactory();
-        }
-      };
-      if (Registry.is("ide.open.editors.asynchronously")) {
-        runnable.run();
-      }
-      else {
-        UIUtil.invokeLaterIfNeeded(runnable);
-      }
+      final FileEditorManagerImpl manager = (FileEditorManagerImpl)fileEditorManager;
+      manager.getMainSplitters().openFiles();
+      manager.initDockableContentFactory();
     }
   }
 }
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/CodeFoldingState.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/CodeFoldingState.java
index dddd465..3b5c089 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/CodeFoldingState.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/CodeFoldingState.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.
@@ -15,8 +15,12 @@
  */
 package com.intellij.openapi.fileEditor.impl.text;
 
+import com.intellij.openapi.editor.Editor;
+import org.jetbrains.annotations.NotNull;
+
 /**
  * Implementations of this interface are expected to provide correct {@link #equals(Object)} & {@link #hashCode()} implementations.
  */
 public interface CodeFoldingState {
+  void setToEditor(@NotNull Editor editor);
 }
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorImpl.java
index c56e88c..3da9961 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorImpl.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.
@@ -51,8 +51,6 @@
     return new TextEditorComponent(project, file, this);
   }
 
-  public void initFolding() {}
-
   @Override
   public void dispose(){
     myComponent.dispose();
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorProvider.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorProvider.java
index 018503d..60b42f7 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorProvider.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorProvider.java
@@ -320,9 +320,6 @@
         editor.getSelectionModel().setSelection(startOffset, endOffset);
       }
     }
-    if (editorEx != null && !preciselyScrollVertically) {
-      ((EditorEx) editor).stopOptimizedScrolling();
-    }
     if (!preciselyScrollVertically) {
       editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
     }
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java
index 893000b..a3c1d37 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeManagerImpl.java
@@ -261,10 +261,11 @@
       }
     });
   }
-  private final TransferToPooledThreadQueue<Collection<VirtualFile>> reDetectQueue = new TransferToPooledThreadQueue<Collection<VirtualFile>>("file type re-detect", Condition.FALSE, -1, new Processor<Collection<VirtualFile>>() {
+
+  private final TransferToPooledThreadQueue<Collection<VirtualFile>> reDetectQueue = new TransferToPooledThreadQueue<Collection<VirtualFile>>("File type re-detect", Condition.FALSE, -1, new Processor<Collection<VirtualFile>>() {
     @Override
     public boolean process(Collection<VirtualFile> files) {
-      ((FileTypeManagerImpl)getInstance()).reDetect(files);
+      reDetect(files);
       return true;
     }
   });
@@ -317,8 +318,7 @@
 
   private boolean shouldBeSavedToFile(final FileType fileType) {
     if (!(fileType instanceof JDOMExternalizable) || !shouldSave(fileType)) return false;
-    if (myDefaultTypes.contains(fileType) && !isDefaultModified(fileType)) return false;
-    return true;
+    return !myDefaultTypes.contains(fileType) || isDefaultModified(fileType);
   }
 
   @Override
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyCodeTypeCommand.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyCodeTypeCommand.java
index 0110527..5d05af1 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyCodeTypeCommand.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyCodeTypeCommand.java
@@ -128,7 +128,7 @@
       }
     }
 
-    return Couple.newOne(codes, modifiers);
+    return Couple.of(codes, modifiers);
   }
 
   public static String unparseKeyCodes(Couple<List<Integer>> pairs) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/AbstractUpdateDialog.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/AbstractUpdateDialog.java
index 00804fb..9fba509 100644
--- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/AbstractUpdateDialog.java
+++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/AbstractUpdateDialog.java
@@ -23,6 +23,7 @@
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.ui.ColorUtil;
 import com.intellij.ui.IdeBorderFactory;
+import com.intellij.ui.LicensingFacade;
 import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -37,6 +38,9 @@
  */
 public abstract class AbstractUpdateDialog extends DialogWrapper {
   private final boolean myEnableLink;
+  protected String myLicenseInfo = null;
+  protected boolean myPaidUpgrade;
+  protected boolean mySubscribtionLicense = false;
 
   public AbstractUpdateDialog(boolean enableLink) {
     super(true);
@@ -76,6 +80,27 @@
     });
   }
 
+  protected void initLicensingInfo(@NotNull UpdateChannel channel, @NotNull BuildInfo build) {
+    LicensingFacade facade = LicensingFacade.getInstance();
+    if (facade != null) {
+      mySubscribtionLicense = facade.isSubscriptionLicense();
+      if (!channel.getLicensing().equals(UpdateChannel.LICENSING_EAP)) {
+        Boolean paidUpgrade = facade.isPaidUpgrade(channel.getMajorVersion(), build.getReleaseDate());
+        if (paidUpgrade == Boolean.TRUE) {
+          myPaidUpgrade = true;
+          myLicenseInfo = IdeBundle.message("updates.channel.key.needed", channel.getEvalDays());
+        }
+        else if (paidUpgrade == Boolean.FALSE) {
+          myLicenseInfo = IdeBundle.message("updates.channel.existing.key");
+        }
+      }
+      else {
+        myLicenseInfo = IdeBundle.message("updates.channel.bundled.key");
+      }
+    }
+  }
+
+
   protected void configureMessageArea(@NotNull JEditorPane area) {
     configureMessageArea(area, IdeBundle.message("updates.configure.label", ShowSettingsUtil.getSettingsMenuName()), null, null);
   }
diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/NewChannelDialog.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/NewChannelDialog.java
index 65cdf28..52b07e6 100644
--- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/NewChannelDialog.java
+++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/NewChannelDialog.java
@@ -32,8 +32,6 @@
 class NewChannelDialog extends AbstractUpdateDialog {
   private final UpdateChannel myChannel;
   private final BuildInfo myLatestBuild;
-  private boolean myShowUpgradeButton = false;
-  private String myLicenseInfo = null;
 
   public NewChannelDialog(@NotNull UpdateChannel channel) {
     super(false);
@@ -41,22 +39,7 @@
     myLatestBuild = channel.getLatestBuild();
     assert myLatestBuild != null;
 
-    LicensingFacade facade = LicensingFacade.getInstance();
-    if (facade != null) {
-      if (!myChannel.getLicensing().equals(UpdateChannel.LICENSING_EAP)) {
-        Boolean paidUpgrade = facade.isPaidUpgrade(myChannel.getMajorVersion(), myLatestBuild.getReleaseDate());
-        if (paidUpgrade == Boolean.TRUE) {
-          myShowUpgradeButton = true;
-          myLicenseInfo = IdeBundle.message("updates.channel.key.needed", myChannel.getEvalDays());
-        }
-        else if (paidUpgrade == Boolean.FALSE) {
-          myLicenseInfo = IdeBundle.message("updates.channel.existing.key");
-        }
-      }
-      else {
-        myLicenseInfo = IdeBundle.message("updates.channel.bundled.key");
-      }
-    }
+    initLicensingInfo(myChannel, myLatestBuild);
 
     init();
   }
@@ -71,7 +54,7 @@
   protected Action[] createActions() {
     List<Action> actions = ContainerUtil.newArrayList(getOKAction());
 
-    if (myShowUpgradeButton) {
+    if (myPaidUpgrade) {
       actions.add(new AbstractAction(IdeBundle.message("updates.buy.online.button")) {
         @Override
         public void actionPerformed(ActionEvent e) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginDownloader.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginDownloader.java
index 44d8047..a6641bb 100644
--- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginDownloader.java
+++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginDownloader.java
@@ -103,7 +103,7 @@
       //store old plugins file
       descriptor = PluginManager.getPlugin(PluginId.getId(myPluginId));
       LOG.assertTrue(descriptor != null);
-      if (myPluginVersion != null && StringUtil.compareVersionNumbers(descriptor.getVersion(), myPluginVersion) >= 0) {
+      if (myPluginVersion != null && compareVersionsSkipBroken(descriptor, myPluginVersion) <= 0) {
         LOG.info("Plugin " + myPluginId + ": current version (max) " + myPluginVersion);
         return false;
       }
@@ -140,7 +140,7 @@
       }
 
       myPluginVersion = actualDescriptor.getVersion();
-      if (descriptor != null && StringUtil.compareVersionNumbers(descriptor.getVersion(), actualDescriptor.getVersion()) >= 0) {
+      if (descriptor != null && compareVersionsSkipBroken(descriptor, myPluginVersion) <= 0) {
         LOG.info("Plugin " + myPluginId + ": current version (max) " + myPluginVersion);
         return false; //was not updated
       }
@@ -155,6 +155,14 @@
     return true;
   }
 
+  public static int compareVersionsSkipBroken(IdeaPluginDescriptor descriptor, String newPluginVersion) {
+    int state = StringUtil.compareVersionNumbers(newPluginVersion, descriptor.getVersion());
+    if (PluginManagerCore.isBrokenPlugin(descriptor) && state < 0) {
+      state = 1;
+    }
+    return state;
+  }
+
   @Nullable
   public static IdeaPluginDescriptorImpl loadDescriptionFromJar(final File file) throws IOException {
     IdeaPluginDescriptorImpl descriptor = PluginManagerCore.loadDescriptorFromJar(file);
diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java
index 8a27864..8205d9e 100644
--- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java
+++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java
@@ -15,6 +15,7 @@
  */
 package com.intellij.openapi.updateSettings.impl;
 
+import com.intellij.diagnostic.IdeErrorsDialog;
 import com.intellij.ide.IdeBundle;
 import com.intellij.ide.plugins.*;
 import com.intellij.ide.reporter.ConnectionException;
@@ -25,6 +26,7 @@
 import com.intellij.openapi.application.ApplicationNamesInfo;
 import com.intellij.openapi.application.PathManager;
 import com.intellij.openapi.application.ex.ApplicationInfoEx;
+import com.intellij.openapi.diagnostic.IdeaLoggingEvent;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.extensions.PluginId;
 import com.intellij.openapi.progress.ProcessCanceledException;
@@ -250,7 +252,7 @@
             prepareToInstall(downloaded, loadedPlugin, indicator, buildNumber);
           } else {
             final String newVersion = loadedPlugin.getVersion();
-            if (StringUtil.compareVersionNumbers(newVersion, installedPlugin.getVersion()) > 0) {
+            if (PluginDownloader.compareVersionsSkipBroken(installedPlugin, newVersion) > 0) {
               updateSettings.myOutdatedPlugins.add(idString);
               if (isReadyToUpdate(idString, newVersion) && !disabledPlugins.contains(idString)) {
                 prepareToInstall(downloaded, loadedPlugin, indicator, buildNumber);
@@ -420,7 +422,7 @@
               final PluginDownloader downloader = new PluginDownloader(pluginId, finalPluginUrl, pluginVersion);
               final IdeaPluginDescriptor loadedPlugin = PluginManager.getPlugin(PluginId.getId(pluginId));
               if (loadedPlugin == null || pluginVersion == null ||
-                  StringUtil.compareVersionNumbers(pluginVersion, loadedPlugin.getVersion()) > 0) {
+                  PluginDownloader.compareVersionsSkipBroken(loadedPlugin, pluginVersion) > 0) {
                 if (isReadyToUpdate(pluginId, pluginVersion) && downloader.prepareToInstall(progressIndicator, buildNumber)) {
                   downloaded.put(PluginId.getId(pluginId), downloader);
                 }
@@ -840,4 +842,16 @@
       LOG.error(e);
     }
   }
+
+  private static boolean ourHasFailedPlugins = false;
+  public static void checkForUpdate(IdeaLoggingEvent event) {
+    if (!ourHasFailedPlugins && UpdateSettings.getInstance().CHECK_NEEDED) {
+      final Throwable throwable = event.getThrowable();
+      final IdeaPluginDescriptor pluginDescriptor = PluginManager.getPlugin(IdeErrorsDialog.findPluginId(throwable));
+      if (pluginDescriptor != null && !pluginDescriptor.isBundled()) {
+        ourHasFailedPlugins = true;
+        updateAndShowResult();
+      }
+    }
+  }
 }
diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java
index 4ea707ee..cbace75 100644
--- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java
+++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java
@@ -57,6 +57,9 @@
     myPatch = myLatestBuild != null ? myLatestBuild.findPatchForCurrentBuild() : null;
     myWriteProtected = myPatch != null && !new File(PathManager.getHomePath()).canWrite();
     getCancelAction().putValue(DEFAULT_ACTION, Boolean.TRUE);
+    if (myLatestBuild != null) {
+      initLicensingInfo(myUpdatedChannel, myLatestBuild);
+    }
     init();
 
     if (incompatiblePlugins != null && !incompatiblePlugins.isEmpty()) {
@@ -184,14 +187,24 @@
     private JBLabel myPatchLabel;
     private JBLabel myPatchInfo;
     private JEditorPane myMessageArea;
+    private JEditorPane myLicenseArea;
 
     public UpdateInfoPanel() {
       ApplicationInfo appInfo = ApplicationInfo.getInstance();
       ApplicationNamesInfo appNames = ApplicationNamesInfo.getInstance();
 
       String message = myLatestBuild.getMessage();
+      final String fullProductName = appNames.getFullProductName();
       if (message == null) {
-        message = IdeBundle.message("updates.new.version.available", appNames.getFullProductName());
+        message = IdeBundle.message("updates.new.version.available", fullProductName);
+      }
+      final String homePageUrl = myUpdatedChannel.getHomePageUrl();
+      if (!StringUtil.isEmptyOrSpaces(homePageUrl)) {
+        final int idx = message.indexOf(fullProductName);
+        if (idx >= 0) {
+          message = message.substring(0, idx) + 
+                    "<a href=\'" + homePageUrl + "\'>" + fullProductName + "</a>" + message.substring(idx + fullProductName.length());
+        }
       }
       configureMessageArea(myUpdateMessage, message, null, new BrowserHyperlinkListener());
 
@@ -213,6 +226,10 @@
       else {
         configureMessageArea(myMessageArea);
       }
+
+      if (mySubscribtionLicense && myLicenseInfo != null) {
+        configureMessageArea(myLicenseArea, myLicenseInfo, myPaidUpgrade ? JBColor.RED : null, null);
+      }
     }
 
     private String formatVersion(String version, String build) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoPanel.form b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoPanel.form
index 27b7eb2..2ea89f6 100644
--- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoPanel.form
+++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoPanel.form
@@ -2,10 +2,12 @@
 <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.openapi.updateSettings.impl.UpdateInfoDialog.UpdateInfoPanel">
   <grid id="27dc6" binding="myPanel" layout-manager="GridBagLayout">
     <constraints>
-      <xy x="20" y="20" width="500" height="140"/>
+      <xy x="20" y="20" width="500" height="172"/>
     </constraints>
     <properties/>
-    <border type="none"/>
+    <border type="empty">
+      <size top="0" left="5" bottom="0" right="5"/>
+    </border>
     <children>
       <component id="f7184" class="javax.swing.JEditorPane" binding="myUpdateMessage">
         <constraints>
@@ -16,10 +18,11 @@
         </constraints>
         <properties>
           <contentType value="text/html"/>
+          <margin top="0" left="0" bottom="0" right="0"/>
         </properties>
       </component>
       <grid id="d6625" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-        <margin top="10" left="5" bottom="10" right="5"/>
+        <margin top="10" left="0" bottom="10" 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"/>
           <gridbag weightx="1.0" weighty="0.0"/>
@@ -95,10 +98,29 @@
       </component>
       <vspacer id="c963e">
         <constraints>
-          <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+          <grid row="5" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
           <gridbag weightx="0.0" weighty="0.0"/>
         </constraints>
       </vspacer>
+      <vspacer id="d89a6">
+        <constraints>
+          <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+          <gridbag top="5" left="0" bottom="0" right="0" weightx="0.0" weighty="0.0"/>
+        </constraints>
+      </vspacer>
+      <component id="f5ccc" class="javax.swing.JEditorPane" binding="myLicenseArea">
+        <constraints>
+          <grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false">
+            <preferred-size width="150" height="50"/>
+          </grid>
+          <gridbag weightx="0.0" weighty="0.0"/>
+        </constraints>
+        <properties>
+          <contentType value="text/html"/>
+          <editable value="false"/>
+          <opaque value="false"/>
+        </properties>
+      </component>
     </children>
   </grid>
 </form>
diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java
index 907ef88..ed6a629 100644
--- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java
+++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/PluginsAdvertiser.java
@@ -37,6 +37,7 @@
 import com.intellij.openapi.util.JDOMUtil;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.reference.SoftReference;
 import com.intellij.ui.EditorNotifications;
 import com.intellij.util.PlatformUtils;
 import com.intellij.util.net.HttpConfigurable;
@@ -67,6 +68,8 @@
   public static final String DISPLAY_ID = "Plugins Suggestion";
   public static final NotificationGroup NOTIFICATION_GROUP = new NotificationGroup(DISPLAY_ID, NotificationDisplayType.STICKY_BALLOON, true);
 
+  private static SoftReference<KnownExtensions> ourKnownExtensions = new SoftReference<KnownExtensions>(null);
+
   public static List<Plugin> retrieve(UnknownFeature unknownFeature) {
     final String featureType = unknownFeature.getFeatureType();
     final String implementationName = unknownFeature.getImplementationName();
@@ -165,11 +168,15 @@
   }
 
   public static KnownExtensions loadExtensions() {
+    KnownExtensions knownExtensions = ourKnownExtensions.get();
+    if (knownExtensions != null) return knownExtensions;
     try {
       File file = getExtensionsFile();
       if (file.isFile()) {
         final Document document = JDOMUtil.loadDocument(file);
-        return XmlSerializer.deserialize(document, KnownExtensions.class);
+        knownExtensions = XmlSerializer.deserialize(document, KnownExtensions.class);
+        ourKnownExtensions = new SoftReference<KnownExtensions>(knownExtensions);
+        return knownExtensions;
       }
     }
     catch (Exception e) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/util/JDOMExternalizableAdapter.java b/platform/platform-impl/src/com/intellij/openapi/util/JDOMExternalizableAdapter.java
deleted file mode 100644
index e5c2f8b..0000000
--- a/platform/platform-impl/src/com/intellij/openapi/util/JDOMExternalizableAdapter.java
+++ /dev/null
@@ -1,57 +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.openapi.util;
-
-import com.intellij.openapi.components.PersistentStateComponent;
-import com.intellij.openapi.diagnostic.Logger;
-import org.jdom.Element;
-
-/**
- * @author Dmitry Avdeev
- */
-public class JDOMExternalizableAdapter implements PersistentStateComponent<Element> {
-
-  private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.util.JDOMExternalizableAdapter");
-
-  private final JDOMExternalizable myExternalizable;
-  private final String myName;
-
-  public JDOMExternalizableAdapter(JDOMExternalizable externalizable, String name) {
-    myExternalizable = externalizable;
-    myName = name;
-  }
-
-  public Element getState() {
-    Element element = new Element(myName);
-    try {
-      myExternalizable.writeExternal(element);
-    }
-    catch (WriteExternalException e) {
-      LOG.info(e);
-    }
-    return element;
-  }
-
-  public void loadState(Element state) {
-    try {
-      myExternalizable.readExternal(state);
-    }
-    catch (InvalidDataException e) {
-      LOG.info(e);
-    }
-  }
-}
diff --git a/platform/platform-impl/src/com/intellij/openapi/vcs/changes/issueLinks/TreeLinkMouseListener.java b/platform/platform-impl/src/com/intellij/openapi/vcs/changes/issueLinks/TreeLinkMouseListener.java
index 2b8e792..979c894 100644
--- a/platform/platform-impl/src/com/intellij/openapi/vcs/changes/issueLinks/TreeLinkMouseListener.java
+++ b/platform/platform-impl/src/com/intellij/openapi/vcs/changes/issueLinks/TreeLinkMouseListener.java
@@ -25,13 +25,14 @@
 import javax.swing.tree.TreePath;
 import java.awt.*;
 import java.awt.event.MouseEvent;
+import java.lang.ref.WeakReference;
 
 /**
  * @author yole
  */
 public class TreeLinkMouseListener extends LinkMouseListenerBase {
   private final ColoredTreeCellRenderer myRenderer;
-  protected TreeNode myLastHitNode;
+  protected WeakReference<TreeNode> myLastHitNode;
 
   public TreeLinkMouseListener(final ColoredTreeCellRenderer renderer) {
     myRenderer = renderer;
@@ -57,8 +58,8 @@
       assert rectangle != null;
       int dx = e.getX() - rectangle.x;
       final TreeNode treeNode = (TreeNode)path.getLastPathComponent();
-      if (myLastHitNode != treeNode) {
-        myLastHitNode = treeNode;
+      if (myLastHitNode == null || myLastHitNode.get() != treeNode) {
+        myLastHitNode = new WeakReference<TreeNode>(treeNode);
         myRenderer.getTreeCellRendererComponent(tree, treeNode, false, false, treeNode.isLeaf(), -1, false);
       }
       tag = myRenderer.getFragmentTagAt(dx);
diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java
index d955c49..f734654 100644
--- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java
+++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java
@@ -217,7 +217,7 @@
 
   private static boolean isUpToDate(File executable) {
     long length = SystemInfo.isWindows ? 71208 :
-                  SystemInfo.isMac ? 13924 :
+                  SystemInfo.isMac ? 13984 :
                   SystemInfo.isLinux ? SystemInfo.isAMD64 ? 29155 : 22791 :
                   -1;
     return length < 0 || length == executable.length();
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeFrameImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeFrameImpl.java
index a782ee1..4289ad1 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeFrameImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/IdeFrameImpl.java
@@ -15,7 +15,6 @@
  */
 package com.intellij.openapi.wm.impl;
 
-import com.apple.eawt.AppEvent;
 import com.intellij.diagnostic.IdeMessagePanel;
 import com.intellij.ide.AppLifecycleListener;
 import com.intellij.ide.DataManager;
@@ -43,6 +42,7 @@
 import com.intellij.openapi.util.Key;
 import com.intellij.openapi.util.SystemInfo;
 import com.intellij.openapi.util.registry.Registry;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.wm.IdeFrame;
 import com.intellij.openapi.wm.IdeRootPaneNorthExtension;
 import com.intellij.openapi.wm.StatusBar;
@@ -65,10 +65,6 @@
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
 
 /**
  * @author Anton Katilin
@@ -316,9 +312,10 @@
       final String applicationName = ((ApplicationInfoEx)ApplicationInfo.getInstance()).getFullApplicationName();
       final Builder builder = new Builder();
       if (SystemInfo.isMac) {
-        builder.append(fileTitle).append(title)
-          .append(ProjectManager.getInstance().getOpenProjects().length == 0
-                  || ((ApplicationInfoEx)ApplicationInfo.getInstance()).isEAP() && !applicationName.endsWith("SNAPSHOT") ? applicationName : null);
+        boolean addAppName = StringUtil.isEmpty(title) ||
+                             ProjectManager.getInstance().getOpenProjects().length == 0 ||
+                             ((ApplicationInfoEx)ApplicationInfo.getInstance()).isEAP() && !applicationName.endsWith("SNAPSHOT");
+        builder.append(fileTitle).append(title).append(addAppName ? applicationName : null);
       } else {
         builder.append(title).append(fileTitle).append(applicationName);
       }
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java
index 1b5ecec..84b6e6a 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InfoAndProgressPanel.java
@@ -411,12 +411,12 @@
 
   public Couple<String> setText(@Nullable final String text, @Nullable final String requestor) {
     if (StringUtil.isEmpty(text) && !Comparing.equal(requestor, myCurrentRequestor) && !EventLog.LOG_REQUESTOR.equals(requestor)) {
-      return Couple.newOne(myInfoPanel.getText(), myCurrentRequestor);
+      return Couple.of(myInfoPanel.getText(), myCurrentRequestor);
     }
 
     boolean logMode = myInfoPanel.updateText(EventLog.LOG_REQUESTOR.equals(requestor) ? "" : text);
     myCurrentRequestor = logMode ? EventLog.LOG_REQUESTOR : requestor;
-    return Couple.newOne(text, requestor);
+    return Couple.of(text, requestor);
   }
 
   public void setRefreshVisible(final boolean visible) {
diff --git a/platform/platform-impl/src/com/intellij/remote/RemoteSdkProducer.java b/platform/platform-impl/src/com/intellij/remote/RemoteSdkProducer.java
index cd5c00e..b3461bf 100644
--- a/platform/platform-impl/src/com/intellij/remote/RemoteSdkProducer.java
+++ b/platform/platform-impl/src/com/intellij/remote/RemoteSdkProducer.java
@@ -15,14 +15,29 @@
  */
 package com.intellij.remote;
 
+import com.intellij.execution.ExecutionException;
 import com.intellij.util.Consumer;
 
 /**
  * @author traff
  */
 public interface RemoteSdkProducer<T extends RemoteSdkCredentials> {
+  /**
+   * Synchronously returns remote sdk credentials
+   * @return
+   * @throws InterruptedException
+   * @deprecated
+   */
   T getRemoteSdkCredentials() throws InterruptedException;
-  
+
+  T getRemoteSdkCredentials(boolean allowSynchronousInteraction) throws InterruptedException, ExecutionException;
+
+  void produceRemoteSdkCredentials(boolean allowSynchronousInteraction, Consumer<T> remoteSdkCredentialsConsumer);
+
+  /**
+   * @param remoteSdkCredentialsConsumer
+   * @deprecated
+   */
   void produceRemoteSdkCredentials(Consumer<T> remoteSdkCredentialsConsumer);
 
   Object getRemoteSdkDataKey();
diff --git a/platform/platform-impl/src/com/intellij/remote/VagrantNotStartedException.java b/platform/platform-impl/src/com/intellij/remote/VagrantNotStartedException.java
new file mode 100644
index 0000000..e73341f
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/remote/VagrantNotStartedException.java
@@ -0,0 +1,32 @@
+/*
+ * 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.remote;
+
+/**
+ * @author traff
+ */
+public class VagrantNotStartedException extends RuntimeException {
+  private String myVagrantFolder;
+
+  public VagrantNotStartedException(String message, String vagrantFolder) {
+    super(message);
+    myVagrantFolder = vagrantFolder;
+  }
+
+  public String getVagrantFolder() {
+    return myVagrantFolder;
+  }
+}
diff --git a/platform/platform-impl/src/com/intellij/remote/VagrantSupport.java b/platform/platform-impl/src/com/intellij/remote/VagrantSupport.java
index 5f8fa4b..a5ebae6 100644
--- a/platform/platform-impl/src/com/intellij/remote/VagrantSupport.java
+++ b/platform/platform-impl/src/com/intellij/remote/VagrantSupport.java
@@ -15,6 +15,7 @@
  */
 package com.intellij.remote;
 
+import com.intellij.execution.ExecutionException;
 import com.intellij.openapi.components.ServiceManager;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.Messages;
@@ -55,7 +56,9 @@
     });
   }
 
-  public abstract boolean checkVagrantAndRunIfDown(String folder);
+  public abstract boolean checkVagrantRunning(String folder, boolean runIfDown);
+
+  public abstract void runVagrant(String folder) throws ExecutionException;
 
   public abstract Collection<? extends RemoteConnector> getVagrantInstancesConnectors(@NotNull Project project);
 
diff --git a/platform/platform-impl/src/com/intellij/ui/ColorPicker.java b/platform/platform-impl/src/com/intellij/ui/ColorPicker.java
index 765f4a2..f3158c2 100644
--- a/platform/platform-impl/src/com/intellij/ui/ColorPicker.java
+++ b/platform/platform-impl/src/com/intellij/ui/ColorPicker.java
@@ -837,7 +837,7 @@
       int row = (y - top - 2) / 31;
       row = row > 1 ? 1 : row;
 
-      return row >= 0 && col >= 0 ? Couple.newOne(row, col) : null;
+      return row >= 0 && col >= 0 ? Couple.of(row, col) : null;
     }
 
     @Override
diff --git a/platform/platform-impl/src/com/intellij/ui/FinderRecursivePanel.java b/platform/platform-impl/src/com/intellij/ui/FinderRecursivePanel.java
index 36bb8d3..6014cb8 100644
--- a/platform/platform-impl/src/com/intellij/ui/FinderRecursivePanel.java
+++ b/platform/platform-impl/src/com/intellij/ui/FinderRecursivePanel.java
@@ -325,7 +325,7 @@
 
   protected boolean performEditAction() {
     Navigatable data = CommonDataKeys.NAVIGATABLE.getData(DataManager.getInstance().getDataContext(myList));
-    if (data != null) {
+    if (data != null && data.canNavigate()) {
       data.navigate(true);
     }
     return false;
diff --git a/platform/platform-impl/src/com/intellij/ui/LicensingFacade.java b/platform/platform-impl/src/com/intellij/ui/LicensingFacade.java
index a7ed2c4..9df936a 100644
--- a/platform/platform-impl/src/com/intellij/ui/LicensingFacade.java
+++ b/platform/platform-impl/src/com/intellij/ui/LicensingFacade.java
@@ -34,6 +34,7 @@
   public abstract String getLicensedToMessage();
   public abstract List<String> getLicenseRestrictionsMessages();
   public abstract boolean isEvaluationLicense();
+  public abstract boolean isSubscriptionLicense();
 
   @Nullable
   public abstract Boolean isPaidUpgrade(int majorVersion, Date releaseDate);
diff --git a/platform/platform-impl/src/com/intellij/ui/docking/impl/DockManagerImpl.java b/platform/platform-impl/src/com/intellij/ui/docking/impl/DockManagerImpl.java
index 73461dd..ee58641 100644
--- a/platform/platform-impl/src/com/intellij/ui/docking/impl/DockManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/ui/docking/impl/DockManagerImpl.java
@@ -20,6 +20,7 @@
 import com.intellij.ide.ui.UISettingsListener;
 import com.intellij.openapi.Disposable;
 import com.intellij.openapi.actionSystem.Presentation;
+import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.components.PersistentStateComponent;
 import com.intellij.openapi.components.State;
 import com.intellij.openapi.components.Storage;
@@ -116,9 +117,15 @@
     readStateFor(id);
   }
 
+  public void readState() {
+    for (String id : myFactories.keySet()) {
+      readStateFor(id);
+    }
+  }
+
   @Override
   public Set<DockContainer> getContainers() {
-    return Collections.unmodifiableSet(myContainers);
+    return Collections.unmodifiableSet(new HashSet<DockContainer>(myContainers));
   }
 
   @Override
@@ -394,7 +401,7 @@
     });
   }
 
-  public Pair<FileEditor[], FileEditorProvider[]> createNewDockContainerFor(VirtualFile file, FileEditorManagerImpl fileEditorManager) {
+  public Pair<FileEditor[], FileEditorProvider[]> createNewDockContainerFor(@NotNull VirtualFile file, FileEditorManagerImpl fileEditorManager) {
     DockContainer container = getFactory(DockableEditorContainerFactory.TYPE).createContainer(null);
     register(container);
 
@@ -458,7 +465,7 @@
       center.add(myDockContentUiContainer, BorderLayout.CENTER);
 
       myUiContainer.add(center, BorderLayout.CENTER);
-      if (!(container instanceof DockContainer.Dialog)) {
+      if (myStatusBar != null) {
         myUiContainer.add(myStatusBar.getComponent(), BorderLayout.SOUTH);
       }
 
@@ -498,6 +505,7 @@
     }
 
     private void updateNorthPanel() {
+      if (ApplicationManager.getApplication().isUnitTestMode()) return;
       myNorthPanel.setVisible(UISettings.getInstance().SHOW_NAVIGATION_BAR
                               && !(myContainer instanceof DockContainer.Dialog)
                               && !UISettings.getInstance().PRESENTATION_MODE);
diff --git a/platform/platform-impl/src/com/intellij/ui/messages/SheetMessage.java b/platform/platform-impl/src/com/intellij/ui/messages/SheetMessage.java
index 8acfaa0..1b3f8f2 100755
--- a/platform/platform-impl/src/com/intellij/ui/messages/SheetMessage.java
+++ b/platform/platform-impl/src/com/intellij/ui/messages/SheetMessage.java
@@ -20,6 +20,7 @@
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.util.SystemInfo;
+import com.intellij.openapi.wm.IdeFocusManager;
 import com.intellij.openapi.wm.ex.WindowManagerEx;
 import com.intellij.ui.Gray;
 import com.intellij.ui.JBColor;
@@ -116,7 +117,19 @@
     LaterInvocator.enterModal(myWindow);
     myWindow.setVisible(true);
     LaterInvocator.leaveModal(myWindow);
-    beforeShowFocusOwner.get().requestFocus();
+
+    Component focusCandidate = beforeShowFocusOwner.get();
+
+    if (focusCandidate == null) {
+      focusCandidate = IdeFocusManager.getGlobalInstance().getLastFocusedFor(IdeFocusManager.getGlobalInstance().getLastFocusedFrame());
+    }
+
+    LOG.assertTrue(focusCandidate != null, "The should return focus on closing the message");
+
+    if (focusCandidate != null) {
+      focusCandidate.requestFocus();
+    }
+
   }
 
   private void setWindowOpacity(float opacity) {
diff --git a/platform/platform-impl/src/com/intellij/util/UriUtil.java b/platform/platform-impl/src/com/intellij/util/UriUtil.java
index c8bf0a8..9511cbc 100644
--- a/platform/platform-impl/src/com/intellij/util/UriUtil.java
+++ b/platform/platform-impl/src/com/intellij/util/UriUtil.java
@@ -55,8 +55,8 @@
   public static Couple<String> splitScheme(@NotNull String url) {
     ArrayList<String> list = Lists.newArrayList(Splitter.on(URLUtil.SCHEME_SEPARATOR).limit(2).split(url));
     if (list.size() == 1) {
-      return Couple.newOne("", list.get(0));
+      return Couple.of("", list.get(0));
     }
-    return Couple.newOne(list.get(0), list.get(1));
+    return Couple.of(list.get(0), list.get(1));
   }
 }
\ No newline at end of file
diff --git a/platform/platform-impl/src/com/intellij/util/io/UrlConnectionUtil.java b/platform/platform-impl/src/com/intellij/util/io/UrlConnectionUtil.java
index 9d7836c..198ead7 100644
--- a/platform/platform-impl/src/com/intellij/util/io/UrlConnectionUtil.java
+++ b/platform/platform-impl/src/com/intellij/util/io/UrlConnectionUtil.java
@@ -51,12 +51,15 @@
   }
 
 
-  public static InputStream getConnectionInputStreamWithException(@NotNull URLConnection connection, @NotNull ProgressIndicator pi)
+  public static InputStream getConnectionInputStreamWithException(@NotNull URLConnection connection, @Nullable ProgressIndicator pi)
     throws IOException {
     InputStreamGetter getter = new InputStreamGetter(connection);
     final Future<?> getterFuture = ApplicationManager.getApplication().executeOnPooledThread(getter);
     while (true) {
-      pi.checkCanceled();
+      if (pi != null) {
+        pi.checkCanceled();
+      }
+
       try {
         try {
           getterFuture.get(50, TimeUnit.MILLISECONDS);
@@ -64,8 +67,11 @@
         catch (TimeoutException ignored) {
         }
 
-        pi.setIndeterminate(true);
-        pi.setText(pi.getText());
+        if (pi != null) {
+          pi.setIndeterminate(true);
+          pi.setText(pi.getText());
+        }
+
         if (getterFuture.isDone()) {
           break;
         }
diff --git a/platform/platform-impl/src/org/jetbrains/io/BuiltInServer.java b/platform/platform-impl/src/org/jetbrains/io/BuiltInServer.java
index e515d00..a7d09ab 100644
--- a/platform/platform-impl/src/org/jetbrains/io/BuiltInServer.java
+++ b/platform/platform-impl/src/org/jetbrains/io/BuiltInServer.java
@@ -63,7 +63,9 @@
     return port;
   }
 
-  static ServerBootstrap createServerBootstrap(EventLoopGroup eventLoopGroup, final ChannelRegistrar channelRegistrar, @Nullable Map<String, Object> xmlRpcHandlers) {
+  static ServerBootstrap createServerBootstrap(@NotNull EventLoopGroup eventLoopGroup,
+                                               @NotNull final ChannelRegistrar channelRegistrar,
+                                               @Nullable Map<String, Object> xmlRpcHandlers) {
     ServerBootstrap bootstrap = NettyUtil.nioServerBootstrap(eventLoopGroup);
     if (xmlRpcHandlers == null) {
       final PortUnificationServerHandler portUnificationServerHandler = new PortUnificationServerHandler();
diff --git a/platform/platform-impl/src/org/jetbrains/io/NettyUtil.java b/platform/platform-impl/src/org/jetbrains/io/NettyUtil.java
index a9913bb..644cb35 100644
--- a/platform/platform-impl/src/org/jetbrains/io/NettyUtil.java
+++ b/platform/platform-impl/src/org/jetbrains/io/NettyUtil.java
@@ -22,6 +22,7 @@
 import io.netty.bootstrap.BootstrapUtil;
 import io.netty.bootstrap.ServerBootstrap;
 import io.netty.channel.*;
+import io.netty.channel.nio.NioEventLoop;
 import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.channel.oio.OioEventLoopGroup;
 import io.netty.channel.socket.nio.NioServerSocketChannel;
@@ -67,9 +68,29 @@
   }
 
   @Nullable
-  public static Channel connect(Bootstrap bootstrap, InetSocketAddress remoteAddress, ActionCallback asyncResult, int maxAttemptCount) {
+  public static Channel connect(@NotNull Bootstrap bootstrap, @NotNull InetSocketAddress remoteAddress, @NotNull ActionCallback asyncResult, int maxAttemptCount) {
     try {
       int attemptCount = 0;
+
+      if (bootstrap.group() instanceof NioEventLoop) {
+        while (true) {
+          ChannelFuture future = bootstrap.connect(remoteAddress).awaitUninterruptibly();
+          if (future.isSuccess()) {
+            return future.channel();
+          }
+          else if (++attemptCount < maxAttemptCount) {
+            //noinspection BusyWait
+            Thread.sleep(attemptCount * MIN_START_TIME);
+          }
+          else {
+            @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+            Throwable cause = future.cause();
+            asyncResult.reject("Cannot connect: " + (cause == null ? "unknown error" : cause.getMessage()));
+            return null;
+          }
+        }
+      }
+
       Socket socket;
       while (true) {
         try {
@@ -123,7 +144,7 @@
     }
   }
 
-  public static ServerBootstrap nioServerBootstrap(EventLoopGroup eventLoopGroup) {
+  public static ServerBootstrap nioServerBootstrap(@NotNull EventLoopGroup eventLoopGroup) {
     ServerBootstrap bootstrap = new ServerBootstrap().group(eventLoopGroup).channel(NioServerSocketChannel.class);
     bootstrap.childOption(ChannelOption.TCP_NODELAY, true).childOption(ChannelOption.SO_KEEPALIVE, true);
     return bootstrap;
@@ -137,7 +158,11 @@
 
   @SuppressWarnings("UnusedDeclaration")
   public static Bootstrap nioClientBootstrap() {
-    Bootstrap bootstrap = new Bootstrap().group(new NioEventLoopGroup(1, PooledThreadExecutor.INSTANCE)).channel(NioSocketChannel.class);
+    return nioClientBootstrap(new NioEventLoopGroup(1, PooledThreadExecutor.INSTANCE));
+  }
+
+  public static Bootstrap nioClientBootstrap(@NotNull EventLoopGroup eventLoopGroup) {
+    Bootstrap bootstrap = new Bootstrap().group(eventLoopGroup).channel(NioSocketChannel.class);
     bootstrap.option(ChannelOption.TCP_NODELAY, true).option(ChannelOption.SO_KEEPALIVE, true);
     return bootstrap;
   }
diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties
index 1224d3f..59e8975 100644
--- a/platform/platform-resources-en/src/messages/ActionsBundle.properties
+++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties
@@ -6,8 +6,10 @@
 action.CaptureMemorySnapShot.description=Capture memory snapshot
 action.CaptureCPUUsageData.text=Start CPU Usage Profiling
 action.CaptureCPUUsageData.description=Capture CPU usage data
+stop.capture.cpu.usage.data.action.name=Stop CPU Usage Profiling
 action.CaptureAllocations.text=Capture Allocations
 action.CaptureAllocations.description=Capture memory allocations data
+stop.capture.allocations.data.action.name=Stop Capturing Allocations
 action.ContextHelp.text=Conte_xt Help
 action.ContextHelp.description=Show context help
 action.RunConfiguration.text=Select Run/Debug Configuration
@@ -769,6 +771,8 @@
 action.StoreDefaultLayout.description=Store current layout as default
 action.MinimizeCurrentWindow.text=Minimize
 action.MinimizeCurrentWindow.description=Minimize current window
+action.ZoomCurrentWindow.text=Zoom
+action.ZoomCurrentWindow.description=Zoom current window
 action.TogglePresentationMode.text.enter=Enter Presentation mode
 action.TogglePresentationMode.text.exit=Exit Presentation mode
 action.TogglePresentationMode.text=Toggle Presentation mode
@@ -959,6 +963,7 @@
 action.Debugger.MarkObject.description=Mark/unmark the object so that it can be visually distinguished in in debugger views
 action.Debugger.AddToWatch.text=Add to Watches
 action.Debugger.EvaluateInConsole.text=Evaluate in Console
+action.Debugger.UnmuteOnStop.text=Unmute breakpoints on session finish
 action.Debugger.AutoRenderer.text=Auto
 group.EditorPopupMenu.text=Editor Popup Menu
 group.EditorPopupMenu.description=Editor Popup Menu
@@ -1027,11 +1032,6 @@
 group.ShowRecentFindUsagesGroup.text=Recent Find Usages
 group.ShowRecentFindUsagesGroup.description=Choose and re-run recent find usages
 
-stop.capture.cpu.usage.data.action.name=Stop CPU Usage Profiling
-stop.capture.cpu.usage.data.action.description=Stop capturing CPU usage data
-stop.capture.allocations.usage.data.action.name=Capture allocations data, now capturing
-stop.capture.allocations.usage.data.action.description=Stop capturing allocations data
-
 action.IntegrateFiles.text=Integrate
 action.IntegrateFiles.description=Integrate selected files or directories
 action.Vcs.IntegrateProject.text=Inte_grate Project
diff --git a/platform/platform-resources-en/src/messages/CodeInsightBundle.properties b/platform/platform-resources-en/src/messages/CodeInsightBundle.properties
index 340d1ef..23931e7 100644
--- a/platform/platform-resources-en/src/messages/CodeInsightBundle.properties
+++ b/platform/platform-resources-en/src/messages/CodeInsightBundle.properties
@@ -3,6 +3,8 @@
 error.dialog.readonly.file.title=File Is Read-Only
 error.dialog.readonly.files.title=Cannot Modify Read-Only Files
 error.dialog.readonly.files.message={0} contains read-only file(s).\nProcess all other (writeable) files?
+reformat.directory.dialog.options=Options
+reformat.directory.dialog.filters=Filters
 process.scope.directory=Directory ''{0}''
 process.scope.project=Project ''{0}''
 process.scope.module=Module ''{0}''
diff --git a/platform/platform-resources-en/src/messages/CommonBundle.properties b/platform/platform-resources-en/src/messages/CommonBundle.properties
index 7820960..46750d5 100644
--- a/platform/platform-resources-en/src/messages/CommonBundle.properties
+++ b/platform/platform-resources-en/src/messages/CommonBundle.properties
@@ -124,10 +124,8 @@
 format.file.size.kbytes={0}Kb
 format.file.size.mbytes={0}Mb
 
-profiling.captured.cpu.snapshot.message.text=Captured CPU snapshot: ''{0}'' is placed in user home directory.
-profiling.captured.allocations.snapshot.message.text=Captured allocations snapshot: ''{0}'' is placed in user home directory.
-information.dialog.title=Information
-captured.memory.snapshot.placed.in.user.home.directory.message.text=Captured memory snapshot: ''{0}'' is placed in user home directory.
+profiling.capture.snapshot.success=Captured snapshot ''{0}'' is placed in user home directory. <a href="{1}">Show in {2}</a>.
+profiling.capture.snapshot.error=Failed to capture snapshot: {0}
 
 cannot.undo.dialog.title=Cannot Undo
 cannot.undo.error.other.affected.files.changed.message=Following files affected by this action have been already changed:
diff --git a/platform/platform-resources-en/src/messages/IdeBundle.properties b/platform/platform-resources-en/src/messages/IdeBundle.properties
index da50b48..af07531 100644
--- a/platform/platform-resources-en/src/messages/IdeBundle.properties
+++ b/platform/platform-resources-en/src/messages/IdeBundle.properties
@@ -764,6 +764,7 @@
 prompt.select.source.directory=Select Source Directory
 prompt.new.project.file.name=Enter a file name to create a new {0} {1}
 prompt.enter.project.file.location=Enter {0} file location
+file.location.should.be.absolute={0} location path should be absolute
 directory.project.file.directory=The {0} file directory\n
 prompt.overwrite.project.file=The {1} file \n''{0}''\nalready exists.\nWould you like to overwrite it?
 prompt.overwrite.project.folder={0} folder already exists in {1}.\nIts content may be overwritten.\nContinue?
@@ -1146,3 +1147,5 @@
 checkbox.allow.vcs.annotations=Allow VCS Annotations
 presentation.mode.fon.size=Font size\:
 update.available.group=Update Checker
+
+loading.editors=Loading files...
diff --git a/platform/platform-resources-en/src/messages/InspectionsBundle.properties b/platform/platform-resources-en/src/messages/InspectionsBundle.properties
index 525c0d5..0e423f5 100644
--- a/platform/platform-resources-en/src/messages/InspectionsBundle.properties
+++ b/platform/platform-resources-en/src/messages/InspectionsBundle.properties
@@ -45,6 +45,7 @@
 
 #dataflow
 inspection.data.flow.display.name=Constant conditions \\& exceptions
+inspection.contract.display.name=Contract issues
 inspection.data.flow.nullable.quickfix.option=<html><body>Suggest @Nullable annotation for methods that may possibly return null and <br>report nullable values passed to non-annotated parameters</body></html>
 inspection.data.flow.true.asserts.option=<html><body>Don't report assertions with condition statically proven to be always <code>true</code></body></html>
 inspection.data.flow.redundant.instanceof.quickfix=Replace with != null
@@ -557,8 +558,10 @@
 boolean.method.is.always.inverted.problem.descriptor=Boolean method <code>#ref</code> is always inverted
 inspection.results.title=Results By Editor Settings
 unnecessary.module.dependency.display.name=Unnecessary module dependency
-unnecessary.module.dependency.problem.descriptor=Module ''{0}'' sources do not depend on module ''{1}'' sources, the dependency between modules could be removed
-suspected.module.dependency.problem.descriptor=Dependency from module ''{0}'' on module ''{1}'' could be probably be removed when complementary scope to ''{2}'' also does not contain references on module ''{3}''
+unnecessary.module.dependency.problem.descriptor=Module ''{0}'' sources do not depend on module ''{1}'' sources
+unnecessary.module.dependency.exported.problem.descriptor1=Module ''{0}'' does not depend on ''{1}''. Though ''{0}'' depends on ''{2}'' through exported dependencies of ''{1}''
+unnecessary.module.dependency.exported.problem.descriptor=Module ''{0}'' does not depend on ''{1}''. Though ''{2}'' depend on ''{1}'' through this exported dependency
+suspected.module.dependency.problem.descriptor=Dependency from module ''{0}'' on module ''{1}'' could be removed when complementary scope to ''{2}'' also does not contain references on module ''{3}''
 run.with.editor.settings.dialog.option=Run with &editor settings
 inspection.new.profile.text=New Profile Name
 profile.save.as.project.checkbox.title=Save as project profile
diff --git a/platform/platform-resources-en/src/messages/OptionsBundle.properties b/platform/platform-resources-en/src/messages/OptionsBundle.properties
index 364c5b4..b1c60ec 100644
--- a/platform/platform-resources-en/src/messages/OptionsBundle.properties
+++ b/platform/platform-resources-en/src/messages/OptionsBundle.properties
@@ -140,6 +140,7 @@
 options.general.color.descriptor.hyperlink.followed=Followed hyperlink
 options.general.color.descriptor.reference.hyperlink=Reference hyperlink
 options.general.color.descriptor.todo.defaults=TODO defaults
+options.general.color.descriptor.bookmarks=Bookmarks
 options.general.color.soft.wrap.sign=Soft wrap sign
 
 
diff --git a/platform/platform-resources-en/src/messages/PsiBundle.properties b/platform/platform-resources-en/src/messages/PsiBundle.properties
index 4797902..716f3e6 100644
--- a/platform/platform-resources-en/src/messages/PsiBundle.properties
+++ b/platform/platform-resources-en/src/messages/PsiBundle.properties
@@ -1,9 +1,5 @@
 psi.scanning.files.progress=Scanning files...
-psi.scanning.files.in.folder.progress=Scanning files in {0}...
-psi.decompiled.text.header=\
-  // IntelliJ API Decompiler stub source generated from a class file\n\
-  // Implementation of methods is not available
-psi.error.incorroect.class.template.message=Cannot create {0} - incorrect {1} template.
+psi.error.incorrect.class.template.message=Cannot create {0} - incorrect {1} template.
 psi.search.inheritors.of.class.progress=Searching for inheritors of {0}...
 psi.search.inheritors.progress=Searching for inheritors...
 psi.search.for.word.progress=Searching for {0}...
diff --git a/platform/platform-resources-en/src/messages/RefactoringBundle.properties b/platform/platform-resources-en/src/messages/RefactoringBundle.properties
index bf22568..080dce7 100644
--- a/platform/platform-resources-en/src/messages/RefactoringBundle.properties
+++ b/platform/platform-resources-en/src/messages/RefactoringBundle.properties
@@ -275,6 +275,7 @@
 there.is.already.a.0.it.will.conflict.with.the.renamed.1=There is already a {0}. It will conflict with the renamed {1}
 0.will.override.renamed.1={0} will override renamed {1}
 0.will.hide.renamed.1={0} will hide renamed {1}
+local.will.be.hidden.renamed=renamed field will hide {0}
 there.is.already.a.0.in.the.1.it.will.conflict.with.the.renamed.parameter=There is already a {0} in the {1}. It will conflict with the renamed parameter.
 do.you.want.to.process.overriding.methods.with.covariant.return.type=Do you want to process overriding methods\nwith covariant return type?
 changing.signature.of.0=Changing signature of {0}
diff --git a/platform/platform-resources-en/src/messages/UsageView.properties b/platform/platform-resources-en/src/messages/UsageView.properties
index ab29484..1e33db4 100644
--- a/platform/platform-resources-en/src/messages/UsageView.properties
+++ b/platform/platform-resources-en/src/messages/UsageView.properties
@@ -50,7 +50,6 @@
 occurence.info.reference={0,choice, 0#Not Found|1#1 reference|2#{0,number} references}{1,choice, 0#|1# in 1 file|2# in {1,number} files}
 default.package.presentable.name=<default>
 changes.detected.error.title=Changes Detected
-usage.target.xml.tag.of.file={0} of file {1}
 usage.target.package.in.directory={0} (in {1})
 usage.target.exception=Exception
 usage.type.new=New instance creation
diff --git a/platform/platform-resources-en/src/messages/XDebuggerBundle.properties b/platform/platform-resources-en/src/messages/XDebuggerBundle.properties
index e76eec2..523c8b6 100644
--- a/platform/platform-resources-en/src/messages/XDebuggerBundle.properties
+++ b/platform/platform-resources-en/src/messages/XDebuggerBundle.properties
@@ -34,10 +34,10 @@
 
 xbreakpoints.properties.actions.group.title=Actions
 xbreakpoints.log.message.checkbox=Log &message to console
-xbreakpoints.log.expression.checkbox=Log evaluated &expression
+xbreakpoints.log.expression.checkbox=Log evaluated &expression:
 xbreakpoints.condition.checkbox=&Condition
 xbreakpoint.group.depends.on=Depends on
-xbreakpoint.label.after.breakpoint.was.hit=After breakpoint was hit:
+xbreakpoint.label.after.breakpoint.was.hit=After breakpoint was hit
 xbreakpoint.radio.disable.again=Disable again
 xbreakpoint.radio.leave.enabled=Leave enabled
 xbreakpoint.master.breakpoint.none=<None>
diff --git a/platform/platform-resources-en/src/messages/XmlBundle.properties b/platform/platform-resources-en/src/messages/XmlBundle.properties
index e761b3c..1ef6ef3 100644
--- a/platform/platform-resources-en/src/messages/XmlBundle.properties
+++ b/platform/platform-resources-en/src/messages/XmlBundle.properties
@@ -215,13 +215,11 @@
 select.xsd.schema.dialog.title=Select XSD Schema
 
 emmet.title=Emmet
-emmet.configuration.title=Emmet (Zen Coding)
+emmet.configuration.title=Emmet
 emmet.enable.label=&Enable XML Emmet
 emmet.enable.bem.filter=Enable &BEM filter by default
 emmet.enable.preview=Enable &abbreviation preview
 emmet.expand.abbreviation.with=Expand &abbreviation with
-zen.coding.enter.abbreviation.dialog.label=Please enter an abbreviation
-zen.coding.incorrect.abbreviation.error=Incorrect abbreviation
 
 title.cannot.create.html.file=Cannot create HTML file
 new.html.file.action=HTML File
diff --git a/platform/platform-resources-en/src/misc/registry.properties b/platform/platform-resources-en/src/misc/registry.properties
index 8f74b27..028ac70 100644
--- a/platform/platform-resources-en/src/misc/registry.properties
+++ b/platform/platform-resources-en/src/misc/registry.properties
@@ -140,7 +140,7 @@
 ide.mac.fix.dialog.showing=false
 ide.mac.hide.cursor.when.typing=true
 ide.mac.show.native.help=true
-ide.mac.useNativeClipboard=false
+ide.mac.useNativeClipboard=true
 ide.mac.boldEditorTabs=false
 ide.mac.disableMacScrollbars=false
 ide.mac.disableMacScrollbars.description=Disables OS X overlay scrollbars (effective on restart)
@@ -300,10 +300,6 @@
 ide.goto.implementation.show.interfaces.description=Whether to show sub-interfaces when invoking\
   'Go to Implementation' action (Ctrl+Alt+B) on an interface.
 
-ide.open.editors.asynchronously=true
-# suppress inspection "UnusedProperty"
-ide.open.editors.asynchronously.description=Prepare editors in background thread
-
 file.colors.in.commit.dialog=false
 
 testng.serialized.protocol.enabled=false
@@ -367,7 +363,6 @@
 ide.libnotify.enabled.description=Enables notifications via LibNotify
 cvs.roots.refresh.uses.vfs=true
 cvs.roots.refresh.uses.vfs.description=Should CVS roots refresh after update use VFS
-editor.wrap.collapsed.region.at.line.start=false
 vcs.add.remove.silent=true
 ide.open.file.in.temp.project.dir=true
 ide.open.file.in.temp.project.dir.description=Enables opening file in temp project directory
@@ -390,7 +385,7 @@
 editor.richcopy.enable=true
 editor.richcopy.max.size.megabytes=10
 editor.richcopy.strip.indents=true
-allow.dialog.based.popups=false
+allow.dialog.based.popups=true
 allow.dialog.based.popups.description=Allows to use a JDialog as popup toplevel
 
 focus.fix.lost.cursor=true
diff --git a/platform/platform-resources/src/DefaultColorSchemesManager.xml b/platform/platform-resources/src/DefaultColorSchemesManager.xml
index 91fcf54..e0737bb 100644
--- a/platform/platform-resources/src/DefaultColorSchemesManager.xml
+++ b/platform/platform-resources/src/DefaultColorSchemesManager.xml
@@ -880,6 +880,11 @@
           <option name="ERROR_STRIPE_COLOR" value="ff" />
         </value>
       </option>
+      <option name="BOOKMARKS_ATTRIBUTES">
+        <value>
+          <option name="ERROR_STRIPE_COLOR" value="0" />
+        </value>
+      </option>
         <option name="CONSOLE_BLACK_OUTPUT">
           <value>
             <option name="FOREGROUND" value="000000" />
diff --git a/platform/platform-resources/src/META-INF/LangExtensionPoints.xml b/platform/platform-resources/src/META-INF/LangExtensionPoints.xml
index 8228211..f25ff6b 100644
--- a/platform/platform-resources/src/META-INF/LangExtensionPoints.xml
+++ b/platform/platform-resources/src/META-INF/LangExtensionPoints.xml
@@ -802,6 +802,8 @@
                     interface="com.intellij.codeInsight.daemon.impl.analysis.DefaultHighlightingSettingProvider"/>
 
     <extensionPoint name="sdkResolveScopeProvider" interface="com.intellij.psi.SdkResolveScopeProvider"/>
+
+    <extensionPoint name="goto.nonProjectScopeDisabler" beanClass="com.intellij.ide.actions.NonProjectScopeDisablerEP"/>
   </extensionPoints>
 </idea-plugin>
 
diff --git a/platform/platform-resources/src/META-INF/XmlPlugin.xml b/platform/platform-resources/src/META-INF/XmlPlugin.xml
index 76c3a7f..d79152d 100644
--- a/platform/platform-resources/src/META-INF/XmlPlugin.xml
+++ b/platform/platform-resources/src/META-INF/XmlPlugin.xml
@@ -159,14 +159,14 @@
     <highlightErrorFilter implementation="com.intellij.codeInsight.highlighting.HtmlClosingTagErrorFilter"/>
 
     <applicationService serviceInterface="com.intellij.javaee.ExternalResourceManager"
-                        serviceImplementation="com.intellij.javaee.ExternalResourceManagerImpl"/>
+                        serviceImplementation="com.intellij.javaee.ExternalResourceManagerExImpl"/>
 
     <applicationService serviceInterface="com.intellij.codeInspection.XmlQuickFixFactory"
                         serviceImplementation="com.intellij.codeInspection.XmlQuickFixFactoryImpl"/>
 
     <standardResourceProvider implementation="com.intellij.javaee.InternalResourceProvider"/>
 
-    <projectService serviceInterface="com.intellij.javaee.ProjectResources"
+    <projectService serviceInterface="com.intellij.javaee.ExternalResourceManagerExImpl"
                     serviceImplementation="com.intellij.javaee.ProjectResources"/>
 
     <roots.watchedRootsProvider implementation="com.intellij.codeInsight.daemon.impl.quickfix.FetchExtResourceAction"/>
diff --git a/platform/platform-resources/src/idea/Keymap_Default.xml b/platform/platform-resources/src/idea/Keymap_Default.xml
index 0e0a7b5..d42b30b 100644
--- a/platform/platform-resources/src/idea/Keymap_Default.xml
+++ b/platform/platform-resources/src/idea/Keymap_Default.xml
@@ -334,9 +334,6 @@
   <action id="Compile">
     <keyboard-shortcut first-keystroke="control shift F9"/>
   </action>
-  <action id="RunAPT">
-    <keyboard-shortcut first-keystroke="control alt shift F9"/>
-  </action>
   <action id="$Cut">
     <keyboard-shortcut first-keystroke="control X"/>
     <keyboard-shortcut first-keystroke="shift DELETE"/>
diff --git a/platform/platform-resources/src/idea/Keymap_Mac.xml b/platform/platform-resources/src/idea/Keymap_Mac.xml
index 9c60daf..70fb209 100644
--- a/platform/platform-resources/src/idea/Keymap_Mac.xml
+++ b/platform/platform-resources/src/idea/Keymap_Mac.xml
@@ -434,6 +434,10 @@
     <action id="MinimizeCurrentWindow">
       <keyboard-shortcut first-keystroke="meta M"/>
     </action>
+    
+    <action id="ZoomCurrentWindow">
+      <keyboard-shortcut first-keystroke="meta control EQUALS"/>
+    </action>
 
     <action id="ToggleFullScreen">
       <keyboard-shortcut first-keystroke="meta control F"/>
diff --git a/platform/platform-resources/src/idea/Keymap_MacClassic.xml b/platform/platform-resources/src/idea/Keymap_MacClassic.xml
index b218734..067a147 100644
--- a/platform/platform-resources/src/idea/Keymap_MacClassic.xml
+++ b/platform/platform-resources/src/idea/Keymap_MacClassic.xml
@@ -330,7 +330,11 @@
     <action id="MinimizeCurrentWindow">
       <keyboard-shortcut first-keystroke="meta M"/>
     </action>
-    
+
+    <action id="ZoomCurrentWindow">
+      <keyboard-shortcut first-keystroke="meta control EQUALS"/>
+    </action>
+
     <action id="ToggleFullScreen">
       <keyboard-shortcut first-keystroke="meta control F"/>
     </action>
diff --git a/platform/platform-resources/src/idea/Keymap_XWin.xml b/platform/platform-resources/src/idea/Keymap_XWin.xml
index 5409956..a07c052 100644
--- a/platform/platform-resources/src/idea/Keymap_XWin.xml
+++ b/platform/platform-resources/src/idea/Keymap_XWin.xml
@@ -22,8 +22,5 @@
     <action id="ShowFilePath">
       <keyboard-shortcut first-keystroke="control alt shift 2"/>
     </action>
-    <action id="RunAPT">
-      <keyboard-shortcut first-keystroke="control alt shift 9"/>
-    </action>
   </keymap>
 </component>
diff --git a/platform/platform-resources/src/idea/LangActions.xml b/platform/platform-resources/src/idea/LangActions.xml
index 273de14..af636ab 100644
--- a/platform/platform-resources/src/idea/LangActions.xml
+++ b/platform/platform-resources/src/idea/LangActions.xml
@@ -713,6 +713,12 @@
       <reference ref="XDebugger.CopyName"/>
       <separator/>
       <reference ref="EvaluateExpression"/>
+      <reference ref="Debugger.Tree.EvaluateInConsole"/>
+      <reference ref="Debugger.Tree.AddToWatches"/>
+      <separator/>
+      <reference ref="XDebugger.JumpToSource"/>
+      <reference ref="XDebugger.JumpToTypeSource"/>
+      <separator/>
     </group>
 
     <group id="XDebugger.Evaluation.Dialog.Tree.Popup">
@@ -727,12 +733,6 @@
 
     <group id="XDebugger.Variables.Tree.Popup">
       <reference ref="XDebugger.ValueGroup"/>
-      <reference ref="Debugger.Tree.EvaluateInConsole"/>
-      <reference ref="Debugger.Tree.AddToWatches"/>
-      <separator/>
-      <reference ref="XDebugger.JumpToSource"/>
-      <reference ref="XDebugger.JumpToTypeSource"/>
-      <separator/>
     </group>
 
     <group id="XDebugger.Variables.Tree.Toolbar">
@@ -754,12 +754,10 @@
 
     <group id="XDebugger.Inspect.Tree.Popup">
       <reference ref="XDebugger.ValueGroup"/>
-      <reference ref="Debugger.Tree.EvaluateInConsole"/>
-      <reference ref="Debugger.Tree.AddToWatches"/>
     </group>
 
     <group id="XDebugger.Settings" icon="AllIcons.General.SecondaryGroup" popup="true">
-
+      <action id="Debugger.UnmuteOnStop" class="com.intellij.xdebugger.impl.actions.UnmuteOnStopAction"/>
     </group>
 
     <group id="RunnerLayoutActions">
diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml
index 32e30af..85a834d 100644
--- a/platform/platform-resources/src/idea/PlatformActions.xml
+++ b/platform/platform-resources/src/idea/PlatformActions.xml
@@ -342,6 +342,7 @@
 
       <group id="WindowMenu" popup="true">
         <action id="MinimizeCurrentWindow" class="com.intellij.ide.actions.MinimizeCurrentWindowAction"/>
+        <action id="ZoomCurrentWindow" class="com.intellij.ide.actions.ZoomCurrentWindowAction"/>
         <action id="StoreDefaultLayout" class="com.intellij.ide.actions.StoreDefaultLayoutAction"/>
         <action id="RestoreDefaultLayout" class="com.intellij.ide.actions.RestoreDefaultLayoutAction"/>
         <separator/>
diff --git a/platform/platform-resources/src/idea/VcsActions.xml b/platform/platform-resources/src/idea/VcsActions.xml
index 5b01728..935bcc7 100644
--- a/platform/platform-resources/src/idea/VcsActions.xml
+++ b/platform/platform-resources/src/idea/VcsActions.xml
@@ -213,6 +213,7 @@
       icon="AllIcons.Actions.ShowAsTree" use-shortcut-of="GotoClass"/>
 
     <group id="EditorGutterVcsPopupMenu">
+      <separator/>
       <reference ref="Annotate"/>
       <add-to-group group-id="EditorGutterPopupMenu" anchor="last"/>
     </group>
diff --git a/platform/platform-tests/testSrc/com/intellij/codeInsight/actions/MockCodeStyleManager.java b/platform/platform-tests/testSrc/com/intellij/codeInsight/actions/MockCodeStyleManager.java
index 1b3771f..adaae70 100644
--- a/platform/platform-tests/testSrc/com/intellij/codeInsight/actions/MockCodeStyleManager.java
+++ b/platform/platform-tests/testSrc/com/intellij/codeInsight/actions/MockCodeStyleManager.java
@@ -28,12 +28,14 @@
 import com.intellij.psi.codeStyle.Indent;
 import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.ThrowableRunnable;
+import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.HashMap;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.Collection;
 import java.util.Map;
+import java.util.Set;
 
 public class MockCodeStyleManager extends CodeStyleManager {
   private Map<PsiFile, ChangedLines[]> myFormattedLinesForFile = new HashMap<PsiFile, ChangedLines[]>();
@@ -44,6 +46,15 @@
     return changedLines != null ? changedLines : new ChangedLines[0];
   }
 
+  @NotNull
+  public Set<PsiFile> getFormattedFiles() {
+    return myFormattedLinesForFile.keySet();
+  }
+
+  public void clearFormattedFiles() {
+    myFormattedLinesForFile = ContainerUtil.newHashMap();
+  }
+
   @Override
   public void reformatText(@NotNull PsiFile file, @NotNull Collection<TextRange> ranges) throws IncorrectOperationException {
     Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
diff --git a/platform/platform-tests/testSrc/com/intellij/codeInsight/actions/ReformatFilesWithFiltersTest.java b/platform/platform-tests/testSrc/com/intellij/codeInsight/actions/ReformatFilesWithFiltersTest.java
new file mode 100644
index 0000000..98ded2c
--- /dev/null
+++ b/platform/platform-tests/testSrc/com/intellij/codeInsight/actions/ReformatFilesWithFiltersTest.java
@@ -0,0 +1,242 @@
+/*
+ * 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.codeInsight.actions;
+
+import com.intellij.lang.LanguageFormatting;
+import com.intellij.openapi.fileTypes.PlainTextLanguage;
+import com.intellij.psi.PsiDirectory;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.codeStyle.CodeStyleManager;
+import com.intellij.psi.search.SearchScope;
+import com.intellij.testFramework.LightPlatformTestCase;
+import com.intellij.testFramework.PlatformTestCase;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.picocontainer.MutablePicoContainer;
+
+import java.io.IOException;
+import java.util.Set;
+
+import static com.intellij.psi.search.GlobalSearchScopesCore.directoryScope;
+
+public class ReformatFilesWithFiltersTest extends LightPlatformTestCase {
+  private static final String TEMP_DIR_NAME = "dir";
+  private PsiDirectory myWorkingDirectory;
+
+  private MockCodeStyleManager myMockCodeStyleManager;
+  private MockPlainTextFormattingModelBuilder myMockPlainTextFormattingModelBuilder;
+
+  private CodeStyleManager myRealCodeStyleManger;
+
+  @Override
+  public void setUp() throws Exception {
+    PlatformTestCase.initPlatformLangPrefix();
+    super.setUp();
+    myWorkingDirectory = TestFileStructure.createDirectory(getProject(), getSourceRoot(), TEMP_DIR_NAME);
+
+    myRealCodeStyleManger = CodeStyleManager.getInstance(getProject());
+    myMockCodeStyleManager = new MockCodeStyleManager();
+    registerCodeStyleManager(myMockCodeStyleManager);
+
+    myMockPlainTextFormattingModelBuilder = new MockPlainTextFormattingModelBuilder();
+    LanguageFormatting.INSTANCE.addExplicitExtension(PlainTextLanguage.INSTANCE, myMockPlainTextFormattingModelBuilder);
+  }
+
+  @Override
+  public void tearDown() throws Exception {
+    registerCodeStyleManager(myRealCodeStyleManger);
+    LanguageFormatting.INSTANCE.removeExplicitExtension(PlainTextLanguage.INSTANCE, myMockPlainTextFormattingModelBuilder);
+
+    TestFileStructure.delete(myWorkingDirectory.getVirtualFile());
+    super.tearDown();
+  }
+
+  private static void registerCodeStyleManager(@NotNull CodeStyleManager manager) {
+    String componentKey = CodeStyleManager.class.getName();
+    MutablePicoContainer container = (MutablePicoContainer)getProject().getPicoContainer();
+    container.unregisterComponent(componentKey);
+    container.registerComponentInstance(componentKey, manager);
+  }
+
+  public void testReformatWithoutMask() throws IOException {
+    TestFileStructure fileTree = new TestFileStructure(getModule(), myWorkingDirectory);
+
+    PsiFile java1 = fileTree.addTestFile("Test.java", "empty content");
+    PsiFile java2 = fileTree.addTestFile("Pair.java", "empty content");
+    PsiFile java3 = fileTree.addTestFile("Pair2.java", "empty content");
+
+    PsiFile php = fileTree.addTestFile("Test.php", "empty content");
+    PsiFile js = fileTree.addTestFile("Test.js", "empty content");
+
+    reformatDirectoryWithFileMask(myWorkingDirectory, null);
+    assertWasFormatted(java1, java2, java3, php, js);
+  }
+
+  public void testFormatByOnlyOneMask() throws IOException {
+    TestFileStructure fileTree = new TestFileStructure(getModule(), myWorkingDirectory);
+
+    PsiFile java1 = fileTree.addTestFile("Test.java", "empty content");
+    PsiFile java2 = fileTree.addTestFile("Pair.java", "empty content");
+    PsiFile java3 = fileTree.addTestFile("Pair2.java", "empty content");
+
+    PsiFile php = fileTree.addTestFile("Test.php", "empty content");
+    PsiFile js = fileTree.addTestFile("Test.js", "empty content");
+
+    reformatDirectoryWithFileMask(myWorkingDirectory, "*.java");
+    assertWasFormatted(java1, java2, java3);
+    assertWasNotFormatted(php, js);
+
+    reformatDirectoryWithFileMask(myWorkingDirectory, "*.js");
+    assertWasFormatted(js);
+    assertWasNotFormatted(java1, java2, java3, php);
+
+  }
+
+  public void testFormatByMultiMask() throws IOException {
+    TestFileStructure fileTree = new TestFileStructure(getModule(), myWorkingDirectory);
+
+    PsiFile java1 = fileTree.addTestFile("Test.java", "empty content");
+    PsiFile java2 = fileTree.addTestFile("Pair.java", "empty content");
+    PsiFile java3 = fileTree.addTestFile("Pair2.java", "empty content");
+
+    PsiFile php1 = fileTree.addTestFile("Test.php", "empty content");
+    PsiFile php2 = fileTree.addTestFile("Test2.php", "empty content");
+
+    PsiFile js1 = fileTree.addTestFile("Test1.js", "empty content");
+    PsiFile js2 = fileTree.addTestFile("Test2.js", "empty content");
+    PsiFile js3 = fileTree.addTestFile("Test3.js", "empty content");
+
+    PsiFile py1 = fileTree.addTestFile("Test1.py", "empty content");
+    PsiFile py2 = fileTree.addTestFile("Test2.py", "empty content");
+    PsiFile py3 = fileTree.addTestFile("Test3.py", "empty content");
+
+    reformatDirectoryWithFileMask(myWorkingDirectory, "*.js, *.java");
+    assertWasFormatted(js1, js2, js3, java1, java2, java3);
+    assertWasNotFormatted(php1, php2, py1, py2, py3);
+
+    reformatDirectoryWithFileMask(myWorkingDirectory, "*.php, *.js");
+    assertWasFormatted(js1, js2, js3, php1, php2);
+    assertWasNotFormatted(java1, java2, java3, py1, py2, py3);
+
+    reformatDirectoryWithFileMask(myWorkingDirectory, "*.js, *.php, *.java");
+    assertWasFormatted(js1, js2, js3, php1, php2, java1, java2, java3);
+    assertWasNotFormatted(py1, py2, py3);
+
+    reformatDirectoryWithFileMask(myWorkingDirectory, "*.js, *.php, *.java, *.py");
+    assertWasFormatted(js1, js2, js3, php1, php2, java1, java2, java3, py1, py2, py3);
+
+    reformatDirectoryWithFileMask(myWorkingDirectory, "*.jsp, *.dart");
+    assertWasNotFormatted(js1, js2, js3, php1, php2, java1, java2, java3, py1, py2, py3);
+  }
+
+  public void testDirectoryScope() throws IOException {
+    TestFileStructure fileTree = new TestFileStructure(getModule(), myWorkingDirectory);
+    PsiFile java1 = fileTree.addTestFile("Test1.java", "empty content");
+    PsiFile php1 = fileTree.addTestFile("Pair1.php", "empty content");
+    PsiFile js1 = fileTree.addTestFile("Pair1.js", "empty content");
+
+    PsiDirectory outer = fileTree.createDirectoryAndMakeItCurrent("toFormat");
+    PsiFile java2 = fileTree.addTestFile("Test2.java", "empty content");
+    PsiFile php2 = fileTree.addTestFile("Pair2.php", "empty content");
+    PsiFile js2 = fileTree.addTestFile("Pair2.js", "empty content");
+
+    PsiDirectory inner = fileTree.createDirectoryAndMakeItCurrent("toFormat");
+    PsiFile java3 = fileTree.addTestFile("Test3.java", "empty content");
+    PsiFile php3 = fileTree.addTestFile("Pair3.php", "empty content");
+    PsiFile js3 = fileTree.addTestFile("Pair3.js", "empty content");
+
+
+    reformatDirectoryWithScopeFilter(myWorkingDirectory, directoryScope(outer, true));
+    assertWasFormatted(java2, php2, js2, java3, php3, js3);
+    assertWasNotFormatted(java1, php1, js1);
+
+
+    reformatDirectoryWithScopeFilter(myWorkingDirectory, directoryScope(outer, false));
+    assertWasFormatted(java2, php2, js2);
+    assertWasNotFormatted(java1, php1, js1, java3, php3, js3);
+
+
+    reformatDirectoryWithScopeFilter(myWorkingDirectory, directoryScope(inner, true));
+    assertWasFormatted(java3, php3, js3);
+    assertWasNotFormatted(java1, php1, js1, java2, php2, js2);
+
+    reformatDirectoryWithScopeFilter(myWorkingDirectory, directoryScope(myWorkingDirectory, false).union(directoryScope(inner, false)));
+    assertWasFormatted(java3, php3, js3, java1, php1, js1);
+    assertWasNotFormatted(java2, php2, js2);
+  }
+
+  public void testDirectoryScopeWithMask() throws IOException {
+    TestFileStructure fileTree = new TestFileStructure(getModule(), myWorkingDirectory);
+    PsiFile java1 = fileTree.addTestFile("Test1.java", "empty content");
+    PsiFile php1 = fileTree.addTestFile("Pair1.php", "empty content");
+    PsiFile js1 = fileTree.addTestFile("Pair1.js", "empty content");
+
+    PsiDirectory outer = fileTree.createDirectoryAndMakeItCurrent("toFormat");
+    PsiFile java2 = fileTree.addTestFile("Test2.java", "empty content");
+    PsiFile php2 = fileTree.addTestFile("Pair2.php", "empty content");
+    PsiFile js2 = fileTree.addTestFile("Pair2.js", "empty content");
+
+    PsiDirectory inner = fileTree.createDirectoryAndMakeItCurrent("toFormat");
+    PsiFile java3 = fileTree.addTestFile("Test3.java", "empty content");
+    PsiFile php3 = fileTree.addTestFile("Pair3.php", "empty content");
+    PsiFile js3 = fileTree.addTestFile("Pair3.js", "empty content");
+
+
+    reformatDirectory(myWorkingDirectory, "*.js", directoryScope(outer, true));
+    assertWasFormatted(js2, js3);
+    assertWasNotFormatted(java1, php1, js1, java2, php2, java3, php3);
+
+    reformatDirectory(myWorkingDirectory, "*.js", directoryScope(myWorkingDirectory, false));
+    assertWasFormatted(js1);
+    assertWasNotFormatted(js2, js3, java1, php1, java2, php2, java3, php3);
+
+    reformatDirectory(myWorkingDirectory, "*.java, *.php", directoryScope(myWorkingDirectory, false).union(directoryScope(inner, false)));
+    assertWasFormatted(java1, php1, java3, php3);
+    assertWasNotFormatted(java2, php2, js1, js2, js3);
+  }
+
+  public void assertWasFormatted(PsiFile... files) {
+    final Set<PsiFile> formattedFiles = myMockCodeStyleManager.getFormattedFiles();
+    for (PsiFile file : files) {
+      assertTrue(file.getName() + "should be formatted", formattedFiles.contains(file));
+    }
+  }
+
+  public void assertWasNotFormatted(PsiFile... files) {
+    final Set<PsiFile> formattedFiles = myMockCodeStyleManager.getFormattedFiles();
+    for (PsiFile file : files) {
+      assertTrue(file.getName() + " should not be formatted", !formattedFiles.contains(file));
+    }
+  }
+
+  public void reformatDirectoryWithFileMask(@NotNull PsiDirectory directory, @Nullable String mask) {
+    reformatDirectory(directory, mask, null);
+  }
+
+  public void reformatDirectoryWithScopeFilter(@NotNull PsiDirectory directory, @Nullable SearchScope scope) {
+    reformatDirectory(directory, null, scope);
+  }
+
+  public void reformatDirectory(@NotNull PsiDirectory directory, @Nullable String mask, @Nullable SearchScope scope) {
+    myMockCodeStyleManager.clearFormattedFiles();
+
+    ReformatCodeProcessor processor = new ReformatCodeProcessor(getProject(), directory, true, false);
+    ReformatCodeAction.registerFileMaskFilter(processor, mask);
+    ReformatCodeAction.registerScopeFilter(processor, scope);
+
+    processor.run();
+  }
+}
diff --git a/platform/platform-tests/testSrc/com/intellij/codeInsight/actions/TestFileStructure.java b/platform/platform-tests/testSrc/com/intellij/codeInsight/actions/TestFileStructure.java
index 6dbe456..098acd4 100644
--- a/platform/platform-tests/testSrc/com/intellij/codeInsight/actions/TestFileStructure.java
+++ b/platform/platform-tests/testSrc/com/intellij/codeInsight/actions/TestFileStructure.java
@@ -67,11 +67,11 @@
   }
 
   @NotNull
-  public TestFileStructure createDirectoryAndMakeItCurrent(String name) throws IOException {
+  public PsiDirectory createDirectoryAndMakeItCurrent(String name) throws IOException {
     myLevel++;
     myFilesForLevel.add(new ArrayList<PsiFile>());
     myCurrentLevelDirectory = createDirectory(myProject, myCurrentLevelDirectory.getVirtualFile(), name);
-    return this;
+    return myCurrentLevelDirectory;
   }
 
   public List<PsiFile> getFilesAtLevel(int level) {
diff --git a/platform/platform-tests/testSrc/com/intellij/concurrency/JobUtilTest.java b/platform/platform-tests/testSrc/com/intellij/concurrency/JobUtilTest.java
index e1bb3f4..12fadb5 100644
--- a/platform/platform-tests/testSrc/com/intellij/concurrency/JobUtilTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/concurrency/JobUtilTest.java
@@ -76,7 +76,7 @@
     return COUNT.incrementAndGet();
   }
 
-  public void testJobUtilCorrectlySplitsUpHugeWorkAndFinishes() throws Exception {
+  public void testJobUtilCorrectlySplitsUpHugeWorkAndFinishes_Performance() throws Exception {
     COUNT.set(0);
     int N = 100000;
     List<String> list = Collections.nCopies(N, null);
@@ -110,7 +110,7 @@
     assertEquals(N, COUNT.get());
   }
 
-  public void testJobUtilProcessesAllItems() throws Exception {
+  public void testJobUtilProcessesAllItems_Performance() throws Exception {
     List<String> list = Collections.nCopies(10000, null);
     final AtomicReference<Exception> exception = new AtomicReference<Exception>();
     for (int i=0; i<10; i++) {
@@ -130,7 +130,7 @@
     }
   }
 
-  public void testJobUtilRecursive() throws Exception {
+  public void testJobUtilRecursive_Performance() throws Exception {
     final List<String> list = Collections.nCopies(100, null);
     for (int i=0; i<10; i++) {
       COUNT.set(0);
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/FoldingStressTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/FoldingStressTest.java
new file mode 100644
index 0000000..3eff928
--- /dev/null
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/FoldingStressTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.openapi.editor;
+
+import com.intellij.openapi.editor.impl.DocumentImpl;
+import com.intellij.testFramework.LightPlatformTestCase;
+import com.intellij.testFramework.PlatformTestCase;
+
+public class FoldingStressTest extends LightPlatformTestCase {
+
+  static {
+    PlatformTestCase.autodetectPlatformPrefix();
+  }
+
+  public void testStressFoldingFromZeroOffset() throws Exception {
+    for (int len = 2; len < 25; len++) {
+      stress(len);
+    }
+  }
+
+  public void testStress8() throws Exception {
+    DocumentImpl doc = new DocumentImpl("0123456789\n123456789\n23456789");
+    Editor editor = EditorFactory.getInstance().createEditor(doc);
+    try {
+      final FoldingModel model = editor.getFoldingModel();
+      model.runBatchFoldingOperation(new Runnable() {
+        @Override
+        public void run() {
+          addAndCollapseFoldRegion(model, 0, 8, "/*...*/");
+          addAndCollapseFoldRegion(model, 10, 12, "/*...*/");
+        }
+      });
+
+      assertEquals(10, editor.logicalPositionToOffset(new LogicalPosition(0, 10)));
+
+      for (int line = 0; line <= 3; line++) {
+        for (int column = 0; column <= 100; column++) {
+          LogicalPosition log = new LogicalPosition(line, column);
+          editor.logicalToVisualPosition(log);
+        }
+      }
+    }
+    finally {
+      EditorFactory.getInstance().releaseEditor(editor);
+    }
+  }
+
+  private static void stress(final int len) {
+    DocumentImpl doc = new DocumentImpl("0123456789\n123456789\n23456789");
+    Editor editor = EditorFactory.getInstance().createEditor(doc);
+    try {
+      final FoldingModel model = editor.getFoldingModel();
+      model.runBatchFoldingOperation(new Runnable() {
+        @Override
+        public void run() {
+          addAndCollapseFoldRegion(model, 0, len, "/*...*/");
+          addAndCollapseFoldRegion(model, len + 2, len + 4, "/*...*/");
+        }
+      });
+
+      for (int line = 0; line <= 3; line++) {
+        for (int column = 0; column <= 100; column++) {
+          LogicalPosition log = new LogicalPosition(line, column);
+          editor.logicalToVisualPosition(log);
+        }
+      }
+    }
+    finally {
+      EditorFactory.getInstance().releaseEditor(editor);
+    }
+  }
+
+  private static void addAndCollapseFoldRegion(FoldingModel model, int startOffset, int endOffset, String placeHolder) {
+    FoldRegion foldRegion = model.addFoldRegion(startOffset, endOffset, placeHolder);
+    assertNotNull(foldRegion);
+    foldRegion.setExpanded(false);
+  }
+
+}
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/FoldingTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/FoldingTest.java
index d9fb2c5..5864112 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/FoldingTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/FoldingTest.java
@@ -1,182 +1,153 @@
+/*
+ * 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.openapi.editor;
 
 import com.intellij.openapi.command.WriteCommandAction;
 import com.intellij.openapi.editor.ex.FoldingModelEx;
-import com.intellij.openapi.editor.impl.DocumentImpl;
-import com.intellij.openapi.util.Ref;
-import com.intellij.testFramework.LightPlatformTestCase;
+import com.intellij.openapi.editor.impl.AbstractEditorTest;
 import com.intellij.testFramework.PlatformTestCase;
-import org.jetbrains.annotations.NonNls;
+import com.intellij.testFramework.TestFileType;
+
+import static org.junit.Assert.assertArrayEquals;
 
 /**
  * @author max
  */
-public class FoldingTest extends LightPlatformTestCase {
-
+public class FoldingTest extends AbstractEditorTest {
   static {
     PlatformTestCase.autodetectPlatformPrefix();
   }
 
-  public void testStressFoldingFromZeroOffset() throws Exception {
-    for (int len = 2; len < 25; len++) {
-      stress(len);
-    }
-  }
+  private FoldingModelEx myModel;
 
-  public void testStress8() throws Exception {
-    DocumentImpl doc = new DocumentImpl("0123456789\n123456789\n23456789");
-    Editor editor = EditorFactory.getInstance().createEditor(doc);
-    try {
-      final FoldingModel model = editor.getFoldingModel();
-      model.runBatchFoldingOperation(new Runnable() {
-        @Override
-        public void run() {
-          model.addFoldRegion(0, 8, "/*...*/").setExpanded(false);
-          model.addFoldRegion(10, 12, "/*...*/").setExpanded(false);
-        }
-      });
-
-      assertEquals(10, editor.logicalPositionToOffset(new LogicalPosition(0, 10)));
-
-      for (int line = 0; line <= 3; line++) {
-        for (int column = 0; column <= 100; column++) {
-          LogicalPosition log = new LogicalPosition(line, column);
-          editor.logicalToVisualPosition(log);
-        }
-      }
-    }
-    finally {
-      EditorFactory.getInstance().releaseEditor(editor);
-    }
-  }
-
-  private static void stress(final int len) {
-    DocumentImpl doc = new DocumentImpl("0123456789\n123456789\n23456789");
-    Editor editor = EditorFactory.getInstance().createEditor(doc);
-    try {
-      final FoldingModel model = editor.getFoldingModel();
-      model.runBatchFoldingOperation(new Runnable() {
-        @Override
-        public void run() {
-          model.addFoldRegion(0, len, "/*...*/").setExpanded(false);
-          model.addFoldRegion(len + 2, len + 4, "/*...*/").setExpanded(false);
-        }
-      });
-
-      for (int line = 0; line <= 3; line++) {
-        for (int column = 0; column <= 100; column++) {
-          LogicalPosition log = new LogicalPosition(line, column);
-          editor.logicalToVisualPosition(log);
-        }
-      }
-    }
-    finally {
-      EditorFactory.getInstance().releaseEditor(editor);
-    }
+  @Override
+  public void setUp() throws Exception {
+    super.setUp();
+    init("I don't know what you mean by `glory,'\" Alice said" +
+      "Humpty Dumpty smiled contemptuously. \"Of course you don't -- till I tell you. I meant `there's a nice knock-down argument for you!'" +
+      "But glory doesn't mean `a nice knock-down argument,'\" Alice objected." +
+      "When I use a word,\" Humpty Dumpty said, in a rather scornful tone, \"it means just what I choose it to mean -- neither more nor less." +
+      "The question is,\" said Alice, \"whether you can make words mean so many different things." +
+      "The question is,\" said Humpty Dumpty, \"which is to be master -- that's all.",
+         TestFileType.TEXT);
+    myModel = (FoldingModelEx)myEditor.getFoldingModel();
   }
 
   public void testCleanupInvalidRegions() {
-    final DocumentImpl doc = new DocumentImpl("foo1\nfoo2\nfoo3\nfoo4");
-    Editor editor = EditorFactory.getInstance().createEditor(doc);
-    final FoldingModel model = editor.getFoldingModel();
-    try {
-      model.runBatchFoldingOperation(new Runnable() {
-        @Override
-        public void run() {
-          model.addFoldRegion(0, 4, "/*...*/");
-          model.addFoldRegion(5, 9, "/*...*/");
-        }
-      });
-      assertSize(2, model.getAllFoldRegions());
-      WriteCommandAction.runWriteCommandAction(getProject(), new Runnable() {
-        @Override
-        public void run() {
-          doc.deleteString(0, 5);
-        }
-      });
-      assertSize(1, model.getAllFoldRegions());
-    }
-    finally {
-      EditorFactory.getInstance().releaseEditor(editor);
-    }
+    myModel.runBatchFoldingOperation(new Runnable() {
+      @Override
+      public void run() {
+        myModel.addFoldRegion(0, 4, "/*...*/");
+        myModel.addFoldRegion(5, 9, "/*...*/");
+      }
+    });
+    assertSize(2, myModel.getAllFoldRegions());
+    WriteCommandAction.runWriteCommandAction(getProject(), new Runnable() {
+      @Override
+      public void run() {
+        myEditor.getDocument().deleteString(0, 5);
+      }
+    });
+    assertSize(1, myModel.getAllFoldRegions());
   }
 
   public void testIntersects () throws Exception {
-    @NonNls DocumentImpl doc = new DocumentImpl("I don't know what you mean by `glory,'\" Alice said" +
-     "Humpty Dumpty smiled contemptuously. \"Of course you don't -- till I tell you. I meant `there's a nice knock-down argument for you!'" +
-     "But glory doesn't mean `a nice knock-down argument,'\" Alice objected." +
-     "When I use a word,\" Humpty Dumpty said, in a rather scornful tone, \"it means just what I choose it to mean -- neither more nor less." +
-     "The question is,\" said Alice, \"whether you can make words mean so many different things." +
-     "The question is,\" said Humpty Dumpty, \"which is to be master -- that's all." );
-    Editor editor = EditorFactory.getInstance().createEditor(doc);
-    try {
-      final FoldingModel model = editor.getFoldingModel();
-
-      model.runBatchFoldingOperation(new Runnable() {
-        @Override
-        public void run() {
-          FoldRegion region = model.addFoldRegion(5, 10, ".");
-          assertNotNull(region);
-          region = model.addFoldRegion(7, 11, ".");
-          assertNull(region);
-          region = model.addFoldRegion(20, 30, ".");
-          assertNotNull(region);
-          region = model.addFoldRegion(9, 12, ".");
-          assertNull(region);
-          region = model.addFoldRegion(7, 10, ".");
-          assertNotNull(region);
-          region = model.addFoldRegion(7, 10, ".");
-          assertNull(region);
-          region = model.addFoldRegion(5, 30, ".");
-          assertNotNull(region);
-        }
-      });
-    }
-    finally {
-      EditorFactory.getInstance().releaseEditor(editor);
-    }
+    myModel.runBatchFoldingOperation(new Runnable() {
+      @Override
+      public void run() {
+        FoldRegion region = myModel.addFoldRegion(5, 10, ".");
+        assertNotNull(region);
+        region = myModel.addFoldRegion(7, 11, ".");
+        assertNull(region);
+        region = myModel.addFoldRegion(20, 30, ".");
+        assertNotNull(region);
+        region = myModel.addFoldRegion(9, 12, ".");
+        assertNull(region);
+        region = myModel.addFoldRegion(7, 10, ".");
+        assertNotNull(region);
+        region = myModel.addFoldRegion(7, 10, ".");
+        assertNull(region);
+        region = myModel.addFoldRegion(5, 30, ".");
+        assertNotNull(region);
+      }
+    });
   }
 
-  public void testDuplicateRegions() {
-    StringBuilder text = new StringBuilder();
-    for (int i = 0; i < 450; i++) {
-      text.append('a');
-    }
-    Editor editor = EditorFactory.getInstance().createEditor(new DocumentImpl(text));
+  public void testAddEmptyRegion() {
+    FoldRegion region = null;
     try {
-      final Ref<Boolean> expandedStatus = new Ref<Boolean>();
-      final int startOffset = 6;
-      final int endOffset = 16;
-      final FoldingModelEx model = (FoldingModelEx)editor.getFoldingModel();
-      model.runBatchFoldingOperation(new Runnable() {
-        @Override
-        public void run() {
-          model.addFoldRegion(2, 20, "..");
-          model.addFoldRegion(4, 18, "..");
-          FoldRegion oldRegion = model.addFoldRegion(startOffset, endOffset, "..");
-          assertNotNull(oldRegion);
-          expandedStatus.set(!oldRegion.isExpanded());
-        }
-      });
-      assertEquals(3, model.getAllFoldRegions().length);
-      
-      final Ref<FoldRegion> newRegion = new Ref<FoldRegion>();
-      model.runBatchFoldingOperation(new Runnable() {
-        @Override
-        public void run() {
-          newRegion.set(model.createFoldRegion(startOffset, endOffset, "..", null, false));
-          assertNotNull(newRegion.get());
-          newRegion.get().setExpanded(expandedStatus.get());
-          boolean additionFlag = model.addFoldRegion(newRegion.get());
-          assertTrue(additionFlag);
-        }
-      });
-      FoldRegion fetched = model.fetchOutermost(startOffset);
-      assertSame(newRegion.get(), fetched);
-      assertEquals(3, model.getAllFoldRegions().length);
+      region = myModel.addFoldRegion(5, 5, "...");
     }
-    finally {
-      EditorFactory.getInstance().releaseEditor(editor);
+    catch (AssertionError ignored) {
     }
+    assertNull(region);
+  }
+
+  public void testCollapsedRegionQueries() {
+    addCollapsedFoldRegion(5, 7, "...");
+    FoldRegion[] regions = myModel.getAllFoldRegions();
+    assertEquals(1, regions.length);
+    FoldRegion region = regions[0];
+    assertNotNull(region);
+
+    assertFalse(myModel.isOffsetCollapsed(4));
+    assertTrue(myModel.isOffsetCollapsed(5));
+    assertTrue(myModel.isOffsetCollapsed(6));
+    assertFalse(myModel.isOffsetCollapsed(7));
+    assertFalse(myModel.isOffsetCollapsed(8));
+
+    assertNull(myModel.getCollapsedRegionAtOffset(4));
+    assertSame(region, myModel.getCollapsedRegionAtOffset(5));
+    assertSame(region, myModel.getCollapsedRegionAtOffset(6));
+    assertNull(myModel.getCollapsedRegionAtOffset(7));
+    assertNull(myModel.getCollapsedRegionAtOffset(8));
+  }
+
+  public void testAdjacentRegions() {
+    addCollapsedFoldRegion(5, 7, "AA");
+    addCollapsedFoldRegion(7, 10, "BB");
+    FoldRegion[] regions = myModel.getAllFoldRegions();
+    assertEquals(2, regions.length);
+    FoldRegion region1 = regions[0];
+    assertNotNull(region1);
+    FoldRegion region2 = regions[1];
+    assertNotNull(region2);
+
+    assertFalse(myModel.isOffsetCollapsed(4));
+    assertTrue(myModel.isOffsetCollapsed(5));
+    assertTrue(myModel.isOffsetCollapsed(6));
+    assertTrue(myModel.isOffsetCollapsed(7));
+    assertTrue(myModel.isOffsetCollapsed(8));
+    assertFalse(myModel.isOffsetCollapsed(10));
+    assertFalse(myModel.isOffsetCollapsed(11));
+
+    assertNull(myModel.getCollapsedRegionAtOffset(4));
+    assertSame(region1, myModel.getCollapsedRegionAtOffset(5));
+    assertSame(region1, myModel.getCollapsedRegionAtOffset(6));
+    assertSame(region2, myModel.getCollapsedRegionAtOffset(7));
+    assertSame(region2, myModel.getCollapsedRegionAtOffset(8));
+    assertNull(myModel.getCollapsedRegionAtOffset(10));
+    assertNull(myModel.getCollapsedRegionAtOffset(11));
+  }
+
+  public void testTopLevel() {
+    FoldRegion region = addCollapsedFoldRegion(5, 15, "...");
+    addCollapsedFoldRegion(10, 12, "???");
+
+    FoldRegion[] topLevelRegions = myModel.fetchTopLevel();
+    assertArrayEquals(new FoldRegion[]{region}, topLevelRegions);
   }
 }
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/ex/util/EditorUtilTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/ex/util/EditorUtilTest.java
new file mode 100644
index 0000000..0b23924
--- /dev/null
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/ex/util/EditorUtilTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.openapi.editor.ex.util;
+
+import com.intellij.testFramework.EditorTestUtil;
+import com.intellij.testFramework.LightPlatformCodeInsightTestCase;
+
+public class EditorUtilTest extends LightPlatformCodeInsightTestCase {
+  public void testGetNotFoldedLineStartEndOffsets() throws Exception {
+    configureFromFileText(getTestName(false) + ".txt",
+                          "aaa\nbbb\nccc\nddd");
+    EditorTestUtil.addFoldRegion(myEditor, 4, 8, "...", true);
+
+    assertVisualLineRange(2, 0, 3);
+    assertVisualLineRange(4, 4, 11);
+    assertVisualLineRange(7, 4, 11);
+    assertVisualLineRange(8, 4, 11);
+    assertVisualLineRange(9, 4, 11);
+    assertVisualLineRange(13, 12, 15);
+  }
+
+  private static void assertVisualLineRange(int offset, int lineStartOffset, int lineEndOffset) {
+    assertEquals(lineStartOffset, EditorUtil.getNotFoldedLineStartOffset(myEditor, offset));
+    assertEquals(lineEndOffset, EditorUtil.getNotFoldedLineEndOffset(myEditor, offset));
+  }
+}
\ No newline at end of file
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorImplTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorImplTest.java
index f2a8e2d..5a9d4da 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorImplTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorImplTest.java
@@ -62,7 +62,7 @@
       document.insertString(document.getLineStartOffset(i), "//");
     }
 
-    verifySoftWrapPositions(58, 87);
+    verifySoftWrapPositions(58, 93);
   }
 
   private void init(String text) throws IOException {
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/CacheUpdateEventsStorageTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/CacheUpdateEventsStorageTest.java
index 1e5ad2d..425d9f5 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/CacheUpdateEventsStorageTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/CacheUpdateEventsStorageTest.java
@@ -16,6 +16,7 @@
 package com.intellij.openapi.editor.impl.softwrap.mapping;
 
 import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.ex.FoldingModelEx;
 import com.intellij.openapi.editor.impl.event.DocumentEventImpl;
 import com.intellij.util.text.CharArrayUtil;
@@ -40,6 +41,7 @@
   private CacheUpdateEventsStorage myStorage;
   private Document myDocument;
   private FoldingModelEx myFoldingModel;
+  private Editor myEditor;
   private Mockery myMockery;
   private String myText;
     
@@ -59,6 +61,7 @@
     }};
     myDocument = myMockery.mock(Document.class);
     myFoldingModel = myMockery.mock(FoldingModelEx.class);
+    myEditor = myMockery.mock(Editor.class);
     myMockery.checking(new Expectations() {{
       allowing(myDocument).getTextLength(); will(new CustomAction("getTextLength()") {
         @Override
@@ -89,6 +92,9 @@
       });
 
       allowing(myFoldingModel).getCollapsedRegionAtOffset(with(any(int.class))); will(returnValue(null));
+
+      allowing(myEditor).getDocument(); will(returnValue(myDocument));
+      allowing(myEditor).getFoldingModel(); will(returnValue(myFoldingModel));
     }});
 
     myStorage = new CacheUpdateEventsStorage();
@@ -228,6 +234,6 @@
   private void change(int offset, String newText) {
     DocumentEventImpl event 
       = new DocumentEventImpl(myDocument, offset, myText.substring(offset, offset + newText.length()), newText, 1, false);
-    myStorage.add(myDocument, new IncrementalCacheUpdateEvent(event, myFoldingModel));
+    myStorage.add(myDocument, new IncrementalCacheUpdateEvent(event, myEditor));
   }
 }
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceOnDocumentModificationTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceOnDocumentModificationTest.java
index d8d0f5d..101e30e 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceOnDocumentModificationTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceOnDocumentModificationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -1040,6 +1040,17 @@
     assertFalse(foldRegion.isExpanded());
     assertEquals(foldStart, myEditor.getCaretModel().getOffset());
   }
+
+  public void testFoldRegionEndingAtLineStart() throws IOException {
+    init(100, "aaa\nbbb\nccc\nddd");
+    addCollapsedFoldRegion(4, 8, "...");
+    addCollapsedFoldRegion(13, 15, "...");
+
+    myEditor.getDocument().insertString(10, "C");
+
+    // verify that cached layout data is intact after document change and position recalculation is done correctly
+    assertEquals(new LogicalPosition(0, 0), myEditor.visualToLogicalPosition(new VisualPosition(0, 0)));
+  }
   
   private void init(final int visibleWidthInColumns, @NotNull String fileText) throws IOException {
     init(visibleWidthInColumns, 7, fileText);
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/HeavyFileEditorManagerTestCase.java b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/HeavyFileEditorManagerTestCase.java
index 76fdce3..f494f56 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/HeavyFileEditorManagerTestCase.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/HeavyFileEditorManagerTestCase.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -49,7 +49,7 @@
 
   public void setUp() throws Exception {
     super.setUp();
-    myManager = new FileEditorManagerImpl(getProject(), DockManager.getInstance(getProject()));
+    myManager = new FileEditorManagerImpl(getProject(), DockManager.getInstance(getProject()), EditorHistoryManager.getInstance(getProject()));
     ((ComponentManagerImpl)getProject()).registerComponentInstance(FileEditorManager.class, myManager);
     ((IdeDocumentHistoryImpl)IdeDocumentHistory.getInstance(getProject())).projectOpened();
     EditorHistoryManager.getInstance(getProject()).projectOpened();
diff --git a/platform/platform-tests/testSrc/com/intellij/psi/PsiDocumentManagerImplTest.java b/platform/platform-tests/testSrc/com/intellij/psi/PsiDocumentManagerImplTest.java
index 6ccb058..718ee8e 100644
--- a/platform/platform-tests/testSrc/com/intellij/psi/PsiDocumentManagerImplTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/psi/PsiDocumentManagerImplTest.java
@@ -23,7 +23,6 @@
 import com.intellij.openapi.editor.impl.DocumentImpl;
 import com.intellij.openapi.editor.impl.event.DocumentEventImpl;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ex.ProjectManagerEx;
 import com.intellij.openapi.vfs.LocalFileSystem;
@@ -34,12 +33,12 @@
 import com.intellij.testFramework.LeakHunter;
 import com.intellij.testFramework.LightVirtualFile;
 import com.intellij.testFramework.PlatformLangTestCase;
+import com.intellij.testFramework.PlatformTestUtil;
 import com.intellij.util.Processor;
 import com.intellij.util.concurrency.Semaphore;
 import com.intellij.util.ui.UIUtil;
 
 import java.io.File;
-import java.lang.ref.Reference;
 import java.util.concurrent.atomic.AtomicInteger;
 
 public class PsiDocumentManagerImplTest extends PlatformLangTestCase {
@@ -94,11 +93,10 @@
     });
     //Class.forName("com.intellij.util.ProfilingUtil").getDeclaredMethod("forceCaptureMemorySnapshot").invoke(null);
 
-    Reference<Document> reference = vFile.getUserData(FileDocumentManagerImpl.DOCUMENT_KEY);
-    assertNotNull(reference);
     for (int i=0;i<1000;i++) {
+      PlatformTestUtil.tryGcSoftlyReachableObjects();
       UIUtil.dispatchAllInvocationEvents();
-      if (reference.get() == null) break;
+      if (documentManager.getCachedDocument(getPsiManager().findFile(vFile)) == null) break;
       System.gc();
     }
     assertNull(documentManager.getCachedDocument(getPsiManager().findFile(vFile)));
diff --git a/platform/platform-tests/testSrc/com/intellij/psi/search/GlobalSearchScopeTest.java b/platform/platform-tests/testSrc/com/intellij/psi/search/GlobalSearchScopeTest.java
new file mode 100644
index 0000000..418190f
--- /dev/null
+++ b/platform/platform-tests/testSrc/com/intellij/psi/search/GlobalSearchScopeTest.java
@@ -0,0 +1,56 @@
+/*
+ * 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.psi.search;
+
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.testFramework.PlatformTestCase;
+
+public class GlobalSearchScopeTest extends PlatformTestCase {
+  public void testUniteDirectorySearchScopeDoesNotSOE() throws Exception {
+    VirtualFile genRoot = getVirtualFile(createTempDir("genSrcRoot"));
+    VirtualFile srcRoot = getVirtualFile(createTempDir("srcRoot"));
+    VirtualFile child = srcRoot.createChildDirectory(this, "child");
+    GlobalSearchScope childScope = GlobalSearchScopesCore.directoryScope(getProject(), child, true);
+
+    GlobalSearchScope directoryScope = GlobalSearchScopesCore.directoryScope(getProject(), srcRoot, true);
+    GlobalSearchScope scope = GlobalSearchScope.EMPTY_SCOPE.uniteWith(directoryScope);
+    assertSame(scope, directoryScope);
+    scope = scope.uniteWith(directoryScope);
+    assertSame(scope, directoryScope);
+
+    scope = scope.uniteWith(childScope);
+    assertSame(scope, directoryScope);
+
+    GlobalSearchScope s = childScope;
+    int N = 1000;
+    VirtualFile[] d = new VirtualFile[N];
+    for (int i=0; i< N;i++) {
+      d[i] = srcRoot.createChildDirectory(this, "d"+i);
+      GlobalSearchScope united = s.uniteWith(GlobalSearchScopesCore.directoryScope(getProject(), d[i], true));
+      assertNotSame(s, united);
+      s = united;
+      assertTrue(s instanceof GlobalSearchScopesCore.DirectoriesScope);
+    }
+    for (VirtualFile file : d) {
+      VirtualFile f = createChildData(file, "f");
+      assertTrue(s.contains(f));
+    }
+    assertFalse(s.contains(genRoot));
+
+    assertSame(s.uniteWith(childScope), s);
+    assertSame(s.uniteWith(s), s);
+  }
+}
\ No newline at end of file
diff --git a/platform/platform-tests/testSrc/com/intellij/util/messages/MessageBusTest.java b/platform/platform-tests/testSrc/com/intellij/util/messages/MessageBusTest.java
index d0b5829..5a72ecc 100644
--- a/platform/platform-tests/testSrc/com/intellij/util/messages/MessageBusTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/util/messages/MessageBusTest.java
@@ -215,7 +215,7 @@
       new MessageBusImpl(this, childBus);
     }
 
-    PlatformTestUtil.assertTiming("Too long", 2500, new Runnable() {
+    PlatformTestUtil.assertTiming("Too long", 3000, new Runnable() {
       @Override
       public void run() {
         T1Listener publisher = myBus.syncPublisher(TOPIC1);
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/RootIndex.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/RootIndex.java
index df88338..ad3b851 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/RootIndex.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/RootIndex.java
@@ -54,6 +54,7 @@
   private final Set<VirtualFile> myProjectExcludedRoots = ContainerUtil.newHashSet();
   private final Set<VirtualFile> myModuleExcludedRoots;
   private final MultiMap<String, VirtualFile> myPackagePrefixRoots = new MultiMap<String, VirtualFile>() {
+    @NotNull
     @Override
     protected Collection<VirtualFile> createCollection() {
       return ContainerUtil.newLinkedHashSet();
@@ -68,7 +69,7 @@
   private volatile Map<VirtualFile, OrderEntry[]> myOrderEntries;
 
   // made public for Upsource
-  public RootIndex(@NotNull Project project, InfoCache cache) {
+  public RootIndex(@NotNull Project project, @NotNull InfoCache cache) {
     myProject = project;
     myInfoCache = cache;
     final RootInfo info = buildRootInfo(project);
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/libraries/LibraryImpl.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/libraries/LibraryImpl.java
index d5eab41..7a8e9ca 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/libraries/LibraryImpl.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/libraries/LibraryImpl.java
@@ -37,6 +37,7 @@
 import com.intellij.openapi.vfs.pointers.VirtualFilePointerManager;
 import com.intellij.util.ArrayUtil;
 import com.intellij.util.SmartList;
+import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.HashMap;
 import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
 import com.intellij.util.xmlb.XmlSerializer;
@@ -612,13 +613,16 @@
   }
 
   private void copyRootsFrom(LibraryImpl fromModel) {
-    myRoots.clear();
+    Map<OrderRootType, VirtualFilePointerContainer> clonedRoots = ContainerUtil.newHashMap();
     for (Map.Entry<OrderRootType, VirtualFilePointerContainer> entry : fromModel.myRoots.entrySet()) {
       OrderRootType rootType = entry.getKey();
       VirtualFilePointerContainer container = entry.getValue();
       VirtualFilePointerContainer clone = container.clone(myPointersDisposable);
-      myRoots.put(rootType, clone);
+      clonedRoots.put(rootType, clone);
     }
+    myRoots.clear();
+    myRoots.putAll(clonedRoots);
+
     VirtualFilePointerContainer excludedRoots = fromModel.myExcludedRoots;
     myExcludedRoots = excludedRoots != null ? excludedRoots.clone(myPointersDisposable) : null;
   }
diff --git a/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/CloudAgentConfigBase.java b/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/CloudAgentConfigBase.java
index 8cfa1e7..d356a4a 100644
--- a/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/CloudAgentConfigBase.java
+++ b/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/CloudAgentConfigBase.java
@@ -18,7 +18,7 @@
 /**
  * @author michael.golubev
  */
-public interface CloudAgentConfigBase extends CloudAgentConfig {
+public interface CloudAgentConfigBase extends CloudAgentConfig, CloudAgentProxyConfig {
 
   String getEmail();
 
diff --git a/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/CloudAgentProxyConfig.java b/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/CloudAgentProxyConfig.java
new file mode 100644
index 0000000..5fb07ea
--- /dev/null
+++ b/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/CloudAgentProxyConfig.java
@@ -0,0 +1,21 @@
+/*
+ * 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.remoteServer.agent.util;
+
+public interface CloudAgentProxyConfig extends CloudAgentConfig {
+
+  CloudProxySettings getProxySettings();
+}
diff --git a/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/CloudProxySettings.java b/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/CloudProxySettings.java
new file mode 100644
index 0000000..6cb353b
--- /dev/null
+++ b/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/CloudProxySettings.java
@@ -0,0 +1,31 @@
+/*
+ * 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.remoteServer.agent.util;
+
+public interface CloudProxySettings {
+
+  boolean useHttpProxy();
+
+  String getHost();
+
+  int getPort();
+
+  boolean useAuthentication();
+
+  String getLogin();
+
+  String getPassword();
+}
diff --git a/platform/remote-servers/api/src/com/intellij/remoteServer/configuration/deployment/DeploymentConfiguration.java b/platform/remote-servers/api/src/com/intellij/remoteServer/configuration/deployment/DeploymentConfiguration.java
index ff44af9..9a40d54 100644
--- a/platform/remote-servers/api/src/com/intellij/remoteServer/configuration/deployment/DeploymentConfiguration.java
+++ b/platform/remote-servers/api/src/com/intellij/remoteServer/configuration/deployment/DeploymentConfiguration.java
@@ -1,10 +1,15 @@
 package com.intellij.remoteServer.configuration.deployment;
 
+import com.intellij.execution.configurations.RuntimeConfigurationException;
 import com.intellij.openapi.components.PersistentStateComponent;
+import com.intellij.remoteServer.configuration.RemoteServer;
 
 /**
  * @author nik
  */
 public abstract class DeploymentConfiguration {
   public abstract PersistentStateComponent<?> getSerializer();
+
+  public abstract void checkConfiguration(RemoteServer<?> server, DeploymentSource deploymentSource)
+    throws RuntimeConfigurationException;
 }
diff --git a/platform/remote-servers/api/src/com/intellij/remoteServer/configuration/deployment/DeploymentConfigurationBase.java b/platform/remote-servers/api/src/com/intellij/remoteServer/configuration/deployment/DeploymentConfigurationBase.java
index 4384bcf..57ed48b 100644
--- a/platform/remote-servers/api/src/com/intellij/remoteServer/configuration/deployment/DeploymentConfigurationBase.java
+++ b/platform/remote-servers/api/src/com/intellij/remoteServer/configuration/deployment/DeploymentConfigurationBase.java
@@ -1,13 +1,16 @@
 package com.intellij.remoteServer.configuration.deployment;
 
+import com.intellij.execution.configurations.RuntimeConfigurationException;
 import com.intellij.openapi.components.PersistentStateComponent;
+import com.intellij.remoteServer.configuration.RemoteServer;
 import com.intellij.util.xmlb.XmlSerializerUtil;
 import org.jetbrains.annotations.Nullable;
 
 /**
  * @author nik
  */
-public class DeploymentConfigurationBase<Self extends DeploymentConfigurationBase> extends DeploymentConfiguration implements PersistentStateComponent<Self> {
+public class DeploymentConfigurationBase<Self extends DeploymentConfigurationBase> extends DeploymentConfiguration
+  implements PersistentStateComponent<Self> {
   @Override
   public PersistentStateComponent<?> getSerializer() {
     return this;
@@ -23,4 +26,9 @@
   public void loadState(Self state) {
     XmlSerializerUtil.copyBean(state, this);
   }
+
+  @Override
+  public void checkConfiguration(RemoteServer<?> server, DeploymentSource deploymentSource) throws RuntimeConfigurationException {
+
+  }
 }
diff --git a/platform/remote-servers/api/src/com/intellij/remoteServer/configuration/deployment/DummyDeploymentConfiguration.java b/platform/remote-servers/api/src/com/intellij/remoteServer/configuration/deployment/DummyDeploymentConfiguration.java
index a4f3f8e..a49921b 100644
--- a/platform/remote-servers/api/src/com/intellij/remoteServer/configuration/deployment/DummyDeploymentConfiguration.java
+++ b/platform/remote-servers/api/src/com/intellij/remoteServer/configuration/deployment/DummyDeploymentConfiguration.java
@@ -1,6 +1,8 @@
 package com.intellij.remoteServer.configuration.deployment;
 
+import com.intellij.execution.configurations.RuntimeConfigurationException;
 import com.intellij.openapi.components.PersistentStateComponent;
+import com.intellij.remoteServer.configuration.RemoteServer;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -21,4 +23,9 @@
   @Override
   public void loadState(DummyDeploymentConfiguration state) {
   }
+
+  @Override
+  public void checkConfiguration(RemoteServer<?> server, DeploymentSource deploymentSource) throws RuntimeConfigurationException {
+
+  }
 }
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerConfigurable.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerConfigurable.java
index 715f983..a614c4e 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerConfigurable.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/RemoteServerConfigurable.java
@@ -1,6 +1,5 @@
 package com.intellij.remoteServer.impl.configuration;
 
-import com.intellij.openapi.application.ModalityState;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.options.ConfigurationException;
 import com.intellij.openapi.options.UnnamedConfigurable;
@@ -14,8 +13,9 @@
 import com.intellij.remoteServer.runtime.ServerConnectionManager;
 import com.intellij.remoteServer.runtime.ServerConnector;
 import com.intellij.remoteServer.runtime.deployment.ServerRuntimeInstance;
+import com.intellij.remoteServer.util.CloudDataLoader;
+import com.intellij.remoteServer.util.DelayedRunner;
 import com.intellij.ui.components.JBLabel;
-import com.intellij.util.Alarm;
 import com.intellij.util.concurrency.Semaphore;
 import com.intellij.util.ui.UIUtil;
 import com.intellij.util.xmlb.XmlSerializerUtil;
@@ -34,9 +34,8 @@
 
   private static final Logger LOG = Logger.getInstance("#" + RemoteServerConfigurable.class.getName());
 
-  private static final int CHANGES_CHECK_TIME = 500;
-  private static final int CONNECTION_CHECK_TIME = 2000;
-  private static final int NO_CHANGES = -1;
+  private static final String HELP_TOPIC_ID = "reference.settings.clouds";
+
 
   private final UnnamedConfigurable myConfigurable;
   private final RemoteServer<?> myServer;
@@ -46,14 +45,17 @@
   private JPanel mySettingsPanel;
   private JBLabel myConnectionStatusLabel;
 
-  private final Alarm myAlarm;
-  private int myChangesPastTime = NO_CHANGES;
+  private final DelayedRunner myRunner;
   private ConnectionTester myConnectionTester;
 
   private final RemoteServer<?> myInnerServer;
   private boolean myInnerApplied;
   private boolean myUncheckedApply;
 
+  private boolean myConnected;
+
+  private CloudDataLoader myDataLoader = CloudDataLoader.NULL;
+
   public <C extends ServerConfiguration> RemoteServerConfigurable(RemoteServer<C> server, Runnable treeUpdater, boolean isNew) {
     super(true, treeUpdater);
     myServer = server;
@@ -67,64 +69,69 @@
 
     myConfigurable = server.getType().createConfigurable(innerConfiguration);
 
-    myAlarm = new Alarm().setActivationComponent(myMainPanel);
-    queueChangesCheck();
-  }
-
-  private void queueChangesCheck() {
-    if (myAlarm.isDisposed()) {
-      return;
-    }
-    myAlarm.addRequest(new Runnable() {
+    myConnected = false;
+    myRunner = new DelayedRunner(myMainPanel) {
 
       @Override
-      public void run() {
-        checkChanges();
-        queueChangesCheck();
+      protected boolean wasChanged() {
+        boolean modified = myConfigurable.isModified();
+        boolean result = modified || myUncheckedApply;
+        if (result) {
+          myUncheckedApply = false;
+
+          setConnectionStatus("");
+          myConnectionTester = null;
+
+          if (modified) {
+            try {
+              myConfigurable.apply();
+              myInnerApplied = true;
+            }
+            catch (ConfigurationException e) {
+              setConnectionStatus(e.getMessage());
+            }
+          }
+        }
+        return result;
       }
-    }, CHANGES_CHECK_TIME, ModalityState.any());
+
+      @Override
+      protected void run() {
+        setConnectionStatus("Connecting...");
+
+        myConnectionTester = new ConnectionTester();
+        myConnectionTester.testConnection();
+      }
+    };
   }
 
-  private void checkChanges() {
-    boolean modified = myConfigurable.isModified();
-    if (modified || myUncheckedApply) {
-      myUncheckedApply = false;
+  private void setConnectionStatus(String text) {
+    setConnectionStatus(false, text);
+  }
 
-      setConnectionStatusText("");
-      myConnectionTester = null;
+  private void setConnectionStatus(boolean connected, String text) {
+    boolean changed = myConnected != connected;
+    myConnected = connected;
+    myConnectionStatusLabel.setText(UIUtil.toHtml(text));
+    if (changed) {
+      notifyDataLoader();
+    }
+  }
 
-      if (modified) {
-        try {
-          myConfigurable.apply();
-          myInnerApplied = true;
-        }
-        catch (ConfigurationException e) {
-          LOG.debug(e);
-          return;
-        }
-      }
+  public void setDataLoader(CloudDataLoader dataLoader) {
+    myDataLoader = dataLoader;
+    notifyDataLoader();
+  }
 
-      myChangesPastTime = 0;
+  private void notifyDataLoader() {
+    if (myConnected) {
+      myDataLoader.loadCloudData();
     }
     else {
-      if (myChangesPastTime != NO_CHANGES) {
-        myChangesPastTime += CHANGES_CHECK_TIME;
-        if (myChangesPastTime >= CONNECTION_CHECK_TIME) {
-          myChangesPastTime = NO_CHANGES;
-
-          setConnectionStatusText("Connecting...");
-
-          myConnectionTester = new ConnectionTester();
-          myConnectionTester.testConnection();
-        }
-      }
+      myDataLoader.clearCloudData();
     }
   }
 
-  private void setConnectionStatusText(String text) {
-    myConnectionStatusLabel.setText(UIUtil.toHtml(text));
-  }
-
   @Override
   public RemoteServer<?> getEditableObject() {
     return myServer;
@@ -150,7 +157,7 @@
   @Nullable
   @Override
   public String getHelpTopic() {
-    return null;
+    return HELP_TOPIC_ID;
   }
 
   @Override
@@ -181,7 +188,7 @@
   @Override
   public void disposeUIResources() {
     myConfigurable.disposeUIResources();
-    Disposer.dispose(myAlarm);
+    Disposer.dispose(myRunner);
   }
 
   @Nullable
@@ -230,17 +237,13 @@
 
             @Override
             public void run() {
-              showConnectionStatus(connected, connection.getStatusText());
+              if (myConnectionTester == ConnectionTester.this) {
+                setConnectionStatus(connected, connected ? "Connection successful" : "Cannot connect: " + connection.getStatusText());
+              }
             }
           });
         }
       }.queue();
     }
-
-    private void showConnectionStatus(boolean connected, String statusText) {
-      if (myConnectionTester == this) {
-        setConnectionStatusText(connected ? "Connection successful" : "Cannot connect: " + statusText);
-      }
-    }
   }
 }
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/deployment/DeployToServerRunConfiguration.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/deployment/DeployToServerRunConfiguration.java
index d95e078..e27e18d 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/deployment/DeployToServerRunConfiguration.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/configuration/deployment/DeployToServerRunConfiguration.java
@@ -32,7 +32,10 @@
 import com.intellij.remoteServer.configuration.RemoteServer;
 import com.intellij.remoteServer.configuration.RemoteServersManager;
 import com.intellij.remoteServer.configuration.ServerConfiguration;
-import com.intellij.remoteServer.configuration.deployment.*;
+import com.intellij.remoteServer.configuration.deployment.DeploymentConfiguration;
+import com.intellij.remoteServer.configuration.deployment.DeploymentConfigurator;
+import com.intellij.remoteServer.configuration.deployment.DeploymentSource;
+import com.intellij.remoteServer.configuration.deployment.DeploymentSourceType;
 import com.intellij.remoteServer.impl.runtime.DeployToServerState;
 import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
 import com.intellij.util.xmlb.XmlSerializer;
@@ -91,7 +94,7 @@
       throw new ExecutionException("Server is not specified");
     }
 
-    RemoteServer<S> server = RemoteServersManager.getInstance().findByName(serverName, myServerType);
+    RemoteServer<S> server = findServer();
     if (server == null) {
       throw new ExecutionException("Server '" + serverName + " not found");
     }
@@ -105,6 +108,25 @@
 
   @Override
   public void checkConfiguration() throws RuntimeConfigurationException {
+    RemoteServer<S> server = findServer();
+    if (server == null) {
+      return;
+    }
+
+    if (myDeploymentSource == null) {
+      return;
+    }
+
+    myDeploymentConfiguration.checkConfiguration(server, myDeploymentSource);
+  }
+
+  private RemoteServer<S> findServer() {
+    String serverName = getServerName();
+    if (serverName == null) {
+      return null;
+    }
+
+    return RemoteServersManager.getInstance().findByName(serverName, myServerType);
   }
 
   public void setServerName(String serverName) {
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudAccountSelectionEditor.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudAccountSelectionEditor.java
index 92f4d06..7bd38b4 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudAccountSelectionEditor.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudAccountSelectionEditor.java
@@ -26,6 +26,7 @@
 import com.intellij.openapi.options.ConfigurationException;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.util.Disposer;
 import com.intellij.remoteServer.ServerType;
 import com.intellij.remoteServer.configuration.RemoteServer;
 import com.intellij.remoteServer.configuration.RemoteServersManager;
@@ -57,12 +58,18 @@
   private RemoteServer<SC> myNewServer;
   private RemoteServerConfigurable myServerConfigurable;
 
+
+  private DelayedRunner myRunner;
+
+  private CloudDataLoader myDataLoader = CloudDataLoader.NULL;
+
   public CloudAccountSelectionEditor(ST cloudType) {
     myCloudType = cloudType;
   }
 
   private void createUIComponents() {
     myServerConfigurablePanel = createServerConfigurablePanel();
+    myServerConfigurablePanel.setVisible(false);
   }
 
   public void initUI() {
@@ -78,6 +85,51 @@
       myServerComboBox.addItem(new ServerItem(server));
     }
     myServerComboBox.addItem(new ServerItem(myNewServer));
+
+    myRunner= new DelayedRunner(myMainPanel) {
+
+      private ServerItem myPreviousServerItem;
+
+      @Override
+      protected boolean wasChanged() {
+        ServerItem currentServerItem = getSelectedServerItem();
+        boolean result = myPreviousServerItem != currentServerItem;
+        if (result) {
+          myPreviousServerItem = currentServerItem;
+          myDataLoader.clearCloudData();
+        }
+        return result;
+      }
+
+      @Override
+      protected void run() {
+        if (getSelectedServerItem().isNew()) {
+          myServerConfigurable.setDataLoader(new CloudDataLoader() {
+
+            @Override
+            public void clearCloudData() {
+              if (getSelectedServerItem().isNew()) {
+                myDataLoader.clearCloudData();
+              }
+            }
+
+            @Override
+            public void loadCloudData() {
+              if (getSelectedServerItem().isNew()) {
+                myDataLoader.loadCloudData();
+              }
+            }
+          });
+        }
+        else {
+          myDataLoader.loadCloudData();
+        }
+      }
+    };
+  }
+
+  public void setDataLoader(CloudDataLoader dataLoader) {
+    myDataLoader = dataLoader;
   }
 
   private void onAccountSelectionChanged() {
@@ -197,6 +249,7 @@
   @Override
   public void dispose() {
     myServerConfigurable.disposeUIResources();
+    Disposer.dispose(myRunner);
   }
 
   private class ServerItem {
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudConfigurationBase.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudConfigurationBase.java
index 4a95bf2..8b48774 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudConfigurationBase.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudConfigurationBase.java
@@ -1,8 +1,11 @@
 package com.intellij.remoteServer.util;
 
 import com.intellij.remoteServer.agent.util.CloudAgentConfigBase;
+import com.intellij.remoteServer.agent.util.CloudProxySettings;
 import com.intellij.remoteServer.configuration.ServerConfigurationBase;
+import com.intellij.util.net.HttpConfigurable;
 import com.intellij.util.xmlb.annotations.Attribute;
+import com.intellij.util.xmlb.annotations.Transient;
 
 /**
  * @author michael.golubev
@@ -32,4 +35,42 @@
   public void setPassword(String password) {
     myPassword = password;
   }
+
+  @Transient
+  @Override
+  public CloudProxySettings getProxySettings() {
+    final HttpConfigurable httpConfigurable = HttpConfigurable.getInstance();
+    return new CloudProxySettings() {
+
+      @Override
+      public boolean useHttpProxy() {
+        return httpConfigurable.USE_HTTP_PROXY;
+      }
+
+      @Override
+      public String getHost() {
+        return httpConfigurable.PROXY_HOST;
+      }
+
+      @Override
+      public int getPort() {
+        return httpConfigurable.PROXY_PORT;
+      }
+
+      @Override
+      public boolean useAuthentication() {
+        return httpConfigurable.PROXY_AUTHENTICATION;
+      }
+
+      @Override
+      public String getLogin() {
+        return httpConfigurable.PROXY_LOGIN;
+      }
+
+      @Override
+      public String getPassword() {
+        return httpConfigurable.getPlainProxyPassword();
+      }
+    };
+  }
 }
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudDataLoader.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudDataLoader.java
new file mode 100644
index 0000000..8a0355b
--- /dev/null
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudDataLoader.java
@@ -0,0 +1,36 @@
+/*
+ * 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.remoteServer.util;
+
+public interface CloudDataLoader {
+
+  void clearCloudData();
+
+  void loadCloudData();
+
+  CloudDataLoader NULL = new CloudDataLoader() {
+
+    @Override
+    public void clearCloudData() {
+
+    }
+
+    @Override
+    public void loadCloudData() {
+
+    }
+  };
+}
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudRuntimeTask.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudRuntimeTask.java
index e377cad..6419485 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudRuntimeTask.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudRuntimeTask.java
@@ -15,14 +15,17 @@
  */
 package com.intellij.remoteServer.util;
 
+import com.intellij.openapi.Disposable;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.progress.Progressive;
 import com.intellij.openapi.progress.Task;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.util.Disposer;
 import com.intellij.remoteServer.configuration.deployment.DeploymentConfiguration;
 import com.intellij.util.concurrency.Semaphore;
+import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
@@ -47,17 +50,23 @@
   }
 
   public T performSync() {
-    return perform(true);
+    return perform(true, null);
   }
 
   public void performAsync() {
-    perform(false);
+    performAsync(null);
   }
 
-  private T perform(boolean modal) {
+  public void performAsync(Disposable disposable) {
+    perform(false, disposable);
+  }
+
+  private T perform(boolean modal, final Disposable disposable) {
     final Semaphore semaphore = new Semaphore();
     semaphore.down();
 
+    final AtomicReference<T> result = new AtomicReference<T>();
+
     final Progressive progressive = new Progressive() {
 
       @Override
@@ -65,6 +74,17 @@
         indicator.setIndeterminate(true);
         while (!indicator.isCanceled()) {
           if (semaphore.waitFor(500)) {
+            if (mySuccess.get()) {
+              UIUtil.invokeLaterIfNeeded(new Runnable() {
+
+                @Override
+                public void run() {
+                  if (disposable == null || !Disposer.isDisposed(disposable)) {
+                    postPerform(result.get());
+                  }
+                }
+              });
+            }
             break;
           }
         }
@@ -95,7 +115,6 @@
     mySuccess.set(false);
     myErrorMessage.set(null);
 
-    AtomicReference<T> result = new AtomicReference<T>();
     run(semaphore, result);
 
     task.queue();
@@ -103,6 +122,10 @@
     return result.get();
   }
 
+  protected void postPerform(T result) {
+
+  }
+
   protected boolean isCancellable(boolean modal) {
     return modal;
   }
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudSupportConfigurableBase.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudSupportConfigurableBase.java
index 0ec83c1..421e75d 100644
--- a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudSupportConfigurableBase.java
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudSupportConfigurableBase.java
@@ -18,6 +18,7 @@
 import com.intellij.remoteServer.runtime.deployment.ServerRuntimeInstance;
 import com.intellij.util.concurrency.Semaphore;
 import com.intellij.util.messages.MessageBusConnection;
+import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
@@ -32,7 +33,7 @@
   DC extends CloudDeploymentNameConfiguration,
   SR extends CloudMultiSourceServerRuntimeInstance<DC, ?, ?, ?>,
   ST extends ServerType<SC>>
-  extends FrameworkSupportConfigurable {
+  extends FrameworkSupportConfigurable implements CloudDataLoader {
 
   private final ST myCloudType;
   private final Project myModelProject;
@@ -58,8 +59,14 @@
     getAccountSelectionEditor().initUI();
   }
 
-  protected void reloadExistingApplications() {
-    Collection<Deployment> deployments = new ConnectionTask<Collection<Deployment>>("Loading existing applications list") {
+  @Override
+  public void clearCloudData() {
+    getExistingComboBox().removeAllItems();
+  }
+
+  @Override
+  public void loadCloudData() {
+    new ConnectionTask<Collection<Deployment>>("Loading existing applications list") {
 
       @Override
       protected void run(final ServerConnection<DC> connection,
@@ -75,6 +82,14 @@
               public void run() {
                 result.set(connection.getDeployments());
                 semaphore.up();
+                UIUtil.invokeLaterIfNeeded(new Runnable() {
+                  @Override
+                  public void run() {
+                    if (!Disposer.isDisposed(CloudSupportConfigurableBase.this)) {
+                      setupExistingApplications(result.get());
+                    }
+                  }
+                });
               }
             });
           }
@@ -91,12 +106,10 @@
       protected Collection<Deployment> run(SR serverRuntimeInstance) throws ServerRuntimeException {
         return null;
       }
-    }.performSync();
+    }.performAsync();
+  }
 
-    if (deployments == null) {
-      return;
-    }
-
+  private void setupExistingApplications(Collection<Deployment> deployments) {
     JComboBox existingComboBox = getExistingComboBox();
     existingComboBox.removeAllItems();
     for (Deployment deployment : deployments) {
@@ -151,6 +164,7 @@
           getNotifier().showMessage(e.getMessage(), MessageType.ERROR);
         }
       };
+      myAccountSelectionEditor.setDataLoader(this);
     }
     return myAccountSelectionEditor;
   }
diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/DelayedRunner.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/DelayedRunner.java
new file mode 100644
index 0000000..8ece5b9
--- /dev/null
+++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/DelayedRunner.java
@@ -0,0 +1,78 @@
+/*
+ * 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.remoteServer.util;
+
+import com.intellij.openapi.Disposable;
+import com.intellij.openapi.application.ModalityState;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.util.Alarm;
+
+import javax.swing.*;
+
+public abstract class DelayedRunner implements Disposable {
+
+  private static final int CHANGES_CHECK_TIME = 500;
+  private static final int RUN_DELAY_TIME = 2000;
+  private static final int NO_CHANGES = -1;
+
+  private final Alarm myAlarm;
+
+  private int myChangesPastTime = NO_CHANGES;
+
+  public DelayedRunner(JComponent activationComponent) {
+    myAlarm = new Alarm().setActivationComponent(activationComponent);
+    queueChangesCheck();
+  }
+
+  private void queueChangesCheck() {
+    if (myAlarm.isDisposed()) {
+      return;
+    }
+    myAlarm.addRequest(new Runnable() {
+
+      @Override
+      public void run() {
+        checkChanges();
+        queueChangesCheck();
+      }
+    }, CHANGES_CHECK_TIME, ModalityState.any());
+  }
+
+  private void checkChanges() {
+    if (wasChanged()) {
+      myChangesPastTime = 0;
+    }
+    else {
+      if (myChangesPastTime != NO_CHANGES) {
+        myChangesPastTime += CHANGES_CHECK_TIME;
+        if (myChangesPastTime >= RUN_DELAY_TIME) {
+          myChangesPastTime = NO_CHANGES;
+
+          run();
+        }
+      }
+    }
+  }
+
+  @Override
+  public void dispose() {
+    Disposer.dispose(myAlarm);
+  }
+
+  protected abstract boolean wasChanged();
+
+  protected abstract void run();
+}
diff --git a/platform/script-debugger/backend/src/org/jetbrains/debugger/CallFrame.java b/platform/script-debugger/backend/src/org/jetbrains/debugger/CallFrame.java
index 16a2e9b..dc38652 100755
--- a/platform/script-debugger/backend/src/org/jetbrains/debugger/CallFrame.java
+++ b/platform/script-debugger/backend/src/org/jetbrains/debugger/CallFrame.java
@@ -36,4 +36,9 @@
    */
   @NotNull
   EvaluateContext getEvaluateContext();
+
+  /**
+   @see com.intellij.xdebugger.frame.XStackFrame#getEqualityObject()
+   */
+  Object getEqualityObject();
 }
\ No newline at end of file
diff --git a/platform/script-debugger/backend/src/org/jetbrains/debugger/DebugEventAdapter.java b/platform/script-debugger/backend/src/org/jetbrains/debugger/DebugEventAdapter.java
index 8b8866f..51cf25e 100644
--- a/platform/script-debugger/backend/src/org/jetbrains/debugger/DebugEventAdapter.java
+++ b/platform/script-debugger/backend/src/org/jetbrains/debugger/DebugEventAdapter.java
@@ -40,4 +40,8 @@
   @Override
   public void navigated(String newUrl) {
   }
+
+  @Override
+  public void errorOccurred(@NotNull String errorMessage) {
+  }
 }
diff --git a/platform/script-debugger/backend/src/org/jetbrains/debugger/DebugEventListener.java b/platform/script-debugger/backend/src/org/jetbrains/debugger/DebugEventListener.java
index fcf23cf..5b73448 100755
--- a/platform/script-debugger/backend/src/org/jetbrains/debugger/DebugEventListener.java
+++ b/platform/script-debugger/backend/src/org/jetbrains/debugger/DebugEventListener.java
@@ -58,4 +58,6 @@
    * @param newUrl the new URL of the debugged target
    */
   void navigated(String newUrl);
+
+  void errorOccurred(@NotNull String errorMessage);
 }
\ No newline at end of file
diff --git a/platform/script-debugger/backend/src/org/jetbrains/debugger/sourcemap/SourceMap.java b/platform/script-debugger/backend/src/org/jetbrains/debugger/sourcemap/SourceMap.java
index 0fb0cd1..a69b3af 100644
--- a/platform/script-debugger/backend/src/org/jetbrains/debugger/sourcemap/SourceMap.java
+++ b/platform/script-debugger/backend/src/org/jetbrains/debugger/sourcemap/SourceMap.java
@@ -42,10 +42,16 @@
     return sourceResolver.canonicalizedSources;
   }
 
+  @NotNull
   public MappingList getMappings() {
     return mappings;
   }
 
+  public int getSourceLineByRawLocation(int rawLine, int rawColumn) {
+    MappingEntry entry = getMappings().get(rawLine, rawColumn);
+    return entry == null ? -1: entry.getSourceLine();
+  }
+
   public boolean processMappingsInLine(@NotNull List<Url> sourceUrls,
                                        int sourceLine,
                                        @NotNull Processor<MappingEntry> mappingProcessor,
diff --git a/platform/script-debugger/backend/src/org/jetbrains/debugger/sourcemap/SourceResolver.java b/platform/script-debugger/backend/src/org/jetbrains/debugger/sourcemap/SourceResolver.java
index 50dbe57..38693e4 100644
--- a/platform/script-debugger/backend/src/org/jetbrains/debugger/sourcemap/SourceResolver.java
+++ b/platform/script-debugger/backend/src/org/jetbrains/debugger/sourcemap/SourceResolver.java
@@ -123,11 +123,11 @@
   }
 
   public interface Resolver {
-    int resolve(@NotNull VirtualFile sourceFile, @NotNull ObjectIntHashMap<Url> map);
+    int resolve(@Nullable VirtualFile sourceFile, @NotNull ObjectIntHashMap<Url> map);
   }
 
   @Nullable
-  public MappingList findMappings(@NotNull VirtualFile sourceFile, @NotNull SourceMap sourceMap, @NotNull Resolver resolver) {
+  public MappingList findMappings(@Nullable VirtualFile sourceFile, @NotNull SourceMap sourceMap, @NotNull Resolver resolver) {
     int index = resolver.resolve(sourceFile, canonicalizedSourcesMap);
     return index < 0 ? null : sourceMap.sourceIndexToMappings[index];
   }
diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/VariableView.java b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/VariableView.java
index 6744955..5b9e671 100644
--- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/VariableView.java
+++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/VariableView.java
@@ -137,7 +137,7 @@
   @NotNull
   @Override
   public MemberFilter createMemberFilter() {
-    return context.getViewSupport().createMemberFilter(context);
+    return context.getViewSupport().createMemberFilter(this);
   }
 
   @Override
diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/CallFrameView.java b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/CallFrameView.java
index ddc9102..eb698e6 100644
--- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/CallFrameView.java
+++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/CallFrameView.java
@@ -44,7 +44,7 @@
 
   @Override
   public Object getEqualityObject() {
-    return callFrame;
+    return callFrame.getEqualityObject();
   }
 
   @Override
diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/SuspendContextImpl.java b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/SuspendContextImpl.java
index 24e0807..97c93f5 100644
--- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/SuspendContextImpl.java
+++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/SuspendContextImpl.java
@@ -34,7 +34,7 @@
     return executionStack;
   }
 
-  public AsyncResult<String> evaluateLogExpression(@NotNull String expression) {
+  public AsyncResult<String> evaluateExpression(@NotNull String expression) {
     CallFrameView frame = executionStack.getTopFrame();
     if (frame == null) {
       return new AsyncResult.Rejected<String>("Top frame is null");
diff --git a/platform/script-debugger/debugger-ui/testSrc/org/jetbrains/debugger/Content.java b/platform/script-debugger/debugger-ui/testSrc/org/jetbrains/debugger/Content.java
new file mode 100644
index 0000000..1a4c13d
--- /dev/null
+++ b/platform/script-debugger/debugger-ui/testSrc/org/jetbrains/debugger/Content.java
@@ -0,0 +1,11 @@
+package org.jetbrains.debugger;
+
+import com.intellij.util.SmartList;
+
+import java.util.List;
+
+public final class Content {
+  public final List<TestCompositeNode> topGroups = new SmartList<TestCompositeNode>();
+  public final List<TestValueNode> values = new SmartList<TestValueNode>();
+  public final List<TestCompositeNode> bottomGroups = new SmartList<TestCompositeNode>();
+}
\ No newline at end of file
diff --git a/platform/script-debugger/debugger-ui/testSrc/org/jetbrains/debugger/TestCompositeNode.java b/platform/script-debugger/debugger-ui/testSrc/org/jetbrains/debugger/TestCompositeNode.java
index 15ddfe2..8824dce 100644
--- a/platform/script-debugger/debugger-ui/testSrc/org/jetbrains/debugger/TestCompositeNode.java
+++ b/platform/script-debugger/debugger-ui/testSrc/org/jetbrains/debugger/TestCompositeNode.java
@@ -6,11 +6,10 @@
 import com.intellij.openapi.util.Conditions;
 import com.intellij.ui.SimpleTextAttributes;
 import com.intellij.util.Consumer;
-import com.intellij.util.SmartList;
-import com.intellij.xdebugger.XTestValueNode;
 import com.intellij.xdebugger.frame.*;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
+import org.jetbrains.debugger.values.ObjectValue;
 
 import javax.swing.*;
 import java.util.List;
@@ -54,7 +53,7 @@
 
   @Override
   public void tooManyChildren(int remaining) {
-    result.setDone();
+    result.setDone(children);
   }
 
   @Override
@@ -86,7 +85,7 @@
   }
 
   @NotNull
-  public AsyncResult<Content> getContent(final @NotNull Condition<XValueGroup> nestedChildrenResolveCondition) {
+  public AsyncResult<Content> loadContent(@NotNull final Condition<XValueGroup> groupContentResolveCondition, @NotNull final Condition<VariableView> valueSubContentResolveCondition) {
     assert content == null;
 
     final AsyncResult<Content> compoundResult = new AsyncResult<Content>();
@@ -96,14 +95,21 @@
       public void consume(XValueChildrenList children) {
         ActionCallback.Chunk chunk = new ActionCallback.Chunk();
         resolveGroups(children.getTopGroups(), content.topGroups, chunk);
+
         for (int i = 0; i < children.size(); i++) {
           XValue value = children.getValue(i);
-          XTestValueNode node = new XTestValueNode();
+          TestValueNode node = new TestValueNode();
           node.myName = children.getName(i);
           value.computePresentation(node, XValuePlace.TREE);
           content.values.add(node);
           chunk.add(node.getResult());
+
+          // myHasChildren could be not computed yet
+          if (value instanceof VariableView && ((VariableView)value).getValue() instanceof ObjectValue && valueSubContentResolveCondition.value((VariableView)value)) {
+            chunk.add(node.loadChildren(value));
+          }
         }
+
         resolveGroups(children.getBottomGroups(), content.bottomGroups, chunk);
 
         chunk.create().doWhenDone(new Runnable() {
@@ -117,23 +123,17 @@
       private void resolveGroups(@NotNull List<XValueGroup> valueGroups, @NotNull List<TestCompositeNode> resultNodes, @NotNull ActionCallback.Chunk chunk) {
         for (XValueGroup group : valueGroups) {
           TestCompositeNode node = new TestCompositeNode(group);
-          boolean computeChildren = nestedChildrenResolveCondition.value(group);
+          boolean computeChildren = groupContentResolveCondition.value(group);
           if (computeChildren) {
             group.computeChildren(node);
           }
           resultNodes.add(node);
           if (computeChildren) {
-            chunk.add(node.getContent(Conditions.<XValueGroup>alwaysFalse()));
+            chunk.add(node.loadContent(Conditions.<XValueGroup>alwaysFalse(), valueSubContentResolveCondition));
           }
         }
       }
     }).notifyWhenRejected(compoundResult);
     return compoundResult;
   }
-
-  public static final class Content {
-    public final List<TestCompositeNode> topGroups = new SmartList<TestCompositeNode>();
-    public final List<XTestValueNode> values = new SmartList<XTestValueNode>();
-    public final List<TestCompositeNode> bottomGroups = new SmartList<TestCompositeNode>();
-  }
 }
\ No newline at end of file
diff --git a/platform/script-debugger/debugger-ui/testSrc/org/jetbrains/debugger/TestValueNode.java b/platform/script-debugger/debugger-ui/testSrc/org/jetbrains/debugger/TestValueNode.java
new file mode 100644
index 0000000..37cbcd9
--- /dev/null
+++ b/platform/script-debugger/debugger-ui/testSrc/org/jetbrains/debugger/TestValueNode.java
@@ -0,0 +1,48 @@
+package org.jetbrains.debugger;
+
+import com.intellij.openapi.util.AsyncResult;
+import com.intellij.openapi.util.Conditions;
+import com.intellij.util.Consumer;
+import com.intellij.xdebugger.XTestValueNode;
+import com.intellij.xdebugger.frame.XValue;
+import com.intellij.xdebugger.frame.XValueGroup;
+import com.intellij.xdebugger.frame.presentation.XValuePresentation;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+
+public class TestValueNode extends XTestValueNode {
+  private final AsyncResult<XTestValueNode> result = new AsyncResult<XTestValueNode>();
+
+  private volatile Content children;
+
+  @NotNull
+  public AsyncResult<XTestValueNode> getResult() {
+    return result;
+  }
+
+  @NotNull
+  public AsyncResult<Content> loadChildren(@NotNull XValue value) {
+    TestCompositeNode childrenNode = new TestCompositeNode();
+    value.computeChildren(childrenNode);
+    return childrenNode.loadContent(Conditions.<XValueGroup>alwaysFalse(), Conditions.<VariableView>alwaysFalse()).doWhenDone(new Consumer<Content>() {
+      @Override
+      public void consume(Content content) {
+        children = content;
+      }
+    });
+  }
+
+  @Nullable
+  public Content getChildren() {
+    return children;
+  }
+
+  @Override
+  public void applyPresentation(@Nullable Icon icon, @NotNull XValuePresentation valuePresentation, boolean hasChildren) {
+    super.applyPresentation(icon, valuePresentation, hasChildren);
+
+    result.setDone(this);
+  }
+}
\ No newline at end of file
diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/SMTRunnerConsoleProperties.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/SMTRunnerConsoleProperties.java
index 977a28f..6bc2f72 100644
--- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/SMTRunnerConsoleProperties.java
+++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/SMTRunnerConsoleProperties.java
@@ -94,15 +94,15 @@
     final int stacktraceLength = stacktrace.length();
     final String[] lines = StringUtil.splitByLines(stacktrace);
     for (String line : lines) {
-      final Filter.Result result;
+      Filter.Result result;
       try {
         result = myCustomFilter.applyFilter(line, stacktraceLength);
       }
       catch (Throwable t) {
-        throw new RuntimeException("Error while applying " + myCustomFilter + " to '"+line+"'", t);
+        throw new RuntimeException("Error while applying " + myCustomFilter + " to '" + line + "'", t);
       }
-      if (result != null) {
-        final HyperlinkInfo info = result.hyperlinkInfo;
+      final HyperlinkInfo info = result != null ? result.getFirstHyperlinkInfo() : null;
+      if (info != null) {
 
         // covers 99% use existing cases
         if (info instanceof FileHyperlinkInfo) {
@@ -113,7 +113,7 @@
         return new Navigatable() {
           @Override
           public void navigate(boolean requestFocus) {
-            result.hyperlinkInfo.navigate(project);
+            info.navigate(project);
           }
 
           @Override
diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/TestProxyPrinterProvider.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/TestProxyPrinterProvider.java
index 769a522..7368321 100644
--- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/TestProxyPrinterProvider.java
+++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/TestProxyPrinterProvider.java
@@ -103,10 +103,10 @@
         throw new RuntimeException("Error while applying " + myFilter + " to '"+line+"'", t);
       }
       if (result != null) {
-        defaultPrint(line.substring(0, result.highlightStartOffset), contentType);
-        String linkText = line.substring(result.highlightStartOffset, result.highlightEndOffset);
-        printHyperlink(linkText, result.hyperlinkInfo);
-        defaultPrint(line.substring(result.highlightEndOffset), contentType);
+        defaultPrint(line.substring(0, result.getHighlightStartOffset()), contentType);
+        String linkText = line.substring(result.getHighlightStartOffset(), result.getHighlightEndOffset());
+        printHyperlink(linkText, result.getHyperlinkInfo());
+        defaultPrint(line.substring(result.getHighlightEndOffset()), contentType);
       }
       else {
         defaultPrint(line, contentType);
diff --git a/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java
index bbd5734..374af22 100644
--- a/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java
+++ b/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java
@@ -29,21 +29,23 @@
 import com.intellij.openapi.editor.highlighter.HighlighterIterator;
 import com.intellij.openapi.editor.impl.DefaultEditorTextRepresentationHelper;
 import com.intellij.openapi.editor.impl.SoftWrapModelImpl;
+import com.intellij.openapi.editor.impl.softwrap.SoftWrapDrawingType;
+import com.intellij.openapi.editor.impl.softwrap.SoftWrapPainter;
 import com.intellij.openapi.editor.impl.softwrap.mapping.SoftWrapApplianceManager;
+import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.util.TextRange;
 import com.intellij.openapi.util.registry.Registry;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.tree.IElementType;
-import org.junit.Assert;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
+import org.junit.Assert;
 
 import java.awt.*;
 import java.util.ArrayList;
 import java.util.List;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.*;
 
 /**
  * @author Maxim.Mossienko
@@ -167,6 +169,27 @@
   public static boolean configureSoftWraps(Editor editor, final int visibleWidth, final int charWidthInPixels) {
     editor.getSettings().setUseSoftWraps(true);
     SoftWrapModelImpl model = (SoftWrapModelImpl)editor.getSoftWrapModel();
+    model.setSoftWrapPainter(new SoftWrapPainter() {
+      @Override
+      public int paint(@NotNull Graphics g, @NotNull SoftWrapDrawingType drawingType, int x, int y, int lineHeight) {
+        return charWidthInPixels;
+      }
+
+      @Override
+      public int getDrawingHorizontalOffset(@NotNull Graphics g, @NotNull SoftWrapDrawingType drawingType, int x, int y, int lineHeight) {
+        return charWidthInPixels;
+      }
+
+      @Override
+      public int getMinDrawingWidth(@NotNull SoftWrapDrawingType drawingType) {
+        return charWidthInPixels;
+      }
+
+      @Override
+      public boolean canUse() {
+        return true;
+      }
+    });
     model.reinitSettings();
 
     SoftWrapApplianceManager applianceManager = model.getApplianceManager();
@@ -391,6 +414,21 @@
     Registry.get("editor.allow.multiple.carets").setValue(false);
   }
 
+  public static FoldRegion addFoldRegion(@NotNull Editor editor, final int startOffset, final int endOffset, final String placeholder, final boolean collapse) {
+    final FoldingModel foldingModel = editor.getFoldingModel();
+    final Ref<FoldRegion> ref = new Ref<FoldRegion>();
+    foldingModel.runBatchFoldingOperation(new Runnable() {
+      @Override
+      public void run() {
+        FoldRegion region = foldingModel.addFoldRegion(startOffset, endOffset, placeholder);
+        assertNotNull(region);
+        region.setExpanded(!collapse);
+        ref.set(region);
+      }
+    });
+    return ref.get();
+  }
+
   public static class CaretAndSelectionState {
     public final List<CaretInfo> carets = new ArrayList<CaretInfo>();
     @Nullable
diff --git a/platform/testFramework/src/com/intellij/testFramework/ExpectedHighlightingData.java b/platform/testFramework/src/com/intellij/testFramework/ExpectedHighlightingData.java
index 616950b..9022104 100644
--- a/platform/testFramework/src/com/intellij/testFramework/ExpectedHighlightingData.java
+++ b/platform/testFramework/src/com/intellij/testFramework/ExpectedHighlightingData.java
@@ -569,7 +569,7 @@
       i++;
     }
 
-    return Couple.newOne(i, endPos);
+    return Couple.of(i, endPos);
   }
 
   private static boolean infosContainsExpectedInfo(Collection<HighlightInfo> infos, HighlightInfo expectedInfo) {
diff --git a/platform/testFramework/src/com/intellij/testFramework/FileEditorManagerTestCase.java b/platform/testFramework/src/com/intellij/testFramework/FileEditorManagerTestCase.java
index 7a91238..3968ece 100644
--- a/platform/testFramework/src/com/intellij/testFramework/FileEditorManagerTestCase.java
+++ b/platform/testFramework/src/com/intellij/testFramework/FileEditorManagerTestCase.java
@@ -1,3 +1,18 @@
+/*
+ * 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.testFramework;
 
 import com.intellij.openapi.application.ApplicationManager;
@@ -5,6 +20,7 @@
 import com.intellij.openapi.components.impl.ComponentManagerImpl;
 import com.intellij.openapi.fileEditor.FileEditorManager;
 import com.intellij.openapi.fileEditor.ex.FileEditorProviderManager;
+import com.intellij.openapi.fileEditor.impl.EditorHistoryManager;
 import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl;
 import com.intellij.openapi.fileEditor.impl.FileEditorProviderManagerImpl;
 import com.intellij.openapi.util.JDOMUtil;
@@ -35,7 +51,7 @@
 
   public void setUp() throws Exception {
     super.setUp();
-    myManager = new FileEditorManagerImpl(getProject(), DockManager.getInstance(getProject()));
+    myManager = new FileEditorManagerImpl(getProject(), DockManager.getInstance(getProject()), EditorHistoryManager.getInstance(getProject()));
     myOldManager = ((ComponentManagerImpl)getProject()).registerComponentInstance(FileEditorManager.class, myManager);
   }
 
@@ -53,7 +69,10 @@
   }
 
   protected VirtualFile getFile(String path) {
-    return LocalFileSystem.getInstance().refreshAndFindFileByPath(getTestDataPath() + path);
+    String fullPath = getTestDataPath() + path;
+    VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByPath(fullPath);
+    assertNotNull("Can't find " + fullPath, file);
+    return file;
   }
 
   protected void openFiles(String s) throws IOException, JDOMException, InterruptedException, ExecutionException {
diff --git a/platform/testFramework/src/com/intellij/testFramework/LightLexerTestCase.java b/platform/testFramework/src/com/intellij/testFramework/LightLexerTestCase.java
deleted file mode 100644
index a729fc8..0000000
--- a/platform/testFramework/src/com/intellij/testFramework/LightLexerTestCase.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.intellij.testFramework;
-
-import com.intellij.FileSetTestCase;
-import com.intellij.lexer.Lexer;
-import com.intellij.psi.tree.IElementType;
-
-/**
- * User: Andrey.Vokin
- * Date: 4/19/12
- */
-public abstract class LightLexerTestCase extends FileSetTestCase {
-  public LightLexerTestCase(String path) {
-    super(path);
-  }
-
-  protected abstract Lexer getLexer();
-
-  @Override
-  public String transform(String testName, String[] data) throws Exception {
-    final StringBuilder output = new StringBuilder();
-    Lexer lexer = getLexer();
-    final String text = data[0].replaceAll("$(\\n+)", "");
-    lexer.start(text);
-    while (lexer.getTokenType() != null) {
-      final int s = lexer.getTokenStart();
-      final int e = lexer.getTokenEnd();
-      final IElementType tokenType = lexer.getTokenType();
-      final String str = tokenType + ": [" + s + ", " + e + "], {" + text.substring(s, e) + "}\n";
-      output.append(str);
-
-      lexer.advance();
-    }
-    return output.toString();
-  }
-}
diff --git a/platform/testFramework/src/com/intellij/testFramework/ParsingTestCase.java b/platform/testFramework/src/com/intellij/testFramework/ParsingTestCase.java
index c76c0bc..f000733 100644
--- a/platform/testFramework/src/com/intellij/testFramework/ParsingTestCase.java
+++ b/platform/testFramework/src/com/intellij/testFramework/ParsingTestCase.java
@@ -111,7 +111,7 @@
       public Document fun(CharSequence charSequence) {
         return editorFactory.createDocument(charSequence);
       }
-    }, FileDocumentManagerImpl.DOCUMENT_KEY));
+    }, FileDocumentManagerImpl.HARD_REF_TO_DOCUMENT_KEY));
     registerComponentInstance(appContainer, PsiDocumentManager.class, new MockPsiDocumentManager());
     myLanguage = myLanguage == null && myDefinitions.length > 0? myDefinitions[0].getFileNodeType().getLanguage() : myLanguage;
     registerComponentInstance(appContainer, FileTypeManager.class, new MockFileTypeManager(new MockLanguageFileType(myLanguage, myFileExt)));
diff --git a/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java
index 44d3019..9e9c944 100644
--- a/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java
+++ b/platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java
@@ -16,6 +16,8 @@
 package com.intellij.testFramework;
 
 import com.intellij.openapi.application.Result;
+import com.intellij.openapi.application.RunResult;
+import com.intellij.openapi.application.WriteAction;
 import com.intellij.openapi.command.WriteCommandAction;
 import com.intellij.openapi.module.ModifiableModuleModel;
 import com.intellij.openapi.module.Module;
@@ -30,6 +32,7 @@
 import com.intellij.openapi.roots.libraries.LibraryTable;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.vfs.*;
 import com.intellij.psi.PsiDocumentManager;
@@ -48,10 +51,7 @@
 import org.junit.Assert;
 
 import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
+import java.util.*;
 
 import static com.intellij.openapi.roots.ModuleRootModificationUtil.updateModel;
 
@@ -266,21 +266,29 @@
   }
 
   public static void addProjectLibrary(final Module module, final String libName, final VirtualFile... classesRoots) {
+    addProjectLibrary(module, libName, Arrays.asList(classesRoots), Collections.<VirtualFile>emptyList());
+  }
+
+  public static Library addProjectLibrary(final Module module, final String libName, final List<VirtualFile> classesRoots,
+                                       final List<VirtualFile> sourceRoots) {
+    final Ref<Library> result = Ref.create();
     updateModel(module, new Consumer<ModifiableRootModel>() {
       @Override
       public void consume(ModifiableRootModel model) {
-        addProjectLibrary(module, model, libName, classesRoots);
+        result.set(addProjectLibrary(module, model, libName, classesRoots, sourceRoots));
       }
     });
+    return result.get();
   }
 
-  private static void addProjectLibrary(final Module module,
-                                        final ModifiableRootModel model,
-                                        final String libName,
-                                        final VirtualFile... classesRoots) {
-    new WriteCommandAction.Simple(module.getProject()) {
+  private static Library addProjectLibrary(final Module module,
+                                           final ModifiableRootModel model,
+                                           final String libName,
+                                           final List<VirtualFile> classesRoots,
+                                           final List<VirtualFile> sourceRoots) {
+    RunResult<Library> result = new WriteAction<Library>() {
       @Override
-      protected void run() throws Throwable {
+      protected void run(@NotNull Result<Library> result) throws Throwable {
         LibraryTable libraryTable = ProjectLibraryTable.getInstance(module.getProject());
         Library library = libraryTable.createLibrary(libName);
         Library.ModifiableModel libraryModel = library.getModifiableModel();
@@ -288,6 +296,9 @@
           for (VirtualFile root : classesRoots) {
             libraryModel.addRoot(root, OrderRootType.CLASSES);
           }
+          for (VirtualFile root : sourceRoots) {
+            libraryModel.addRoot(root, OrderRootType.SOURCES);
+          }
           libraryModel.commit();
         }
         catch (Throwable t) {
@@ -302,8 +313,11 @@
         System.arraycopy(orderEntries, 0, orderEntries, 1, orderEntries.length - 1);
         orderEntries[0] = last;
         model.rearrangeOrderEntries(orderEntries);
+        result.setResult(library);
       }
-    }.execute().throwException();
+    }.execute();
+    result.throwException();
+    return result.getResultObject();
   }
 
   public static void addLibrary(final Module module,
@@ -327,7 +341,7 @@
       assert root != null : "Library root folder not found: " + path + "!/";
       classesRoots.add(root);
     }
-    addProjectLibrary(module, model, libName, VfsUtilCore.toVirtualFileArray(classesRoots));
+    addProjectLibrary(module, model, libName, classesRoots, Collections.<VirtualFile>emptyList());
   }
 
   public static void addLibrary(final Module module,
diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
index 7bc0f57..890d69b 100644
--- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
+++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
@@ -1384,16 +1384,14 @@
       @Override
       public void run() {
         try {
-          copy.setBinaryContent(loader.newFileText.getBytes(copy.getCharset()), 0, 0, null);
+          copy.setBinaryContent(loader.newFileText.getBytes(copy.getCharset()));
         }
         catch (IOException e) {
           throw new RuntimeException(e);
         }
         myFile = copy;
         myEditor = createEditor(copy);
-        assert myEditor != null : "Editor couldn't be created for file: " +
-                                  copy.getPath() +
-                                  ", use copyFileToProject(..) method for this file instead of configureByFile(..)";
+        assert myEditor != null : "editor couldn't be created for: " + copy.getPath() + ", use copyFileToProject() instead of configureByFile()";
 
         EditorTestUtil.setCaretsAndSelection(myEditor, loader.caretState);
 
diff --git a/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java b/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java
index 72df634..01a6921 100644
--- a/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java
+++ b/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java
@@ -20,6 +20,7 @@
 import com.intellij.execution.configurations.RunConfiguration;
 import com.intellij.notification.NotificationGroup;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
+import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.actionSystem.LangDataKeys;
 import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.fileEditor.OpenFileDescriptor;
@@ -36,6 +37,8 @@
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import javax.swing.*;
+import javax.swing.tree.TreePath;
 import java.awt.*;
 import java.util.List;
 
@@ -74,6 +77,17 @@
     return null;
   }
 
+  public static boolean isMultipleSelectionImpossible(DataContext dataContext) {
+    final Component component = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext);
+    if (component instanceof JTree) {
+      final TreePath[] selectionPaths = ((JTree)component).getSelectionPaths();
+      if (selectionPaths == null || selectionPaths.length <= 1) {
+        return true;
+      }
+    }
+    return false;
+  }
+  
   public static Navigatable getOpenFileDescriptor(final AbstractTestProxy testProxy, final TestFrameworkRunningModel model) {
     final TestConsoleProperties testConsoleProperties = model.getProperties();
     return getOpenFileDescriptor(testProxy, testConsoleProperties,
diff --git a/platform/testRunner/src/com/intellij/execution/testframework/autotest/AutoTestManager.java b/platform/testRunner/src/com/intellij/execution/testframework/autotest/AutoTestManager.java
index 822e9d1..fb433b2 100644
--- a/platform/testRunner/src/com/intellij/execution/testframework/autotest/AutoTestManager.java
+++ b/platform/testRunner/src/com/intellij/execution/testframework/autotest/AutoTestManager.java
@@ -91,6 +91,8 @@
     if (processHandler != null && !processHandler.isProcessTerminated()) {
       return;
     }
+    descriptor.setActivateToolWindowWhenAdded(false);
+    descriptor.setReuseToolWindowActivation(true);
     restarter.run();
   }
 
diff --git a/platform/util-rt/src/com/intellij/openapi/util/Couple.java b/platform/util-rt/src/com/intellij/openapi/util/Couple.java
index 0748227..27e782b 100644
--- a/platform/util-rt/src/com/intellij/openapi/util/Couple.java
+++ b/platform/util-rt/src/com/intellij/openapi/util/Couple.java
@@ -19,13 +19,14 @@
  * @author Konstantin Bulenkov
  */
 public class Couple<T> extends Pair<T, T> {
-  private static final Couple EMPTY_COUPLE = newOne(null, null);
+  @SuppressWarnings("unchecked")
+  private static final Couple EMPTY_COUPLE = new Couple(null, null);
 
   public Couple(T first, T second) {
     super(first, second);
   }
 
-  public static <T> Couple<T> newOne(T first, T second) {
+  public static <T> Couple<T> of(T first, T second) {
     return new Couple<T>(first, second);
   }
 
diff --git a/platform/util/src/com/intellij/execution/rmi/RemoteUtil.java b/platform/util/src/com/intellij/execution/rmi/RemoteUtil.java
index 1e6fb3f..9480a02 100644
--- a/platform/util/src/com/intellij/execution/rmi/RemoteUtil.java
+++ b/platform/util/src/com/intellij/execution/rmi/RemoteUtil.java
@@ -222,7 +222,7 @@
         return method.invoke(myRemote, args);
       }
       else {
-        Method remoteMethod = ourRemoteToLocalMap.get(Couple.newOne(myRemote.getClass(), myClazz)).get(method);
+        Method remoteMethod = ourRemoteToLocalMap.get(Couple.of(myRemote.getClass(), myClazz)).get(method);
         if (remoteMethod == null) throw new NoSuchMethodError(method.getName() + " in " + myRemote.getClass());
         return invokeRemote(method, remoteMethod, myRemote, args, myLoader, false);
       }
diff --git a/platform/util/src/com/intellij/icons/AllIcons.java b/platform/util/src/com/intellij/icons/AllIcons.java
index 99dca68..eceeda2 100644
--- a/platform/util/src/com/intellij/icons/AllIcons.java
+++ b/platform/util/src/com/intellij/icons/AllIcons.java
@@ -522,6 +522,7 @@
   
   public static class Gutter {
     public static final Icon Colors = IconLoader.getIcon("/gutter/colors.png"); // 12x12
+    public static final Icon ExtAnnotation = IconLoader.getIcon("/gutter/extAnnotation.png"); // 12x12
     public static final Icon ImplementedMethod = IconLoader.getIcon("/gutter/implementedMethod.png"); // 12x12
     public static final Icon ImplementingMethod = IconLoader.getIcon("/gutter/implementingMethod.png"); // 12x12
     public static final Icon OverridenMethod = IconLoader.getIcon("/gutter/overridenMethod.png"); // 12x12
diff --git a/platform/util/src/com/intellij/openapi/diagnostic/Logger.java b/platform/util/src/com/intellij/openapi/diagnostic/Logger.java
index 9a255cb..f3da0c2 100644
--- a/platform/util/src/com/intellij/openapi/diagnostic/Logger.java
+++ b/platform/util/src/com/intellij/openapi/diagnostic/Logger.java
@@ -18,6 +18,7 @@
 import com.intellij.util.ArrayUtil;
 import com.intellij.util.ExceptionUtil;
 import org.apache.log4j.Level;
+import org.jetbrains.annotations.Contract;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -134,6 +135,7 @@
 
   public abstract void error(@NonNls String message, @Nullable Throwable t, @NonNls @NotNull String... details);
 
+  @Contract("false,_->fail") // wrong, but avoid quite a few warnings in the code
   public boolean assertTrue(boolean value, @Nullable @NonNls Object message) {
     if (!value) {
       @NonNls String resultMessage = "Assertion failed";
@@ -141,9 +143,11 @@
       error(resultMessage, new Throwable());
     }
 
+    //noinspection Contract
     return value;
   }
 
+  @Contract("false->fail") // wrong, but avoid quite a few warnings in the code
   public boolean assertTrue(boolean value) {
     return value || assertTrue(false, null);
   }
diff --git a/platform/util/src/com/intellij/openapi/util/IconLoader.java b/platform/util/src/com/intellij/openapi/util/IconLoader.java
index 3258446..37948df 100644
--- a/platform/util/src/com/intellij/openapi/util/IconLoader.java
+++ b/platform/util/src/com/intellij/openapi/util/IconLoader.java
@@ -331,7 +331,7 @@
 
     @NotNull
     private synchronized Icon getRealIcon() {
-      if (isLoaderDisabled()) return EMPTY_ICON;
+      if (isLoaderDisabled() && (myRealIcon == null || dark != USE_DARK_ICONS)) return EMPTY_ICON;
 
       if (dark != USE_DARK_ICONS) {
         myRealIcon = null;
diff --git a/platform/util/src/com/intellij/openapi/util/io/FileAttributes.java b/platform/util/src/com/intellij/openapi/util/io/FileAttributes.java
index 910f3ad..f3b4173 100644
--- a/platform/util/src/com/intellij/openapi/util/io/FileAttributes.java
+++ b/platform/util/src/com/intellij/openapi/util/io/FileAttributes.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -35,20 +35,6 @@
   @MagicConstant(flags = {SYM_LINK, HIDDEN, READ_ONLY})
   public @interface Flags { }
 
-  /** @deprecated (to remove in IDEA 14) */ @SuppressWarnings("unused") public static final int OWNER_READ = 0400;
-  /** @deprecated (to remove in IDEA 14) */ @SuppressWarnings("unused") public static final int OWNER_WRITE = 0200;
-  /** @deprecated (to remove in IDEA 14) */ @SuppressWarnings("unused") public static final int OWNER_EXECUTE = 0100;
-  /** @deprecated (to remove in IDEA 14) */ @SuppressWarnings("unused") public static final int GROUP_READ = 0040;
-  /** @deprecated (to remove in IDEA 14) */ @SuppressWarnings("unused") public static final int GROUP_WRITE = 0020;
-  /** @deprecated (to remove in IDEA 14) */ @SuppressWarnings("unused") public static final int GROUP_EXECUTE = 0010;
-  /** @deprecated (to remove in IDEA 14) */ @SuppressWarnings("unused") public static final int OTHERS_READ = 0004;
-  /** @deprecated (to remove in IDEA 14) */ @SuppressWarnings("unused") public static final int OTHERS_WRITE = 0002;
-  /** @deprecated (to remove in IDEA 14) */ @SuppressWarnings("unused") public static final int OTHERS_EXECUTE = 0001;
-
-  /** @deprecated (to remove in IDEA 14) */
-  @SuppressWarnings("unused")
-  public @interface Permissions { }
-
   public static final FileAttributes BROKEN_SYMLINK = new FileAttributes(null, SYM_LINK, 0, 0);
 
   /**
@@ -72,27 +58,16 @@
    */
   public final long lastModified;
 
-  /** @deprecated use {@linkplain #isWritable()} (to remove in IDEA 14) */
-  @SuppressWarnings("unused") public final int permissions;
-
 
   public FileAttributes(boolean directory, boolean special, boolean symlink, boolean hidden, long length, long lastModified, boolean writable) {
     this(type(directory, special), flags(symlink, hidden, !writable), length, lastModified);
   }
 
-  /** @deprecated use {@linkplain #FileAttributes(boolean, boolean, boolean, boolean, long, long, boolean)} (to remove in IDEA 14) */
-  @SuppressWarnings("unused")
-  public FileAttributes(boolean directory, boolean special, boolean symlink, long length, long lastModified, int permissions) {
-    this(type(directory, special), flags(symlink, false, true), length, lastModified);
-  }
-
-  @SuppressWarnings("deprecation")
   private FileAttributes(@Nullable Type type, @Flags byte flags, long length, long lastModified) {
     this.type = type;
     this.flags = flags;
     this.length = length;
     this.lastModified = lastModified;
-    this.permissions = -1;
   }
 
   private static Type type(boolean isDirectory, boolean isSpecial) {
diff --git a/platform/util/src/com/intellij/openapi/util/io/FileSystemUtil.java b/platform/util/src/com/intellij/openapi/util/io/FileSystemUtil.java
index 34e90b2..d734d4b 100644
--- a/platform/util/src/com/intellij/openapi/util/io/FileSystemUtil.java
+++ b/platform/util/src/com/intellij/openapi/util/io/FileSystemUtil.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -44,8 +44,8 @@
  * @version 11.1
  */
 public class FileSystemUtil {
-  private static final String FORCE_USE_NIO2_KEY = "idea.io.use.nio2";
-  private static final String COARSE_TIMESTAMP = "idea.io.coarse.ts";
+  static final String FORCE_USE_NIO2_KEY = "idea.io.use.nio2";
+  static final String COARSE_TIMESTAMP = "idea.io.coarse.ts";
 
   private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.util.io.FileSystemUtil");
 
@@ -424,8 +424,8 @@
         return new File(path).getCanonicalPath();
       }
       catch (IOException e) {
-        final String message = e.getMessage();
-        if (message != null && message.toLowerCase().contains("too many levels of symbolic links")) {
+        String message = e.getMessage();
+        if (message != null && message.toLowerCase(Locale.US).contains("too many levels of symbolic links")) {
           LOG.debug(e);
           return null;
         }
diff --git a/platform/util/src/com/intellij/openapi/util/io/win32/IdeaWin32.java b/platform/util/src/com/intellij/openapi/util/io/win32/IdeaWin32.java
index ce0ec3d..3484d06 100644
--- a/platform/util/src/com/intellij/openapi/util/io/win32/IdeaWin32.java
+++ b/platform/util/src/com/intellij/openapi/util/io/win32/IdeaWin32.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -71,7 +71,7 @@
     path = path.replace('/', '\\');
     if (DEBUG_ENABLED) {
       long t = System.nanoTime();
-      final FileInfo result = getInfo0(path);
+      FileInfo result = getInfo0(path);
       t = (System.nanoTime() - t) / 1000;
       LOG.debug("getInfo(" + path + "): " + t + " mks");
       return result;
@@ -86,7 +86,7 @@
     path = path.replace('/', '\\');
     if (DEBUG_ENABLED) {
       long t = System.nanoTime();
-      final String result = resolveSymLink0(path);
+      String result = resolveSymLink0(path);
       t = (System.nanoTime() - t) / 1000;
       LOG.debug("resolveSymLink(" + path + "): " + t + " mks");
       return result;
@@ -103,7 +103,7 @@
       long t = System.nanoTime();
       FileInfo[] children = listChildren0(path);
       t = (System.nanoTime() - t) / 1000;
-      LOG.debug("list(" + path + "): " + children.length + " children, " + t + " mks");
+      LOG.debug("list(" + path + "): " + (children == null ? -1 : children.length) + " children, " + t + " mks");
       return children;
     }
     else {
diff --git a/platform/util/src/com/intellij/ui/mac/foundation/MacUtil.java b/platform/util/src/com/intellij/ui/mac/foundation/MacUtil.java
index 43a21f2..8ee9ee9 100644
--- a/platform/util/src/com/intellij/ui/mac/foundation/MacUtil.java
+++ b/platform/util/src/com/intellij/ui/mac/foundation/MacUtil.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -47,7 +47,7 @@
   }
 
   @Nullable
-  public static ID findWindowForTitle(final String title) {
+  public static ID findWindowForTitle(@Nullable String title) {
     if (title == null || title.isEmpty()) return null;
     final ID pool = invoke("NSAutoreleasePool", "new");
 
@@ -173,23 +173,22 @@
       catch (IllegalAccessException e) {
         LOG.debug(e);
       }
-
-    } else {
+    }
+    else {
       String foremostWindowTitle = getWindowTitle(w);
       windowId = findWindowForTitle(foremostWindowTitle);
     }
     return windowId;
   }
 
-
+  @Nullable
   public static String getWindowTitle(Window documentRoot) {
-    String windowTitle;
+    String windowTitle = null;
     if (documentRoot instanceof Frame) {
       windowTitle = ((Frame)documentRoot).getTitle();
-    } else if (documentRoot instanceof Dialog) {
+    }
+    else if (documentRoot instanceof Dialog) {
       windowTitle = ((Dialog)documentRoot).getTitle();
-    } else {
-      throw new RuntimeException("The window " + documentRoot.getClass() + " is not a frame and not a dialog!");
     }
     return windowTitle;
   }
diff --git a/platform/util/src/com/intellij/util/ArrayUtil.java b/platform/util/src/com/intellij/util/ArrayUtil.java
index 1e47adf..5de68c1 100644
--- a/platform/util/src/com/intellij/util/ArrayUtil.java
+++ b/platform/util/src/com/intellij/util/ArrayUtil.java
@@ -78,6 +78,21 @@
     System.arraycopy(array, 0, result, 0, Math.min(oldSize, newSize));
     return result;
   }
+  @NotNull
+  public static boolean[] realloc(@NotNull boolean[] array, final int newSize) {
+    if (newSize == 0) {
+      return EMPTY_BOOLEAN_ARRAY;
+    }
+
+    final int oldSize = array.length;
+    if (oldSize == newSize) {
+      return array;
+    }
+
+    boolean[] result = new boolean[newSize];
+    System.arraycopy(array, 0, result, 0, Math.min(oldSize, newSize));
+    return result;
+  }
 
   @NotNull
   public static int[] realloc(@NotNull int[] array, final int newSize) {
@@ -131,6 +146,12 @@
     array[array.length - 1] = value;
     return array;
   }
+  @NotNull
+  public static boolean[] append(@NotNull boolean[] array, boolean value) {
+    array = realloc(array, array.length + 1);
+    array[array.length - 1] = value;
+    return array;
+  }
 
   @NotNull
   public static char[] realloc(@NotNull char[] array, final int newSize) {
diff --git a/platform/util/src/com/intellij/util/containers/ConcurrentMultiMap.java b/platform/util/src/com/intellij/util/containers/ConcurrentMultiMap.java
index 23f3743..9ebd04c 100644
--- a/platform/util/src/com/intellij/util/containers/ConcurrentMultiMap.java
+++ b/platform/util/src/com/intellij/util/containers/ConcurrentMultiMap.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.
@@ -16,6 +16,8 @@
 
 package com.intellij.util.containers;
 
+import org.jetbrains.annotations.NotNull;
+
 import java.util.Collection;
 import java.util.Map;
 
@@ -23,11 +25,13 @@
  * @author peter
  */
 public class ConcurrentMultiMap<K,V> extends MultiMap<K,V> {
+  @NotNull
   @Override
   protected Map<K, Collection<V>> createMap() {
     return ContainerUtil.newConcurrentMap();
   }
 
+  @NotNull
   @Override
   protected Collection<V> createCollection() {
     return ContainerUtil.createLockFreeCopyOnWriteList();
diff --git a/platform/util/src/com/intellij/util/containers/ContainerUtil.java b/platform/util/src/com/intellij/util/containers/ContainerUtil.java
index f08c405..7a1b1f8 100644
--- a/platform/util/src/com/intellij/util/containers/ContainerUtil.java
+++ b/platform/util/src/com/intellij/util/containers/ContainerUtil.java
@@ -459,7 +459,7 @@
       V v1 = map1.get(k);
       V v2 = map2.get(k);
       if (!(v1 == v2 || v1 != null && v1.equals(v2))) {
-        res.put(k, Couple.newOne(v1, v2));
+        res.put(k, Couple.of(v1, v2));
       }
     }
     return res;
diff --git a/platform/util/src/com/intellij/util/containers/LinkedMultiMap.java b/platform/util/src/com/intellij/util/containers/LinkedMultiMap.java
index 8fce1e5..9c780bc 100644
--- a/platform/util/src/com/intellij/util/containers/LinkedMultiMap.java
+++ b/platform/util/src/com/intellij/util/containers/LinkedMultiMap.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.
@@ -17,6 +17,7 @@
 package com.intellij.util.containers;
 
 import com.intellij.util.containers.hash.LinkedHashMap;
+import org.jetbrains.annotations.NotNull;
 
 import java.util.Collection;
 import java.util.Map;
@@ -25,11 +26,13 @@
  * @author Evgeny Gerashchenko
  */
 public class LinkedMultiMap<K, V> extends MultiMap<K, V> {
+    @NotNull
     @Override
     protected Map<K, Collection<V>> createMap() {
         return new LinkedHashMap<K, Collection<V>>();
     }
 
+    @NotNull
     @Override
     protected Map<K, Collection<V>> createMap(int initialCapacity, float loadFactor) {
         return new LinkedHashMap<K, Collection<V>>(initialCapacity, loadFactor);
diff --git a/platform/util/src/com/intellij/util/containers/MultiMap.java b/platform/util/src/com/intellij/util/containers/MultiMap.java
index c7471c3..bd0906e 100644
--- a/platform/util/src/com/intellij/util/containers/MultiMap.java
+++ b/platform/util/src/com/intellij/util/containers/MultiMap.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.
@@ -42,7 +42,7 @@
     myMap = createMap();
   }
 
-  public MultiMap(MultiMap<? extends K, ? extends V> toCopy) {
+  public MultiMap(@NotNull MultiMap<? extends K, ? extends V> toCopy) {
     this();
     putAllValues(toCopy);
   }
@@ -51,29 +51,33 @@
     myMap = createMap(i, v);
   }
 
+  @NotNull
   protected Map<K, Collection<V>> createMap() {
     return new HashMap<K, Collection<V>>();
   }
 
+  @NotNull
   protected Map<K, Collection<V>>  createMap(int initialCapacity, float loadFactor) {
     return new HashMap<K, Collection<V>>(initialCapacity, loadFactor);
   }
 
+  @NotNull
   protected Collection<V> createCollection() {
     return new ArrayList<V>();
   }
 
+  @NotNull
   protected Collection<V> createEmptyCollection() {
     return Collections.emptyList();
   }
 
-  public <Kk extends K, Vv extends V> void putAllValues(MultiMap<Kk, Vv> from) {
+  public <Kk extends K, Vv extends V> void putAllValues(@NotNull MultiMap<Kk, Vv> from) {
     for (Map.Entry<Kk, Collection<Vv>> entry : from.entrySet()) {
       putValues(entry.getKey(), entry.getValue());
     }
   }
 
-  public void putValues(K key, Collection<? extends V> values) {
+  public void putValues(K key, @NotNull Collection<? extends V> values) {
     Collection<V> list = myMap.get(key);
     if (list == null) {
       list = createCollection();
@@ -91,6 +95,7 @@
     list.add(value);
   }
 
+  @NotNull
   public Set<Map.Entry<K, Collection<V>>> entrySet() {
     return myMap.entrySet();
   }
@@ -134,6 +139,7 @@
     return collection;
   }
 
+  @NotNull
   public Set<K> keySet() {
     return myMap.keySet();
   }
@@ -142,7 +148,7 @@
     return myMap.size();
   }
 
-  public void put(final K key, final Collection<V> values) {
+  public void put(final K key, Collection<V> values) {
     myMap.put(key, values);
   }
 
@@ -165,6 +171,7 @@
     return false;
   }
 
+  @NotNull
   public Collection<? extends V> values() {
     if (values == null) {
       values = new AbstractCollection<V>() {
@@ -249,11 +256,13 @@
   @NotNull
   public static <K, V> MultiMap<K, V> create(@NotNull final TObjectHashingStrategy<K> strategy) {
     return new MultiMap<K, V>() {
+      @NotNull
       @Override
       protected Map<K, Collection<V>> createMap() {
         return new THashMap<K, Collection<V>>(strategy);
       }
 
+      @NotNull
       @Override
       protected Collection<V> createCollection() {
         return new SmartList<V>();
@@ -269,11 +278,13 @@
   @NotNull
   public static <K, V> MultiMap<K, V> createSmartList() {
     return new MultiMap<K, V>() {
+      @NotNull
       @Override
       protected Collection<V> createCollection() {
         return new SmartList<V>();
       }
 
+      @NotNull
       @Override
       protected Map<K, Collection<V>> createMap() {
         return new THashMap<K, Collection<V>>();
@@ -284,16 +295,19 @@
   @NotNull
   public static <K, V> MultiMap<K, V> createSet() {
     return new MultiMap<K, V>() {
+      @NotNull
       @Override
       protected Collection<V> createCollection() {
         return new SmartHashSet<V>();
       }
 
+      @NotNull
       @Override
       protected Collection<V> createEmptyCollection() {
         return Collections.emptySet();
       }
 
+      @NotNull
       @Override
       protected Map<K, Collection<V>> createMap() {
         return new THashMap<K, Collection<V>>();
@@ -324,6 +338,7 @@
   }
 
   private static class EmptyMap extends MultiMap {
+    @NotNull
     @Override
     protected Map createMap() {
       return Collections.emptyMap();
diff --git a/platform/util/src/com/intellij/util/containers/MultiMapBasedOnSet.java b/platform/util/src/com/intellij/util/containers/MultiMapBasedOnSet.java
index 0fefb79..54c3efd 100644
--- a/platform/util/src/com/intellij/util/containers/MultiMapBasedOnSet.java
+++ b/platform/util/src/com/intellij/util/containers/MultiMapBasedOnSet.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -28,11 +28,13 @@
  */
 public class MultiMapBasedOnSet<K, V> extends MultiMap<K, V> {
 
+  @NotNull
   @Override
   protected Collection<V> createCollection() {
     return new HashSet<V>();
   }
 
+  @NotNull
   @Override
   protected Collection<V> createEmptyCollection() {
     return Collections.emptySet();
diff --git a/platform/util/src/com/intellij/util/containers/RecentStringInterner.java b/platform/util/src/com/intellij/util/containers/RecentStringInterner.java
index cb73a3f..e46e1b9 100644
--- a/platform/util/src/com/intellij/util/containers/RecentStringInterner.java
+++ b/platform/util/src/com/intellij/util/containers/RecentStringInterner.java
@@ -82,9 +82,13 @@
 
   public void clear() {
     for(int i = 0; i < myInterns.length; ++i) {
-      myStripeLocks[i].lock();
-      myInterns[i].clear();
-      myStripeLocks[i].unlock();
+      try {
+        myStripeLocks[i].lock();
+        myInterns[i].clear();
+      }
+      finally {
+        myStripeLocks[i].unlock();
+      }
     }
   }
 }
diff --git a/platform/util/src/com/intellij/util/graph/DFSTBuilder.java b/platform/util/src/com/intellij/util/graph/DFSTBuilder.java
index 30b7f6b..b6b6ae0 100644
--- a/platform/util/src/com/intellij/util/graph/DFSTBuilder.java
+++ b/platform/util/src/com/intellij/util/graph/DFSTBuilder.java
@@ -99,7 +99,7 @@
           Node prev = it.next();
           Integer prevNumber = myNodeToNNumber.get(prev);
           if (prevNumber != null && prevNumber.intValue() > nNumber) {
-            myBackEdge = Couple.newOne(node, prev);
+            myBackEdge = Couple.of(node, prev);
             break;
           }
         }
diff --git a/platform/util/src/com/intellij/util/io/URLUtil.java b/platform/util/src/com/intellij/util/io/URLUtil.java
index 88c482c..1a6e633 100644
--- a/platform/util/src/com/intellij/util/io/URLUtil.java
+++ b/platform/util/src/com/intellij/util/io/URLUtil.java
@@ -15,7 +15,7 @@
  */
 package com.intellij.util.io;
 
-import com.intellij.openapi.util.Couple;
+import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.CharsetToolkit;
@@ -88,7 +88,7 @@
 
   @NotNull
   private static InputStream openJarStream(@NotNull URL url) throws IOException {
-    Couple<String> paths = splitJarUrl(url.getFile());
+    Pair<String, String> paths = splitJarUrl(url.getFile());
     if (paths == null) {
       throw new MalformedURLException(url.getFile());
     }
@@ -116,7 +116,7 @@
    * E.g. "jar:file:///path/to/jar.jar!/resource.xml" is converted into ["/path/to/jar.jar", "resource.xml"].
    */
   @Nullable
-  public static Couple<String> splitJarUrl(@NotNull String url) {
+  public static Pair<String, String> splitJarUrl(@NotNull String url) {
     int pivot = url.indexOf(JAR_SEPARATOR);
     if (pivot < 0) return null;
 
@@ -137,7 +137,7 @@
       }
     }
 
-    return Couple.newOne(jarPath, resourcePath);
+    return Pair.create(jarPath, resourcePath);
   }
 
   @NotNull
diff --git a/platform/util/src/com/intellij/util/ui/Centerizer.java b/platform/util/src/com/intellij/util/ui/Centerizer.java
index 79b811b..aaabe13 100644
--- a/platform/util/src/com/intellij/util/ui/Centerizer.java
+++ b/platform/util/src/com/intellij/util/ui/Centerizer.java
@@ -55,10 +55,10 @@
 
   private static Couple<Integer> getFit(int compSize, int containerSize) {
     if (compSize >= containerSize) {
-      return Couple.newOne(0, compSize);
+      return Couple.of(0, compSize);
     } else {
       final int position = containerSize / 2 - compSize / 2;
-      return Couple.newOne(position, compSize);
+      return Couple.of(position, compSize);
     }
   }
 
diff --git a/platform/util/src/com/intellij/util/xmlb/BeanBinding.java b/platform/util/src/com/intellij/util/xmlb/BeanBinding.java
index 26c0c1a..d9db488 100644
--- a/platform/util/src/com/intellij/util/xmlb/BeanBinding.java
+++ b/platform/util/src/com/intellij/util/xmlb/BeanBinding.java
@@ -229,7 +229,7 @@
       Couple<Method> candidate = candidates.get(propertyData.first);
       if (candidate == null) candidate = Couple.getEmpty();
       if ((propertyData.second ? candidate.second : candidate.first) != null) continue;
-      candidate = Couple.newOne(propertyData.second ? candidate.first : method, propertyData.second ? method : candidate.second);
+      candidate = Couple.of(propertyData.second ? candidate.first : method, propertyData.second ? method : candidate.second);
       candidates.put(propertyData.first, candidate);
     }
     for (Map.Entry<String, Couple<Method>> candidate: candidates.entrySet()) {
diff --git a/platform/util/testSrc/com/intellij/openapi/util/io/FileAttributesNio2ReadingTest.java b/platform/util/testSrc/com/intellij/openapi/util/io/FileAttributesNio2ReadingTest.java
index 6d00daf..b750f89 100644
--- a/platform/util/testSrc/com/intellij/openapi/util/io/FileAttributesNio2ReadingTest.java
+++ b/platform/util/testSrc/com/intellij/openapi/util/io/FileAttributesNio2ReadingTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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,36 +19,22 @@
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 
-import java.lang.reflect.Field;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assume.assumeTrue;
 
 public class FileAttributesNio2ReadingTest extends FileAttributesReadingTest {
-  private static final String FORCE_USE_NIO_2_KEY;
-  static {
-    try {
-      Field field = FileSystemUtil.class.getDeclaredField("FORCE_USE_NIO2_KEY");
-      field.setAccessible(true);
-      FORCE_USE_NIO_2_KEY = (String)field.get(null);
-    }
-    catch (Exception e) {
-      throw new AssertionError("Please keep constants in sync: " + e.getMessage());
-    }
-  }
-
   @BeforeClass
   public static void setUpClass() throws Exception {
     assumeTrue(SystemInfo.isJavaVersionAtLeast("1.7"));
 
-    System.setProperty(FORCE_USE_NIO_2_KEY, "true");
+    System.setProperty(FileSystemUtil.FORCE_USE_NIO2_KEY, "true");
     FileSystemUtil.resetMediator();
     assertEquals("Nio2", FileSystemUtil.getMediatorName());
   }
 
   @AfterClass
   public static void tearDownClass() throws Exception {
-    System.setProperty(FORCE_USE_NIO_2_KEY, "");
+    System.clearProperty(FileSystemUtil.FORCE_USE_NIO2_KEY);
     FileSystemUtil.resetMediator();
   }
 }
diff --git a/platform/util/testSrc/com/intellij/util/containers/ConcurrentBitSetTest.java b/platform/util/testSrc/com/intellij/util/containers/ConcurrentBitSetTest.java
index a7e315a..6dd5329 100644
--- a/platform/util/testSrc/com/intellij/util/containers/ConcurrentBitSetTest.java
+++ b/platform/util/testSrc/com/intellij/util/containers/ConcurrentBitSetTest.java
@@ -95,7 +95,7 @@
 
     assertEquals(-1, bitSet.nextSetBit(0));
   }
-  public void testStress2() throws InterruptedException {
+  public void testStress2_Performance() throws InterruptedException {
     final ConcurrentBitSet bitSet = new ConcurrentBitSet();
     int N = 10;
     final int L = 1000000;
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcsHelper.java b/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcsHelper.java
index f7a2a68..eb51a12 100644
--- a/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcsHelper.java
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcsHelper.java
@@ -144,10 +144,10 @@
   }
 
   public abstract void showFileHistory(VcsHistoryProvider vcsHistoryProvider, FilePath path, final AbstractVcs vcs,
-                                       final RepositoryLocation repositoryLocation);
+                                       final String repositoryPath);
 
   public abstract void showFileHistory(VcsHistoryProvider vcsHistoryProvider, AnnotationProvider annotationProvider, FilePath path,
-                                       final RepositoryLocation repositoryLocation, final AbstractVcs vcs);
+                                       final String repositoryPath, final AbstractVcs vcs);
 
   /**
    * Shows the "Rollback Changes" dialog with the specified list of changes.
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/RequestsMerger.java b/platform/vcs-api/src/com/intellij/openapi/vcs/RequestsMerger.java
index a484989..44c5d5d 100644
--- a/platform/vcs-api/src/com/intellij/openapi/vcs/RequestsMerger.java
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/RequestsMerger.java
@@ -226,12 +226,12 @@
     }
 
     private static void add(final MyState from, final MyState to, final MyExitAction... action) {
-      myMap.put(Couple.newOne(from, to), action);
+      myMap.put(Couple.of(from, to), action);
     }
 
     @Nullable
     public static MyExitAction[] getExit(final MyState from, final MyState to) {
-      return myMap.get(Couple.newOne(from, to));
+      return myMap.get(Couple.of(from, to));
     }
   }
 
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAnnotationCachedProxy.java b/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAnnotationCachedProxy.java
index 65acd62..ccfa155 100644
--- a/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAnnotationCachedProxy.java
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAnnotationCachedProxy.java
@@ -21,7 +21,6 @@
 import com.intellij.openapi.util.ThrowableComputable;
 import com.intellij.openapi.vcs.AbstractVcs;
 import com.intellij.openapi.vcs.FilePath;
-import com.intellij.openapi.vcs.RepositoryLocation;
 import com.intellij.openapi.vcs.VcsException;
 import com.intellij.openapi.vcs.actions.VcsContextFactory;
 import com.intellij.openapi.vcs.annotate.AnnotationProvider;
@@ -200,12 +199,6 @@
         public void beforeRefresh() {
         }
 
-        @Nullable
-        @Override
-        public RepositoryLocation getRepositoryLocation() {
-          return null;
-        }
-
         @Override
         public void forceRefresh() {
         }
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAppendableHistoryPartnerAdapter.java b/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAppendableHistoryPartnerAdapter.java
index 1e795dd..5150875 100644
--- a/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAppendableHistoryPartnerAdapter.java
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAppendableHistoryPartnerAdapter.java
@@ -15,9 +15,7 @@
  */
 package com.intellij.openapi.vcs.history;
 
-import com.intellij.openapi.vcs.RepositoryLocation;
 import com.intellij.openapi.vcs.VcsException;
-import org.jetbrains.annotations.Nullable;
 
 /**
  * @author irengrig
@@ -55,12 +53,6 @@
   public void beforeRefresh() {
   }
 
-  @Nullable
-  @Override
-  public RepositoryLocation getRepositoryLocation() {
-    return null;
-  }
-
   public void check() throws VcsException {
     if (myException != null) throw myException;
   }
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAppendableHistorySessionPartner.java b/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAppendableHistorySessionPartner.java
index e60917c..f97cbc3 100644
--- a/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAppendableHistorySessionPartner.java
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/history/VcsAppendableHistorySessionPartner.java
@@ -15,9 +15,7 @@
  */
 package com.intellij.openapi.vcs.history;
 
-import com.intellij.openapi.vcs.RepositoryLocation;
 import com.intellij.openapi.vcs.VcsException;
-import org.jetbrains.annotations.Nullable;
 
 public interface VcsAppendableHistorySessionPartner {
   void reportCreatedEmptySession(VcsAbstractHistorySession session);
@@ -26,7 +24,4 @@
   void finished();
   void forceRefresh();
   void beforeRefresh();
-
-  @Nullable
-  RepositoryLocation getRepositoryLocation();
 }
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/CommonCheckinFilesAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/CommonCheckinFilesAction.java
index fd3114c..89d1f56 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/CommonCheckinFilesAction.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/actions/CommonCheckinFilesAction.java
@@ -15,21 +15,18 @@
  */
 package com.intellij.openapi.vcs.actions;
 
-import com.intellij.lifecycle.PeriodicalTasksCloser;
-import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.ContentIterator;
-import com.intellij.openapi.roots.FileIndexFacade;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.vcs.*;
 import com.intellij.openapi.vcs.changes.Change;
 import com.intellij.openapi.vcs.changes.ChangeListManager;
 import com.intellij.openapi.vcs.changes.LocalChangeList;
 import com.intellij.openapi.vcs.checkin.CheckinEnvironment;
-import com.intellij.openapi.vfs.VfsUtilCore;
 import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.VirtualFileFilter;
+import com.intellij.util.containers.HashSet;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
 
 public class CommonCheckinFilesAction extends AbstractCommonCheckinAction {
   protected String getActionName(final VcsContext dataContext) {
@@ -67,44 +64,30 @@
   @Override
   protected LocalChangeList getInitiallySelectedChangeList(final VcsContext context, final Project project) {
     final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
+    LocalChangeList defaultChangeList = changeListManager.getDefaultChangeList();
 
     final FilePath[] roots = getRoots(context);
-    for(final FilePath root: roots) {
+    LocalChangeList changeList = null;
+    for (final FilePath root : roots) {
       final VirtualFile file = root.getVirtualFile();
       if (file == null) continue;
-      final Ref<Change> change = new Ref<Change>();
-      if (!file.isDirectory()) {
-        change.set(changeListManager.getChange(file));
+      Collection<LocalChangeList> lists = getChangeListsForRoot(changeListManager, root);
+      if (lists.contains(defaultChangeList)) {
+        return defaultChangeList;
       }
-      else {
-        final FileIndexFacade index = PeriodicalTasksCloser.getInstance().safeGetService(project, FileIndexFacade.class);
-        final VirtualFileFilter filter = new VirtualFileFilter() {
-          public boolean accept(final VirtualFile file) {
-            return ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
-              @Override
-              public Boolean compute() {
-                return (! index.isExcludedFile(file));
-              }
-            });
-          }
-        };
-        VfsUtilCore.iterateChildrenRecursively(file, filter, new ContentIterator() {
-          public boolean processFile(final VirtualFile fileOrDir) {
-            final Change c = changeListManager.getChange(fileOrDir);
-            if (c != null) {
-              change.set(c);
-              return false;
-            }
-            return true;
-          }
-        });
-      }
-      if (!change.isNull()) {
-        return changeListManager.getChangeList(change.get());
-      }
+      Iterator<LocalChangeList> it = lists.iterator();
+      changeList = it.hasNext() ? it.next() : null;
     }
+    return changeList == null ? defaultChangeList : changeList;
+  }
 
-    return changeListManager.getDefaultChangeList();
+  private static Collection<LocalChangeList> getChangeListsForRoot(ChangeListManager changeListManager, final FilePath dirPath) {
+    Collection<Change> changes = changeListManager.getChangesIn(dirPath);
+    Set<LocalChangeList> changeLists = new HashSet<LocalChangeList>();
+    for (Change change : changes) {
+      changeLists.add(changeListManager.getChangeList(change));
+    }
+    return changeLists;
   }
 
   private String getCheckinActionName(final VcsContext dataContext) {
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java
index 125ac77..b9f0855 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java
@@ -788,7 +788,7 @@
   Couple<Integer> getUnversionedFilesSize() {
     synchronized (myDataLock) {
       final VirtualFileHolder holder = myComposite.getVFHolder(FileHolder.HolderType.UNVERSIONED);
-      return Couple.newOne(holder.getSize(), holder.getNumDirs());
+      return Couple.of(holder.getSize(), holder.getNumDirs());
     }
   }
 
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java
index 11a2fd3..63ed9d4 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java
@@ -107,6 +107,7 @@
 
   private void checkForMultipleCopiesNotMove(boolean somethingChanged) {
     final MultiMap<FilePath, Pair<Change, String>> moves = new MultiMap<FilePath, Pair<Change, String>>() {
+      @NotNull
       protected Collection<Pair<Change, String>> createCollection() {
         return new LinkedList<Pair<Change, String>>();
       }
@@ -565,7 +566,7 @@
       final String beforeKey = beforePath == null ? null : beforePath.getIOFile().getAbsolutePath();
       final FilePath afterPath = ChangesUtil.getAfterPath(change);
       final String afterKey = afterPath == null ? null : afterPath.getIOFile().getAbsolutePath();
-      return Couple.newOne(beforeKey, afterKey);
+      return Couple.of(beforeKey, afterKey);
     }
 
     private void preparation() {
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeVfsListener.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeVfsListener.java
index 3fc10a3..524c957 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeVfsListener.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeVfsListener.java
@@ -216,7 +216,7 @@
       for (VcsDirtyScopeManager manager : managers) {
         Couple<HashSet<FilePath>> filesAndDirs = map.get(manager);
         if (filesAndDirs == null) {
-          filesAndDirs = Couple.newOne(new HashSet<FilePath>(), new HashSet<FilePath>());
+          filesAndDirs = Couple.of(new HashSet<FilePath>(), new HashSet<FilePath>());
           map.put(manager, filesAndDirs);
         }
 
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/RepositoryLocationCache.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/RepositoryLocationCache.java
index c94fbab..0b03c5b 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/RepositoryLocationCache.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/RepositoryLocationCache.java
@@ -46,7 +46,7 @@
   }
 
   public RepositoryLocation getLocation(final AbstractVcs vcs, final FilePath filePath, final boolean silent) {
-    final Couple<String> key = Couple.newOne(vcs.getName(), filePath.getIOFile().getAbsolutePath());
+    final Couple<String> key = Couple.of(vcs.getName(), filePath.getIOFile().getAbsolutePath());
     RepositoryLocation location = myMap.get(key);
     if (location != null) {
       return location;
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/dbCommitted/KnownRepositoryLocations.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/dbCommitted/KnownRepositoryLocations.java
index eb56d14..161f83e 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/dbCommitted/KnownRepositoryLocations.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/dbCommitted/KnownRepositoryLocations.java
@@ -106,7 +106,7 @@
 
   public long getLocationId(final String key, final String path) {
     synchronized (myMap) {
-      final Long id = myLocations.get(Couple.newOne(key, path));
+      final Long id = myLocations.get(Couple.of(key, path));
       assert  id != null;
       return id;
     }
@@ -115,7 +115,7 @@
   public void add(final String key, final String path, final long id) {
     synchronized (myMap) {
       myMap.putValue(key, path);
-      myLocations.put(Couple.newOne(key, path), id);
+      myLocations.put(Couple.of(key, path), id);
     }
   }
 
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java
index d10c08d..bacd551 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java
@@ -132,7 +132,7 @@
           final Set<Couple<String>> set = new HashSet<Couple<String>>();
           for (FilePatchInProgress.PatchChange change : includedChanges) {
             final TextFilePatch patch = change.getPatchInProgress().getPatch();
-            final Couple<String> pair = Couple.newOne(patch.getBeforeName(), patch.getAfterName());
+            final Couple<String> pair = Couple.of(patch.getBeforeName(), patch.getAfterName());
             if (set.contains(pair)) continue;
             set.add(pair);
             acceptChange(includedTrinity, change);
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/FilePatchInProgress.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/FilePatchInProgress.java
index 11db822..f4770e4 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/FilePatchInProgress.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/FilePatchInProgress.java
@@ -258,7 +258,7 @@
   }
 
   public Couple<String> getKey() {
-    return Couple.newOne(myPatch.getBeforeName(), myPatch.getAfterName());
+    return Couple.of(myPatch.getBeforeName(), myPatch.getAfterName());
   }
 
   private void refresh() {
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java
index 7537ca2..22efde1 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java
@@ -278,7 +278,7 @@
   private void putMovedMessage(final String beforeName, final String afterName) {
     final String movedMessage = RelativePathCalculator.getMovedString(beforeName, afterName);
     if (movedMessage != null) {
-      myMoveRenameInfo.put(Couple.newOne(beforeName, afterName), movedMessage);
+      myMoveRenameInfo.put(Couple.of(beforeName, afterName), movedMessage);
     }
   }
 
@@ -470,7 +470,7 @@
       }
       else if (nodeValue instanceof ShelvedChange) {
         ShelvedChange change = (ShelvedChange) nodeValue;
-        final String movedMessage = myMoveRenameInfo.get(Couple.newOne(change.getBeforePath(), change.getAfterPath()));
+        final String movedMessage = myMoveRenameInfo.get(Couple.of(change.getBeforePath(), change.getAfterPath()));
         renderFileName(change.getBeforePath(), change.getFileStatus(), movedMessage);
       }
       else if (nodeValue instanceof ShelvedBinaryFile) {
@@ -479,7 +479,7 @@
         if (path == null) {
           path = binaryFile.AFTER_PATH;
         }
-        final String movedMessage = myMoveRenameInfo.get(Couple.newOne(binaryFile.BEFORE_PATH, binaryFile.AFTER_PATH));
+        final String movedMessage = myMoveRenameInfo.get(Couple.of(binaryFile.BEFORE_PATH, binaryFile.AFTER_PATH));
         renderFileName(path, binaryFile.getFileStatus(), movedMessage);
       }
     }
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java
index 753f24d..f8daa55 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java
@@ -406,14 +406,9 @@
           final TreeTableView treeView = myDualView.getTreeView();
           final int lastRow = treeView.getRowCount() - 1;
           if (lastRow >= 0) {
-            treeView.addRowSelectionInterval(lastRow, lastRow);
             treeView.scrollRectToVisible(treeView.getCellRect(lastRow, 0, true));
           }
         }
-        final TableView flatView = myDualView.getFlatView();
-        if (flatView.getRowCount() > 0) {
-          flatView.addRowSelectionInterval(0, 0);
-        }
         myInRefresh = false;
         myTargetSelection = null;
 
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryRefresher.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryRefresher.java
index 73cf253..a335916 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryRefresher.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryRefresher.java
@@ -17,7 +17,6 @@
 
 import com.intellij.openapi.vcs.AbstractVcs;
 import com.intellij.openapi.vcs.FilePath;
-import com.intellij.openapi.vcs.RepositoryLocation;
 import com.intellij.openapi.vcs.annotate.AnnotationProvider;
 
 /**
@@ -36,12 +35,12 @@
   public FileHistoryRefresher(final VcsHistoryProvider vcsHistoryProvider,
                               final AnnotationProvider annotationProvider,
                               final FilePath path,
-                              final RepositoryLocation repositoryLocation,
+                              final String repositoryPath,
                               final AbstractVcs vcs) {
     myVcsHistoryProvider = vcsHistoryProvider;
     myPath = path;
     myVcs = vcs;
-    mySessionPartner = new FileHistorySessionPartner(vcsHistoryProvider, annotationProvider, path, repositoryLocation, vcs, this);
+    mySessionPartner = new FileHistorySessionPartner(vcsHistoryProvider, annotationProvider, path, repositoryPath, vcs, this);
     myCanUseCache = true;
   }
 
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistorySessionPartner.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistorySessionPartner.java
index a360ba4..6c9a6c2 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistorySessionPartner.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistorySessionPartner.java
@@ -17,7 +17,10 @@
 
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.ui.MessageType;
-import com.intellij.openapi.vcs.*;
+import com.intellij.openapi.vcs.AbstractVcs;
+import com.intellij.openapi.vcs.FilePath;
+import com.intellij.openapi.vcs.VcsBundle;
+import com.intellij.openapi.vcs.VcsException;
 import com.intellij.openapi.vcs.annotate.AnnotationProvider;
 import com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx;
 import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier;
@@ -30,7 +33,6 @@
 import com.intellij.util.BufferedListConsumer;
 import com.intellij.util.Consumer;
 import com.intellij.util.ContentsUtil;
-import org.jetbrains.annotations.Nullable;
 
 import java.util.List;
 
@@ -43,7 +45,7 @@
   private final VcsHistoryProvider myVcsHistoryProvider;
   private final AnnotationProvider myAnnotationProvider;
   private final FilePath myPath;
-  private final RepositoryLocation myRepositoryLocation;
+  private final String myRepositoryPath;
   private final AbstractVcs myVcs;
   private final FileHistoryRefresherI myRefresherI;
   private volatile VcsAbstractHistorySession mySession;
@@ -51,14 +53,14 @@
 
   public FileHistorySessionPartner(final VcsHistoryProvider vcsHistoryProvider, final AnnotationProvider annotationProvider,
                                    final FilePath path,
-                                   final RepositoryLocation repositoryLocation,
+                                   final String repositoryPath,
                                    final AbstractVcs vcs,
                                    final FileHistoryRefresherI refresherI) {
     myVcsHistoryProvider = vcsHistoryProvider;
     myAnnotationProvider = annotationProvider;
     myPath = path;
     myLimitHistoryCheck = new LimitHistoryCheck(vcs.getProject(), path.getPath());
-    myRepositoryLocation = repositoryLocation;
+    myRepositoryPath = repositoryPath;
     myVcs = vcs;
     myRefresherI = refresherI;
     myBuffer = new BufferedListConsumer<VcsFileRevision>(5, new Consumer<List<VcsFileRevision>>() {
@@ -74,12 +76,6 @@
     }, 1000);
   }
 
-  @Nullable
-  @Override
-  public RepositoryLocation getRepositoryLocation() {
-    return myRepositoryLocation;
-  }
-
   public void acceptRevision(VcsFileRevision revision) {
     myLimitHistoryCheck.checkNumber();
     myBuffer.consumeOne(revision);
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryProviderBackgroundableProxy.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryProviderBackgroundableProxy.java
index 60d7568..c28a39b 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryProviderBackgroundableProxy.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryProviderBackgroundableProxy.java
@@ -221,12 +221,6 @@
       myPartner.beforeRefresh();
     }
 
-    @Nullable
-    @Override
-    public RepositoryLocation getRepositoryLocation() {
-      return myPartner.getRepositoryLocation();
-    }
-
     @Override
     public void forceRefresh() {
       myPartner.forceRefresh();
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java
index df2b404..11c00bc 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java
@@ -268,7 +268,7 @@
       left = revision2;
       right = revision1;
     }
-    return Couple.newOne(left, right);
+    return Couple.of(left, right);
   }
 
 }
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/AbstractVcsHelperImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/AbstractVcsHelperImpl.java
index 32357d6..77ef5d7 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/AbstractVcsHelperImpl.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/AbstractVcsHelperImpl.java
@@ -116,13 +116,13 @@
   }
 
   public void showFileHistory(final VcsHistoryProvider vcsHistoryProvider, final FilePath path, final AbstractVcs vcs,
-                              final RepositoryLocation repositoryLocation) {
-    showFileHistory(vcsHistoryProvider, null, path, repositoryLocation, vcs);
+                              final String repositoryPath) {
+    showFileHistory(vcsHistoryProvider, null, path, repositoryPath, vcs);
   }
 
   public void showFileHistory(final VcsHistoryProvider vcsHistoryProvider, final AnnotationProvider annotationProvider, final FilePath path,
-                              final RepositoryLocation repositoryLocation, final AbstractVcs vcs) {
-    final FileHistoryRefresherI refresherI = new FileHistoryRefresher(vcsHistoryProvider, annotationProvider, path, repositoryLocation, vcs);
+                              final String repositoryPath, final AbstractVcs vcs) {
+    final FileHistoryRefresherI refresherI = new FileHistoryRefresher(vcsHistoryProvider, annotationProvider, path, repositoryPath, vcs);
     refresherI.run(false, true);
   }
 
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/UpdateFilesHelper.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/UpdateFilesHelper.java
index 90cc017..7166ada 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/UpdateFilesHelper.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/UpdateFilesHelper.java
@@ -67,7 +67,7 @@
 
   private static void iterateGroup(final FileGroup group, final Consumer<Couple<String>> callback) {
     for (FileGroup.UpdatedFile updatedFile : group.getUpdatedFiles()) {
-      callback.consume(Couple.newOne(updatedFile.getPath(), updatedFile.getVcsName()));
+      callback.consume(Couple.of(updatedFile.getPath(), updatedFile.getVcsName()));
     }
   }
 
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogUtil.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogUtil.java
index 30fba91..ad610c4 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogUtil.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogUtil.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -27,6 +27,7 @@
   @NotNull
   public static MultiMap<VirtualFile, VcsRef> groupRefsByRoot(@NotNull Collection<VcsRef> refs) {
     MultiMap<VirtualFile, VcsRef> map = new MultiMap<VirtualFile, VcsRef>() {
+      @NotNull
       @Override
       protected Map<VirtualFile, Collection<VcsRef>> createMap() {
         return new TreeMap<VirtualFile, Collection<VcsRef>>(new Comparator<VirtualFile>() { // TODO common to VCS root sorting method
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
index b2fc65f..95931e5 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
@@ -61,6 +61,7 @@
 import com.intellij.xdebugger.impl.breakpoints.*;
 import com.intellij.xdebugger.impl.evaluate.quick.common.ValueLookupManager;
 import com.intellij.xdebugger.impl.frame.XValueMarkers;
+import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
 import com.intellij.xdebugger.impl.ui.XDebugSessionData;
 import com.intellij.xdebugger.impl.ui.XDebugSessionTab;
 import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants;
@@ -345,8 +346,8 @@
       .showRunContent(DefaultDebugExecutor.getDebugExecutorInstance(), descriptor);
   }
 
+  @Nullable
   public XValueMarkers<?, ?> getValueMarkers() {
-    ApplicationManager.getApplication().assertIsDispatchThread();
     if (myValueMarkers == null) {
       XValueMarkerProvider<?, ?> provider = myDebugProcess.createValueMarkerProvider();
       if (provider != null) {
@@ -834,6 +835,12 @@
         breakpointManager.getDependentBreakpointManager().removeListener(myDependentBreakpointListener);
       }
     }
+    if (myValueMarkers != null) {
+      myValueMarkers.clear();
+    }
+    if (XDebuggerSettingsManager.getInstance().getGeneralSettings().isUnmuteOnStop()) {
+      mySessionData.setBreakpointsMuted(false);
+    }
     myStopped = true;
     myDebuggerManager.removeSession(this);
     myDispatcher.getMulticaster().sessionStopped();
@@ -914,4 +921,9 @@
       }
     }
   }
+
+  public void setWatchExpressions(@NotNull XExpression[] watchExpressions) {
+    mySessionData.setWatchExpressions(watchExpressions);
+    myDebuggerManager.getWatchesManager().setWatches(getSessionName(), watchExpressions);
+  }
 }
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerHistoryManager.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerHistoryManager.java
index 2a120b4..757610b 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerHistoryManager.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerHistoryManager.java
@@ -38,7 +38,7 @@
   }
 
   public boolean addRecentExpression(@NotNull @NonNls String id, @Nullable XExpression expression) {
-    if (expression == null || StringUtil.isEmptyOrSpaces(expression.getExpression())) {
+    if (XDebuggerUtilImpl.isEmptyExpression(expression)) {
       return false;
     }
 
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java
index 3afd27f..69c1166 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java
@@ -68,6 +68,7 @@
   @NonNls public static final String COMPONENT_NAME = "XDebuggerManager";
   private final Project myProject;
   private final XBreakpointManagerImpl myBreakpointManager;
+  private final XDebuggerWatchesManager myWatchesManager;
   private final Map<RunContentDescriptor, XDebugSessionData> mySessionData;
   private final Map<RunContentDescriptor, XDebugSessionTab> mySessionTabs;
   private final Map<ProcessHandler, XDebugSessionImpl> mySessions;
@@ -77,6 +78,7 @@
   public XDebuggerManagerImpl(final Project project, final StartupManager startupManager, MessageBus messageBus) {
     myProject = project;
     myBreakpointManager = new XBreakpointManagerImpl(project, this, startupManager);
+    myWatchesManager = new XDebuggerWatchesManager();
     mySessionData = new THashMap<RunContentDescriptor, XDebugSessionData>();
     mySessionTabs = new THashMap<RunContentDescriptor, XDebugSessionTab>();
     mySessions = new LinkedHashMap<ProcessHandler, XDebugSessionImpl>();
@@ -86,14 +88,18 @@
     messageBusConnection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() {
       @Override
       public void fileContentLoaded(@NotNull VirtualFile file, @NotNull Document document) {
-        if (file.equals(myExecutionPointHighlighter.getCurrentFile())) {
-          myExecutionPointHighlighter.update();
-        }
+        updateExecutionPoint(file);
       }
 
       @Override
       public void fileContentReloaded(@NotNull VirtualFile file, @NotNull Document document) {
-        myExecutionPointHighlighter.update();
+        updateExecutionPoint(file);
+      }
+
+      private void updateExecutionPoint(@NotNull VirtualFile file) {
+        if (file.equals(myExecutionPointHighlighter.getCurrentFile())) {
+          myExecutionPointHighlighter.update();
+        }
       }
     });
     myBreakpointManager.addBreakpointListener(new XBreakpointAdapter<XBreakpoint<?>>() {
@@ -144,6 +150,10 @@
     return myBreakpointManager;
   }
 
+  public XDebuggerWatchesManager getWatchesManager() {
+    return myWatchesManager;
+  }
+
   public Project getProject() {
     return myProject;
   }
@@ -199,7 +209,7 @@
 
     XDebugSessionData oldSessionData = contentToReuse != null ? mySessionData.get(contentToReuse) : null;
     if (oldSessionData == null) {
-      oldSessionData = new XDebugSessionData();
+      oldSessionData = new XDebugSessionData(myWatchesManager.getWatches(session.getSessionName()));
     }
 
     // Perform custom configuration of session data for XDebugProcessConfiguratorStarter classes
@@ -310,12 +320,13 @@
 
   @Override
   public XDebuggerState getState() {
-    return new XDebuggerState(myBreakpointManager.getState());
+    return new XDebuggerState(myBreakpointManager.getState(), myWatchesManager.getState());
   }
 
   @Override
   public void loadState(final XDebuggerState state) {
     myBreakpointManager.loadState(state.myBreakpointManagerState);
+    myWatchesManager.loadState(state.myWatchesManagerState);
   }
 
   public void showExecutionPosition() {
@@ -325,12 +336,14 @@
   @SuppressWarnings("UnusedDeclaration")
   public static class XDebuggerState {
     private XBreakpointManagerImpl.BreakpointManagerState myBreakpointManagerState;
+    private XDebuggerWatchesManager.WatchesManagerState myWatchesManagerState;
 
     public XDebuggerState() {
     }
 
-    public XDebuggerState(final XBreakpointManagerImpl.BreakpointManagerState breakpointManagerState) {
+    public XDebuggerState(final XBreakpointManagerImpl.BreakpointManagerState breakpointManagerState, XDebuggerWatchesManager.WatchesManagerState watchesManagerState) {
       myBreakpointManagerState = breakpointManagerState;
+      myWatchesManagerState = watchesManagerState;
     }
 
     @Property(surroundWithTag = false)
@@ -341,5 +354,14 @@
     public void setBreakpointManagerState(final XBreakpointManagerImpl.BreakpointManagerState breakpointManagerState) {
       myBreakpointManagerState = breakpointManagerState;
     }
+
+    @Property(surroundWithTag = false)
+    public XDebuggerWatchesManager.WatchesManagerState getWatchesManagerState() {
+      return myWatchesManagerState;
+    }
+
+    public void setWatchesManagerState(XDebuggerWatchesManager.WatchesManagerState watchesManagerState) {
+      myWatchesManagerState = watchesManagerState;
+    }
   }
 }
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java
index 6e7c700..6db46f5 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java
@@ -28,6 +28,7 @@
 import com.intellij.openapi.fileEditor.OpenFileDescriptor;
 import com.intellij.openapi.fileTypes.StdFileTypes;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
@@ -366,4 +367,8 @@
   public XExpression createExpression(@NotNull String text, Language language, String custom, EvaluationMode mode) {
     return new XExpressionImpl(text, language, custom, mode);
   }
+
+  public static boolean isEmptyExpression(@Nullable XExpression expression) {
+    return expression == null || StringUtil.isEmptyOrSpaces(expression.getExpression());
+  }
 }
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerWatchesManager.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerWatchesManager.java
new file mode 100644
index 0000000..e803453
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerWatchesManager.java
@@ -0,0 +1,115 @@
+/*
+ * 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.xdebugger.impl;
+
+import com.intellij.openapi.components.PersistentStateComponent;
+import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.xmlb.annotations.AbstractCollection;
+import com.intellij.util.xmlb.annotations.Attribute;
+import com.intellij.util.xmlb.annotations.Property;
+import com.intellij.util.xmlb.annotations.Tag;
+import com.intellij.xdebugger.XExpression;
+import com.intellij.xdebugger.impl.breakpoints.XExpressionState;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author egor
+ */
+public class XDebuggerWatchesManager implements PersistentStateComponent<XDebuggerWatchesManager.WatchesManagerState> {
+  private final Map<String, XExpression[]> watches = ContainerUtil.newConcurrentMap();
+
+  @NotNull
+  public XExpression[] getWatches(String confName) {
+    XExpression[] expressions = watches.get(confName);
+    if (expressions == null) {
+      return new XExpression[0];
+    }
+    return expressions;
+  }
+
+  public void setWatches(String configurationName, XExpression[] expressions) {
+    if (expressions != null && expressions.length > 0) {
+      watches.put(configurationName, expressions);
+    }
+    else {
+      watches.remove(configurationName);
+    }
+  }
+
+  @Override
+  public WatchesManagerState getState() {
+    WatchesManagerState state = new WatchesManagerState();
+    for (Map.Entry<String, XExpression[]> entry : watches.entrySet()) {
+      state.expressions.add(new ConfigurationState(entry.getKey(), entry.getValue()));
+    }
+    return state;
+  }
+
+  @Override
+  public void loadState(WatchesManagerState state) {
+    watches.clear();
+    if (state != null) {
+      for (ConfigurationState expressionState : state.expressions) {
+        WatchState[] states = expressionState.myExpressionStates;
+        XExpression[] expressions = new XExpression[states.length];
+        for (int i = 0; i < states.length; i++) {
+          expressions[i] = states[i].toXExpression();
+        }
+        watches.put(expressionState.myName, expressions);
+      }
+    }
+  }
+
+  @Tag("watches-manager")
+  public static class WatchesManagerState {
+    @Property(surroundWithTag = false)
+    @AbstractCollection(surroundWithTag = false)
+    public List<ConfigurationState> expressions = new ArrayList<ConfigurationState>();
+  }
+
+  @Tag("configuration")
+  public static class ConfigurationState {
+    @Attribute("name")
+    public String myName;
+
+    @Property(surroundWithTag = false)
+    @AbstractCollection(surroundWithTag = false)
+    public WatchState[] myExpressionStates;
+
+    public ConfigurationState() {
+    }
+
+    public ConfigurationState(String name, XExpression[] expressions) {
+      this.myName = name;
+      myExpressionStates = new WatchState[expressions.length];
+      for (int i = 0; i < expressions.length; i++) {
+        myExpressionStates[i] = new WatchState(expressions[i]);
+      }
+    }
+  }
+  @Tag("watch")
+  public static class WatchState extends XExpressionState {
+    public WatchState() {}
+
+    public WatchState(XExpression expression) {
+      super(expression);
+    }
+  }
+}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/UnmuteOnStopAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/UnmuteOnStopAction.java
new file mode 100644
index 0000000..79cef65
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/UnmuteOnStopAction.java
@@ -0,0 +1,36 @@
+/*
+ * 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.xdebugger.impl.actions;
+
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.ToggleAction;
+import com.intellij.openapi.project.DumbAware;
+import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
+
+/**
+ * @author egor
+ */
+public class UnmuteOnStopAction extends ToggleAction implements DumbAware {
+  @Override
+  public boolean isSelected(AnActionEvent e) {
+    return XDebuggerSettingsManager.getInstance().getGeneralSettings().isUnmuteOnStop();
+  }
+
+  @Override
+  public void setSelected(AnActionEvent e, boolean state) {
+    XDebuggerSettingsManager.getInstance().getGeneralSettings().setUnmuteOnStop(state);
+  }
+}
\ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java
index caec361..8631b8f 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java
@@ -15,14 +15,16 @@
  */
 package com.intellij.xdebugger.impl.breakpoints;
 
-import com.intellij.lang.Language;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.util.xmlb.annotations.*;
+import com.intellij.util.xmlb.annotations.Attribute;
+import com.intellij.util.xmlb.annotations.Property;
+import com.intellij.util.xmlb.annotations.Tag;
+import com.intellij.util.xmlb.annotations.Transient;
 import com.intellij.xdebugger.XExpression;
 import com.intellij.xdebugger.breakpoints.SuspendPolicy;
 import com.intellij.xdebugger.breakpoints.XBreakpoint;
 import com.intellij.xdebugger.breakpoints.XBreakpointProperties;
 import com.intellij.xdebugger.breakpoints.XBreakpointType;
+import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
 import org.jdom.Element;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -192,12 +194,12 @@
     }
 
     private Condition(boolean disabled, XExpression expression) {
-      super(disabled, expression.getExpression(), expression.getLanguage() != null ? expression.getLanguage().getID() : null, expression.getCustomInfo());
+      super(disabled, expression);
     }
 
     @Nullable
     public static Condition create(boolean disabled, XExpression expression) {
-      if (expression == null || StringUtil.isEmpty(expression.getExpression())) {
+      if (XDebuggerUtilImpl.isEmptyExpression(expression)) {
         return null;
       }
       return new Condition(disabled, expression);
@@ -210,53 +212,15 @@
     }
 
     private LogExpression(boolean disabled, XExpression expression) {
-      super(disabled, expression.getExpression(), expression.getLanguage() != null ? expression.getLanguage().getID() : null, expression.getCustomInfo());
+      super(disabled, expression);
     }
 
     @Nullable
     public static LogExpression create(boolean disabled, XExpression expression) {
-      if (expression == null || StringUtil.isEmpty(expression.getExpression())) {
+      if (XDebuggerUtilImpl.isEmptyExpression(expression)) {
         return null;
       }
       return new LogExpression(disabled, expression);
     }
   }
-
-  private static class XExpressionState {
-    @Attribute("disabled")
-    public boolean myDisabled;
-
-    @Attribute("expression")
-    public String myExpression;
-
-    @Attribute("language")
-    public String myLanguage;
-
-    @Attribute("custom")
-    public String myCustomInfo;
-
-    @Text
-    public String myOldExpression;
-
-    public XExpressionState() {
-    }
-
-    public XExpressionState(boolean disabled, @NotNull String expression, String language, String customInfo) {
-      myDisabled = disabled;
-      myExpression = expression;
-      myLanguage = language;
-      myCustomInfo = customInfo;
-    }
-
-    void checkConverted() {
-      if (myOldExpression != null) {
-        myExpression = myOldExpression;
-        myOldExpression = null;
-      }
-    }
-
-    public XExpression toXExpression() {
-      return new XExpressionImpl(myExpression, Language.findLanguageByID(myLanguage), myCustomInfo);
-    }
-  }
 }
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointManagerImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointManagerImpl.java
index 38d4979..be227ce 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointManagerImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointManagerImpl.java
@@ -417,7 +417,12 @@
 
     for (BreakpointState defaults : state.getBreakpointsDefaults()) {
       XBreakpointType<?,?> type = XBreakpointUtil.findType(defaults.getTypeId());
-      myBreakpointsDefaults.put(type, defaults);
+      if (type != null) {
+        myBreakpointsDefaults.put(type, defaults);
+      }
+      else {
+        LOG.warn("Unknown breakpoint type " + defaults.getTypeId());
+      }
     }
 
     myDependentBreakpointManager.loadState();
@@ -482,12 +487,16 @@
   @Nullable
   private XBreakpointBase<?,?,?> createBreakpoint(final BreakpointState breakpointState) {
     XBreakpointType<?,?> type = XBreakpointUtil.findType(breakpointState.getTypeId());
-    if (type == null) return null;
+    if (type == null) {
+      LOG.warn("Unknown breakpoint type " + breakpointState.getTypeId());
+      return null;
+    }
     //noinspection unchecked
     return breakpointState.createBreakpoint(type, this);
   }
 
-  public BreakpointState getBreakpointDefaults(XBreakpointType type) {
+  @NotNull
+  public BreakpointState getBreakpointDefaults(@NotNull XBreakpointType type) {
     BreakpointState defaultState = myBreakpointsDefaults.get(type);
     if (defaultState == null) {
       defaultState = createBreakpointDefaults(type);
@@ -496,7 +505,8 @@
     return defaultState;
   }
 
-  private static BreakpointState createBreakpointDefaults(XBreakpointType type) {
+  @NotNull
+  private static BreakpointState createBreakpointDefaults(@NotNull XBreakpointType type) {
     BreakpointState state = new BreakpointState();
     state.setTypeId(type.getId());
     return state;
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XExpressionState.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XExpressionState.java
new file mode 100644
index 0000000..8fc46ba
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XExpressionState.java
@@ -0,0 +1,71 @@
+/*
+ * 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.xdebugger.impl.breakpoints;
+
+import com.intellij.lang.Language;
+import com.intellij.util.xmlb.annotations.Attribute;
+import com.intellij.util.xmlb.annotations.Text;
+import com.intellij.xdebugger.XExpression;
+import org.jetbrains.annotations.NotNull;
+
+/**
+* @author egor
+*/
+public class XExpressionState {
+  @Attribute("disabled")
+  public boolean myDisabled;
+
+  @Attribute("expression")
+  public String myExpression;
+
+  @Attribute("language")
+  public String myLanguage;
+
+  @Attribute("custom")
+  public String myCustomInfo;
+
+  @Text
+  public String myOldExpression;
+
+  public XExpressionState() {
+  }
+
+  public XExpressionState(boolean disabled, @NotNull String expression, String language, String customInfo) {
+    myDisabled = disabled;
+    myExpression = expression;
+    myLanguage = language;
+    myCustomInfo = customInfo;
+  }
+
+  public XExpressionState(boolean disabled, XExpression expression) {
+    this(disabled, expression.getExpression(), expression.getLanguage() != null ? expression.getLanguage().getID() : null, expression.getCustomInfo());
+  }
+
+  public XExpressionState(XExpression expression) {
+    this(false, expression);
+  }
+
+  void checkConverted() {
+    if (myOldExpression != null) {
+      myExpression = myOldExpression;
+      myOldExpression = null;
+    }
+  }
+
+  public XExpression toXExpression() {
+    return new XExpressionImpl(myExpression, Language.findLanguageByID(myLanguage), myCustomInfo);
+  }
+}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java
index 852d239..d86970b 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointImpl.java
@@ -91,10 +91,11 @@
     RangeHighlighterEx highlighter = myHighlighter;
     if (highlighter != null &&
         (!highlighter.isValid() ||
-         highlighter.getStartOffset() >= document.getTextLength() ||
-         document.getLineNumber(highlighter.getStartOffset()) != getLine())) {
-      highlighter.dispose();
-      myHighlighter = null;
+         highlighter.getStartOffset() >= document.getTextLength()
+         // it seems that this check is not needed - we always update line number from the highlighter
+         // and highlighter is removed on line and file change anyway
+         /*|| document.getLineNumber(highlighter.getStartOffset()) != getLine()*/)) {
+      removeHighlighter();
       highlighter = null;
     }
 
@@ -213,7 +214,7 @@
       public boolean copy(int line, VirtualFile file) {
         if (canMoveTo(line, file)) {
           setFileUrl(file.getUrl());
-          setLine(line);
+          setLine(line, true);
           return true;
         }
         return false;
@@ -232,7 +233,7 @@
 
   public void updatePosition() {
     if (myHighlighter != null && myHighlighter.isValid()) {
-      setLine(myHighlighter.getDocument().getLineNumber(myHighlighter.getStartOffset()));
+      setLine(myHighlighter.getDocument().getLineNumber(myHighlighter.getStartOffset()), false);
     }
   }
 
@@ -240,14 +241,18 @@
     if (!Comparing.equal(getFileUrl(), newUrl)) {
       myState.setFileUrl(newUrl);
       mySourcePosition = null;
+      removeHighlighter();
       fireBreakpointChanged();
     }
   }
 
-  private void setLine(final int line) {
+  private void setLine(final int line, boolean removeHighlighter) {
     if (getLine() != line) {
       myState.setLine(line);
       mySourcePosition = null;
+      if (removeHighlighter) {
+        removeHighlighter();
+      }
       fireBreakpointChanged();
     }
   }
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java
index e4e516e..0f98bce 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java
@@ -20,6 +20,7 @@
 import com.intellij.xdebugger.breakpoints.XBreakpointManager;
 import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
 import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
+import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
 import com.intellij.xdebugger.impl.breakpoints.XBreakpointBase;
 import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
 import com.intellij.xdebugger.impl.ui.XDebuggerExpressionComboBox;
@@ -115,7 +116,7 @@
     if (myLogExpressionComboBox != null) {
       myBreakpoint.setLogExpressionEnabled(myLogExpressionCheckBox.isSelected());
       XExpression expression = myLogExpressionComboBox.getExpression();
-      myBreakpoint.setLogExpressionObject(expression != null && !expression.getExpression().isEmpty() ? expression : null);
+      myBreakpoint.setLogExpressionObject(!XDebuggerUtilImpl.isEmptyExpression(expression) ? expression : null);
       myLogExpressionComboBox.saveTextInHistory();
     }
   }
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java
index cbe4089..9f869ac 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java
@@ -27,6 +27,7 @@
 import com.intellij.xdebugger.breakpoints.XBreakpointType;
 import com.intellij.xdebugger.breakpoints.ui.XBreakpointCustomPropertiesPanel;
 import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
+import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
 import com.intellij.xdebugger.impl.breakpoints.XBreakpointBase;
 import com.intellij.xdebugger.impl.breakpoints.XBreakpointUtil;
 import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
@@ -165,6 +166,10 @@
       myCustomRightPropertiesPanelWrapper.add(customRightConditionPanel.getComponent(), BorderLayout.CENTER);
       myCustomPanels.add(customRightConditionPanel);
     }
+    else {
+      // see IDEA-125745
+      myCustomRightPropertiesPanelWrapper.getParent().remove(myCustomRightPropertiesPanelWrapper);
+    }
 
     XBreakpointCustomPropertiesPanel<B> customTopPropertiesPanel = breakpointType.createCustomTopPropertiesPanel(project);
     if (customTopPropertiesPanel != null) {
@@ -203,7 +208,7 @@
     if (myConditionComboBox != null) {
       myBreakpoint.setConditionEnabled(myConditionEnabledCheckbox.isSelected());
       XExpression expression = myConditionComboBox.getExpression();
-      myBreakpoint.setConditionExpression(expression != null && !expression.getExpression().isEmpty() ? expression : null);
+      myBreakpoint.setConditionExpression(!XDebuggerUtilImpl.isEmptyExpression(expression) ? expression : null);
       myConditionComboBox.saveTextInHistory();
     }
 
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java
index 37c657d..2ad50e1 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java
@@ -31,13 +31,14 @@
 import com.intellij.xdebugger.impl.actions.XDebuggerActions;
 import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl;
 import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
-import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
 import com.intellij.xdebugger.impl.ui.XDebuggerEditorBase;
-import com.intellij.xdebugger.impl.ui.XDebuggerExpressionComboBox;
 import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
+import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeListener;
 import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreePanel;
 import com.intellij.xdebugger.impl.ui.tree.nodes.EvaluatingExpressionRootNode;
+import com.intellij.xdebugger.impl.ui.tree.nodes.RestorableStateNode;
 import com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode;
+import com.intellij.xdebugger.impl.ui.tree.nodes.XValueContainerNode;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -46,6 +47,7 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
+import java.util.List;
 
 /**
  * @author nik
@@ -110,7 +112,9 @@
     }.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.ALT_DOWN_MASK)), getRootPane(),
                                 myDisposable);
 
-    EvaluationMode mode = XDebuggerSettingsManager.getInstance().getDataViewSettings().getEvaluationDialogMode();
+    myTreePanel.getTree().addTreeListener(new MyTreeListener());
+
+    EvaluationMode mode = XDebuggerSettingsManager.getInstance().getGeneralSettings().getEvaluationDialogMode();
     myIsCodeFragmentEvaluationSupported = evaluator.isCodeFragmentEvaluationSupported();
     if (mode == EvaluationMode.CODE_FRAGMENT && !myIsCodeFragmentEvaluationSupported) {
       mode = EvaluationMode.EXPRESSION;
@@ -124,7 +128,6 @@
 
   @Override
   protected void doOKAction() {
-    setOKActionEnabled(false);
     evaluate();
   }
 
@@ -138,6 +141,11 @@
   }
 
   @Override
+  protected String getHelpId() {
+    return "debugging.debugMenu.evaluate";
+  }
+
+  @Override
   protected JButton createJButtonForAction(Action action) {
     final JButton button = super.createJButtonForAction(action);
     if (action == mySwitchModeAction) {
@@ -163,7 +171,7 @@
   private void switchToMode(EvaluationMode mode, XExpression text) {
     if (myMode == mode) return;
 
-    XDebuggerSettingsManager.getInstance().getDataViewSettings().setEvaluationDialogMode(mode);
+    XDebuggerSettingsManager.getInstance().getGeneralSettings().setEvaluationDialogMode(mode);
 
     myMode = mode;
 
@@ -193,37 +201,51 @@
   private void evaluate() {
     final XDebuggerEditorBase inputEditor = myInputComponent.getInputEditor();
     int offset = -1;
-    Editor editor;
+
     //try to save caret position
-    if (inputEditor instanceof XDebuggerExpressionComboBox) {
-      editor = ((XDebuggerExpressionComboBox)inputEditor).getEditor();
-      if (editor != null) {
-        offset = editor.getCaretModel().getOffset();
-      }
+    Editor editor = inputEditor.getEditor();
+    if (editor != null) {
+      offset = editor.getCaretModel().getOffset();
     }
 
     final XDebuggerTree tree = myTreePanel.getTree();
-    XDebuggerTreeNode root = tree.getRoot();
-    if (root instanceof EvaluatingExpressionRootNode) {
-      root.clearChildren();
-    } else {
-      tree.setRoot(new EvaluatingExpressionRootNode(this, tree), false);
-    }
+    tree.markNodesObsolete();
+    tree.setRoot(new EvaluatingExpressionRootNode(this, tree), false);
 
     myResultPanel.invalidate();
 
     //editor is already changed
-    editor = inputEditor instanceof XDebuggerExpressionComboBox ? ((XDebuggerExpressionComboBox)inputEditor).getEditor() : null;
+    editor = inputEditor.getEditor();
     //selectAll puts focus back
     inputEditor.selectAll();
 
     //try to restore caret position and clear selection
     if (offset >= 0 && editor != null) {
+      offset = Math.min(editor.getDocument().getTextLength(), offset);
       editor.getCaretModel().moveToOffset(offset);
       editor.getSelectionModel().setSelection(offset, offset);
     }
   }
 
+  private class MyTreeListener implements XDebuggerTreeListener {
+    @Override
+    public void nodeLoaded(@NotNull RestorableStateNode node, String name) {
+      if (node.getParent() instanceof EvaluatingExpressionRootNode) {
+        if (!node.isLeaf()) {
+          // cause children computing
+          node.getChildCount();
+        }
+      }
+    }
+
+    @Override
+    public void childrenLoaded(@NotNull XDebuggerTreeNode node, @NotNull List<XValueContainerNode<?>> children, boolean last) {
+      if (node.getParent() instanceof EvaluatingExpressionRootNode) {
+        myTreePanel.getTree().expandPath(node.getPath());
+      }
+    }
+  }
+
   @Override
   protected String getDimensionServiceKey() {
     return "#xdebugger.evaluate";
@@ -248,15 +270,6 @@
     }
   }
 
-  public void finishEvaluation() {
-    DebuggerUIUtil.invokeLater(new Runnable() {
-      @Override
-      public void run() {
-        setOKActionEnabled(true);
-      }
-    });
-  }
-
   @Override
   public JComponent getPreferredFocusedComponent() {
     return myInputComponent.getInputEditor().getPreferredFocusedComponent();
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/WatchInplaceEditor.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/WatchInplaceEditor.java
index b3e52b4..683c27e 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/WatchInplaceEditor.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/WatchInplaceEditor.java
@@ -19,6 +19,7 @@
 import com.intellij.xdebugger.XDebugSession;
 import com.intellij.xdebugger.XDebugSessionAdapter;
 import com.intellij.xdebugger.XExpression;
+import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
 import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeInplaceEditor;
 import com.intellij.xdebugger.impl.ui.tree.nodes.WatchNode;
 import com.intellij.xdebugger.impl.ui.tree.nodes.WatchesRootNode;
@@ -70,7 +71,7 @@
     myExpressionEditor.saveTextInHistory();
     super.doOKAction();
     int index = myRootNode.removeChildNode(getNode());
-    if (!expression.getExpression().isEmpty() && index != -1) {
+    if (!XDebuggerUtilImpl.isEmptyExpression(expression) && index != -1) {
       myWatchesView.addWatchExpression(expression, index, false);
     }
   }
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XFramesView.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XFramesView.java
index d4ca8726..b07bd62 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XFramesView.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XFramesView.java
@@ -153,11 +153,13 @@
     myBuilders.clear();
     mySelectedStack = null;
     XSuspendContext suspendContext = mySession.getSuspendContext();
-    if (suspendContext == null) {
+    if (suspendContext == null || event == SessionEvent.PAUSED) {
       myThreadComboBox.removeAllItems();
       myFramesList.clear();
       myExecutionStacks.clear();
-      return;
+      if (suspendContext == null) {
+        return;
+      }
     }
 
     XExecutionStack[] executionStacks = suspendContext.getExecutionStacks();
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XValueMarkers.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XValueMarkers.java
index 6fb9647..e21c3d6 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XValueMarkers.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XValueMarkers.java
@@ -21,6 +21,7 @@
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -76,4 +77,12 @@
       myMarkers.remove(m);
     }
   }
+
+  public Map<M, ValueMarkup> getAllMarkers() {
+    return Collections.unmodifiableMap(myMarkers);
+  }
+
+  public void clear() {
+    myMarkers.clear();
+  }
 }
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java
index 648124f..5183877 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java
@@ -19,22 +19,23 @@
 import com.intellij.ide.dnd.DnDEvent;
 import com.intellij.ide.dnd.DnDManager;
 import com.intellij.ide.dnd.DnDNativeTarget;
+import com.intellij.openapi.CompositeDisposable;
+import com.intellij.openapi.Disposable;
 import com.intellij.openapi.actionSystem.*;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.EmptyRunnable;
 import com.intellij.openapi.util.SystemInfo;
-import com.intellij.ui.AnActionButton;
-import com.intellij.ui.AnActionButtonRunnable;
-import com.intellij.ui.CaptionPanel;
-import com.intellij.ui.ToolbarDecorator;
+import com.intellij.ui.*;
 import com.intellij.ui.border.CustomLineBorder;
+import com.intellij.util.Alarm;
+import com.intellij.util.ui.UIUtil;
 import com.intellij.util.ui.tree.TreeUtil;
-import com.intellij.xdebugger.XDebugSession;
 import com.intellij.xdebugger.XDebuggerBundle;
 import com.intellij.xdebugger.XExpression;
 import com.intellij.xdebugger.frame.XStackFrame;
 import com.intellij.xdebugger.impl.XDebugSessionImpl;
 import com.intellij.xdebugger.impl.actions.XDebuggerActions;
 import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl;
-import com.intellij.xdebugger.impl.ui.XDebugSessionData;
 import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
 import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreePanel;
 import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeRestorer;
@@ -43,12 +44,16 @@
 import com.intellij.xdebugger.impl.ui.tree.nodes.WatchesRootNode;
 import com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode;
 import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
+import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
 import java.awt.*;
 import java.awt.datatransfer.DataFlavor;
-import java.awt.event.KeyEvent;
+import java.awt.event.*;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -60,13 +65,12 @@
   private XDebuggerTreeState myTreeState;
   private XDebuggerTreeRestorer myTreeRestorer;
   private final WatchesRootNode myRootNode;
-  @NotNull private final XDebugSession mySession;
-  private final XDebugSessionData mySessionData;
+  @NotNull private final XDebugSessionImpl mySession;
   private final JPanel myDecoratedPanel;
+  private final CompositeDisposable myDisposables = new CompositeDisposable();
 
-  public XWatchesViewImpl(@NotNull final XDebugSession session, final @NotNull XDebugSessionData sessionData) {
+  public XWatchesViewImpl(@NotNull final XDebugSessionImpl session) {
     mySession = session;
-    mySessionData = sessionData;
     myTreePanel = new XDebuggerTreePanel(session.getProject(), session.getDebugProcess().getEditorsProvider(), this, null,
                                          XDebuggerActions.WATCHES_TREE_POPUP_GROUP, ((XDebugSessionImpl)session).getValueMarkers());
 
@@ -80,7 +84,7 @@
     actionManager.getAction(XDebuggerActions.XEDIT_WATCH).registerCustomShortcutSet(f2Shortcut, tree);
 
     DnDManager.getInstance().registerTarget(this, tree);
-    myRootNode = new WatchesRootNode(tree, session, this, sessionData.getWatchExpressions());
+    myRootNode = new WatchesRootNode(tree, session, this, session.getSessionData().getWatchExpressions());
     tree.setRoot(myRootNode, false);
 
     final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myTreePanel.getTree()).disableUpDownActions();
@@ -100,18 +104,104 @@
                                                    SystemInfo.isMac ? 1 : 0, 0,
                                                    SystemInfo.isMac ? 0 : 1, 0);
     decorator.setToolbarBorder(border);
-    myDecoratedPanel = decorator.createPanel();
+    myDecoratedPanel = new MyPanel(decorator.createPanel());
     myDecoratedPanel.setBorder(null);
 
     myTreePanel.getTree().getEmptyText().setText(XDebuggerBundle.message("debugger.no.watches"));
 
+    installEditListeners();
+  }
+
+  private void installEditListeners() {
+    final XDebuggerTree watchTree = myTreePanel.getTree();
+    final Alarm quitePeriod = new Alarm();
+    final Alarm editAlarm = new Alarm();
+    final ClickListener mouseListener = new ClickListener() {
+      @Override
+      public boolean onClick(@NotNull MouseEvent event, int clickCount) {
+        if (!SwingUtilities.isLeftMouseButton(event) ||
+            ((event.getModifiers() & (InputEvent.SHIFT_MASK | InputEvent.ALT_MASK | InputEvent.CTRL_MASK | InputEvent.META_MASK)) !=0) ) {
+          return false;
+        }
+        boolean sameRow = isAboveSelectedItem(event, watchTree);
+        final AnAction editWatchAction = ActionManager.getInstance().getAction(XDebuggerActions.XEDIT_WATCH);
+        Presentation presentation = editWatchAction.getTemplatePresentation().clone();
+        DataContext context = DataManager.getInstance().getDataContext(watchTree);
+        final AnActionEvent actionEvent = new AnActionEvent(null, context, "WATCH_TREE", presentation, ActionManager.getInstance(), 0);
+        Runnable runnable = new Runnable() {
+          public void run() {
+            editWatchAction.actionPerformed(actionEvent);
+          }
+        };
+        if (sameRow && editAlarm.isEmpty() && quitePeriod.isEmpty()) {
+          editAlarm.addRequest(runnable, UIUtil.getMultiClickInterval());
+        } else {
+          editAlarm.cancelAllRequests();
+        }
+        return false;
+      }
+    };
+    final ClickListener mouseEmptySpaceListener = new DoubleClickListener() {
+      @Override
+      protected boolean onDoubleClick(MouseEvent event) {
+        if (!isAboveSelectedItem(event, watchTree)) {
+          myRootNode.addNewWatch();
+          return true;
+        }
+        return false;
+      }
+    };
+    ListenerUtil.addClickListener(watchTree, mouseListener);
+    ListenerUtil.addClickListener(watchTree, mouseEmptySpaceListener);
+
+    final FocusListener focusListener = new FocusListener() {
+      @Override
+      public void focusGained(FocusEvent e) {
+        quitePeriod.addRequest(EmptyRunnable.getInstance(), UIUtil.getMultiClickInterval());
+      }
+
+      @Override
+      public void focusLost(FocusEvent e) {
+        editAlarm.cancelAllRequests();
+      }
+    };
+    ListenerUtil.addFocusListener(watchTree, focusListener);
+
+    final TreeSelectionListener selectionListener = new TreeSelectionListener() {
+      @Override
+      public void valueChanged(TreeSelectionEvent e) {
+        quitePeriod.addRequest(EmptyRunnable.getInstance(), UIUtil.getMultiClickInterval());
+      }
+    };
+    watchTree.addTreeSelectionListener(selectionListener);
+    myDisposables.add(new Disposable() {
+      @Override
+      public void dispose() {
+        ListenerUtil.removeClickListener(watchTree, mouseListener);
+        ListenerUtil.removeClickListener(watchTree, mouseEmptySpaceListener);
+        ListenerUtil.removeFocusListener(watchTree, focusListener);
+        watchTree.removeTreeSelectionListener(selectionListener);
+      }
+    });
   }
 
   @Override
   public void dispose() {
+    Disposer.dispose(myDisposables);
     DnDManager.getInstance().unregisterTarget(this, myTreePanel.getTree());
   }
 
+  private static boolean isAboveSelectedItem(MouseEvent event, XDebuggerTree watchTree) {
+    Rectangle bounds = watchTree.getRowBounds(watchTree.getLeadSelectionRow());
+    if (bounds != null) {
+      bounds.width = watchTree.getWidth();
+      if (bounds.contains(event.getPoint())) {
+        return true;
+      }
+    }
+    return false;
+  }
+
   private void executeAction(@NotNull String watch) {
     AnAction action = ActionManager.getInstance().getAction(watch);
     Presentation presentation = action.getTemplatePresentation().clone();
@@ -203,7 +293,7 @@
         watchExpressions.add(child.getExpression());
       }
     }
-    mySessionData.setWatchExpressions(watchExpressions.toArray(new XExpression[watchExpressions.size()]));
+    mySession.setWatchExpressions(watchExpressions.toArray(new XExpression[watchExpressions.size()]));
   }
 
   @Override
@@ -249,4 +339,21 @@
   @Override
   public void updateDraggedImage(final Image image, final Point dropPoint, final Point imageOffset) {
   }
+
+  private class MyPanel extends JPanel implements DataProvider {
+    public MyPanel(JPanel panel) {
+      setLayout(new BorderLayout());
+      add(panel);
+      panel.setBorder(null);
+    }
+
+    @Nullable
+    @Override
+    public Object getData(@NonNls String dataId) {
+      if (XWatchesView.DATA_KEY.is(dataId)) {
+        return XWatchesViewImpl.this;
+      }
+      return null;
+    }
+  }
 }
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerDataViewSettings.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerDataViewSettings.java
index 8dced66..bff7c53 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerDataViewSettings.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerDataViewSettings.java
@@ -24,7 +24,6 @@
 @Tag("data-views")
 public class XDebuggerDataViewSettings {
   private boolean mySortValues;
-  private EvaluationMode myEvaluationDialogMode = EvaluationMode.EXPRESSION;
 
   @Tag("sort-values")
   public boolean isSortValues() {
@@ -34,13 +33,4 @@
   public void setSortValues(boolean sortValues) {
     mySortValues = sortValues;
   }
-
-  @Tag("evaluation-dialog-mode")
-  public EvaluationMode getEvaluationDialogMode() {
-    return myEvaluationDialogMode;
-  }
-
-  public void setEvaluationDialogMode(EvaluationMode evaluationDialogMode) {
-    myEvaluationDialogMode = evaluationDialogMode;
-  }
 }
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerGeneralSettings.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerGeneralSettings.java
new file mode 100644
index 0000000..1f89b14
--- /dev/null
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerGeneralSettings.java
@@ -0,0 +1,46 @@
+/*
+ * 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.xdebugger.impl.settings;
+
+import com.intellij.util.xmlb.annotations.Tag;
+import com.intellij.xdebugger.evaluation.EvaluationMode;
+
+/**
+ * @author egor
+ */
+@Tag("general")
+public class XDebuggerGeneralSettings {
+  private EvaluationMode myEvaluationDialogMode = EvaluationMode.EXPRESSION;
+  private boolean myUnmuteOnStop = false;
+
+  @Tag("evaluation-dialog-mode")
+  public EvaluationMode getEvaluationDialogMode() {
+    return myEvaluationDialogMode;
+  }
+
+  public void setEvaluationDialogMode(EvaluationMode evaluationDialogMode) {
+    myEvaluationDialogMode = evaluationDialogMode;
+  }
+
+  @Tag("unmute-on-stop")
+  public boolean isUnmuteOnStop() {
+    return myUnmuteOnStop;
+  }
+
+  public void setUnmuteOnStop(boolean unmuteOnStop) {
+    myUnmuteOnStop = unmuteOnStop;
+  }
+}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsManager.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsManager.java
index 5e7a175..ae2dcbc 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsManager.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/XDebuggerSettingsManager.java
@@ -45,6 +45,7 @@
   private Map<String, XDebuggerSettings<?>> mySettingsById;
   private Map<Class<? extends XDebuggerSettings>, XDebuggerSettings<?>> mySettingsByClass;
   private XDebuggerDataViewSettings myDataViewSettings = new XDebuggerDataViewSettings();
+  private XDebuggerGeneralSettings myGeneralSettings = new XDebuggerGeneralSettings();
 
   public static XDebuggerSettingsManager getInstance() {
     return ServiceManager.getService(XDebuggerSettingsManager.class);
@@ -53,6 +54,7 @@
   public SettingsState getState() {
     SettingsState settingsState = new SettingsState();
     settingsState.setDataViewSettings(myDataViewSettings);
+    settingsState.setGeneralSettings(myGeneralSettings);
     for (XDebuggerSettings<?> settings : getSettingsList()) {
       SpecificSettingsState state = new SpecificSettingsState();
       state.setId(settings.getId());
@@ -71,8 +73,13 @@
     return myDataViewSettings;
   }
 
+  public XDebuggerGeneralSettings getGeneralSettings() {
+    return myGeneralSettings;
+  }
+
   public void loadState(final SettingsState state) {
     myDataViewSettings = state.getDataViewSettings();
+    myGeneralSettings = state.getGeneralSettings();
     for (SpecificSettingsState settingsState : state.getSpecificStates()) {
       XDebuggerSettings<?> settings = findSettings(settingsState.getId());
       if (settings != null) {
@@ -106,6 +113,7 @@
   public static class SettingsState {
     private List<SpecificSettingsState> mySpecificStates = new ArrayList<SpecificSettingsState>();
     private XDebuggerDataViewSettings myDataViewSettings = new XDebuggerDataViewSettings();
+    private XDebuggerGeneralSettings myGeneralSettings = new XDebuggerGeneralSettings();
 
     @Tag("debuggers")
     @AbstractCollection(surroundWithTag = false)
@@ -125,6 +133,15 @@
     public void setDataViewSettings(XDebuggerDataViewSettings dataViewSettings) {
       myDataViewSettings = dataViewSettings;
     }
+
+    @Property(surroundWithTag = false)
+    public XDebuggerGeneralSettings getGeneralSettings() {
+      return myGeneralSettings;
+    }
+
+    public void setGeneralSettings(XDebuggerGeneralSettings generalSettings) {
+      myGeneralSettings = generalSettings;
+    }
   }
 
   @Tag("debugger")
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java
index 0939583..9fed59c 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java
@@ -66,7 +66,8 @@
         mySourcePosition = position;
 
         myOpenFileDescriptor = XSourcePositionImpl.createOpenFileDescriptor(myProject, position);
-        myOpenFileDescriptor.setUseCurrentWindow(true);
+        //see IDEA-125645 and IDEA-63459
+        //myOpenFileDescriptor.setUseCurrentWindow(true);
 
         myGutterIconRenderer = gutterIconRenderer;
         myUseSelection = useSelection;
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionData.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionData.java
index acc8cc5..08bf63a 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionData.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionData.java
@@ -16,7 +16,6 @@
 package com.intellij.xdebugger.impl.ui;
 
 import com.intellij.openapi.actionSystem.DataKey;
-import com.intellij.util.ArrayUtil;
 import com.intellij.xdebugger.XExpression;
 import org.jetbrains.annotations.NotNull;
 
@@ -26,6 +25,7 @@
 public class XDebugSessionData {
   public static final DataKey<XDebugSessionData> DATA_KEY = DataKey.create("XDebugSessionData");
 
+  @NotNull
   private XExpression[] myWatchExpressions;
   private boolean myBreakpointsMuted = false;
 
@@ -33,10 +33,6 @@
     myWatchExpressions = watchExpressions;
   }
 
-  public XDebugSessionData() {
-    this(new XExpression[0]);
-  }
-
   public void setWatchExpressions(@NotNull XExpression[] watchExpressions) {
     myWatchExpressions = watchExpressions;
   }
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java
index 7137f1b..ef0b720 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java
@@ -90,8 +90,8 @@
     return result;
   }
 
-  private Content createWatchesContent(final XDebugSession session, final XDebugSessionData sessionData) {
-    myWatchesView = new XWatchesViewImpl(session, sessionData);
+  private Content createWatchesContent(final XDebugSessionImpl session, final XDebugSessionData sessionData) {
+    myWatchesView = new XWatchesViewImpl(session);
     myViews.add(myWatchesView);
     Content watchesContent = myUi.createContent(DebuggerContentInfo.WATCHES_CONTENT, myWatchesView.getMainPanel(),
                                          XDebuggerBundle.message("debugger.session.tab.watches.title"), AllIcons.Debugger.Watches, null);
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java
index 32b3f55..991036b 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java
@@ -22,6 +22,7 @@
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.actionSystem.DefaultActionGroup;
 import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.fileTypes.LanguageFileType;
 import com.intellij.openapi.project.Project;
@@ -128,6 +129,9 @@
     return myMode;
   }
 
+  @Nullable
+  public abstract Editor getEditor();
+
   public abstract JComponent getComponent();
 
   protected abstract void doSetText(XExpression text);
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java
index 8ff17b3..051683b 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java
@@ -17,6 +17,9 @@
 
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
+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.project.Project;
 import com.intellij.openapi.ui.ComboBox;
 import com.intellij.ui.EditorComboBoxEditor;
@@ -107,6 +110,23 @@
   }
 
   @Override
+  protected Document createDocument(XExpression text) {
+    Document document = super.createDocument(text);
+    document.addDocumentListener(REPLACE_NEWLINES_LISTENER);
+    return document;
+  }
+
+  private static DocumentListener REPLACE_NEWLINES_LISTENER = new DocumentAdapter() {
+    @Override
+    public void documentChanged(DocumentEvent e) {
+      String text = e.getNewFragment().toString();
+      if (text.contains("\n")) {
+        e.getDocument().replaceString(e.getOffset(), e.getOffset() + e.getNewLength(), text.replace('\n', ' '));
+      }
+    }
+  };
+
+  @Override
   protected void onHistoryChanged() {
     fillComboBox();
   }
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerMultilineEditor.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerMultilineEditor.java
index 95a6988..0c41a5d 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerMultilineEditor.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerMultilineEditor.java
@@ -80,6 +80,12 @@
     return editor != null ? editor.getContentComponent() : null;
   }
 
+  @Nullable
+  @Override
+  public Editor getEditor() {
+    return myEditorTextField.getEditor();
+  }
+
   @Override
   public void selectAll() {
     myEditorTextField.selectAll();
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java
index 2cf8c71..3b3a481 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java
@@ -63,10 +63,7 @@
       String text = null;
       if (o != null) {
         final Object node = o.getLastPathComponent();
-        if (node instanceof RestorableStateNode) {
-          text = ((RestorableStateNode)node).getName();
-        }
-        else if (node instanceof XDebuggerTreeNode) {
+        if (node instanceof XDebuggerTreeNode) {
           text = ((XDebuggerTreeNode)node).getText().toString();
         }
       }
@@ -153,8 +150,7 @@
     new DoubleClickListener() {
       @Override
       protected boolean onDoubleClick(MouseEvent e) {
-        expandIfEllipsis();
-        return true;
+        return expandIfEllipsis();
       }
     }.installOn(this);
 
@@ -188,7 +184,7 @@
     setTransferHandler(DEFAULT_TRANSFER_HANDLER);
   }
 
-  private void expandIfEllipsis() {
+  private boolean expandIfEllipsis() {
     MessageTreeNode[] treeNodes = getSelectedNodes(MessageTreeNode.class, null);
     if (treeNodes.length == 1) {
       MessageTreeNode node = treeNodes[0];
@@ -196,9 +192,11 @@
         TreeNode parent = node.getParent();
         if (parent instanceof XValueContainerNode) {
           ((XValueContainerNode)parent).startComputingChildren();
+          return true;
         }
       }
     }
+    return false;
   }
 
   public void addTreeListener(@NotNull XDebuggerTreeListener listener) {
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XAddToWatchesAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XAddToWatchesAction.java
index 830d0fd..c4bb274 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XAddToWatchesAction.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XAddToWatchesAction.java
@@ -16,6 +16,11 @@
 package com.intellij.xdebugger.impl.ui.tree.actions;
 
 import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.xdebugger.XDebugSession;
+import com.intellij.xdebugger.XDebuggerManager;
+import com.intellij.xdebugger.impl.XDebugSessionImpl;
 import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl;
 import com.intellij.xdebugger.impl.frame.XWatchesView;
 import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
@@ -27,15 +32,32 @@
 class XAddToWatchesAction extends XDebuggerTreeActionBase {
   @Override
   protected boolean isEnabled(@NotNull final XValueNodeImpl node, @NotNull AnActionEvent e) {
-    return super.isEnabled(node, e) && node.getValueContainer().getEvaluationExpression() != null && e.getData(XWatchesView.DATA_KEY) != null;
+    return super.isEnabled(node, e) && node.getValueContainer().getEvaluationExpression() != null && getWatchesView(e) != null;
   }
 
   @Override
   protected void perform(final XValueNodeImpl node, @NotNull final String nodeName, final AnActionEvent e) {
-    XWatchesView watchesView = e.getData(XWatchesView.DATA_KEY);
-    String expression = node.getValueContainer().getEvaluationExpression();
-    if (watchesView != null && expression != null) {
-      watchesView.addWatchExpression(XExpressionImpl.fromText(expression), -1, true);
+    XWatchesView watchesView = getWatchesView(e);
+    if (watchesView != null) {
+      String expression = node.getValueContainer().getEvaluationExpression();
+      if (!StringUtil.isEmpty(expression)) {
+        XExpressionImpl watchExpression = XExpressionImpl.fromText(expression);
+        if (watchExpression != null) {
+          watchesView.addWatchExpression(watchExpression, -1, true);
+        }
+      }
     }
   }
+
+  private static XWatchesView getWatchesView(@NotNull AnActionEvent e) {
+    XWatchesView view = e.getData(XWatchesView.DATA_KEY);
+    Project project = e.getProject();
+    if (view == null && project != null) {
+      XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
+      if (session != null) {
+        return ((XDebugSessionImpl)session).getSessionTab().getWatchesView();
+      }
+    }
+    return null;
+  }
 }
\ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/EvaluatingExpressionRootNode.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/EvaluatingExpressionRootNode.java
index e778572..381bef8 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/EvaluatingExpressionRootNode.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/EvaluatingExpressionRootNode.java
@@ -23,17 +23,14 @@
 import com.intellij.xdebugger.frame.XValueContainer;
 import com.intellij.xdebugger.impl.evaluate.XDebuggerEvaluationDialog;
 import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
-import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeListener;
 import org.jetbrains.annotations.NotNull;
 
-import java.util.List;
-
 /**
  * @author nik
  */
 public class EvaluatingExpressionRootNode extends XValueContainerNode<EvaluatingExpressionRootNode.EvaluatingResultContainer> {
   public EvaluatingExpressionRootNode(XDebuggerEvaluationDialog evaluationDialog, final XDebuggerTree tree) {
-    super(tree, null, new EvaluatingResultContainer(evaluationDialog, tree));
+    super(tree, null, new EvaluatingResultContainer(evaluationDialog));
     setLeaf(false);
   }
 
@@ -42,13 +39,11 @@
     return MessageTreeNode.createEvaluatingMessage(myTree, this);
   }
 
-  public static class EvaluatingResultContainer extends XValueContainer implements XDebuggerTreeListener {
+  public static class EvaluatingResultContainer extends XValueContainer {
     private final XDebuggerEvaluationDialog myDialog;
-    private final XDebuggerTree myTree;
 
-    public EvaluatingResultContainer(final XDebuggerEvaluationDialog dialog, XDebuggerTree tree) {
+    public EvaluatingResultContainer(final XDebuggerEvaluationDialog dialog) {
       myDialog = dialog;
-      myTree = tree;
     }
 
     @Override
@@ -56,39 +51,15 @@
       myDialog.startEvaluation(new XEvaluationCallbackBase() {
         @Override
         public void evaluated(@NotNull final XValue result) {
-          myTree.addTreeListener(EvaluatingResultContainer.this);
           String name = UIUtil.removeMnemonic(XDebuggerBundle.message("xdebugger.evaluate.result"));
           node.addChildren(XValueChildrenList.singleton(name, result), true);
-          myDialog.finishEvaluation();
         }
 
         @Override
         public void errorOccurred(@NotNull final String errorMessage) {
           node.setErrorMessage(errorMessage);
-          myDialog.finishEvaluation();
         }
       });
     }
-
-    @Override
-    public void nodeLoaded(@NotNull RestorableStateNode node, String name) {
-      if (node.getParent() instanceof EvaluatingExpressionRootNode) {
-        if (node.isLeaf()) {
-          myTree.removeTreeListener(this);
-        }
-        else {
-          // cause children computing
-          node.getChildCount();
-        }
-      }
-    }
-
-    @Override
-    public void childrenLoaded(@NotNull XDebuggerTreeNode node, @NotNull List<XValueContainerNode<?>> children, boolean last) {
-      if (node.getParent() instanceof EvaluatingExpressionRootNode) {
-        myTree.removeTreeListener(this);
-        myTree.expandPath(node.getPath());
-      }
-    }
   }
 }
diff --git a/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XTestValueNode.java b/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XTestValueNode.java
index 07a667d..e1dbca4 100644
--- a/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XTestValueNode.java
+++ b/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XTestValueNode.java
@@ -1,6 +1,5 @@
 package com.intellij.xdebugger;
 
-import com.intellij.openapi.util.AsyncResult;
 import com.intellij.xdebugger.frame.XFullValueEvaluator;
 import com.intellij.xdebugger.frame.presentation.XValuePresentation;
 import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodePresentationConfigurator;
@@ -21,8 +20,6 @@
 
   private final Semaphore myFinished = new Semaphore(0);
 
-  private final AsyncResult<XTestValueNode> result = new AsyncResult<XTestValueNode>();
-
   @Override
   public void applyPresentation(@Nullable Icon icon,
                                 @NotNull XValuePresentation valuePresentation,
@@ -32,7 +29,6 @@
     myHasChildren = hasChildren;
 
     myFinished.release();
-    result.setDone(this);
   }
 
   @Override
@@ -45,11 +41,6 @@
     return false;
   }
 
-  @NotNull
-  public AsyncResult<XTestValueNode> getResult() {
-    return result;
-  }
-
   public void waitFor(long timeoutInMillis) throws InterruptedException {
     if (!XDebuggerTestUtil.waitFor(myFinished, timeoutInMillis)) {
       throw new AssertionError("Waiting timed out");
diff --git a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ByteCodeViewerComponent.java b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ByteCodeViewerComponent.java
index b13e49e..fbd2b1b 100644
--- a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ByteCodeViewerComponent.java
+++ b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ByteCodeViewerComponent.java
@@ -56,8 +56,6 @@
     EditorHighlighterFactory editorHighlighterFactory = EditorHighlighterFactory.getInstance();
     final SyntaxHighlighter syntaxHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(StdFileTypes.JAVA, project, null);
     ((EditorEx)myEditor).setHighlighter(editorHighlighterFactory.createEditorHighlighter(syntaxHighlighter, EditorColorsManager.getInstance().getGlobalScheme()));
-    ((EditorEx)myEditor).setBackgroundColor(EditorFragmentComponent.getBackgroundColor(myEditor));
-    myEditor.getColorsScheme().setColor(EditorColors.CARET_ROW_COLOR, new JBColor(Gray.xF5, Gray.x50));
     ((EditorEx)myEditor).setCaretVisible(true);
 
     final EditorSettings settings = myEditor.getSettings();
diff --git a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ShowByteCodeAction.java b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ShowByteCodeAction.java
index 9add783..39d0157 100644
--- a/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ShowByteCodeAction.java
+++ b/plugins/ByteCodeViewer/src/com/intellij/byteCodeViewer/ShowByteCodeAction.java
@@ -17,10 +17,13 @@
 
 import com.intellij.codeInsight.documentation.DocumentationManager;
 import com.intellij.codeInsight.lookup.LookupManager;
-import com.intellij.compiler.impl.TranslatingCompilerFilesMonitor;
 import com.intellij.icons.AllIcons;
-import com.intellij.openapi.actionSystem.*;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.CommonDataKeys;
+import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.compiler.CompilerManager;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.progress.ProgressManager;
@@ -39,7 +42,6 @@
 import com.intellij.psi.util.PsiUtilCore;
 import com.intellij.ui.awt.RelativePoint;
 import com.intellij.ui.popup.NotLookupOrSearchCondition;
-import com.intellij.ui.popup.PopupPositionManager;
 import com.intellij.util.Processor;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -90,8 +92,7 @@
 
       @Override
       public void run(@NotNull ProgressIndicator indicator) {
-        if (ProjectRootManager.getInstance(project).getFileIndex().isInContent(virtualFile) &&
-            TranslatingCompilerFilesMonitor.getInstance().isMarkedForCompilation(project, virtualFile)) {
+        if (ProjectRootManager.getInstance(project).getFileIndex().isInContent(virtualFile) && isMarkedForCompilation(project, virtualFile)) {
           myErrorMessage = "Unable to show byte code for '" + psiElementTitle + "'. Class file does not exist or is out-of-date.";
           myErrorTitle = "Class File Out-Of-Date";
         }
@@ -158,6 +159,11 @@
     });
   }
 
+  private static boolean isMarkedForCompilation(Project project, VirtualFile virtualFile) {
+    final CompilerManager compilerManager = CompilerManager.getInstance(project);
+    return !compilerManager.isUpToDate(compilerManager.createFilesCompileScope(new VirtualFile[]{virtualFile}));
+  }
+
   @Nullable
   private static PsiElement getPsiElement(DataContext dataContext, Project project, Editor editor) {
     PsiElement psiElement = null;
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties
index 32c7b55..04419fb 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/InspectionGadgetsBundle.properties
@@ -1297,7 +1297,7 @@
 trivial.string.concatenation.problem.descriptor=Empty string used in concatenation
 string.replace.quickfix=Replace concatenation with ''{0}''
 instantiating.object.to.get.class.object.replace.quickfix=Replace with direct class object access
-manual.array.copy.replace.quickfix=Replace with 'System.arrayCopy()'
+manual.array.copy.replace.quickfix=Replace with 'System.arraycopy()'
 manual.array.to.collection.copy.replace.quickfix=Replace with 'Collections.addAll(...,...)'
 method.may.be.static.only.option=Only check 'private' or 'final' methods
 method.may.be.static.empty.option=Ignore empty methods
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseInspection.java
index bf57d92..1b07927 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseInspection.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseInspection.java
@@ -17,6 +17,7 @@
 
 import com.intellij.codeInsight.daemon.HighlightDisplayKey;
 import com.intellij.codeInspection.BaseJavaBatchLocalInspectionTool;
+import com.intellij.codeInspection.InspectionProfileEntry;
 import com.intellij.codeInspection.LocalInspectionToolSession;
 import com.intellij.codeInspection.ProblemsHolder;
 import com.intellij.codeInspection.ex.InspectionProfileImpl;
@@ -44,9 +45,6 @@
 public abstract class BaseInspection extends BaseJavaBatchLocalInspectionTool {
   private static final Logger LOG = Logger.getInstance("#com.siyeh.ig.BaseInspection");
 
-  @NonNls private static final String INSPECTION = "Inspection";
-  @NonNls private static final String INSPECTION_BASE = "InspectionBase";
-
   private String m_shortName = null;
   private long timestamp = -1L;
 
@@ -55,14 +53,9 @@
   public String getShortName() {
     if (m_shortName == null) {
       final Class<? extends BaseInspection> aClass = getClass();
-      final String name = aClass.getName();
-      if (name.endsWith(INSPECTION)) {
-        m_shortName = name.substring(name.lastIndexOf((int)'.') + 1, name.length() - INSPECTION.length());
-      }
-      else if (name.endsWith(INSPECTION_BASE)) {
-        m_shortName = name.substring(name.lastIndexOf((int)'.') + 1, name.length() - INSPECTION_BASE.length());
-      }
-      else {
+      final String name = aClass.getSimpleName();
+      m_shortName = InspectionProfileEntry.getShortName(name);
+      if (m_shortName.equals(name)) {
         throw new AssertionError("class name must end with 'Inspection' to correctly calculate the short name: " + name);
       }
     }
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/CollectionQueryCalledVisitor.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/CollectionQueryCalledVisitor.java
deleted file mode 100644
index 688dd99..0000000
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/CollectionQueryCalledVisitor.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright 2003-2014 Dave Griffith, Bas Leijdekkers
- *
- * 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.siyeh.ig.bugs;
-
-import com.intellij.psi.*;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Set;
-
-class CollectionQueryCalledVisitor extends JavaRecursiveElementVisitor {
-
-  @NonNls private final Set<String> queryNames;
-
-  private boolean queried = false;
-  private final PsiVariable variable;
-
-  CollectionQueryCalledVisitor(PsiVariable variable, Set<String> queryNames) {
-    this.variable = variable;
-    this.queryNames = queryNames;
-  }
-
-  @Override
-  public void visitElement(@NotNull PsiElement element) {
-    if (!queried) {
-      super.visitElement(element);
-    }
-  }
-
-  @Override
-  public void visitForeachStatement(
-    @NotNull PsiForeachStatement statement) {
-    if (queried) {
-      return;
-    }
-    super.visitForeachStatement(statement);
-    final PsiExpression qualifier = statement.getIteratedValue();
-    checkExpression(qualifier);
-  }
-
-  @Override
-  public void visitMethodCallExpression(
-    @NotNull PsiMethodCallExpression call) {
-    if (queried) {
-      return;
-    }
-    super.visitMethodCallExpression(call);
-    final PsiReferenceExpression methodExpression =
-      call.getMethodExpression();
-    final boolean isStatement =
-      call.getParent() instanceof PsiExpressionStatement;
-    if (isStatement) {
-      final String methodName = methodExpression.getReferenceName();
-      if (methodName == null) {
-        return;
-      }
-      if (!queryNames.contains(methodName)) {
-        boolean found = false;
-        for (String queryName : queryNames) {
-          if (methodName.startsWith(queryName)) {
-            found = true;
-            break;
-          }
-        }
-        if (!found) {
-          return;
-        }
-      }
-    }
-    final PsiExpression qualifier =
-      methodExpression.getQualifierExpression();
-    checkExpression(qualifier);
-  }
-
-
-  @Override
-  public void visitMethodReferenceExpression(PsiMethodReferenceExpression expression) {
-    if (queried) return;
-    final String methodName = expression.getReferenceName();
-    if (methodName == null) {
-      return;
-    }
-    checkExpression(expression.getQualifierExpression());
-  }
-
-  private void checkExpression(PsiExpression expression) {
-    if (queried) {
-      return;
-    }
-    if (expression instanceof PsiReferenceExpression) {
-      final PsiReferenceExpression referenceExpression =
-        (PsiReferenceExpression)expression;
-      final PsiElement referent = referenceExpression.resolve();
-      if (referent == null) {
-        return;
-      }
-      if (referent.equals(variable)) {
-        queried = true;
-      }
-    }
-    else if (expression instanceof PsiParenthesizedExpression) {
-      final PsiParenthesizedExpression parenthesizedExpression =
-        (PsiParenthesizedExpression)expression;
-      checkExpression(parenthesizedExpression.getExpression());
-    }
-    else if (expression instanceof PsiConditionalExpression) {
-      final PsiConditionalExpression conditionalExpression =
-        (PsiConditionalExpression)expression;
-      final PsiExpression thenExpression =
-        conditionalExpression.getThenExpression();
-      checkExpression(thenExpression);
-      final PsiExpression elseExpression =
-        conditionalExpression.getElseExpression();
-      checkExpression(elseExpression);
-    }
-  }
-
-  public boolean isQueried() {
-    return queried;
-  }
-}
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/CollectionQueryUpdateCalledVisitor.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/CollectionQueryUpdateCalledVisitor.java
new file mode 100644
index 0000000..3de34fb
--- /dev/null
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/CollectionQueryUpdateCalledVisitor.java
@@ -0,0 +1,250 @@
+/*
+ * Copyright 2003-2014 Dave Griffith, Bas Leijdekkers
+ *
+ * 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.siyeh.ig.bugs;
+
+import com.intellij.psi.*;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.util.containers.ContainerUtil;
+import com.siyeh.ig.psiutils.ExpectedTypeUtils;
+import com.siyeh.ig.psiutils.ParenthesesUtils;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+class CollectionQueryUpdateCalledVisitor extends JavaRecursiveElementVisitor {
+
+  private static final HashSet<String> COLLECTIONS_QUERIES =
+    ContainerUtil.newHashSet("binarySearch", "disjoint", "frequency", "indexOfSubList", "lastIndexOfSubList", "max", "min", "nCopies",
+                             "unmodifiableList", "unmodifiableMap", "unmodifiableNavigableMap", "unmodifiableNavigableSet",
+                             "unmodifiableSet", "unmodifiableSortedMap", "unmodifiableSortedSet");
+
+  private static final HashSet<String> COLLECTIONS_TRANSFORMS =
+    ContainerUtil.newHashSet("asLifoQueue", "checkedCollection", "checkedList", "checkedMap", "checkedNavigableMap", "checkedNavigableSet",
+                             "checkedQueue", "checkedSet", "checkedSortedMap", "checkedSortedSet", "enumeration", "newSetFromMap",
+                             "synchronizedCollection", "singleton", "singletonList", "singletonMap", "singletonSpliterator",
+                             "synchronizedList", "synchronizedMap", "synchronizedNavigableMap", "synchronizedNavigableSet",
+                             "synchronizedSet", "synchronizedSortedMap", "synchronizedSortedSet", "unmodifiableCollection");
+
+  @NonNls private final Set<String> myQueryUpdateNames;
+  private final boolean myCheckForQuery;
+
+  private boolean myQueriedUpdated = false;
+  private final PsiVariable variable;
+
+  CollectionQueryUpdateCalledVisitor(@Nullable PsiVariable variable, Set<String> queryUpdateNames, boolean checkForQuery) {
+    this.variable = variable;
+    myQueryUpdateNames = queryUpdateNames;
+    myCheckForQuery = checkForQuery;
+  }
+
+  @Override
+  public void visitElement(@NotNull PsiElement element) {
+    if (!myQueriedUpdated) {
+      super.visitElement(element);
+    }
+  }
+
+  @Override
+  public void visitReferenceExpression(PsiReferenceExpression expression) {
+    super.visitReferenceExpression(expression);
+    final PsiElement parent = ParenthesesUtils.getParentSkipParentheses(expression);
+    if (!(parent instanceof PsiExpressionList)) {
+      return;
+    }
+    final PsiExpressionList expressionList = (PsiExpressionList)parent;
+    final PsiElement grandParent = expressionList.getParent();
+    if (!(grandParent instanceof PsiMethodCallExpression)) {
+      return;
+    }
+    final PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression)grandParent;
+    final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression();
+    final String name = methodExpression.getReferenceName();
+    if (myCheckForQuery) {
+      if (COLLECTIONS_QUERIES.contains(name) || COLLECTIONS_TRANSFORMS.contains(name)) {
+        if (methodCallExpression.getParent() instanceof PsiExpressionStatement) {
+          return;
+        }
+      }
+      else if ("addAll".equals(name) || "copy".equals(name) || "fill".equals(name) || "replaceAll".equals(name)) {
+        final PsiExpression[] arguments = expressionList.getExpressions();
+        if (arguments.length < 2 || PsiTreeUtil.isAncestor(arguments[0], expression, false)) {
+          return;
+        }
+      }
+      else {
+        return;
+      }
+    }
+    else {
+      if ("addAll".equals(name) || "fill".equals(name) || "copy".equals(name) || "replaceAll".equals(name)) {
+        if (!PsiTreeUtil.isAncestor(expressionList.getExpressions()[0], expression, false)) {
+          return;
+        }
+      }
+      else if (COLLECTIONS_TRANSFORMS.contains(name)) {
+        if (methodCallExpression.getParent() instanceof PsiExpressionStatement) {
+          return;
+        }
+      }
+      else {
+        return;
+      }
+    }
+    final PsiMethod method = methodCallExpression.resolveMethod();
+    if (method == null) {
+      return;
+    }
+    final PsiClass aClass = method.getContainingClass();
+    if (aClass == null) {
+      return;
+    }
+    final String qualifiedName = aClass.getQualifiedName();
+    if (!"java.util.Collections".equals(qualifiedName)) {
+      return;
+    }
+    checkExpression(expression);
+  }
+
+  @Override
+  public void visitForeachStatement(@NotNull PsiForeachStatement statement) {
+    super.visitForeachStatement(statement);
+    if (myQueriedUpdated || !myCheckForQuery) {
+      return;
+    }
+    final PsiExpression qualifier = statement.getIteratedValue();
+    checkExpression(qualifier);
+  }
+
+  @Override
+  public void visitMethodReferenceExpression(PsiMethodReferenceExpression expression) {
+    super.visitMethodReferenceExpression(expression);
+    if (myQueriedUpdated) {
+      return;
+    }
+    final String methodName = expression.getReferenceName();
+    if (!isQueryUpdateMethodName(methodName)) {
+      if (myCheckForQuery) {
+        final PsiElement target = expression.resolve();
+        if (!(target instanceof PsiMethod)) {
+          return;
+        }
+        final PsiMethod method = (PsiMethod)target;
+        final PsiType returnType = method.getReturnType();
+        if (PsiType.VOID.equals(returnType)) {
+          return;
+        }
+        final PsiType expectedType = ExpectedTypeUtils.findExpectedType(expression, false);
+        if (!(expectedType instanceof PsiClassType)) {
+          return;
+        }
+        final PsiClassType classType = (PsiClassType)expectedType;
+        final PsiClass aClass = classType.resolve();
+        if (aClass == null || LambdaHighlightingUtil.checkInterfaceFunctional(aClass) != null) {
+          return;
+        }
+        final List<HierarchicalMethodSignature> candidates = LambdaUtil.findFunctionCandidates(aClass);
+        if (candidates == null || candidates.size() != 1) {
+          return;
+        }
+        final HierarchicalMethodSignature signature = candidates.get(0);
+        final PsiMethod functionalMethod = signature.getMethod();
+        if (PsiType.VOID.equals(functionalMethod.getReturnType())) {
+          return;
+        }
+      }
+      else {
+        return;
+      }
+    }
+    checkExpression(expression.getQualifierExpression());
+  }
+
+  @Override
+  public void visitMethodCallExpression(@NotNull PsiMethodCallExpression call) {
+    if (myQueriedUpdated) {
+      return;
+    }
+    super.visitMethodCallExpression(call);
+    final PsiReferenceExpression methodExpression =
+      call.getMethodExpression();
+    final boolean isStatement = call.getParent() instanceof PsiExpressionStatement;
+    if ((!myCheckForQuery || isStatement) && !isQueryUpdateMethodName(methodExpression.getReferenceName())) {
+      return;
+    }
+    final PsiExpression qualifier = methodExpression.getQualifierExpression();
+    checkExpression(qualifier);
+  }
+
+  private boolean isQueryUpdateMethodName(String methodName) {
+    if (methodName == null) {
+      return false;
+    }
+    if (myQueryUpdateNames.contains(methodName)) {
+      return true;
+    }
+    for (String updateName : myQueryUpdateNames) {
+      if (methodName.startsWith(updateName)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  private void checkExpression(PsiExpression expression) {
+    if (myQueriedUpdated) {
+      return;
+    }
+    if (variable != null && expression instanceof PsiReferenceExpression) {
+      final PsiReferenceExpression referenceExpression =
+        (PsiReferenceExpression)expression;
+      final PsiElement referent = referenceExpression.resolve();
+      if (referent == null) {
+        return;
+      }
+      if (referent.equals(variable)) {
+        myQueriedUpdated = true;
+      }
+    }
+    else if (expression instanceof PsiParenthesizedExpression) {
+      final PsiParenthesizedExpression parenthesizedExpression =
+        (PsiParenthesizedExpression)expression;
+      checkExpression(parenthesizedExpression.getExpression());
+    }
+    else if (expression instanceof PsiConditionalExpression) {
+      final PsiConditionalExpression conditionalExpression =
+        (PsiConditionalExpression)expression;
+      final PsiExpression thenExpression =
+        conditionalExpression.getThenExpression();
+      checkExpression(thenExpression);
+      final PsiExpression elseExpression =
+        conditionalExpression.getElseExpression();
+      checkExpression(elseExpression);
+    }
+    else if (variable == null) {
+      if (expression == null || expression instanceof PsiThisExpression || expression instanceof PsiSuperExpression) {
+        myQueriedUpdated = true;
+      }
+    }
+  }
+
+  public boolean isQueriedUpdated() {
+    return myQueriedUpdated;
+  }
+}
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/CollectionUpdateCalledVisitor.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/CollectionUpdateCalledVisitor.java
deleted file mode 100644
index a118b14..0000000
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/CollectionUpdateCalledVisitor.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright 2003-2011 Dave Griffith, Bas Leijdekkers
- *
- * 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.siyeh.ig.bugs;
-
-import com.intellij.psi.*;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Set;
-
-class CollectionUpdateCalledVisitor extends JavaRecursiveElementVisitor {
-
-  @NonNls private final Set<String> updateNames;
-
-  private boolean updated = false;
-  private final PsiVariable variable;
-
-  CollectionUpdateCalledVisitor(@Nullable PsiVariable variable, Set<String> updateNames) {
-    this.variable = variable;
-    this.updateNames = updateNames;
-  }
-
-  @Override
-  public void visitElement(@NotNull PsiElement element) {
-    if (!updated) {
-      super.visitElement(element);
-    }
-  }
-
-  @Override
-  public void visitMethodReferenceExpression(PsiMethodReferenceExpression expression) {
-    super.visitMethodReferenceExpression(expression);
-    if (updated) return;
-    final String methodName = expression.getReferenceName();
-    if (checkMethodName(methodName)) return;
-    checkQualifier(expression.getQualifierExpression());
-  }
-
-  @Override
-  public void visitMethodCallExpression(
-    @NotNull PsiMethodCallExpression call) {
-    super.visitMethodCallExpression(call);
-    if (updated) {
-      return;
-    }
-    final PsiReferenceExpression methodExpression =
-      call.getMethodExpression();
-    final String methodName = methodExpression.getReferenceName();
-    if (checkMethodName(methodName)) return;
-    final PsiExpression qualifier = methodExpression.getQualifierExpression();
-    checkQualifier(qualifier);
-  }
-
-  private boolean checkMethodName(String methodName) {
-    if (methodName == null) {
-      return true;
-    }
-    if (!updateNames.contains(methodName)) {
-      boolean found = false;
-      for (String updateName : updateNames) {
-        if (!methodName.startsWith(updateName)) {
-          continue;
-        }
-        found = true;
-        break;
-      }
-      if (!found) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  private void checkQualifier(PsiExpression expression) {
-    if (updated) {
-      return;
-    }
-    if (variable != null && expression instanceof PsiReferenceExpression) {
-      final PsiReferenceExpression referenceExpression =
-        (PsiReferenceExpression)expression;
-      final PsiElement referent = referenceExpression.resolve();
-      if (referent == null) {
-        return;
-      }
-      if (referent.equals(variable)) {
-        updated = true;
-      }
-    }
-    else if (expression instanceof PsiParenthesizedExpression) {
-      final PsiParenthesizedExpression parenthesizedExpression =
-        (PsiParenthesizedExpression)expression;
-      checkQualifier(parenthesizedExpression.getExpression());
-    }
-    else if (expression instanceof PsiConditionalExpression) {
-      final PsiConditionalExpression conditionalExpression =
-        (PsiConditionalExpression)expression;
-      final PsiExpression thenExpression =
-        conditionalExpression.getThenExpression();
-      checkQualifier(thenExpression);
-      final PsiExpression elseExpression =
-        conditionalExpression.getElseExpression();
-      checkQualifier(elseExpression);
-    }
-    else if (variable == null) {
-      if (expression == null || expression instanceof PsiThisExpression || expression instanceof PsiSuperExpression) {
-        updated = true;
-      }
-    }
-  }
-
-  public boolean isUpdated() {
-    return updated;
-  }
-}
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/MismatchedCollectionQueryUpdateInspectionBase.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/MismatchedCollectionQueryUpdateInspectionBase.java
index 4444710..147117c 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/MismatchedCollectionQueryUpdateInspectionBase.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/bugs/MismatchedCollectionQueryUpdateInspectionBase.java
@@ -29,10 +29,21 @@
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
 public class MismatchedCollectionQueryUpdateInspectionBase extends BaseInspection {
+  private static final Set<String> QUERY_EXCLUDES = Collections.singleton("java.util.Collections");
+  private static final Set<String> UPDATE_EXCLUDES = new HashSet<String>(CollectionUtils.getAllCollectionNames());
+  static {
+    UPDATE_EXCLUDES.add("java.util.Collections");
+  }
+
   @SuppressWarnings({"PublicField"})
   public final ExternalizableStringSet queryNames =
-    new ExternalizableStringSet("copyInto", "drainTo", "propertyNames", "save", "store", "write", "forEach", "replaceAll");
+    new ExternalizableStringSet("copyInto", "drainTo", "parallelStream", "propertyNames", "save", "store", "stream", "write", "forEach",
+                                "replaceAll");
   @SuppressWarnings({"PublicField"})
   public final ExternalizableStringSet updateNames =
     new ExternalizableStringSet("add", "clear", "drainTo", "insert", "load", "offer", "poll", "push", "put", "remove", "replace",
@@ -225,7 +236,7 @@
     }
 
     private boolean collectionContentsAreUpdated(PsiVariable variable, PsiElement context) {
-      if (VariableAccessUtils.variableIsPassedAsMethodArgument(variable, CollectionUtils.getAllCollectionNames(), context) ||
+      if (VariableAccessUtils.variableIsPassedAsMethodArgument(variable, UPDATE_EXCLUDES, context) ||
           collectionUpdateCalled(variable, context)) {
         return true;
       }
@@ -251,7 +262,8 @@
     }
 
     private boolean collectionContentsAreQueried(PsiVariable variable, PsiElement context) {
-      if (VariableAccessUtils.variableIsPassedAsMethodArgument(variable, context) || collectionQueryCalled(variable, context)) {
+      if (VariableAccessUtils.variableIsPassedAsMethodArgument(variable, QUERY_EXCLUDES, context) ||
+          collectionQueryCalled(variable, context)) {
         return true;
       }
       final PsiExpression initializer = variable.getInitializer();
@@ -262,15 +274,15 @@
     }
 
     private boolean collectionQueryCalled(PsiVariable variable, PsiElement context) {
-      final CollectionQueryCalledVisitor visitor = new CollectionQueryCalledVisitor(variable, queryNames);
+      final CollectionQueryUpdateCalledVisitor visitor = new CollectionQueryUpdateCalledVisitor(variable, queryNames, true);
       context.accept(visitor);
-      return visitor.isQueried();
+      return visitor.isQueriedUpdated();
     }
 
     private boolean collectionUpdateCalled(@Nullable PsiVariable variable, PsiElement context) {
-      final CollectionUpdateCalledVisitor visitor = new CollectionUpdateCalledVisitor(variable, updateNames);
+      final CollectionQueryUpdateCalledVisitor visitor = new CollectionQueryUpdateCalledVisitor(variable, updateNames, false);
       context.accept(visitor);
-      return visitor.isUpdated();
+      return visitor.isQueriedUpdated();
     }
   }
 }
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/errorhandling/NewExceptionWithoutArgumentsInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/errorhandling/NewExceptionWithoutArgumentsInspection.java
index 7355df3..c50e4dd 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/errorhandling/NewExceptionWithoutArgumentsInspection.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/errorhandling/NewExceptionWithoutArgumentsInspection.java
@@ -28,7 +28,8 @@
 
 public class NewExceptionWithoutArgumentsInspection extends BaseInspection {
 
-  @SuppressWarnings("PublicField")
+  @Deprecated
+  @SuppressWarnings({"PublicField", "UnusedDeclaration"})
   public boolean ignoreWithoutParameters = false;
 
   @Nls
@@ -45,12 +46,6 @@
   }
 
   @Override
-  public JComponent createOptionsPanel() {
-    return new SingleCheckboxOptionsPanel(InspectionGadgetsBundle.message("new.exception.without.arguments.ignore.option"), this,
-                                          "ignoreWithoutParameters");
-  }
-
-  @Override
   public BaseInspectionVisitor buildVisitor() {
     return new NewExceptionWithoutArgumentsVisitor();
   }
@@ -80,10 +75,9 @@
       if (!InheritanceUtil.isInheritor(aClass, CommonClassNames.JAVA_LANG_EXCEPTION)) {
         return;
       }
-      if (ignoreWithoutParameters) {
-        if (!hasAccessibleConstructorWithParameters(aClass, expression)) return;
+      if (hasAccessibleConstructorWithParameters(aClass, expression)) {
+        registerNewExpressionError(expression);
       }
-      registerNewExpressionError(expression);
     }
 
     private boolean hasAccessibleConstructorWithParameters(PsiClass aClass, PsiElement context) {
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/fixes/ChangeModifierFix.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/fixes/ChangeModifierFix.java
index 8e3bf79..0e114ab 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/fixes/ChangeModifierFix.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/fixes/ChangeModifierFix.java
@@ -29,18 +29,12 @@
 import org.jetbrains.annotations.NotNull;
 
 public class ChangeModifierFix extends InspectionGadgetsFix {
+  public static final String FAMILY_NAME = "Change modifier";
 
   @PsiModifier.ModifierConstant private final String modifierText;
-  private final String[] incompatibleModifiers;
 
   public ChangeModifierFix(@NonNls @PsiModifier.ModifierConstant String modifierText) {
     this.modifierText = modifierText;
-    this.incompatibleModifiers = null;
-  }
-
-  public ChangeModifierFix(String modifierText, String... incompatibleModifiers) {
-    this.modifierText = modifierText;
-    this.incompatibleModifiers = incompatibleModifiers;
   }
 
   @Override
@@ -53,7 +47,7 @@
   @NotNull
   @Override
   public String getFamilyName() {
-    return "Change modifier";
+    return FAMILY_NAME;
   }
 
   @Override
@@ -70,10 +64,5 @@
       return;
     }
     modifiers.setModifierProperty(modifierText, true);
-    if (incompatibleModifiers != null) {
-      for (String modifier : incompatibleModifiers) {
-        modifiers.setModifierProperty(modifier, false);
-      }
-    }
   }
 }
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/MethodMayBeStaticInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/MethodMayBeStaticInspection.java
deleted file mode 100644
index ab8934e..0000000
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/MethodMayBeStaticInspection.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright 2003-2013 Dave Griffith, Bas Leijdekkers
- *
- * 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.siyeh.ig.performance;
-
-import com.intellij.codeInspection.InspectionManager;
-import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel;
-import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.util.WriteExternalException;
-import com.intellij.psi.*;
-import com.intellij.psi.search.searches.ClassInheritorsSearch;
-import com.intellij.util.Processor;
-import com.intellij.util.Query;
-import com.siyeh.InspectionGadgetsBundle;
-import com.siyeh.ig.BaseInspection;
-import com.siyeh.ig.BaseInspectionVisitor;
-import com.siyeh.ig.InspectionGadgetsFix;
-import com.siyeh.ig.fixes.ChangeModifierFix;
-import com.siyeh.ig.psiutils.ClassUtils;
-import com.siyeh.ig.psiutils.MethodUtils;
-import com.siyeh.ig.psiutils.SerializationUtils;
-import org.jdom.Element;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-import java.util.concurrent.atomic.AtomicInteger;
-
-public class MethodMayBeStaticInspection extends BaseInspection {
-
-  private static final String IGNORE_DEFAULT_METHODS_ATTR_NAME = "m_ignoreDefaultMethods";
-  private static final String ONLY_PRIVATE_OR_FINAL_ATTR_NAME = "m_onlyPrivateOrFinal";
-  private static final String IGNORE_EMPTY_METHODS_ATTR_NAME = "m_ignoreEmptyMethods";
-  /**
-   * @noinspection PublicField
-   */
-  public boolean m_onlyPrivateOrFinal = false;
-  /**
-   * @noinspection PublicField
-   */
-  public boolean m_ignoreEmptyMethods = true;
-  public boolean m_ignoreDefaultMethods = true;
-
-  @Override
-  @NotNull
-  public String getDisplayName() {
-    return InspectionGadgetsBundle.message("method.may.be.static.display.name");
-  }
-
-  @Override
-  @NotNull
-  protected String buildErrorString(Object... infos) {
-    return InspectionGadgetsBundle.message("method.may.be.static.problem.descriptor");
-  }
-
-  @Override
-  protected InspectionGadgetsFix buildFix(Object... infos) {
-    return new ChangeModifierFix(PsiModifier.STATIC, PsiModifier.DEFAULT);
-  }
-
-  @Override
-  public JComponent createOptionsPanel() {
-    final MultipleCheckboxOptionsPanel optionsPanel = new MultipleCheckboxOptionsPanel(this);
-    optionsPanel.addCheckbox(InspectionGadgetsBundle.message("method.may.be.static.only.option"), ONLY_PRIVATE_OR_FINAL_ATTR_NAME);
-    optionsPanel.addCheckbox(InspectionGadgetsBundle.message("method.may.be.static.empty.option"), IGNORE_EMPTY_METHODS_ATTR_NAME);
-    optionsPanel.addCheckbox("Ignore default methods", IGNORE_DEFAULT_METHODS_ATTR_NAME);
-    return optionsPanel;
-  }
-
-  @Override
-  public BaseInspectionVisitor buildVisitor() {
-    return new MethodCanBeStaticVisitor();
-  }
-
-  @Override
-  public void writeSettings(@NotNull Element node) throws WriteExternalException {
-    node.addContent(new Element("option").setAttribute("name", ONLY_PRIVATE_OR_FINAL_ATTR_NAME).setAttribute("value", String.valueOf(m_onlyPrivateOrFinal)));
-    node.addContent(new Element("option").setAttribute("name", IGNORE_EMPTY_METHODS_ATTR_NAME).setAttribute("value", String.valueOf(
-      m_ignoreEmptyMethods)));
-    if (!m_ignoreDefaultMethods) {
-      node.addContent(new Element("option").setAttribute("name", IGNORE_DEFAULT_METHODS_ATTR_NAME).setAttribute("value", "false"));
-    }
-  }
-
-  private class MethodCanBeStaticVisitor extends BaseInspectionVisitor {
-
-    @Override
-    public void visitMethod(@NotNull PsiMethod method) {
-      super.visitMethod(method);
-      if (method.hasModifierProperty(PsiModifier.STATIC) ||
-          method.hasModifierProperty(PsiModifier.ABSTRACT) ||
-          method.hasModifierProperty(PsiModifier.SYNCHRONIZED) ||
-          method.hasModifierProperty(PsiModifier.NATIVE)) {
-        return;
-      }
-      if (method.isConstructor() || method.getNameIdentifier() == null) {
-        return;
-      }
-      if (m_ignoreDefaultMethods && method.hasModifierProperty(PsiModifier.DEFAULT)) {
-        return;
-      }
-      if (m_ignoreEmptyMethods && MethodUtils.isEmpty(method)) {
-        return;
-      }
-      final PsiClass containingClass = ClassUtils.getContainingClass(method);
-      if (containingClass == null) {
-        return;
-      }
-      final Condition<PsiElement>[] addins = InspectionManager.CANT_BE_STATIC_EXTENSION.getExtensions();
-      for (Condition<PsiElement> addin : addins) {
-        if (addin.value(method)) {
-          return;
-        }
-      }
-      final PsiElement scope = containingClass.getScope();
-      if (!(scope instanceof PsiJavaFile) && !containingClass.hasModifierProperty(PsiModifier.STATIC) && !containingClass.isInterface()) {
-        return;
-      }
-      if (m_onlyPrivateOrFinal && !method.hasModifierProperty(PsiModifier.FINAL) && !method.hasModifierProperty(PsiModifier.PRIVATE)) {
-        return;
-      }
-      if (isExcluded(method) || MethodUtils.hasSuper(method) || MethodUtils.isOverridden(method)) {
-        return;
-      }
-      if (implementsSurprisingInterface(method)) {
-        return;
-      }
-      final MethodReferenceVisitor visitor = new MethodReferenceVisitor(method);
-      method.accept(visitor);
-      if (!visitor.areReferencesStaticallyAccessible()) {
-        return;
-      }
-      registerMethodError(method);
-    }
-
-    private boolean implementsSurprisingInterface(final PsiMethod method) {
-      final PsiClass containingClass = method.getContainingClass();
-      if (containingClass == null) {
-        return false;
-      }
-      final Query<PsiClass> search = ClassInheritorsSearch.search(containingClass, method.getUseScope(), true, true, false);
-      final boolean[] result = new boolean[1];
-      search.forEach(new Processor<PsiClass>() {
-        AtomicInteger count = new AtomicInteger(0);
-
-        @Override
-        public boolean process(PsiClass subClass) {
-          if (count.incrementAndGet() > 5) {
-            result[0] = true;
-            return false;
-          }
-          final PsiReferenceList list = subClass.getImplementsList();
-          if (list == null) {
-            return true;
-          }
-          final PsiJavaCodeReferenceElement[] referenceElements = list.getReferenceElements();
-          for (PsiJavaCodeReferenceElement referenceElement : referenceElements) {
-            final PsiElement target = referenceElement.resolve();
-            if (!(target instanceof PsiClass)) {
-              result[0] = true;
-              return false;
-            }
-            final PsiClass aClass = (PsiClass)target;
-            if (!aClass.isInterface()) {
-              result[0] = true;
-              return false;
-            }
-            if (aClass.findMethodBySignature(method, true) != null) {
-              result[0] = true;
-              return false;
-            }
-          }
-          return true;
-        }
-      });
-      return result[0];
-    }
-
-    private boolean isExcluded(PsiMethod method) {
-      return SerializationUtils.isWriteObject(method) || SerializationUtils.isReadObject(method) ||
-             SerializationUtils.isWriteReplace(method) || SerializationUtils.isReadResolve(method);
-    }
-  }
-}
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ControlFlowUtils.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ControlFlowUtils.java
index 3741d26..67546e0 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ControlFlowUtils.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ControlFlowUtils.java
@@ -321,7 +321,7 @@
   public static boolean isInFinallyBlock(@NotNull PsiElement element) {
     PsiElement currentElement = element;
     while (true) {
-      final PsiTryStatement tryStatement = PsiTreeUtil.getParentOfType(currentElement, PsiTryStatement.class, true, PsiClass.class);
+      final PsiTryStatement tryStatement = PsiTreeUtil.getParentOfType(currentElement, PsiTryStatement.class, true, PsiClass.class, PsiLambdaExpression.class);
       if (tryStatement == null) {
         return false;
       }
diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/performance/MethodMayBeStaticInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/performance/MethodMayBeStaticInspection.java
new file mode 100644
index 0000000..e73b6cc
--- /dev/null
+++ b/plugins/InspectionGadgets/src/com/siyeh/ig/performance/MethodMayBeStaticInspection.java
@@ -0,0 +1,224 @@
+/*
+ * Copyright 2003-2013 Dave Griffith, Bas Leijdekkers
+ *
+ * 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.siyeh.ig.performance;
+
+import com.intellij.codeInspection.InspectionManager;
+import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.util.WriteExternalException;
+import com.intellij.psi.*;
+import com.intellij.psi.search.searches.ClassInheritorsSearch;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.refactoring.makeStatic.MakeMethodStaticProcessor;
+import com.intellij.refactoring.makeStatic.Settings;
+import com.intellij.util.Processor;
+import com.intellij.util.Query;
+import com.siyeh.InspectionGadgetsBundle;
+import com.siyeh.ig.BaseInspection;
+import com.siyeh.ig.BaseInspectionVisitor;
+import com.siyeh.ig.InspectionGadgetsFix;
+import com.siyeh.ig.fixes.ChangeModifierFix;
+import com.siyeh.ig.psiutils.ClassUtils;
+import com.siyeh.ig.psiutils.MethodUtils;
+import com.siyeh.ig.psiutils.SerializationUtils;
+import org.jdom.Element;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class MethodMayBeStaticInspection extends BaseInspection {
+
+  private static final String IGNORE_DEFAULT_METHODS_ATTR_NAME = "m_ignoreDefaultMethods";
+  private static final String ONLY_PRIVATE_OR_FINAL_ATTR_NAME = "m_onlyPrivateOrFinal";
+  private static final String IGNORE_EMPTY_METHODS_ATTR_NAME = "m_ignoreEmptyMethods";
+  private static final String REPLACE_QUALIFIER_ATTR_NAME = "m_replaceQualifier";
+  /**
+   * @noinspection PublicField
+   */
+  public boolean m_onlyPrivateOrFinal = false;
+  /**
+   * @noinspection PublicField
+   */
+  public boolean m_ignoreEmptyMethods = true;
+  public boolean m_ignoreDefaultMethods = true;
+  public boolean m_replaceQualifier = true;
+
+  @Override
+  @NotNull
+  public String getDisplayName() {
+    return InspectionGadgetsBundle.message("method.may.be.static.display.name");
+  }
+
+  @Override
+  @NotNull
+  protected String buildErrorString(Object... infos) {
+    return InspectionGadgetsBundle.message("method.may.be.static.problem.descriptor");
+  }
+
+  @Override
+  protected InspectionGadgetsFix buildFix(Object... infos) {
+    return new InspectionGadgetsFix() {
+      @Override
+      public void doFix(Project project, ProblemDescriptor descriptor) {
+        final PsiMethod element = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), PsiMethod.class);
+        new MakeMethodStaticProcessor(element.getProject(), element, new Settings(m_replaceQualifier, null, null)).run();
+      }
+
+      @Override
+      @NotNull
+      public String getName() {
+        return InspectionGadgetsBundle.message("change.modifier.quickfix", PsiModifier.STATIC);
+      }
+
+      @NotNull
+      @Override
+      public String getFamilyName() {
+        return ChangeModifierFix.FAMILY_NAME;
+      }
+    };
+  }
+
+  @Override
+  public JComponent createOptionsPanel() {
+    final MultipleCheckboxOptionsPanel optionsPanel = new MultipleCheckboxOptionsPanel(this);
+    optionsPanel.addCheckbox(InspectionGadgetsBundle.message("method.may.be.static.only.option"), ONLY_PRIVATE_OR_FINAL_ATTR_NAME);
+    optionsPanel.addCheckbox(InspectionGadgetsBundle.message("method.may.be.static.empty.option"), IGNORE_EMPTY_METHODS_ATTR_NAME);
+    optionsPanel.addCheckbox("Ignore default methods", IGNORE_DEFAULT_METHODS_ATTR_NAME);
+    optionsPanel.addCheckbox("Replace qualifier by class name", REPLACE_QUALIFIER_ATTR_NAME);
+    return optionsPanel;
+  }
+
+  @Override
+  public BaseInspectionVisitor buildVisitor() {
+    return new MethodCanBeStaticVisitor();
+  }
+
+  @Override
+  public void writeSettings(@NotNull Element node) throws WriteExternalException {
+    node.addContent(new Element("option").setAttribute("name", ONLY_PRIVATE_OR_FINAL_ATTR_NAME).setAttribute("value", String.valueOf(m_onlyPrivateOrFinal)));
+    node.addContent(new Element("option").setAttribute("name", IGNORE_EMPTY_METHODS_ATTR_NAME).setAttribute("value", String.valueOf(
+      m_ignoreEmptyMethods)));
+    if (!m_ignoreDefaultMethods) {
+      node.addContent(new Element("option").setAttribute("name", IGNORE_DEFAULT_METHODS_ATTR_NAME).setAttribute("value", "false"));
+    }
+    if (!m_replaceQualifier) {
+      node.addContent(new Element("option").setAttribute("name", REPLACE_QUALIFIER_ATTR_NAME).setAttribute("value", "false"));
+    }
+  }
+
+  private class MethodCanBeStaticVisitor extends BaseInspectionVisitor {
+
+    @Override
+    public void visitMethod(@NotNull PsiMethod method) {
+      super.visitMethod(method);
+      if (method.hasModifierProperty(PsiModifier.STATIC) ||
+          method.hasModifierProperty(PsiModifier.ABSTRACT) ||
+          method.hasModifierProperty(PsiModifier.SYNCHRONIZED) ||
+          method.hasModifierProperty(PsiModifier.NATIVE)) {
+        return;
+      }
+      if (method.isConstructor() || method.getNameIdentifier() == null) {
+        return;
+      }
+      if (m_ignoreDefaultMethods && method.hasModifierProperty(PsiModifier.DEFAULT)) {
+        return;
+      }
+      if (m_ignoreEmptyMethods && MethodUtils.isEmpty(method)) {
+        return;
+      }
+      final PsiClass containingClass = ClassUtils.getContainingClass(method);
+      if (containingClass == null) {
+        return;
+      }
+      final Condition<PsiElement>[] addins = InspectionManager.CANT_BE_STATIC_EXTENSION.getExtensions();
+      for (Condition<PsiElement> addin : addins) {
+        if (addin.value(method)) {
+          return;
+        }
+      }
+      final PsiElement scope = containingClass.getScope();
+      if (!(scope instanceof PsiJavaFile) && !containingClass.hasModifierProperty(PsiModifier.STATIC) && !containingClass.isInterface()) {
+        return;
+      }
+      if (m_onlyPrivateOrFinal && !method.hasModifierProperty(PsiModifier.FINAL) && !method.hasModifierProperty(PsiModifier.PRIVATE)) {
+        return;
+      }
+      if (isExcluded(method) || MethodUtils.hasSuper(method) || MethodUtils.isOverridden(method)) {
+        return;
+      }
+      if (implementsSurprisingInterface(method)) {
+        return;
+      }
+      final MethodReferenceVisitor visitor = new MethodReferenceVisitor(method);
+      method.accept(visitor);
+      if (!visitor.areReferencesStaticallyAccessible()) {
+        return;
+      }
+      registerMethodError(method);
+    }
+
+    private boolean implementsSurprisingInterface(final PsiMethod method) {
+      final PsiClass containingClass = method.getContainingClass();
+      if (containingClass == null) {
+        return false;
+      }
+      final Query<PsiClass> search = ClassInheritorsSearch.search(containingClass, method.getUseScope(), true, true, false);
+      final boolean[] result = new boolean[1];
+      search.forEach(new Processor<PsiClass>() {
+        AtomicInteger count = new AtomicInteger(0);
+
+        @Override
+        public boolean process(PsiClass subClass) {
+          if (count.incrementAndGet() > 5) {
+            result[0] = true;
+            return false;
+          }
+          final PsiReferenceList list = subClass.getImplementsList();
+          if (list == null) {
+            return true;
+          }
+          final PsiJavaCodeReferenceElement[] referenceElements = list.getReferenceElements();
+          for (PsiJavaCodeReferenceElement referenceElement : referenceElements) {
+            final PsiElement target = referenceElement.resolve();
+            if (!(target instanceof PsiClass)) {
+              result[0] = true;
+              return false;
+            }
+            final PsiClass aClass = (PsiClass)target;
+            if (!aClass.isInterface()) {
+              result[0] = true;
+              return false;
+            }
+            if (aClass.findMethodBySignature(method, true) != null) {
+              result[0] = true;
+              return false;
+            }
+          }
+          return true;
+        }
+      });
+      return result[0];
+    }
+
+    private boolean isExcluded(PsiMethod method) {
+      return SerializationUtils.isWriteObject(method) || SerializationUtils.isReadObject(method) ||
+             SerializationUtils.isWriteReplace(method) || SerializationUtils.isReadResolve(method);
+    }
+  }
+}
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/AbsoluteAlignmentInUserInterface.html b/plugins/InspectionGadgets/src/inspectionDescriptions/AbsoluteAlignmentInUserInterface.html
index 5acbdb9..c79cdd1 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/AbsoluteAlignmentInUserInterface.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/AbsoluteAlignmentInUserInterface.html
@@ -4,6 +4,5 @@
 relative alignment, because it respects locale component orientation settings.
 <!-- tooltip end -->
 <p>
-<small>New in 11</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/AmbiguousFieldAccess.html b/plugins/InspectionGadgets/src/inspectionDescriptions/AmbiguousFieldAccess.html
index 67f0068..b22ad37 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/AmbiguousFieldAccess.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/AmbiguousFieldAccess.html
@@ -19,6 +19,5 @@
 </code></pre>
 <!-- tooltip end -->
 <p>
-<small>New in 11</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/AmbiguousMethodCall.html b/plugins/InspectionGadgets/src/inspectionDescriptions/AmbiguousMethodCall.html
index ef7dc8a..47bb71c 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/AmbiguousMethodCall.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/AmbiguousMethodCall.html
@@ -8,6 +8,5 @@
 <b>super</b> qualifier to the method call.
 <!-- tooltip end -->
 <p>
-<small>New in 8</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/ArrayEquality.html b/plugins/InspectionGadgets/src/inspectionDescriptions/ArrayEquality.html
index 2b0e729..3b44d8e 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/ArrayEquality.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/ArrayEquality.html
@@ -4,6 +4,5 @@
 rather than the <b>"java.util.Arrays.equals()"</b> method.
 <!-- tooltip end -->
 <p>
-<small>New in 10.5</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/ArrayHashCode.html b/plugins/InspectionGadgets/src/inspectionDescriptions/ArrayHashCode.html
index bf03e45..be0bb28 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/ArrayHashCode.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/ArrayHashCode.html
@@ -7,6 +7,5 @@
 code of a multi-dimensional array.
 <!-- tooltip end -->
 <p>
-<small>New in 10.5</small>
 </body>
 </html>
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/ArraysAsListWithZeroOrOneArgument.html b/plugins/InspectionGadgets/src/inspectionDescriptions/ArraysAsListWithZeroOrOneArgument.html
index 1ac168e..46258eb 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/ArraysAsListWithZeroOrOneArgument.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/ArraysAsListWithZeroOrOneArgument.html
@@ -4,6 +4,5 @@
 with either a call to <b>Collections.singletonList()</b> or <b>Collections.emptyList()</b> which will save some memory.
 <!-- tooltip end -->
 <p>
-<small>New in 12</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/AssertEqualsCalledOnArray.html b/plugins/InspectionGadgets/src/inspectionDescriptions/AssertEqualsCalledOnArray.html
index 515782b..b667202 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/AssertEqualsCalledOnArray.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/AssertEqualsCalledOnArray.html
@@ -5,6 +5,5 @@
 <b>assertArrayEquals()</b> methods.
 <!-- tooltip end -->
 <p>
-<small>New in 10</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/BooleanVariableAlwaysNegated.html b/plugins/InspectionGadgets/src/inspectionDescriptions/BooleanVariableAlwaysNegated.html
index 20b9f27..9d3be24 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/BooleanVariableAlwaysNegated.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/BooleanVariableAlwaysNegated.html
@@ -4,6 +4,5 @@
 when its value is used.
 <!-- tooltip end -->
 <p>
-<small>New in 11</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/BoxingBoxedValue.html b/plugins/InspectionGadgets/src/inspectionDescriptions/BoxingBoxedValue.html
index 20ba73d..f2bb652 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/BoxingBoxedValue.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/BoxingBoxedValue.html
@@ -6,6 +6,5 @@
 problems.
 <!-- tooltip end -->
 <p>
-<small>New in 10.0.2</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/ClassIndependentOfModule.html b/plugins/InspectionGadgets/src/inspectionDescriptions/ClassIndependentOfModule.html
index 0fb377e..203e943 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/ClassIndependentOfModule.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/ClassIndependentOfModule.html
@@ -5,6 +5,5 @@
 and may often profitably be moved.
 <!-- tooltip end -->
 <p>
-<small>New in 11</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/ClassOnlyUsedInOneModule.html b/plugins/InspectionGadgets/src/inspectionDescriptions/ClassOnlyUsedInOneModule.html
index ce83114..e73c848 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/ClassOnlyUsedInOneModule.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/ClassOnlyUsedInOneModule.html
@@ -5,6 +5,5 @@
 that module.
 <!-- tooltip end -->
 <p>
-<small>New in 11</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/ClassOnlyUsedInOnePackage.html b/plugins/InspectionGadgets/src/inspectionDescriptions/ClassOnlyUsedInOnePackage.html
index ce83114..e73c848 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/ClassOnlyUsedInOnePackage.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/ClassOnlyUsedInOnePackage.html
@@ -5,6 +5,5 @@
 that module.
 <!-- tooltip end -->
 <p>
-<small>New in 11</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/DoubleLiteralMayBeFloatLiteral.html b/plugins/InspectionGadgets/src/inspectionDescriptions/DoubleLiteralMayBeFloatLiteral.html
index e517999..ffb311c 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/DoubleLiteralMayBeFloatLiteral.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/DoubleLiteralMayBeFloatLiteral.html
@@ -6,6 +6,5 @@
 literal.
 <!-- tooltip end -->
 <p>
-<small>New in 10.0.2</small>
 </body>
 </html>
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/ElementOnlyUsedFromTestCode.html b/plugins/InspectionGadgets/src/inspectionDescriptions/ElementOnlyUsedFromTestCode.html
index 66a1e0d..75b3186 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/ElementOnlyUsedFromTestCode.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/ElementOnlyUsedFromTestCode.html
@@ -5,6 +5,5 @@
 <em>Analyze|Run Inspection by Name</em> and it will not report in the editor.
 <!-- tooltip end -->
 <p>
-<small>New in 11</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/EmptyDirectory.html b/plugins/InspectionGadgets/src/inspectionDescriptions/EmptyDirectory.html
index 6e845ac..0c9e047 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/EmptyDirectory.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/EmptyDirectory.html
@@ -5,6 +5,5 @@
 <p>
 Use the checkbox below to have this inspection only report directories under source roots.
 <p>
-<small>New in 11</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/EqualsCalledOnEnumConstant.html b/plugins/InspectionGadgets/src/inspectionDescriptions/EqualsCalledOnEnumConstant.html
index da79ddf..bb08023 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/EqualsCalledOnEnumConstant.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/EqualsCalledOnEnumConstant.html
@@ -7,6 +7,5 @@
 have the same identity.
 <!-- tooltip end -->
 <p>
-<small>New in 8.1 </small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/ExpectedExceptionNeverThrown.html b/plugins/InspectionGadgets/src/inspectionDescriptions/ExpectedExceptionNeverThrown.html
index 72c3bc9..bc756a3 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/ExpectedExceptionNeverThrown.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/ExpectedExceptionNeverThrown.html
@@ -4,6 +4,5 @@
 which are never thrown inside the method body.
 <!-- tooltip end -->
 <p>
-<small>New in 10</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/ExternalizableWithoutPublicNoArgConstructor.html b/plugins/InspectionGadgets/src/inspectionDescriptions/ExternalizableWithoutPublicNoArgConstructor.html
index c4b75ab..e30510c 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/ExternalizableWithoutPublicNoArgConstructor.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/ExternalizableWithoutPublicNoArgConstructor.html
@@ -5,6 +5,5 @@
 method called. If a public no-arg constructor is not present a <b>java.io.InvalidClassException</b> will be thrown at runtime.
 <!-- tooltip end -->
 <p>
-<small>New in 12</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/HtmlTagCanBeJavadocTag.html b/plugins/InspectionGadgets/src/inspectionDescriptions/HtmlTagCanBeJavadocTag.html
index 1f7b2c4..99d9fec 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/HtmlTagCanBeJavadocTag.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/HtmlTagCanBeJavadocTag.html
@@ -5,6 +5,5 @@
 inside the comment, instead of HTML character entities.
 <!-- tooltip end -->
 <p>
-<small>New in 10.5</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/IfCanBeSwitch.html b/plugins/InspectionGadgets/src/inspectionDescriptions/IfCanBeSwitch.html
index 2c96f0b..f5b62d5 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/IfCanBeSwitch.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/IfCanBeSwitch.html
@@ -16,6 +16,5 @@
 <p>
 Use the third checkbox below to only suggest switch statements which can't introduce a <b>NullPointerException</b>
 <p>
-<small>New in 10.5</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/IgnoredJUnitTest.html b/plugins/InspectionGadgets/src/inspectionDescriptions/IgnoredJUnitTest.html
index da6d81f..9048c8e 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/IgnoredJUnitTest.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/IgnoredJUnitTest.html
@@ -3,6 +3,5 @@
 Reports JUnit tests which are annotated with @Ignore.
 <!-- tooltip end -->
 <p>
-<small>New in 11</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/IntLiteralMayBeLongLiteral.html b/plugins/InspectionGadgets/src/inspectionDescriptions/IntLiteralMayBeLongLiteral.html
index e4fac09..68262bf 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/IntLiteralMayBeLongLiteral.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/IntLiteralMayBeLongLiteral.html
@@ -6,6 +6,5 @@
 literal.
 <!-- tooltip end -->
 <p>
-<small>New in 9</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/JUnit3StyleTestMethodInJUnit4Class.html b/plugins/InspectionGadgets/src/inspectionDescriptions/JUnit3StyleTestMethodInJUnit4Class.html
index e73eefa..63fca0a 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/JUnit3StyleTestMethodInJUnit4Class.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/JUnit3StyleTestMethodInJUnit4Class.html
@@ -5,6 +5,5 @@
 In addition to being confusing such test methods will not be run.
 <!-- tooltip end -->
 <p>
-<small>New in 12</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/LogStatementGuardedByLogCondition.html b/plugins/InspectionGadgets/src/inspectionDescriptions/LogStatementGuardedByLogCondition.html
index 29dcb9c..6adda60 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/LogStatementGuardedByLogCondition.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/LogStatementGuardedByLogCondition.html
@@ -15,6 +15,5 @@
 <p>
 Use the checkbox below to let this inspection flag all unguarded log calls, not only those with non-constant arguments.
 <p>
-<small>New in 8</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/LoggerInitializedWithForeignClass.html b/plugins/InspectionGadgets/src/inspectionDescriptions/LoggerInitializedWithForeignClass.html
index d19c82e..4c4419c 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/LoggerInitializedWithForeignClass.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/LoggerInitializedWithForeignClass.html
@@ -6,6 +6,5 @@
 <p>
 Use the table below to specify the logger factory classes and logger factory methods recognized by this inspection.
 <p>
-<small>New in 8</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/MathRandomCastToInt.html b/plugins/InspectionGadgets/src/inspectionDescriptions/MathRandomCastToInt.html
index b433b5d..68b0e2b 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/MathRandomCastToInt.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/MathRandomCastToInt.html
@@ -9,6 +9,5 @@
 <b>java.util.Random</b>.
 <!-- tooltip end -->
 <p>
-<small>New in 10.5</small>
 </body>
 </html>
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/MethodCanBeVariableArityMethod.html b/plugins/InspectionGadgets/src/inspectionDescriptions/MethodCanBeVariableArityMethod.html
index 8f51c94..26e0474 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/MethodCanBeVariableArityMethod.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/MethodCanBeVariableArityMethod.html
@@ -15,6 +15,5 @@
 <p>
 Use the fourth checkbox below ot ignore method with more than one array parameter.
 <p>
-<small>New in 10.5</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/MismatchedStringBuilderQueryUpdate.html b/plugins/InspectionGadgets/src/inspectionDescriptions/MismatchedStringBuilderQueryUpdate.html
index a883418..11712f9 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/MismatchedStringBuilderQueryUpdate.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/MismatchedStringBuilderQueryUpdate.html
@@ -5,6 +5,5 @@
 dead, incomplete or erroneous code.
 <!-- tooltip end -->
 <p>
-<small>New in 10.5</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/MultipleExceptionsDeclaredOnTestMethod.html b/plugins/InspectionGadgets/src/inspectionDescriptions/MultipleExceptionsDeclaredOnTestMethod.html
index db4fc4b..7d177a7 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/MultipleExceptionsDeclaredOnTestMethod.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/MultipleExceptionsDeclaredOnTestMethod.html
@@ -6,6 +6,5 @@
 <pre><b>throws</b> Exception</pre>
 <!-- tooltip end -->
 <p>
-<small>New in 9 </small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/NegatedEqualityExpression.html b/plugins/InspectionGadgets/src/inspectionDescriptions/NegatedEqualityExpression.html
index b7319be..f823106 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/NegatedEqualityExpression.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/NegatedEqualityExpression.html
@@ -4,6 +4,5 @@
 <pre><code>!(i == 1)</code></pre>
 <!-- tooltip end -->
 <p>
-<small>New in 12</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/NewExceptionWithoutArguments.html b/plugins/InspectionGadgets/src/inspectionDescriptions/NewExceptionWithoutArguments.html
index 08d5cad..7c7abc4 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/NewExceptionWithoutArguments.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/NewExceptionWithoutArguments.html
@@ -3,9 +3,5 @@
 Reports exception instance creation without any arguments specified. When an exception is constructed
 without arguments it contains no information about the fault that happened, which makes debugging needlessly hard.
 <!-- tooltip end -->
-<p>
-Use the checkbox below to ignore instance creation of exception classes which have no constructors that take arguments.
-<p>
-<small>New in 11</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/NonAtomicOperationOnVolatileField.html b/plugins/InspectionGadgets/src/inspectionDescriptions/NonAtomicOperationOnVolatileField.html
index a60cf32..b1bdb1b 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/NonAtomicOperationOnVolatileField.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/NonAtomicOperationOnVolatileField.html
@@ -10,6 +10,5 @@
 from the <b>java.util.concurrent.atomic</b> package.
 <!-- tooltip end -->
 <p>
-<small>New in 10</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/NonFinalFieldInEnum.html b/plugins/InspectionGadgets/src/inspectionDescriptions/NonFinalFieldInEnum.html
index b0ead44..b6893d8 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/NonFinalFieldInEnum.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/NonFinalFieldInEnum.html
@@ -3,6 +3,5 @@
 Reports non-<b>final</b> fields in enumeration types. A non-<b>final</b> field in an enum is rarely needed.
 <!-- tooltip end -->
 <p>
-<small>New in 12</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/NonFinalUtilityClass.html b/plugins/InspectionGadgets/src/inspectionDescriptions/NonFinalUtilityClass.html
index 23f0a2e..a9c5da4 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/NonFinalUtilityClass.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/NonFinalUtilityClass.html
@@ -5,6 +5,5 @@
  prevents them from being inadvertently subclassed.
 <!-- tooltip end -->
 <p>
-<small>New in 12</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/NullThrown.html b/plugins/InspectionGadgets/src/inspectionDescriptions/NullThrown.html
index a777ebb..bccf0e6 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/NullThrown.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/NullThrown.html
@@ -3,6 +3,5 @@
 Reports any null literals which are used as the argument for a throw statement.
 <!-- tooltip end -->
 <p>
-<small>New in 11</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/PackageNamingConvention.html b/plugins/InspectionGadgets/src/inspectionDescriptions/PackageNamingConvention.html
index db67839..4513ceb 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/PackageNamingConvention.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/PackageNamingConvention.html
@@ -7,6 +7,5 @@
 Use the fields below to specify minimum length, maximum length and regular expression expected for package names
 (Regular expressions are in standard <b>java.util.regex</b> format).
 <p>
-<small>New in 11</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/PointlessNullCheck.html b/plugins/InspectionGadgets/src/inspectionDescriptions/PointlessNullCheck.html
index 9c47a0d..e898d4b 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/PointlessNullCheck.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/PointlessNullCheck.html
@@ -9,6 +9,5 @@
 <pre><code>    if (x instanceof String) { ... }</code></pre>
 <!-- tooltip end -->
 <p>
-<small>New in 11</small>
 </body>
 </html>
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/PublicConstructor.html b/plugins/InspectionGadgets/src/inspectionDescriptions/PublicConstructor.html
index b4898e4..8654d1d 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/PublicConstructor.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/PublicConstructor.html
@@ -4,6 +4,5 @@
 <b>static</b> factory methods. This way the implementation can be swapped out without affecting the call sites.
 <!-- tooltip end -->
 <p>
-<small>New in 12</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/SimplifiableAnnotation.html b/plugins/InspectionGadgets/src/inspectionDescriptions/SimplifiableAnnotation.html
index 94cd40b..cac085c 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/SimplifiableAnnotation.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/SimplifiableAnnotation.html
@@ -5,6 +5,5 @@
 of the annotation are also reported.
 <!-- tooltip end -->
 <p>
-<small>New in 10 </small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/SimplifiableEqualsExpression.html b/plugins/InspectionGadgets/src/inspectionDescriptions/SimplifiableEqualsExpression.html
index ded9547..271ab04 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/SimplifiableEqualsExpression.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/SimplifiableEqualsExpression.html
@@ -13,6 +13,5 @@
 </pre></code>
   <!-- tooltip end -->
 <p>
-<small>New in 11 </small>
 </body>
 </html>
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/StringConcatenationArgumentToLogCall.html b/plugins/InspectionGadgets/src/inspectionDescriptions/StringConcatenationArgumentToLogCall.html
index 5c4da2c..6d59921 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/StringConcatenationArgumentToLogCall.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/StringConcatenationArgumentToLogCall.html
@@ -7,6 +7,5 @@
 <p>
 Use the combobox below to ignore certain logging levels (where <i>error</i> is the highest level and <i>trace</i> is the lowest level).
 <p>
-<small>New in 12 </small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/StringConcatenationInFormatCall.html b/plugins/InspectionGadgets/src/inspectionDescriptions/StringConcatenationInFormatCall.html
index c0a4b96..ded57b2 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/StringConcatenationInFormatCall.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/StringConcatenationInFormatCall.html
@@ -10,6 +10,5 @@
 or <b>java.io.PrintStream</b>.
 <!-- tooltip end -->
 <p>
-<small>New in 10.0.2 </small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/StringConcatenationInMessageFormatCall.html b/plugins/InspectionGadgets/src/inspectionDescriptions/StringConcatenationInMessageFormatCall.html
index e886a7f..eefb35c 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/StringConcatenationInMessageFormatCall.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/StringConcatenationInMessageFormatCall.html
@@ -6,6 +6,5 @@
 a '+' when a ',' was meant.
 <!-- tooltip end -->
 <p>
-<small>New in 10.0.2 </small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/StringConcatenationMissingWhitespace.html b/plugins/InspectionGadgets/src/inspectionDescriptions/StringConcatenationMissingWhitespace.html
index e63c62f..6b2cc9d 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/StringConcatenationMissingWhitespace.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/StringConcatenationMissingWhitespace.html
@@ -10,6 +10,5 @@
 <p>
 Use the checkbox below to have this inspection only report when both the left and right side of the concatenation are literals.
 <p>
-<small>New in 12</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/SuspiciousArrayCast.html b/plugins/InspectionGadgets/src/inspectionDescriptions/SuspiciousArrayCast.html
index 0176c71..54a3461 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/SuspiciousArrayCast.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/SuspiciousArrayCast.html
@@ -4,6 +4,5 @@
 a cast is legal at compile time but may fail with a <b>ClassCastException</b> at runtime.
 <!-- tooltip end -->
 <p>
-<small>New in 12</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/SynchronizationOnLocalVariableOrMethodParameter.html b/plugins/InspectionGadgets/src/inspectionDescriptions/SynchronizationOnLocalVariableOrMethodParameter.html
index f306639..d690e66 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/SynchronizationOnLocalVariableOrMethodParameter.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/SynchronizationOnLocalVariableOrMethodParameter.html
@@ -6,6 +6,5 @@
 will usually be clearer if synchronization on a field is used.
 <!-- tooltip end -->
 <p>
-<small>New in 8</small>
 </body>
 </html>
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/SynchronizationOnStaticField.html b/plugins/InspectionGadgets/src/inspectionDescriptions/SynchronizationOnStaticField.html
index 537ac4d..713686b 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/SynchronizationOnStaticField.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/SynchronizationOnStaticField.html
@@ -4,6 +4,5 @@
 synchronization on static fields can lead to bad performance because of contention.
 <!-- tooltip end -->
 <p>
-<small>New in 10</small>
 </body>
 </html>
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/ThrowsRuntimeException.html b/plugins/InspectionGadgets/src/inspectionDescriptions/ThrowsRuntimeException.html
index 56f3199..03f27e4 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/ThrowsRuntimeException.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/ThrowsRuntimeException.html
@@ -4,6 +4,5 @@
 Declaration of unchecked exceptions are not required and may be removed or moved to a Javadoc <b>@throws</b> tag.
 <!-- tooltip end -->
 <p>
-<small>New in 11</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/TooBroadThrows.html b/plugins/InspectionGadgets/src/inspectionDescriptions/TooBroadThrows.html
index 6c94af8..99a0b18 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/TooBroadThrows.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/TooBroadThrows.html
@@ -11,6 +11,5 @@
 Use the third checkbox below to ignore any exceptions which hide other exceptions, but which may be thrown from the method body and thus
 are technically not overly broad.
 <p>
-<small>New in 10</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/TryFinallyCanBeTryWithResources.html b/plugins/InspectionGadgets/src/inspectionDescriptions/TryFinallyCanBeTryWithResources.html
index 6cbca36..3d3da4e 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/TryFinallyCanBeTryWithResources.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/TryFinallyCanBeTryWithResources.html
@@ -7,6 +7,5 @@
 This inspection only reports if the project or module is configured to use a
 language level of 7.0 or higher.
 <!-- tooltip end -->
-<p><small>New in 10.5</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/TryWithIdenticalCatches.html b/plugins/InspectionGadgets/src/inspectionDescriptions/TryWithIdenticalCatches.html
index e9d9648..47baccf 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/TryWithIdenticalCatches.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/TryWithIdenticalCatches.html
@@ -6,6 +6,5 @@
 This inspection only reports if the project or module is configured to use a
 language level of 7.0 or higher.
 <!-- tooltip end -->
-<p><small>New in 10.5</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/UnclearBinaryExpression.html b/plugins/InspectionGadgets/src/inspectionDescriptions/UnclearBinaryExpression.html
index 837a1fb..53cb6f2 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/UnclearBinaryExpression.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/UnclearBinaryExpression.html
@@ -5,6 +5,5 @@
 of the different operators. This inspection has a quickfix which adds clarifying parentheses.
 <!-- tooltip end -->
 <p>
-<small>New in 11</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessarilyQualifiedInnerClassAccess.html b/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessarilyQualifiedInnerClassAccess.html
index d76730e..3423336 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessarilyQualifiedInnerClassAccess.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessarilyQualifiedInnerClassAccess.html
@@ -8,6 +8,5 @@
 Use the checkbox below to ignore references to inner classes where the removal of the qualification
 would require the addition of an import.
 <p>
-<small>New in 10</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessarilyQualifiedStaticallyImportedElement.html b/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessarilyQualifiedStaticallyImportedElement.html
index f0cb4d4..17a1fdb 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessarilyQualifiedStaticallyImportedElement.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessarilyQualifiedStaticallyImportedElement.html
@@ -5,6 +5,5 @@
 and can be removed.
 <!-- tooltip end -->
 <p>
-<small>New in 10</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessaryConstantArrayCreationExpression.html b/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessaryConstantArrayCreationExpression.html
index 05cedc3..42ee807 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessaryConstantArrayCreationExpression.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessaryConstantArrayCreationExpression.html
@@ -6,6 +6,5 @@
 assigned to.
 <!-- tooltip end -->
 <p>
-<small>New in 8</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessaryExplicitNumericCast.html b/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessaryExplicitNumericCast.html
index 8ceb97a..9ba4ce4 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessaryExplicitNumericCast.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/UnnecessaryExplicitNumericCast.html
@@ -4,6 +4,5 @@
 implicitly by the compiler.
 <!-- tooltip end -->
 <p>
-<small>New in 11</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/UnqualifiedInnerClassAccess.html b/plugins/InspectionGadgets/src/inspectionDescriptions/UnqualifiedInnerClassAccess.html
index 917ae08..727d633 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/UnqualifiedInnerClassAccess.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/UnqualifiedInnerClassAccess.html
@@ -6,6 +6,5 @@
 <p>
 Use the checkbox below to ignore references to local inner classes that do not require an import.
 <p>
-<small>New in 10</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/UnqualifiedMethodAccess.html b/plugins/InspectionGadgets/src/inspectionDescriptions/UnqualifiedMethodAccess.html
index c60f32d..f79b576 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/UnqualifiedMethodAccess.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/UnqualifiedMethodAccess.html
@@ -3,6 +3,5 @@
 Reports calls to non-static methods of the same object which are not qualified with <b>this</b>.
 <!-- tooltip end -->
 <p>
-<small>New in 11</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/UseOfObsoleteAssert.html b/plugins/InspectionGadgets/src/inspectionDescriptions/UseOfObsoleteAssert.html
index cd4ac9b..95fa543 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/UseOfObsoleteAssert.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/UseOfObsoleteAssert.html
@@ -4,6 +4,5 @@
 obsolete and the calls can be replaced by calls to methods from the <b>org.junit.Assert</b> class.
 <!-- tooltip end -->
 <p>
-<small>New in 11</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/mismatched_collection_query_update/MismatchedCollectionQueryUpdate.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/mismatched_collection_query_update/MismatchedCollectionQueryUpdate.java
index 373b75f..5c53674 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/mismatched_collection_query_update/MismatchedCollectionQueryUpdate.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/mismatched_collection_query_update/MismatchedCollectionQueryUpdate.java
@@ -197,10 +197,18 @@
         return list.toString();
     }
 
+  void copyStuff(List other) {
+    List <warning descr="Contents of collection 'list' are updated, but never queried">list</warning> = new ArrayList();
+    J j = list::add;
+  }
+
     private void forEach(I<E> ei) {}
     interface I<E> {
         boolean _(E e);
     }
+    interface J<E> {
+      void m(E e);
+    }
 
     void qTest() {
         Map<Integer, Boolean> map = new HashMap<>();
@@ -218,3 +226,53 @@
     }
   }
 }
+class CollectionsUser {
+  void a(List<String> list) {
+    List<String> l = new ArrayList();
+    Collections.addAll(l, "1", "2", "4");
+    Collections.copy(list, l);
+  }
+
+  int b(List<String> list) {
+    List<String> l = new ArrayList();
+    Collections.addAll(l, "1", "2", "4");
+    return Collections.indexOfSubList(list, l);
+  }
+
+  void c() {
+    List<String> <warning descr="Contents of collection 'l' are queried, but never updated">l</warning> = new ArrayList();
+    final int frequency = Collections.frequency(l, "one");
+  }
+
+  List<String> d() {
+    List<String> <warning descr="Contents of collection 'l' are queried, but never updated">l</warning> = new ArrayList();
+    return Collections.unmodifiableList(l);
+  }
+
+  List<String> e() {
+    List<String> l = new ArrayList<String>();
+    return Collections.checkedList(l, String.class);
+  }
+
+  private final List<Object> <warning descr="Contents of collection 'list' are updated, but never queried">list</warning> = new ArrayList<Object>();
+  public void add() {
+    Collections.addAll(list, "Hello");
+  }
+}
+
+class SimpleAdd {
+  protected String[] doPerform() {
+    List<String> result = new ArrayList<String>();
+    for (String app : getApplications()) {
+      if (app.startsWith("")) {
+        result.add(app);
+      }
+    }
+    return result.toArray(new String[result.size()]);
+  }
+
+  public String[] getApplications() {
+    return null;
+  }
+
+}
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/errorhandling/NewExceptionWithoutArgumentsInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/errorhandling/NewExceptionWithoutArgumentsInspectionTest.java
index fbd585c..894b803 100644
--- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/errorhandling/NewExceptionWithoutArgumentsInspectionTest.java
+++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/errorhandling/NewExceptionWithoutArgumentsInspectionTest.java
@@ -6,7 +6,6 @@
 
   public void test() throws Exception {
     final NewExceptionWithoutArgumentsInspection tool = new NewExceptionWithoutArgumentsInspection();
-    tool.ignoreWithoutParameters = true;
     doTest("com/siyeh/igtest/errorhandling/new_exception_without_arguments", tool);
   }
 
diff --git a/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/pattern/compiler/AnnotationBasedInstrumentingCompiler.java b/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/pattern/compiler/AnnotationBasedInstrumentingCompiler.java
deleted file mode 100644
index a421f47..0000000
--- a/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/pattern/compiler/AnnotationBasedInstrumentingCompiler.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright 2006 Sascha Weinreuter
- *
- * 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 org.intellij.plugins.intelliLang.pattern.compiler;
-
-import com.intellij.compiler.PsiClassWriter;
-import com.intellij.lang.StdLanguages;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.project.DumbService;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.JavaSdk;
-import com.intellij.openapi.projectRoots.JavaSdkVersion;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.CompilerModuleExtension;
-import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.roots.ProjectFileIndex;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.JavaPsiFacade;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiJavaFile;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.PsiSearchHelper;
-import com.intellij.util.Processor;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.asm4.ClassReader;
-import org.jetbrains.asm4.ClassWriter;
-
-import java.io.DataInput;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Based on NotNullVerifyingCompiler, kindly provided by JetBrains for reference.
- */
-public abstract class AnnotationBasedInstrumentingCompiler implements ClassInstrumentingCompiler {
-  private static final Logger LOG = Logger.getInstance("org.intellij.lang.pattern.compiler.AnnotationBasedInstrumentingCompiler");
-
-  public AnnotationBasedInstrumentingCompiler() {
-  }
-
-  @NotNull
-  public ProcessingItem[] getProcessingItems(final CompileContext context) {
-    if (!isEnabled()) {
-      return ProcessingItem.EMPTY_ARRAY;
-    }
-
-    final Project project = context.getProject();
-    final Set<InstrumentationItem> result = new HashSet<InstrumentationItem>();
-    final PsiSearchHelper searchHelper = PsiSearchHelper.SERVICE.getInstance(context.getProject());
-
-    DumbService.getInstance(project).runReadActionInSmartMode(new Runnable() {
-      public void run() {
-        final String[] names = getAnnotationNames(project);
-        for (String name : names) {
-          final GlobalSearchScope scope = GlobalSearchScope.projectScope(project);
-
-          final PsiClass psiClass = JavaPsiFacade.getInstance(project).findClass(name, GlobalSearchScope.allScope(project));
-          if (psiClass == null) {
-            context.addMessage(CompilerMessageCategory.ERROR, "Cannot find class " + name, null, -1, -1);
-            continue;
-          }
-
-          // wow, this is a sweet trick... ;)
-          searchHelper.processAllFilesWithWord(StringUtil.getShortName(name), scope, new Processor<PsiFile>() {
-            public boolean process(PsiFile psifile) {
-              if (StdLanguages.JAVA == psifile.getLanguage() && psifile.getVirtualFile() != null && psifile instanceof PsiJavaFile) {
-                addClassFiles((PsiJavaFile)psifile, result, project);
-              }
-              return true;
-            }
-          }, true);
-        }
-      }
-    });
-    return result.toArray(new ProcessingItem[result.size()]);
-  }
-
-  private static void addClassFiles(PsiJavaFile srcFile, Set<InstrumentationItem> result, final Project project) {
-
-    final VirtualFile sourceFile = srcFile.getVirtualFile();
-    assert sourceFile != null;
-
-    final ProjectFileIndex index = ProjectRootManager.getInstance(project).getFileIndex();
-    final Module module = index.getModuleForFile(sourceFile);
-    if (module != null) {
-      final Sdk jdk = ModuleRootManager.getInstance(module).getSdk();
-      final boolean jdk6 = jdk != null && JavaSdk.getInstance().isOfVersionOrHigher(jdk, JavaSdkVersion.JDK_1_6);
-
-      final CompilerModuleExtension extension = CompilerModuleExtension.getInstance(module);
-      final VirtualFile compilerOutputPath = extension != null ? extension.getCompilerOutputPath() : null;
-      if (compilerOutputPath != null) {
-        final String packageName = srcFile.getPackageName();
-        final VirtualFile packageDir =
-            packageName.length() > 0 ? compilerOutputPath.findFileByRelativePath(packageName.replace('.', '/')) : compilerOutputPath;
-
-        if (packageDir != null && packageDir.isDirectory()) {
-          final PsiClass[] classes = srcFile.getClasses();
-          final VirtualFile[] children = packageDir.getChildren();
-          for (VirtualFile classFile : children) {
-            if (classFile.isDirectory() || !"class".equals(classFile.getExtension())) {
-              // no point in looking at directories or non-class files
-              continue;
-            }
-            final String name = classFile.getName();
-            for (PsiClass clazz : classes) {
-              final String className = clazz.getName();
-              if (className != null && name.startsWith(className)) {
-                result.add(new InstrumentationItem(classFile, jdk6));
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-
-  public ProcessingItem[] process(final CompileContext context, final ProcessingItem[] items) {
-    final ProgressIndicator progressIndicator = context.getProgressIndicator();
-    progressIndicator.setText(getProgressMessage());
-
-    final Project project = context.getProject();
-    final ArrayList<ProcessingItem> result = new ArrayList<ProcessingItem>(items.length);
-    ApplicationManager.getApplication().runReadAction(new Runnable() {
-
-      public void run() {
-        int filesProcessed = 0;
-
-        for (ProcessingItem pi : items) {
-          final InstrumentationItem item = ((InstrumentationItem)pi);
-          final VirtualFile classFile = item.getClassFile();
-
-          try {
-            final byte[] bytes = classFile.contentsToByteArray();
-            final ClassReader classreader;
-            try {
-              classreader = new ClassReader(bytes, 0, bytes.length);
-            }
-            catch (Exception e) {
-              LOG.debug("ASM failed to read class file <" + classFile.getPresentableUrl() + ">", e);
-              continue;
-            }
-
-            final ClassWriter classwriter = new PsiClassWriter(project, item.isJDK6());
-            final Instrumenter instrumenter = createInstrumenter(classwriter);
-
-            classreader.accept(instrumenter, 0);
-
-            if (instrumenter.instrumented()) {
-              // only dump the class if it has actually been instrumented
-              final FileOutputStream out = new FileOutputStream(classFile.getPath());
-              try {
-                out.write(classwriter.toByteArray());
-              }
-              finally {
-                out.close();
-              }
-            }
-
-            result.add(item);
-            progressIndicator.setFraction(++filesProcessed / (double)items.length);
-          }
-          catch (InstrumentationException e) {
-            context.addMessage(CompilerMessageCategory.ERROR, "[" + getDescription() + "]: " + e.getLocalizedMessage(), null, -1, -1);
-          }
-          catch (IOException e) {
-            context.addMessage(CompilerMessageCategory.ERROR, "[" + getDescription() + "]: " + e.getLocalizedMessage(), null, -1, -1);
-          }
-        }
-      }
-    });
-    return result.toArray(new ProcessingItem[result.size()]);
-  }
-
-  protected abstract boolean isEnabled();
-
-  protected abstract String[] getAnnotationNames(Project project);
-
-  protected abstract Instrumenter createInstrumenter(ClassWriter classwriter);
-
-  protected abstract String getProgressMessage();
-
-  public boolean validateConfiguration(CompileScope compilescope) {
-    return true;
-  }
-
-  @Nullable
-  public ValidityState createValidityState(DataInput datainputstream) throws IOException {
-//        return TimestampValidityState.load(datainputstream);
-    return null;
-  }
-}
diff --git a/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/pattern/compiler/impl/PatternValidationCompiler.java b/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/pattern/compiler/impl/PatternValidationCompiler.java
deleted file mode 100644
index 2d60247..0000000
--- a/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/pattern/compiler/impl/PatternValidationCompiler.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright 2006 Sascha Weinreuter
- *
- * 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 org.intellij.plugins.intelliLang.pattern.compiler.impl;
-
-import com.intellij.codeInsight.AnnotationUtil;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Pair;
-import com.intellij.psi.JavaPsiFacade;
-import com.intellij.psi.PsiAnnotation;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiMember;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.searches.AnnotatedMembersSearch;
-import com.intellij.util.ArrayUtil;
-import com.intellij.util.Processor;
-import com.intellij.util.Query;
-import org.intellij.plugins.intelliLang.Configuration;
-import org.intellij.plugins.intelliLang.pattern.compiler.AnnotationBasedInstrumentingCompiler;
-import org.intellij.plugins.intelliLang.pattern.compiler.Instrumenter;
-import org.intellij.plugins.intelliLang.util.AnnotationUtilEx;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.asm4.ClassWriter;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-public class PatternValidationCompiler extends AnnotationBasedInstrumentingCompiler {
-
-  private final Map<String, String> myAnnotations = new HashMap<String, String>();
-
-  protected String[] getAnnotationNames(Project project) {
-    synchronized (myAnnotations) {
-      myAnnotations.clear();
-      final Pair<String, ? extends Set<String>> patternAnnotation =
-        Configuration.getProjectInstance(project).getAdvancedConfiguration().getPatternAnnotationPair();
-
-      final GlobalSearchScope scope = GlobalSearchScope.allScope(project);
-      final PsiClass psiClass = JavaPsiFacade.getInstance(project).findClass(patternAnnotation.first, scope);
-
-      if (psiClass == null) {
-        // annotation is not present in project's classpath, nothing to instrument
-        return ArrayUtil.EMPTY_STRING_ARRAY;
-      }
-
-      final Query<PsiMember> query = AnnotatedMembersSearch.search(psiClass, GlobalSearchScope.allScope(project));
-
-      query.forEach(new Processor<PsiMember>() {
-        public boolean process(PsiMember psiMember) {
-          if (psiMember instanceof PsiClass) {
-            final PsiClass clazz = (PsiClass)psiMember;
-            if (clazz.isAnnotationType()) {
-              final PsiAnnotation annotation = AnnotationUtil.findAnnotation(clazz, patternAnnotation.second);
-              if (annotation != null) {
-                final String s = AnnotationUtilEx.calcAnnotationValue(annotation, "value");
-                if (s != null) {
-                  myAnnotations.put(clazz.getQualifiedName(), s);
-                }
-              }
-            }
-          }
-          return true;
-        }
-      });
-
-      myAnnotations.put(patternAnnotation.first, null);
-
-      final Set<String> names = myAnnotations.keySet();
-      return ArrayUtil.toStringArray(names);
-    }
-  }
-
-  protected boolean isEnabled() {
-    final Configuration.InstrumentationType option = Configuration.getInstance().getAdvancedConfiguration().getInstrumentation();
-    return option == Configuration.InstrumentationType.ASSERT || option == Configuration.InstrumentationType.EXCEPTION;
-  }
-
-  @NotNull
-  protected Instrumenter createInstrumenter(ClassWriter classwriter) {
-    synchronized (myAnnotations) {
-      final Configuration.InstrumentationType instrumentation = Configuration.getInstance().getAdvancedConfiguration().getInstrumentation();
-      return new PatternValidationInstrumenter(new HashMap<String, String>(myAnnotations), classwriter, instrumentation);
-    }
-  }
-
-  protected String getProgressMessage() {
-    return "Inserting @Pattern assertions";
-  }
-
-  @NotNull
-  public String getDescription() {
-    return "Pattern Validation";
-  }
-}
diff --git a/plugins/IntelliLang/src/META-INF/intellilang-java-support.xml b/plugins/IntelliLang/src/META-INF/intellilang-java-support.xml
index 2821e74..f233b63 100644
--- a/plugins/IntelliLang/src/META-INF/intellilang-java-support.xml
+++ b/plugins/IntelliLang/src/META-INF/intellilang-java-support.xml
@@ -3,8 +3,6 @@
 <idea-plugin version="2">
 
   <extensions defaultExtensionNs="com.intellij">
-    <compiler implementation="org.intellij.plugins.intelliLang.pattern.compiler.impl.PatternValidationCompiler"/>
-
     <localInspection shortName="UnknownLanguage" displayName="Unknown Language ID" groupName="Language Injection" enabledByDefault="true"
                      level="ERROR" implementationClass="org.intellij.plugins.intelliLang.inject.java.validation.UnknownLanguageID"/>
     <localInspection shortName="LanguageMismatch" displayName="Language Mismatch" groupName="Language Injection" enabledByDefault="true"
diff --git a/plugins/IntentionPowerPak/src/META-INF/IntentionPowerPack.xml b/plugins/IntentionPowerPak/src/META-INF/IntentionPowerPack.xml
index bf03d7b..73e279f 100644
--- a/plugins/IntentionPowerPak/src/META-INF/IntentionPowerPack.xml
+++ b/plugins/IntentionPowerPak/src/META-INF/IntentionPowerPack.xml
@@ -184,6 +184,11 @@
       <categoryKey>intention.category.junit</categoryKey>
     </intentionAction>
 
+    <intentionAction>
+      <className>com.siyeh.ipp.junit.DataPointHolderConversionIntention</className>
+      <bundleName>com.siyeh.IntentionPowerPackBundle</bundleName>
+      <categoryKey>intention.category.junit</categoryKey>
+    </intentionAction>
     <!-- Declaration -->
 
     <!--
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/interfacetoclass/ConvertInterfaceToClassIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/interfacetoclass/ConvertInterfaceToClassIntention.java
index a806e9b..f3d69de 100644
--- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/interfacetoclass/ConvertInterfaceToClassIntention.java
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/interfacetoclass/ConvertInterfaceToClassIntention.java
@@ -106,7 +106,7 @@
     final PsiClass anInterface = (PsiClass)element.getParent();
     final SearchScope searchScope = anInterface.getUseScope();
     final Query<PsiClass> query = ClassInheritorsSearch.search(anInterface, searchScope, false);
-    final MultiMap<PsiElement, String> conflicts = new MultiMap();
+    final MultiMap<PsiElement, String> conflicts = new MultiMap<PsiElement, String>();
     query.forEach(new Processor<PsiClass>() {
       @Override
       public boolean process(PsiClass aClass) {
@@ -180,11 +180,14 @@
     final PsiReferenceList extendsList = anInterface.getExtendsList();
     final PsiReferenceList implementsList = anInterface.getImplementsList();
     assert extendsList != null;
-    final PsiJavaCodeReferenceElement[] referenceElements = extendsList.getReferenceElements();
-    for (PsiJavaCodeReferenceElement referenceElement : referenceElements) {
+    final PsiJavaCodeReferenceElement[] extendsRefElements = extendsList.getReferenceElements();
+    for (PsiJavaCodeReferenceElement referenceElement : extendsRefElements) {
       assert implementsList != null;
-      implementsList.add(referenceElement);
-      referenceElement.delete();
+      final PsiElement resolved = referenceElement.resolve();
+      if (resolved instanceof PsiClass && ((PsiClass)resolved).isInterface()) {
+        implementsList.add(referenceElement);
+        referenceElement.delete();
+      }
     }
   }
 
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/DataPointHolderConversionIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/DataPointHolderConversionIntention.java
new file mode 100644
index 0000000..841ccab
--- /dev/null
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/junit/DataPointHolderConversionIntention.java
@@ -0,0 +1,157 @@
+/*
+ * 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.siyeh.ipp.junit;
+
+import com.intellij.codeInsight.AnnotationUtil;
+import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction;
+import com.intellij.codeInsight.template.TemplateBuilder;
+import com.intellij.codeInsight.template.TemplateBuilderFactory;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Pair;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.JavaCodeStyleManager;
+import com.intellij.psi.codeStyle.VariableKind;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class DataPointHolderConversionIntention extends PsiElementBaseIntentionAction {
+  private static final String THEORIES_PACKAGE = "org.junit.experimental.theories";
+  private static final String DATA_POINT_FQN = THEORIES_PACKAGE + ".DataPoint";
+  private static final String DATA_POINTS_FQN = THEORIES_PACKAGE + ".DataPoints";
+
+  private static final String REPLACE_BY_TEMPLATE = "Replace by @%s %s";
+
+  @Override
+  public void invoke(@NotNull final Project project, final Editor editor, @NotNull final PsiElement element)
+    throws IncorrectOperationException {
+    final PsiElement holder = element.getParent();
+    PsiModifierListOwner createdElement =
+      holder instanceof PsiField ? convertToMethod((PsiField)holder) : convertToField((PsiMethod)holder);
+
+    final PsiModifierListOwner oldElement = (PsiModifierListOwner)holder;
+    final PsiAnnotation psiAnnotation = AnnotationUtil.findAnnotation(oldElement, DATA_POINT_FQN, DATA_POINTS_FQN);
+    assert psiAnnotation != null;
+    final String annotation = psiAnnotation.getQualifiedName();
+    assert annotation != null;
+    final PsiModifierList modifierList = createdElement.getModifierList();
+    assert modifierList != null;
+    modifierList.addAnnotation(annotation);
+    modifierList.setModifierProperty(PsiModifier.STATIC, true);
+    modifierList.setModifierProperty(PsiModifier.PUBLIC, true);
+    createdElement = (PsiModifierListOwner)oldElement.replace(createdElement);
+
+    PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(editor.getDocument());
+    final TemplateBuilder templateBuilder = TemplateBuilderFactory.getInstance().createTemplateBuilder(createdElement);
+    final PsiNameIdentifierOwner asNameIdOwner = (PsiNameIdentifierOwner)createdElement;
+    templateBuilder.replaceElement(asNameIdOwner.getNameIdentifier(), asNameIdOwner.getName());
+    templateBuilder.run(editor, false);
+  }
+
+  private static PsiField convertToField(final PsiMethod method) {
+    final Project project = method.getProject();
+    final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project);
+    final JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(project);
+
+    final String fieldName = codeStyleManager.propertyNameToVariableName(method.getName(), VariableKind.STATIC_FIELD);
+    final PsiType returnType = method.getReturnType();
+    assert returnType != null;
+    final PsiField field = elementFactory.createField(fieldName, returnType);
+    final PsiStatement returnStatement = PsiTreeUtil.findChildOfType(method, PsiStatement.class);
+    if (returnStatement != null) {
+      field.setInitializer(((PsiReturnStatement) returnStatement).getReturnValue());
+    }
+    return field;
+  }
+
+  private static PsiMethod convertToMethod(final PsiField field) {
+    final Project project = field.getProject();
+    final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project);
+    final JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(project);
+
+    final PsiExpression fieldInitializer = field.getInitializer();
+
+    final PsiMethod method =
+      elementFactory.createMethod(codeStyleManager.variableNameToPropertyName(field.getName(), VariableKind.STATIC_FIELD), field.getType());
+    PsiCodeBlock body = method.getBody();
+    assert body != null;
+
+    final PsiStatement methodCode = elementFactory.createStatementFromText(PsiKeyword.RETURN + " " + fieldInitializer.getText() + ";", null);
+    body.add(methodCode);
+    return method;
+  }
+
+  @Override
+  public boolean isAvailable(@NotNull final Project project, final Editor editor, @NotNull final PsiElement element) {
+    final Pair<PsiMember, PsiAnnotation> dataPointsHolder = extractDataPointsHolder(element);
+    if (dataPointsHolder != null && isConvertible(dataPointsHolder.getFirst())) {
+      final String replaceType = dataPointsHolder.getFirst() instanceof PsiMethod ? "field" : "method";
+      final String annotation = StringUtil.getShortName(dataPointsHolder.getSecond().getQualifiedName());
+      setText(String.format(REPLACE_BY_TEMPLATE, annotation, replaceType));
+      return true;
+    }
+    return false;
+  }
+
+  private static Pair<PsiMember, PsiAnnotation> extractDataPointsHolder(@NotNull final PsiElement element) {
+    if (!(element instanceof PsiIdentifier)) {
+      return null;
+    }
+    final PsiElement maybeHolder = element.getParent();
+    if (maybeHolder == null || !(maybeHolder instanceof PsiMethod || maybeHolder instanceof PsiField)) {
+      return null;
+    }
+    final PsiMember holder = (PsiMember)maybeHolder;
+    final PsiAnnotation annotation = AnnotationUtil.findAnnotation(holder, DATA_POINT_FQN, DATA_POINTS_FQN);
+    return annotation == null ? null : Pair.create(holder, annotation);
+  }
+
+  private static boolean isConvertible(@NotNull final PsiMember member) {
+    if (!(member instanceof PsiMethod)) {
+      return ((PsiField)member).getInitializer() != null;
+    }
+    final PsiMethod method = (PsiMethod)member;
+    final PsiType returnType = method.getReturnType();
+    if (returnType == null || returnType.equals(PsiType.VOID) || method.getParameterList().getParametersCount() != 0) {
+      return false;
+    }
+    final PsiCodeBlock body = method.getBody();
+    if (body == null) {
+      return false;
+    }
+    final PsiStatement[] methodStatements = body.getStatements();
+    switch (methodStatements.length) {
+      case 1:
+        final PsiStatement methodStatement = methodStatements[0];
+        return methodStatement instanceof PsiReturnStatement;
+      case 0:
+        return true;
+      default:
+        return false;
+    }
+  }
+
+  @NotNull
+  @Override
+  public String getFamilyName() {
+    return "Convert @DataPoint(s) annotation holder";
+  }
+}
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/AdapterToListenerIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/AdapterToListenerIntention/description.html
index 8d03793..c7c4a80 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/AdapterToListenerIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/AdapterToListenerIntention/description.html
@@ -3,6 +3,5 @@
 This intention replaces an extension of an
 adapter class with a direct implementation of the listeners.
 <br><br>
-<small>New in 9</small>
 </body>
 </html>
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/AddArrayCreationExpressionIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/AddArrayCreationExpressionIntention/description.html
index 8abf950..5072b9c 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/AddArrayCreationExpressionIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/AddArrayCreationExpressionIntention/description.html
@@ -3,6 +3,5 @@
 This intention adds an array creation expression to an
 array initializer expression without one.
 <br><br>
-<small>New in 10.5</small>
 </body>
 </html>
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/AnnotateOverriddenMethodsIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/AnnotateOverriddenMethodsIntention/description.html
index 1281dc3..091d4df 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/AnnotateOverriddenMethodsIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/AnnotateOverriddenMethodsIntention/description.html
@@ -2,6 +2,5 @@
 <body>
 This intention copies an annotation on a method or parameter to all overridden methods.
 <br><br>
-<small>New in 11</small>
 </body>
 </html>
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToBinaryIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToBinaryIntention/description.html
index c2b6537..d909b62 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToBinaryIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToBinaryIntention/description.html
@@ -3,6 +3,5 @@
 This intention converts selected integer literal into <b>binary</b> notation
 (supported in JDK 7 or higher).
 <br><br>
-<small>New in 10.5</small>
 </body>
 </html>
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToScientificNotationIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToScientificNotationIntention/description.html
index 14c118b..40fd029 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToScientificNotationIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertToScientificNotationIntention/description.html
@@ -3,6 +3,5 @@
 This intention converts selected double or float literal written in <b>decimal</b> notation
 into <b>scientific</b> notation.
 <br><br>
-<small>New in 10.5</small>
 </body>
 </html>
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/DataPointHolderConversionIntention/after.java.template b/plugins/IntentionPowerPak/src/intentionDescriptions/DataPointHolderConversionIntention/after.java.template
new file mode 100644
index 0000000..9e20513
--- /dev/null
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/DataPointHolderConversionIntention/after.java.template
@@ -0,0 +1,4 @@
+public class X {
+  @DataPoint
+  public static int f = 0;
+}
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/DataPointHolderConversionIntention/before.java.template b/plugins/IntentionPowerPak/src/intentionDescriptions/DataPointHolderConversionIntention/before.java.template
new file mode 100644
index 0000000..c9ed326
--- /dev/null
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/DataPointHolderConversionIntention/before.java.template
@@ -0,0 +1,6 @@
+public class X {
+   @DataPoint
+   int <spot>f</spot>() {
+     return 0;
+   }
+ }
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/DataPointHolderConversionIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/DataPointHolderConversionIntention/description.html
new file mode 100644
index 0000000..4f98a39
--- /dev/null
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/DataPointHolderConversionIntention/description.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+This intention replaces field annotated with @DataPoint(s) by method and vice versa
+</body>
+</html>
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ExpandToNormalAnnotationIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/ExpandToNormalAnnotationIntention/description.html
index 27921b7..17c52c5 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/ExpandToNormalAnnotationIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ExpandToNormalAnnotationIntention/description.html
@@ -3,6 +3,5 @@
 This intention expands an annotation in <i>marker</i> or
 <i>single element</i> form to the <i>normal</i> form.
 <br><br>
-<small>New in 10.5</small>
 </body>
 </html>
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/FlipSetterCallIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/FlipSetterCallIntention/description.html
index 714a8ae..e98d5ae 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/FlipSetterCallIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/FlipSetterCallIntention/description.html
@@ -2,6 +2,5 @@
 <body>
 This intention flips setter calls.
 <br><br>
-<small>New in 9</small>
 </body>
 </html>
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/IfToAssertionIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/IfToAssertionIntention/description.html
index 2175860..5fd2e7c 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/IfToAssertionIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/IfToAssertionIntention/description.html
@@ -3,6 +3,5 @@
 This intention replaces an <b>if</b> statement
 which throws any <b>java.lang.Throwable</b> when the condition is <b>true</b> and does not have an <b>else</b> branch, with an <b>assert</b> statement.
 <br><br>
-<small>New in 10</small>
 </body>
 </html>
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ObscureThrownExceptionsIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/ObscureThrownExceptionsIntention/description.html
index 2c1a203..f82934c 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/ObscureThrownExceptionsIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ObscureThrownExceptionsIntention/description.html
@@ -2,6 +2,5 @@
 <body>
 This intention replaces several exceptions in a <b>throws</b> clause with a single more general one.
 <br><br>
-<small>New in 10.5</small>
 </body>
 </html>
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ReplaceArmWithTryFinallyIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/ReplaceArmWithTryFinallyIntention/description.html
index 9bb6c48..1e61d09 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/ReplaceArmWithTryFinallyIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ReplaceArmWithTryFinallyIntention/description.html
@@ -5,6 +5,5 @@
 block is replaced. If the ARM does have a <b>catch</b> section, it is converted to a normal
 <b>try catch</b> block and the <b>try finally</b> construct is placed inside.
 <br><br>
-<small>New in 10.5</small>
 </body>
 </html>
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ReplaceAssignmentWithPostfixExpressionIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/ReplaceAssignmentWithPostfixExpressionIntention/description.html
index bf6120f..774157a 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/ReplaceAssignmentWithPostfixExpressionIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ReplaceAssignmentWithPostfixExpressionIntention/description.html
@@ -3,6 +3,5 @@
 This intention replaces an assignment expression
 with an equivalent post fix increment or decrement expression.
 <br><br>
-<small>New in 9</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ReplaceDiamondWithExplicitTypeArgumentsIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/ReplaceDiamondWithExplicitTypeArgumentsIntention/description.html
index 1f5f2ea..0e8f450 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/ReplaceDiamondWithExplicitTypeArgumentsIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ReplaceDiamondWithExplicitTypeArgumentsIntention/description.html
@@ -3,6 +3,5 @@
 This intention replaces a <b><></b> (diamond) with the equivalent
 explicit type arguments.
 <br><br>
-<small>New in 11</small>
 </body>
 </html>
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ReplaceOperatorAssignmentWithPostfixExpressionIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/ReplaceOperatorAssignmentWithPostfixExpressionIntention/description.html
index 3de1dae..c58d4e1 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/ReplaceOperatorAssignmentWithPostfixExpressionIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ReplaceOperatorAssignmentWithPostfixExpressionIntention/description.html
@@ -4,6 +4,5 @@
 expression which increments or decrements an <b>int</b> or <b>long</b> with an
 equivalent postfix increment or decrement expression.
 <br><br>
-<small>New in 9</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ReplacePostfixExpressionWithAssignmentIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/ReplacePostfixExpressionWithAssignmentIntention/description.html
index e769d02..5380ad5 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/ReplacePostfixExpressionWithAssignmentIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ReplacePostfixExpressionWithAssignmentIntention/description.html
@@ -3,6 +3,5 @@
 This intention replaces a post fix increment or
 decrement expression with an equivalent assignment expression.
 <br><br>
-<small>New in 9</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ReplacePostfixExpressionWithOperatorAssignmentIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/ReplacePostfixExpressionWithOperatorAssignmentIntention/description.html
index cc0a940..21f4533 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/ReplacePostfixExpressionWithOperatorAssignmentIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ReplacePostfixExpressionWithOperatorAssignmentIntention/description.html
@@ -3,6 +3,5 @@
 This intention replaces a post fix increment or
 decrement expression with an equivalent operator assignment expression.
 <br><br>
-<small>New in 9</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ReverseForLoopDirectionIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/ReverseForLoopDirectionIntention/description.html
index c24e1dc..21dfaf3 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/ReverseForLoopDirectionIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ReverseForLoopDirectionIntention/description.html
@@ -2,6 +2,5 @@
 <body>
 This intention reverses the order of traversal of a <b>for</b> loop.
 <br><br>
-<small>New in 9</small>
 </body>
 </html>
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/SplitMultiCatchIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/SplitMultiCatchIntention/description.html
index 16d16cd..0cc13ea 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/SplitMultiCatchIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/SplitMultiCatchIntention/description.html
@@ -2,6 +2,5 @@
 <body>
 This intention splits a multi-catch section into separate <b>catch</b> blocks.
 <br><br>
-<small>New in 10.5</small>
 </body>
 </html>
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/interfaceToClass/InterfaceExtendsClass.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/interfaceToClass/InterfaceExtendsClass.java
new file mode 100644
index 0000000..121a30d
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/interfaceToClass/InterfaceExtendsClass.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+abstract class Foo {
+
+}
+
+interface Bar extends F<caret>oo {
+
+}
+
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/interfaceToClass/InterfaceExtendsClass_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/interfaceToClass/InterfaceExtendsClass_after.java
new file mode 100644
index 0000000..2b708b2
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/interfaceToClass/InterfaceExtendsClass_after.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+abstract class Foo {
+
+}
+
+abstract class Bar extends Foo {
+
+}
+
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterField.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterField.java
new file mode 100644
index 0000000..d91f851
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterField.java
@@ -0,0 +1,9 @@
+// "Replace by @DataPoints method" "true"
+class Foo {
+
+    @org.junit.experimental.theories.DataPoints
+    public static int[] myData() {
+        return new int[]{0, 1};
+    }
+
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterField2.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterField2.java
new file mode 100644
index 0000000..2ab6c16
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterField2.java
@@ -0,0 +1,9 @@
+// "Replace by @DataPoints method" "true"
+class Foo {
+
+    @org.junit.experimental.theories.DataPoints
+    public static int[] myData() {
+        return new int[]{1, 2, 3};
+    }
+
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterMethod.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterMethod.java
new file mode 100644
index 0000000..1969a99
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterMethod.java
@@ -0,0 +1,7 @@
+// "Replace by @DataPoint field" "true"
+class Foo {
+
+    @org.junit.experimental.theories.DataPoint
+    public static int qweBarasd = 0;
+
+}
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterMethod2.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterMethod2.java
new file mode 100644
index 0000000..60493b0
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterMethod2.java
@@ -0,0 +1,7 @@
+// "Replace by @DataPoint field" "true"
+class Foo {
+
+    @org.junit.experimental.theories.DataPoint
+    public static String qweBarasd = "a" + "b" + "c";
+
+}
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterMethod5.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterMethod5.java
new file mode 100644
index 0000000..4146bf8
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterMethod5.java
@@ -0,0 +1,7 @@
+// "Replace by @DataPoint field" "true"
+class Foo {
+
+    @org.junit.experimental.theories.DataPoint
+    public static String qweBarasd;
+
+}
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterNameTyping.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterNameTyping.java
new file mode 100644
index 0000000..7712317
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/afterNameTyping.java
@@ -0,0 +1,9 @@
+// "Replace by @DataPoint method" "true"
+class Foo {
+
+    @org.junit.experimental.theories.DataPoint
+    public static String typedMethodNameFromTemplates() {
+        return null;
+    }
+
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeField.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeField.java
new file mode 100644
index 0000000..fdefc47
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeField.java
@@ -0,0 +1,7 @@
+// "Replace by @DataPoints method" "true"
+class Foo {
+
+  @org.junit.experimental.theories.DataPoints
+  public static int[] qweMyDa<caret>taasd = new int[] {0, 1};
+
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeField2.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeField2.java
new file mode 100644
index 0000000..5e2cc0c
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeField2.java
@@ -0,0 +1,7 @@
+// "Replace by @DataPoints method" "true"
+class Foo {
+
+  @org.junit.experimental.theories.DataPoints
+  public static int[] myD<caret>ata = new int[] {1, 2, 3};
+
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeMethod.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeMethod.java
new file mode 100644
index 0000000..dc37954
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeMethod.java
@@ -0,0 +1,9 @@
+// "Replace by @DataPoint field" "true"
+class Foo {
+
+  @org.junit.experimental.theories.DataPoint
+  public static int ba<caret>r() {
+    return 0;
+  }
+
+}
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeMethod2.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeMethod2.java
new file mode 100644
index 0000000..3875300
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeMethod2.java
@@ -0,0 +1,9 @@
+// "Replace by @DataPoint field" "true"
+class Foo {
+
+  @org.junit.experimental.theories.DataPoint
+  public static String b<caret>ar() {
+    return "a" + "b" + "c";
+  }
+
+}
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeMethod3.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeMethod3.java
new file mode 100644
index 0000000..b838e92
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeMethod3.java
@@ -0,0 +1,10 @@
+// "Replace by @DataPoint field" "false"
+class Foo {
+
+  //wrong @DataPoint method declaration (len(params) != 0)
+  @org.junit.experimental.the ories.DataPoint
+  public static int b<caret>ar(int j) {
+    return 0;
+  }
+
+}
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeMethod4.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeMethod4.java
new file mode 100644
index 0000000..cfa76d3
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeMethod4.java
@@ -0,0 +1,9 @@
+// "Replace by @DataPoint field" "false"
+class Foo {
+
+  //wrong @DataPoint method declaration (returnType == void)
+  @org.junit.experimental.the ories.DataPoint
+  public static void ba<caret>r() {
+  }
+
+}
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeMethod5.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeMethod5.java
new file mode 100644
index 0000000..d55be51
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeMethod5.java
@@ -0,0 +1,8 @@
+// "Replace by @DataPoint field" "true"
+class Foo {
+
+  @org.junit.experimental.theories.DataPoint
+  public static String b<caret>ar() {
+  }
+
+}
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeNameTyping.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeNameTyping.java
new file mode 100644
index 0000000..052879c
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/junit/dataPointHolders/beforeNameTyping.java
@@ -0,0 +1,7 @@
+// "Replace by @DataPoint method" "true"
+class Foo {
+
+  @org.junit.experimental.theories.DataPoint
+  public static String qweBa<caret>rasd = null;
+
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/interfacetoclass/ConvertInterfaceToClassTest.java b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/interfacetoclass/ConvertInterfaceToClassTest.java
index c74f136..b33a66c 100644
--- a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/interfacetoclass/ConvertInterfaceToClassTest.java
+++ b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/interfacetoclass/ConvertInterfaceToClassTest.java
@@ -24,6 +24,7 @@
   public void testExtensionMethods() { doTest(); }
   public void testInnerInterface() { doTest(); }
   public void testStaticMethods() { doTest(); }
+  public void testInterfaceExtendsClass() { doTest(); }
   public void testFunctionalExpressions() {
     try {
       doTest();
diff --git a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/junit/DataPointHolderConversionIntentionTest.java b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/junit/DataPointHolderConversionIntentionTest.java
new file mode 100644
index 0000000..cd6e8f4
--- /dev/null
+++ b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/junit/DataPointHolderConversionIntentionTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.siyeh.ipp.junit;
+
+import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase;
+import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
+import com.intellij.codeInsight.template.impl.TemplateState;
+import com.intellij.openapi.application.PluginPathManager;
+import com.intellij.psi.codeStyle.CodeStyleSettings;
+import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class DataPointHolderConversionIntentionTest extends LightQuickFixTestCase {
+  @Override
+  protected void setUp() throws Exception {
+    super.setUp();
+    final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
+    settings.STATIC_FIELD_NAME_PREFIX = "qwe";
+    settings.STATIC_FIELD_NAME_SUFFIX = "asd";
+  }
+
+  @Override
+  protected void tearDown() throws Exception {
+    final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
+    settings.STATIC_FIELD_NAME_PREFIX = "";
+    settings.STATIC_FIELD_NAME_SUFFIX = "";
+    super.tearDown();
+  }
+
+  private void doTest() {
+    doSingleTest(getTestName(false) + ".java");
+  }
+
+  public void testField() {
+    doTest();
+  }
+
+  public void testField2() {
+    doTest();
+  }
+
+  public void testMethod() {
+    doTest();
+  }
+
+  public void testMethod2() {
+    doTest();
+  }
+
+  public void testMethod3() {
+    doTest();
+  }
+
+  public void testMethod4() {
+    doTest();
+  }
+
+  public void testMethod5() {
+    doTest();
+  }
+
+  public void testNameTyping() {
+    configureByFile(getBasePath() + "/beforeNameTyping.java");
+    TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
+    doAction("Replace by @DataPoint method");
+    final TemplateState state = TemplateManagerImpl.getTemplateState(getEditor());
+    assertNotNull(state);
+    type("typedMethodNameFromTemplates");
+    state.nextTab();
+    assertTrue(state.isFinished());
+    checkResultByFile(getBasePath() + "/afterNameTyping.java");
+  }
+
+  @NotNull
+  @Override
+  protected String getTestDataPath() {
+    return PluginPathManager.getPluginHomePath("IntentionPowerPak") + "/test/com/siyeh/ipp/junit/";
+  }
+
+  @Override
+  protected String getBasePath() {
+    return "dataPointHolders";
+  }
+}
diff --git a/plugins/ShortcutPromoter/ShortcutPromoter.iml b/plugins/ShortcutPromoter/ShortcutPromoter.iml
new file mode 100644
index 0000000..83561d9
--- /dev/null
+++ b/plugins/ShortcutPromoter/ShortcutPromoter.iml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="core-api" />
+    <orderEntry type="module" module-name="editor-ui-api" />
+    <orderEntry type="module" module-name="platform-api" />
+  </component>
+</module>
+
diff --git a/plugins/ShortcutPromoter/resources/META-INF/plugin.xml b/plugins/ShortcutPromoter/resources/META-INF/plugin.xml
new file mode 100644
index 0000000..a9a1188
--- /dev/null
+++ b/plugins/ShortcutPromoter/resources/META-INF/plugin.xml
@@ -0,0 +1,21 @@
+<idea-plugin version="2">
+  <name>Shortcut Promoter</name>
+  <id>com.intellij.promoter</id>
+  <version>1.0</version>
+  <vendor>JetBrains</vendor>
+  <description>The plugin advertises to use shortcuts instead of mouse clicks</description>
+  <depends>com.intellij.modules.platform</depends>
+
+  <application-components>
+    <component>
+      <implementation-class>com.intellij.promoter.ShortcutPromoterManager</implementation-class>
+    </component>
+  </application-components>
+  <extensionPoints>
+    <extensionPoint qualifiedName="com.intellij.shortcutPromoter" beanClass="com.intellij.promoter.ShortcutPromoterEP"/>
+  </extensionPoints>
+  <extensions defaultExtensionNs="com.intellij">
+    <errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
+    <shortcutPromoter actionId="Debug" skip="3" repeat="2"/>
+  </extensions>
+</idea-plugin>
diff --git a/plugins/ShortcutPromoter/src/com/intellij/promoter/PromoterState.java b/plugins/ShortcutPromoter/src/com/intellij/promoter/PromoterState.java
new file mode 100644
index 0000000..b44b378
--- /dev/null
+++ b/plugins/ShortcutPromoter/src/com/intellij/promoter/PromoterState.java
@@ -0,0 +1,20 @@
+package com.intellij.promoter;
+
+/**
+ * @author Konstantin Bulenkov
+ */
+public class PromoterState {
+  private int myClicks;
+
+  public int getClicks() {
+    return myClicks;
+  }
+
+  public void setClicks(int clicks) {
+    myClicks = clicks;
+  }
+
+  public void incClicks() {
+    myClicks++;
+  }
+}
diff --git a/plugins/ShortcutPromoter/src/com/intellij/promoter/ShortcutPromoterEP.java b/plugins/ShortcutPromoter/src/com/intellij/promoter/ShortcutPromoterEP.java
new file mode 100644
index 0000000..7fe7626
--- /dev/null
+++ b/plugins/ShortcutPromoter/src/com/intellij/promoter/ShortcutPromoterEP.java
@@ -0,0 +1,32 @@
+package com.intellij.promoter;
+
+import com.intellij.openapi.extensions.AbstractExtensionPointBean;
+import com.intellij.openapi.extensions.ExtensionPointName;
+import com.intellij.util.xmlb.annotations.Attribute;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author Konstantin Bulenkov
+ */
+public class ShortcutPromoterEP extends AbstractExtensionPointBean {
+  public static final ExtensionPointName<ShortcutPromoterEP> EP_NAME = new ExtensionPointName<ShortcutPromoterEP>("com.intellij.shortcutPromoter");
+
+  @Attribute("actionId")
+  public String actionId;
+
+  @Attribute("skip")
+  public int skip;
+
+  @Attribute("repeat")
+  public int repeat;
+
+  @Nullable
+  public static ShortcutPromoterEP find(@Nullable String actionId) {
+    for (ShortcutPromoterEP ep : EP_NAME.getExtensions()) {
+      if (ep.actionId.equals(actionId)) {
+        return ep;
+      }
+    }
+    return null;
+  }
+}
diff --git a/plugins/ShortcutPromoter/src/com/intellij/promoter/ShortcutPromoterManager.java b/plugins/ShortcutPromoter/src/com/intellij/promoter/ShortcutPromoterManager.java
new file mode 100644
index 0000000..0235682
--- /dev/null
+++ b/plugins/ShortcutPromoter/src/com/intellij/promoter/ShortcutPromoterManager.java
@@ -0,0 +1,122 @@
+package com.intellij.promoter;
+
+import com.intellij.openapi.actionSystem.ActionManager;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.actionSystem.ex.AnActionListener;
+import com.intellij.openapi.application.PathManager;
+import com.intellij.openapi.components.*;
+import org.jdom.Element;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.awt.event.InputEvent;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.util.HashMap;
+
+/**
+ * @author Konstantin Bulenkov
+ */
+@State(
+  name = "ShortcutPromoterManager",
+  roamingType = RoamingType.PER_PLATFORM,
+  storages = {
+    @Storage(
+      file = StoragePathMacros.APP_CONFIG + "/promoter.xml"
+    )}
+)
+public class ShortcutPromoterManager implements ApplicationComponent, AnActionListener, ExportableApplicationComponent,
+                                                PersistentStateComponent<Element> {
+  private final HashMap<String, PromoterState> myState = new HashMap<String, PromoterState>();
+  private final HashMap<String, ShortcutPromoterEP> myExtensions = new HashMap<String, ShortcutPromoterEP>();
+
+  @Override
+  public void initComponent() {
+    myExtensions.clear();
+    myState.clear();
+
+    for (ShortcutPromoterEP ep : ShortcutPromoterEP.EP_NAME.getExtensions()) {
+      myExtensions.put(ep.actionId, ep);
+    }
+    ActionManager.getInstance().addAnActionListener(this);
+  }
+
+  @Override
+  public void disposeComponent() {
+    ActionManager.getInstance().removeAnActionListener(this);
+  }
+
+  @NotNull
+  @Override
+  public String getComponentName() {
+    return getClass().getName();
+  }
+
+  @Override
+  public void beforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
+    final InputEvent input = event.getInputEvent();
+    if (input instanceof MouseEvent) {
+      final String id = ActionManager.getInstance().getId(action);
+      final ShortcutPromoterEP ep = myExtensions.get(id);
+      if (ep != null) {
+        PromoterState state = myState.get(id);
+        if (state == null) {
+          state = new PromoterState();
+          myState.put(id, state);
+        }
+        state.incClicks();
+      }
+    }
+  }
+
+  @Override
+  public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
+
+  }
+
+  @Override
+  public void beforeEditorTyping(char c, DataContext dataContext) {
+
+  }
+
+  @NotNull
+  @Override
+  public File[] getExportFiles() {
+    return new File[]{PathManager.getOptionsFile("shortcutPromoter")};
+  }
+
+  @NotNull
+  @Override
+  public String getPresentableName() {
+    return "Shortcut Promoter";
+  }
+
+  @Nullable
+  @Override
+  public Element getState() {
+    final Element actions = new Element("actions");
+    for (String id : myState.keySet()) {
+      final Element action = new Element("action");
+      action.setAttribute("actionId", id);
+      action.setAttribute("clicks", String.valueOf(myState.get(id).getClicks()));
+      actions.addContent(action);
+    }
+    return actions;
+  }
+
+  @Override
+  public void loadState(Element state) {
+    myState.clear();
+    for (Element action : state.getChildren("action")) {
+      final String id = action.getAttributeValue("actionId");
+      final String clicks = action.getAttributeValue("clicks");
+      try {
+        final PromoterState info = new PromoterState();
+        info.setClicks(Integer.parseInt(clicks));
+        myState.put(id, info);
+      } catch (Exception ignore) {}
+    }
+  }
+}
diff --git a/plugins/ant/src/com/intellij/lang/ant/config/execution/AntRunProfileState.java b/plugins/ant/src/com/intellij/lang/ant/config/execution/AntRunProfileState.java
index 14ab1f7..ac12015 100644
--- a/plugins/ant/src/com/intellij/lang/ant/config/execution/AntRunProfileState.java
+++ b/plugins/ant/src/com/intellij/lang/ant/config/execution/AntRunProfileState.java
@@ -48,12 +48,13 @@
       AntBuildTarget target = antRunConfiguration.getTarget();
       if (target == null) return null;
       ProcessHandler processHandler = ExecutionHandler
-        .runTarget(antRunConfiguration, myEnvironment.getDataContext(), new ArrayList<BuildFileProperty>(), new AntBuildListener() {
-          @Override
-          public void buildFinished(int state, int errorCount) {
+        .executeRunConfiguration(antRunConfiguration, myEnvironment.getDataContext(), new ArrayList<BuildFileProperty>(),
+                                 new AntBuildListener() {
+                                   @Override
+                                   public void buildFinished(int state, int errorCount) {
 
-          }
-        });
+                                   }
+                                 });
       if (processHandler == null) return null;
       return new DefaultExecutionResult(null, processHandler);
     }
diff --git a/plugins/ant/src/com/intellij/lang/ant/config/execution/ExecutionHandler.java b/plugins/ant/src/com/intellij/lang/ant/config/execution/ExecutionHandler.java
index 4f5c8db..0d5f4c3 100644
--- a/plugins/ant/src/com/intellij/lang/ant/config/execution/ExecutionHandler.java
+++ b/plugins/ant/src/com/intellij/lang/ant/config/execution/ExecutionHandler.java
@@ -63,16 +63,17 @@
   }
 
   @Nullable
-  public static ProcessHandler runTarget(AntRunConfiguration antRunConfiguration,
-                                         final DataContext dataContext,
-                                         List<BuildFileProperty> additionalProperties, @NotNull final AntBuildListener antBuildListener) {
+  public static ProcessHandler executeRunConfiguration(AntRunConfiguration antRunConfiguration,
+                                                       final DataContext dataContext,
+                                                       List<BuildFileProperty> additionalProperties,
+                                                       @NotNull final AntBuildListener antBuildListener) {
     AntBuildTarget target = antRunConfiguration.getTarget();
     if (target == null) return null;
     FutureResult<ProcessHandler> result = runBuildImpl((AntBuildFileBase)target.getModel().getBuildFile(),
                                                        new String[]{target.getName()},
                                                        null,
                                                        dataContext,
-                                                       additionalProperties, antBuildListener);
+                                                       additionalProperties, antBuildListener, false);
     if (result != null) {
       try {
         return result.get();
@@ -95,19 +96,19 @@
                               @Nullable final AntBuildMessageView buildMessageViewToReuse,
                               final DataContext dataContext,
                               List<BuildFileProperty> additionalProperties, @NotNull final AntBuildListener antBuildListener) {
-      runBuildImpl(buildFile, targets, buildMessageViewToReuse, dataContext, additionalProperties, antBuildListener);
+      runBuildImpl(buildFile, targets, buildMessageViewToReuse, dataContext, additionalProperties, antBuildListener, true);
   }
 
   /**
    * @param antBuildListener should not be null. Use {@link com.intellij.lang.ant.config.AntBuildListener#NULL}
    */
   @Nullable
-  public static FutureResult<ProcessHandler> runBuildImpl(final AntBuildFileBase buildFile,
+  private static FutureResult<ProcessHandler> runBuildImpl(final AntBuildFileBase buildFile,
                                                           String[] targets,
                                                           @Nullable final AntBuildMessageView buildMessageViewToReuse,
                                                           final DataContext dataContext,
                                                           List<BuildFileProperty> additionalProperties,
-                                                          @NotNull final AntBuildListener antBuildListener) {
+                                                          @NotNull final AntBuildListener antBuildListener, final boolean waitFor) {
     final AntBuildMessageView messageView;
     final GeneralCommandLine commandLine;
     final Project project = buildFile.getProject();
@@ -158,7 +159,11 @@
 
       public void run(@NotNull final ProgressIndicator indicator) {
         try {
-          future.set(runBuild(indicator, messageView, buildFile, antBuildListener, commandLine));
+          ProcessHandler handler = runBuild(indicator, messageView, buildFile, antBuildListener, commandLine);
+          future.set(handler);
+          if (waitFor && handler != null) {
+            handler.waitFor();
+          }
         }
         catch (Throwable e) {
           LOG.error(e);
diff --git a/plugins/ant/src/com/intellij/lang/ant/config/execution/OutputParser.java b/plugins/ant/src/com/intellij/lang/ant/config/execution/OutputParser.java
index 943a985..6f2fb85 100644
--- a/plugins/ant/src/com/intellij/lang/ant/config/execution/OutputParser.java
+++ b/plugins/ant/src/com/intellij/lang/ant/config/execution/OutputParser.java
@@ -15,9 +15,7 @@
  */
 package com.intellij.lang.ant.config.execution;
 
-import com.intellij.compiler.impl.javaCompiler.FileObject;
 import com.intellij.compiler.impl.javaCompiler.javac.JavacOutputParser;
-import com.intellij.compiler.impl.javaCompiler.jikes.JikesOutputParser;
 import com.intellij.execution.process.OSProcessHandler;
 import com.intellij.lang.ant.AntBundle;
 import com.intellij.openapi.application.ApplicationManager;
@@ -181,30 +179,6 @@
     }
   }
 
-  private static boolean isJikesMessage(String errorMessage) {
-    for (int j = 0; j < errorMessage.length(); j++) {
-      if (errorMessage.charAt(j) == ':') {
-        int offset = getNextTwoPoints(j, errorMessage);
-        if (offset < 0) {
-          continue;
-        }
-        offset = getNextTwoPoints(offset, errorMessage);
-        if (offset < 0) {
-          continue;
-        }
-        offset = getNextTwoPoints(offset, errorMessage);
-        if (offset < 0) {
-          continue;
-        }
-        offset = getNextTwoPoints(offset, errorMessage);
-        if (offset >= 0) {
-          return true;
-        }
-      }
-    }
-    return false;
-  }
-
   private static int getNextTwoPoints(int offset, String message) {
     for (int i = offset + 1; i < message.length(); i++) {
       char c = message.charAt(i);
@@ -220,30 +194,18 @@
   }
 
   private static void processJavacMessages(final List<String> javacMessages, final AntBuildMessageView messageView, Project project) {
-    if (javacMessages == null) return;
-
-    boolean isJikes = false;
-    for (String errorMessage : javacMessages) {
-      if (isJikesMessage(errorMessage)) {
-        isJikes = true;
-        break;
-      }
+    if (javacMessages == null) {
+      return;
     }
 
-    com.intellij.compiler.OutputParser outputParser;
-    if (isJikes) {
-      outputParser = new JikesOutputParser(project);
-    }
-    else {
-      outputParser = new JavacOutputParser(project);
-    }
+    final com.intellij.compiler.OutputParser outputParser = new JavacOutputParser(project);
 
     com.intellij.compiler.OutputParser.Callback callback = new com.intellij.compiler.OutputParser.Callback() {
       private int myIndex = -1;
 
       @Nullable
       public String getCurrentLine() {
-        if (javacMessages == null || myIndex >= javacMessages.size()) {
+        if (myIndex >= javacMessages.size()) {
           return null;
         }
         return javacMessages.get(myIndex);
@@ -289,7 +251,7 @@
       public void fileProcessed(String path) {
       }
 
-      public void fileGenerated(FileObject path) {
+      public void fileGenerated(String path) {
       }
     };
     try {
diff --git a/plugins/ant/src/com/intellij/lang/ant/config/execution/PlainTextView.java b/plugins/ant/src/com/intellij/lang/ant/config/execution/PlainTextView.java
index 99e0c99..5d681fc 100644
--- a/plugins/ant/src/com/intellij/lang/ant/config/execution/PlainTextView.java
+++ b/plugins/ant/src/com/intellij/lang/ant/config/execution/PlainTextView.java
@@ -24,6 +24,7 @@
 import com.intellij.execution.ui.ConsoleView;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.util.Key;
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -51,7 +52,7 @@
   }
 
   public void dispose() {
-    myConsole.dispose();
+    Disposer.dispose(myConsole);
   }
 
   @Override
diff --git a/plugins/ant/src/com/intellij/lang/ant/config/impl/AntToolwindowRegistrar.java b/plugins/ant/src/com/intellij/lang/ant/config/impl/AntToolwindowRegistrar.java
index 368a4e5..0c3efda 100644
--- a/plugins/ant/src/com/intellij/lang/ant/config/impl/AntToolwindowRegistrar.java
+++ b/plugins/ant/src/com/intellij/lang/ant/config/impl/AntToolwindowRegistrar.java
@@ -15,6 +15,7 @@
  */
 package com.intellij.lang.ant.config.impl;
 
+import com.intellij.lang.ant.config.AntBuildTarget;
 import com.intellij.lang.ant.config.AntConfiguration;
 import com.intellij.lang.ant.config.AntConfigurationBase;
 import com.intellij.lang.ant.config.actions.TargetActionStub;
@@ -25,6 +26,7 @@
 import com.intellij.openapi.compiler.CompileContext;
 import com.intellij.openapi.compiler.CompileTask;
 import com.intellij.openapi.compiler.CompilerManager;
+import com.intellij.openapi.compiler.CompilerMessageCategory;
 import com.intellij.openapi.components.AbstractProjectComponent;
 import com.intellij.openapi.keymap.Keymap;
 import com.intellij.openapi.keymap.ex.KeymapManagerEx;
@@ -66,8 +68,15 @@
     });
     compilerManager.addAfterTask(new CompileTask() {
       public boolean execute(CompileContext context) {
-        final AntConfiguration config = AntConfiguration.getInstance(myProject);
-        ((AntConfigurationBase)config).ensureInitialized();
+        final AntConfigurationBase config = (AntConfigurationBase)AntConfiguration.getInstance(myProject);
+        config.ensureInitialized();
+        if (context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
+          final AntBuildTarget target = config.getTargetForEvent(ExecuteAfterCompilationEvent.getInstance());
+          if (target != null) {
+            context.addMessage(CompilerMessageCategory.INFORMATION, "Skipping ant target \"" + target.getDisplayName() + "\" because of compilation errors", null , -1, -1);
+          }
+          return true;
+        }
         return config.executeTargetAfterCompile(dataContext);
       }
     });
diff --git a/plugins/ant/src/com/intellij/lang/ant/dom/AntDomTargetReference.java b/plugins/ant/src/com/intellij/lang/ant/dom/AntDomTargetReference.java
index 5cd816e..9b90a2a 100644
--- a/plugins/ant/src/com/intellij/lang/ant/dom/AntDomTargetReference.java
+++ b/plugins/ant/src/com/intellij/lang/ant/dom/AntDomTargetReference.java
@@ -87,7 +87,7 @@
                     if (prefixNamePairs == null) {
                       prefixNamePairs = new ArrayList<Couple<String>>(); // lazy init
                     }
-                    prefixNamePairs.add(Couple.newOne(prefix, candidateName));
+                    prefixNamePairs.add(Couple.of(prefix, candidateName));
                   }
                 }
               }
diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/CvsFilePath.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/CvsFilePath.java
new file mode 100644
index 0000000..aa9164b
--- /dev/null
+++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/CvsFilePath.java
@@ -0,0 +1,38 @@
+/*
+ * 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.cvsSupport2;
+
+import com.intellij.cvsSupport2.changeBrowser.CvsRepositoryLocation;
+import com.intellij.openapi.vcs.FilePathImpl;
+import com.intellij.openapi.vfs.VirtualFile;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Bas Leijdekkers
+ */
+public class CvsFilePath extends FilePathImpl {
+
+  private final CvsRepositoryLocation myRepositoryLocation;
+
+  public CvsFilePath(@NotNull VirtualFile virtualFile, CvsRepositoryLocation repositoryLocation) {
+    super(virtualFile);
+    myRepositoryLocation = repositoryLocation;
+  }
+
+  public CvsRepositoryLocation getRepositoryLocation() {
+    return myRepositoryLocation;
+  }
+}
diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/ui/BrowserPanel.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/ui/BrowserPanel.java
index 643657d..caf4b59 100644
--- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/ui/BrowserPanel.java
+++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/cvsBrowser/ui/BrowserPanel.java
@@ -16,6 +16,7 @@
 package com.intellij.cvsSupport2.cvsBrowser.ui;
 
 import com.intellij.CvsBundle;
+import com.intellij.cvsSupport2.CvsFilePath;
 import com.intellij.cvsSupport2.CvsVcs2;
 import com.intellij.cvsSupport2.actions.cvsContext.CvsContextAdapter;
 import com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile;
@@ -165,7 +166,7 @@
     }
 
     public void actionPerformed(AnActionEvent e) {
-      CvsElement[] currentSelection = myTree.getCurrentSelection();
+      final CvsElement[] currentSelection = myTree.getCurrentSelection();
       if (currentSelection.length != 1) return;
       final CvsElement cvsElement = currentSelection[0];
       final VirtualFile virtualFile = cvsElement.getVirtualFile();
@@ -174,7 +175,7 @@
       final VcsHistoryProvider historyProvider = vcs.getVcsHistoryProvider();
       final String moduleName = cvsElement.getElementPath();
       final CvsRepositoryLocation location = new CvsRepositoryLocation(null, myCvsRootConfiguration, moduleName);
-      AbstractVcsHelper.getInstance(myProject).showFileHistory(historyProvider, new FilePathImpl(virtualFile), vcs, location);
+      AbstractVcsHelper.getInstance(myProject).showFileHistory(historyProvider, new CvsFilePath(virtualFile, location), vcs, null);
     }
   }
 
diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/CvsHistoryProvider.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/CvsHistoryProvider.java
index 4ab9e03..5de3880 100644
--- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/CvsHistoryProvider.java
+++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/history/CvsHistoryProvider.java
@@ -16,6 +16,7 @@
 package com.intellij.cvsSupport2.history;
 
 import com.intellij.CvsBundle;
+import com.intellij.cvsSupport2.CvsFilePath;
 import com.intellij.cvsSupport2.CvsUtil;
 import com.intellij.cvsSupport2.application.CvsEntriesManager;
 import com.intellij.cvsSupport2.changeBrowser.CvsChangeList;
@@ -203,9 +204,9 @@
   }
 
   public void reportAppendableHistory(FilePath path, VcsAppendableHistorySessionPartner partner) throws VcsException {
-    final CvsRepositoryLocation location = (CvsRepositoryLocation)partner.getRepositoryLocation();
     final VcsHistorySession session;
-    if (location != null) {
+    if (path instanceof CvsFilePath) {
+      final CvsRepositoryLocation location = ((CvsFilePath)path).getRepositoryLocation();
       final List<VcsFileRevision> fileRevisionList = createRevisions(location.getEnvironment(), path.getIOFile());
       if (fileRevisionList == null) return;
       session = new MyHistorySession(fileRevisionList, path);
diff --git a/plugins/devkit/devkit.iml b/plugins/devkit/devkit.iml
index 7e0ce39..7232990 100644
--- a/plugins/devkit/devkit.iml
+++ b/plugins/devkit/devkit.iml
@@ -45,6 +45,7 @@
     <orderEntry type="module" module-name="lang-impl" />
     <orderEntry type="module" module-name="testFramework" />
     <orderEntry type="module" module-name="dom-impl" />
+    <orderEntry type="module" module-name="devkit-jps-plugin" />
   </component>
 </module>
 
diff --git a/plugins/devkit/resources/META-INF/plugin.xml b/plugins/devkit/resources/META-INF/plugin.xml
index 396d620..d92839c 100644
--- a/plugins/devkit/resources/META-INF/plugin.xml
+++ b/plugins/devkit/resources/META-INF/plugin.xml
@@ -50,7 +50,7 @@
     <configurationType implementation="org.jetbrains.idea.devkit.run.PluginConfigurationType"/>
     <moduleType id="PLUGIN_MODULE" implementationClass="org.jetbrains.idea.devkit.module.PluginModuleType" classpathProvider="true"/>
     <sdkType implementation="org.jetbrains.idea.devkit.projectRoots.IdeaJdk"/>
-    <compileServer.plugin classpath="jps/devkit-jps-plugin.jar"/>
+    <compileServer.plugin classpath="devkit-jps-plugin.jar"/>
     <fileTemplateGroup implementation="org.jetbrains.idea.devkit.DevKitFileTemplatesFactory"/>
     <lang.documentationProvider language="XML"
                                 implementationClass="org.jetbrains.idea.devkit.references.extensions.ExtensionPointDocumentationProvider"/>
diff --git a/plugins/devkit/src/dom/generator/DomGenDialog.java b/plugins/devkit/src/dom/generator/DomGenDialog.java
index c04c920..0dba163 100644
--- a/plugins/devkit/src/dom/generator/DomGenDialog.java
+++ b/plugins/devkit/src/dom/generator/DomGenDialog.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.
@@ -53,6 +53,9 @@
     if (panel.getAuthor().trim().length() > 0) {
       emitter.setAuthor(panel.getAuthor());
     }
+    if (panel.isUseQualifiedClassNames()) {
+      emitter.enableQualifiedClassNames();
+    }
     final ModelGen modelGen = new ModelGen(loader, emitter, fileManager);
     final NamespaceDesc desc = panel.getNamespaceDescriptor();
     modelGen.setConfig(desc.name, location, desc, panel.getSkippedSchemas());
diff --git a/plugins/devkit/src/dom/generator/DomGenPanel.form b/plugins/devkit/src/dom/generator/DomGenPanel.form
index 1e75b6c..5ae4445 100644
--- a/plugins/devkit/src/dom/generator/DomGenPanel.form
+++ b/plugins/devkit/src/dom/generator/DomGenPanel.form
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.idea.devkit.dom.generator.DomGenPanel">
-  <grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="8" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+  <grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="9" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
     <margin top="0" left="0" bottom="0" right="0"/>
     <constraints>
-      <xy x="20" y="20" width="424" height="262"/>
+      <xy x="20" y="20" width="443" height="297"/>
     </constraints>
     <properties/>
     <clientProperties>
@@ -21,12 +21,12 @@
       </component>
       <vspacer id="e8ccd">
         <constraints>
-          <grid row="7" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+          <grid row="8" 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>
       <component id="f5680" class="javax.swing.JLabel">
         <constraints>
-          <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+          <grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
         </constraints>
         <properties>
           <text value="Super Class:"/>
@@ -34,7 +34,7 @@
       </component>
       <component id="20f66" class="javax.swing.JTextField" binding="mySuperClass">
         <constraints>
-          <grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
+          <grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
             <preferred-size width="327" height="22"/>
           </grid>
         </constraints>
@@ -62,7 +62,7 @@
       </component>
       <component id="d62dc" class="javax.swing.JLabel">
         <constraints>
-          <grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+          <grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
         </constraints>
         <properties>
           <text value="Output Dir:"/>
@@ -70,7 +70,7 @@
       </component>
       <component id="6a48b" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myOutputDir" custom-create="true">
         <constraints>
-          <grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
+          <grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
             <preferred-size width="327" height="22"/>
           </grid>
         </constraints>
@@ -102,7 +102,7 @@
       </component>
       <component id="bdaaf" class="javax.swing.JLabel">
         <constraints>
-          <grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
+          <grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
         </constraints>
         <properties>
           <text value="Skip schemes:"/>
@@ -110,7 +110,7 @@
       </component>
       <component id="f4732" class="javax.swing.JTextArea" binding="mySkipSchemas">
         <constraints>
-          <grid row="6" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false">
+          <grid row="7" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false">
             <preferred-size width="150" height="50"/>
           </grid>
         </constraints>
@@ -118,7 +118,7 @@
       </component>
       <component id="54b59" class="javax.swing.JLabel">
         <constraints>
-          <grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+          <grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
         </constraints>
         <properties>
           <text value="@author:"/>
@@ -126,12 +126,27 @@
       </component>
       <component id="b033e" class="javax.swing.JTextField" binding="myAuthor">
         <constraints>
-          <grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
+          <grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
             <preferred-size width="150" height="-1"/>
           </grid>
         </constraints>
         <properties/>
       </component>
+      <component id="9b2c4" class="com.intellij.ui.components.JBCheckBox" binding="myUseQualifiedClassNames">
+        <constraints>
+          <grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+        </constraints>
+        <properties/>
+      </component>
+      <component id="df0c8" class="javax.swing.JLabel">
+        <constraints>
+          <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+        </constraints>
+        <properties>
+          <text value="Use FQNs:"/>
+          <toolTipText value="Use FQNs in generated code to prevent name conflicts"/>
+        </properties>
+      </component>
     </children>
   </grid>
 </form>
diff --git a/plugins/devkit/src/dom/generator/DomGenPanel.java b/plugins/devkit/src/dom/generator/DomGenPanel.java
index df2a6d8..e0c2161 100644
--- a/plugins/devkit/src/dom/generator/DomGenPanel.java
+++ b/plugins/devkit/src/dom/generator/DomGenPanel.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.
@@ -31,6 +31,7 @@
 import com.intellij.psi.xml.XmlDocument;
 import com.intellij.psi.xml.XmlFile;
 import com.intellij.psi.xml.XmlTag;
+import com.intellij.ui.components.JBCheckBox;
 import com.intellij.util.ArrayUtil;
 
 import javax.swing.*;
@@ -51,6 +52,7 @@
   private TextFieldWithBrowseButton myOutputDir;
   private JTextArea mySkipSchemas;
   private JTextField myAuthor;
+  private JBCheckBox myUseQualifiedClassNames;
   private final Project myProject;
 
   public DomGenPanel(Project project) {
@@ -127,6 +129,7 @@
     myOutputDir.setText(getValue("output", ""));
     mySkipSchemas.setText(getValue("skipSchemas", "http://www.w3.org/2001/XMLSchema\nhttp://www.w3.org/2001/XMLSchema-instance"));
     myAuthor.setText(getValue("author", ""));
+    myUseQualifiedClassNames.setSelected(getValue("useFQNs", "false").equals("true"));
   }
 
   private static String getValue(String name, String defaultValue) {
@@ -145,6 +148,7 @@
     setValue("output", myOutputDir.getText());
     setValue("skipSchemas", mySkipSchemas.getText());
     setValue("author", myAuthor.getText());
+    setValue("useFQNs", myUseQualifiedClassNames.isSelected() ? "true" : "false");
   }
 
   public boolean validate() {
@@ -174,4 +178,8 @@
   public String getAuthor() {
     return myAuthor.getText();
   }
+
+  public boolean isUseQualifiedClassNames() {
+    return myUseQualifiedClassNames.isSelected();
+  }
 }
diff --git a/plugins/devkit/src/dom/generator/JetBrainsEmitter.java b/plugins/devkit/src/dom/generator/JetBrainsEmitter.java
index bf3c3bc..efc82d6 100644
--- a/plugins/devkit/src/dom/generator/JetBrainsEmitter.java
+++ b/plugins/devkit/src/dom/generator/JetBrainsEmitter.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.
@@ -22,6 +22,9 @@
  */
 package org.jetbrains.idea.devkit.dom.generator;
 
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.CommonClassNames;
+
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
@@ -37,6 +40,7 @@
   static final boolean JB_OFF = false;
   static final boolean REPLACE_TYPES_WITH_INTERFACES = true;
   private String AUTHOR = null;
+  private boolean myUseQualifiedClassNames = false;
 
 
   public void emit(FileManager fileManager, ModelDesc model, File outputRoot) {
@@ -66,6 +70,7 @@
     final String typeName = td.name;
     final String typeQName = model.getNSDPrefix(td) + typeName;
     final String pkgName = typeQName.lastIndexOf('.') > -1 ? typeQName.substring(0, typeQName.lastIndexOf('.')) : "";
+    final String stringClass = getStringClassName();
 
     final File outFile = fileManager.getOutputFile(new File(outDir, toJavaFileName(typeQName)));
     PrintWriter out = null;
@@ -179,9 +184,9 @@
         if (text) {
           out.println(";");
           out.println();
-          out.println("\tprivate final String value;");
-          out.println("\tprivate " + typeName + "(String value) { this.value = value; }");
-          out.println("\tpublic String getValue() { return value; }");
+          out.println("\tprivate final " + stringClass + " value;");
+          out.println("\tprivate " + typeName + "(" + stringClass + " value) { this.value = value; }");
+          out.println("\tpublic " + stringClass + " getValue() { return value; }");
         }
         out.println();
         out.println("}");
@@ -235,8 +240,8 @@
       out.println("");
       for (FieldDesc field : fields) {
         String tagName = field.tagName;
-        String type = field.type;
-        String elementType = field.elementType;
+        String type = myUseQualifiedClassNames ? pkgName + "." + field.type : field.type;
+        String elementType = myUseQualifiedClassNames ? pkgName + "." + field.elementType : field.elementType;
         String name = field.name;
         String paramName = toJavaIdName(field.clType > 0 ? name : field.elementName);
         String javaDocTagName = field.clType < 0 ? tagName + " children" : tagName != null ? tagName + " child" : "simple content";
@@ -330,7 +335,7 @@
           type = newType;
         }
         if (isList) {
-          type = "List<" + elementType + ">";
+          type = "java.util.List<" + elementType + ">";
         }
 
         StringBuffer sbAnnotations = new StringBuffer();
@@ -526,6 +531,7 @@
     }
     if (jtList.size() == 0) return;
 
+    final String stringClass = getStringClassName();
     String typeName = nsd.helperClass.substring(nsd.helperClass.lastIndexOf(".") + 1);
     final String typeQName = model.toJavaQualifiedTypeName("", nsd.helperClass, false);
     String pkgName = typeQName.substring(0, typeQName.lastIndexOf('.'));
@@ -550,7 +556,7 @@
       out.print("public class " + typeName + " ");
       out.println("{");
       out.println("");
-      out.println("\tprivate interface GetName { String getName(Object o); }");
+      out.println("\tprivate interface GetName { " + stringClass + " getName(Object o); }");
       out.println("\tprivate static java.util.HashMap<Class, GetName> nameMap = new java.util.HashMap();");
       out.println("\tstatic {");
 
@@ -597,12 +603,12 @@
         String qname = model.getNSDPrefix(td) + td.name;
         String tdNameString = "\"" + toPresentationName(td.name) + "\"";
         out.println("\t\tnameMap.put(" + qname + ".class, new GetName() {");
-        out.println("\t\t\tpublic String getName(Object o) {");
+        out.println("\t\t\tpublic " + stringClass + " getName(Object o) {");
         if (guessedField != null) {
           out.println("\t\t\t\t" + qname + " my = (" + qname + ") o;");
           String getter = "my.get" + Util.capitalize(guessedField.name) + "()";
           if (guessedField.clType > 0) {
-            out.println("\t\t\t\tString s = o==null? null:" + getter +
+            out.println("\t\t\t\t" + stringClass + " s = o==null? null:" + getter +
                         (guessedField.clType == FieldDesc.STR || guessedField.clType == FieldDesc.ATTR ? ".getValue();" : ";"));
             out.println("\t\t\t\treturn s==null?" + tdNameString + ":s;");
           }
@@ -619,7 +625,7 @@
       }
       out.println("\t}");
 
-      out.println("\tpublic static String getPresentationName(Object o, String def) {");
+      out.println("\tpublic static " + stringClass + " getPresentationName(Object o, " + stringClass + " def) {");
       out.println("\t\tGetName g = o!=null? nameMap.get(o.getClass().getInterfaces()[0]):null;");
       out.println("\t\treturn g != null?g.getName(o):def;");
       out.println("\t}");
@@ -665,6 +671,10 @@
     return typeName.replace('.', File.separatorChar) + ".java";
   }
 
+  private String getStringClassName() {
+    return myUseQualifiedClassNames ? CommonClassNames.JAVA_LANG_STRING : StringUtil.getShortName(CommonClassNames.JAVA_LANG_STRING);
+  }
+
   public static String toJavaIdName(String javaFieldName) {
     if (Util.RESERVED_NAMES_MAP.containsKey(javaFieldName)) {
       javaFieldName += "_";
@@ -676,4 +686,8 @@
   public void setAuthor(String author) {
     AUTHOR = "@author " + author;
   }
+
+  public void enableQualifiedClassNames() {
+    myUseQualifiedClassNames = true;
+  }
 }
diff --git a/plugins/devkit/src/inspections/internal/UseCoupleInspection.java b/plugins/devkit/src/inspections/internal/UseCoupleInspection.java
index 4b1a97f..8d5873f 100644
--- a/plugins/devkit/src/inspections/internal/UseCoupleInspection.java
+++ b/plugins/devkit/src/inspections/internal/UseCoupleInspection.java
@@ -65,7 +65,7 @@
               if (psiClass != null && PAIR_FQN.equals(psiClass.getQualifiedName())) {
                 final PsiType[] types = expression.getArgumentList().getExpressionTypes();
                 if (types.length == 2 && types[0].equals(types[1])) {
-                  final String name = "Change to Couple.newOne";
+                  final String name = "Change to Couple.of";
                   holder.registerProblem(expression, name, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new UseCoupleQuickFix(name));
                 }
               }
diff --git a/plugins/devkit/src/inspections/quickfix/PluginDescriptorChooser.java b/plugins/devkit/src/inspections/quickfix/PluginDescriptorChooser.java
index f46429f..e701055 100644
--- a/plugins/devkit/src/inspections/quickfix/PluginDescriptorChooser.java
+++ b/plugins/devkit/src/inspections/quickfix/PluginDescriptorChooser.java
@@ -160,11 +160,14 @@
       public int compare(DomFileElement<IdeaPlugin> o1, DomFileElement<IdeaPlugin> o2) {
         // current module = first group
         final Module module1 = o1.getModule();
-        if (currentModule.equals(module1)) return -1;
         final Module module2 = o2.getModule();
+        final int byAlpha = ModulesAlphaComparator.INSTANCE.compare(module1, module2);
+        if (byAlpha == 0) return 0;
+
+        if (currentModule.equals(module1)) return -1;
         if (currentModule.equals(module2)) return 1;
 
-        return ModulesAlphaComparator.INSTANCE.compare(module1, module2);
+        return byAlpha;
       }
     });
     Collections.sort(elements, new Comparator<DomFileElement<IdeaPlugin>>() {
diff --git a/plugins/devkit/src/inspections/quickfix/UseCoupleQuickFix.java b/plugins/devkit/src/inspections/quickfix/UseCoupleQuickFix.java
index 74850b9..31deb0b 100644
--- a/plugins/devkit/src/inspections/quickfix/UseCoupleQuickFix.java
+++ b/plugins/devkit/src/inspections/quickfix/UseCoupleQuickFix.java
@@ -43,7 +43,7 @@
       final PsiTypeElement newType = factory.createTypeElementFromText(COUPLE_FQN + "<" + type + ">", element.getContext());
       newElement = element.replace(newType);
     } else {
-      final String text = COUPLE_FQN + ".newOne" + element.getText().substring("Pair.create".length());
+      final String text = COUPLE_FQN + ".of" + element.getText().substring("Pair.create".length());
       final PsiExpression expression = factory.createExpressionFromText(text, element.getContext());
       newElement = element.replace(expression);
     }
diff --git a/plugins/devkit/src/navigation/ExtensionPointDeclarationRelatedItemLineMarkerProvider.java b/plugins/devkit/src/navigation/ExtensionPointDeclarationRelatedItemLineMarkerProvider.java
index deb75fd..8ecdbac 100644
--- a/plugins/devkit/src/navigation/ExtensionPointDeclarationRelatedItemLineMarkerProvider.java
+++ b/plugins/devkit/src/navigation/ExtensionPointDeclarationRelatedItemLineMarkerProvider.java
@@ -25,6 +25,7 @@
 import com.intellij.openapi.util.Condition;
 import com.intellij.psi.*;
 import com.intellij.psi.util.PsiTypesUtil;
+import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.NotNullFunction;
 import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.NotNull;
@@ -94,16 +95,10 @@
 
   @Nullable
   private static PsiClass resolveExtensionPointClass(PsiField psiField) {
-    final PsiClassType type = (PsiClassType)psiField.getType();
-    final PsiClassType.ClassResolveResult resolveResult = type.resolveGenerics();
-    final PsiClass psiClass = resolveResult.getElement();
-    if (psiClass == null) return null;
-    final PsiTypeParameter[] parameters = psiClass.getTypeParameters();
-    if (parameters.length != 1) return null;
-    final PsiTypeParameter parameter = parameters[0];
-    final PsiSubstitutor substitutor = resolveResult.getSubstitutor();
-    final PsiType substituteType = substitutor.substitute(parameter);
-    return PsiTypesUtil.getPsiClass(substituteType);
+    final PsiType typeParameter = PsiUtil.substituteTypeParameter(psiField.getType(),
+                                                                  ExtensionPointName.class.getName(),
+                                                                  0, false);
+    return PsiUtil.resolveClassInClassTypeOnly(typeParameter);
   }
 
   private static String resolveEpName(PsiField psiField) {
diff --git a/plugins/devkit/src/projectRoots/IdeaJdk.java b/plugins/devkit/src/projectRoots/IdeaJdk.java
index cd484b1..df65b36 100644
--- a/plugins/devkit/src/projectRoots/IdeaJdk.java
+++ b/plugins/devkit/src/projectRoots/IdeaJdk.java
@@ -27,7 +27,10 @@
 import com.intellij.openapi.util.SystemInfo;
 import com.intellij.openapi.util.WriteExternalException;
 import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.*;
+import com.intellij.openapi.vfs.JarFileSystem;
+import com.intellij.openapi.vfs.VfsUtilCore;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.VirtualFileManager;
 import com.intellij.util.ArrayUtil;
 import com.intellij.util.cls.BytePointer;
 import com.intellij.util.cls.ClsFormatException;
@@ -172,19 +175,19 @@
     ArrayList<VirtualFile> result = new ArrayList<VirtualFile>();
     appendIdeaLibrary(home, result, "junit.jar");
     appendIdeaLibrary(plugins + "JavaEE", result, "javaee-impl.jar", "jpa-console.jar");
-    appendIdeaLibrary(plugins + "JSF", result, "jsf-impl.jar");
     appendIdeaLibrary(plugins + "PersistenceSupport", result, "persistence-impl.jar");
     appendIdeaLibrary(plugins + "DatabaseSupport", result, "database-impl.jar", "jdbc-console.jar");
     appendIdeaLibrary(plugins + "css", result, "css.jar");
     appendIdeaLibrary(plugins + "uml", result, "uml-support.jar");
     appendIdeaLibrary(plugins + "Spring", result,
-                      "spring-el.jar", "spring-jsf.jar", "spring-persistence-integration.jar", "spring-web.jar");
+                      "spring.jar", "spring-el.jar", "spring-jsf.jar", "spring-persistence-integration.jar");
     return VfsUtilCore.toVirtualFileArray(result);
   }
 
   private static void appendIdeaLibrary(final String libDirPath,
                                         final ArrayList<VirtualFile> result,
                                         @NonNls final String... forbidden) {
+    Arrays.sort(forbidden);
     final String path = libDirPath + File.separator + LIB_DIR_NAME;
     final JarFileSystem jfs = JarFileSystem.getInstance();
     final File lib = new File(path);
@@ -204,7 +207,7 @@
 
   public boolean setupSdkPaths(final Sdk sdk, SdkModel sdkModel) {
     final Sandbox additionalData = (Sandbox)sdk.getSdkAdditionalData();
-    if (additionalData != null) {    
+    if (additionalData != null) {
       additionalData.cleanupWatchedRoots();
     }
 
diff --git a/plugins/devkit/testSources/build/PluginModuleCompilationTest.java b/plugins/devkit/testSources/build/PluginModuleCompilationTest.java
index 4a46d70..d9862ed 100644
--- a/plugins/devkit/testSources/build/PluginModuleCompilationTest.java
+++ b/plugins/devkit/testSources/build/PluginModuleCompilationTest.java
@@ -68,11 +68,6 @@
   }
 
   @Override
-  protected boolean useExternalCompiler() {
-    return true;
-  }
-
-  @Override
   protected void tearDown() throws Exception {
     new WriteAction() {
       protected void run(final Result result) {
diff --git a/plugins/git4idea/remote-servers-git/remote-servers-git.iml b/plugins/git4idea/remote-servers-git/remote-servers-git.iml
index 154f591..a2ae794 100644
--- a/plugins/git4idea/remote-servers-git/remote-servers-git.iml
+++ b/plugins/git4idea/remote-servers-git/remote-servers-git.iml
@@ -17,6 +17,7 @@
     <orderEntry type="module" module-name="lang-impl" />
     <orderEntry type="module" module-name="idea-ui" />
     <orderEntry type="module" module-name="openapi" />
+    <orderEntry type="module" module-name="vcs-impl" />
   </component>
 </module>
 
diff --git a/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/CloudGitDeploymentChecker.java b/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/CloudGitDeploymentChecker.java
index df40458..ed0bf68 100644
--- a/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/CloudGitDeploymentChecker.java
+++ b/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/CloudGitDeploymentChecker.java
@@ -15,9 +15,9 @@
  */
 package com.intellij.remoteServer.util;
 
+import com.intellij.execution.configurations.RuntimeConfigurationException;
 import com.intellij.execution.configurations.RuntimeConfigurationWarning;
 import com.intellij.openapi.module.Module;
-import com.intellij.openapi.options.ConfigurationException;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.Messages;
 import com.intellij.openapi.vfs.LocalFileSystem;
@@ -29,7 +29,6 @@
 import com.intellij.remoteServer.configuration.deployment.ModuleDeploymentSource;
 import git4idea.GitUtil;
 import git4idea.repo.GitRepository;
-import git4idea.repo.GitRepositoryManager;
 
 import java.io.File;
 import java.util.List;
@@ -42,57 +41,44 @@
   SC extends ServerConfigurationBase,
   SR extends CloudMultiSourceServerRuntimeInstance<T, ?, ?, ?>> {
 
-  private GitRepositoryManager myGitRepositoryManager;
-
-  private final DeploymentSource myDeploymentSource;
-  private final RemoteServer<SC> myServer;
-  private final CloudDeploymentNameEditor<T> mySettingsEditor;
   private final CloudGitDeploymentDetector myDetector;
 
-  public CloudGitDeploymentChecker(DeploymentSource deploymentSource,
-                                   RemoteServer<SC> server,
-                                   CloudDeploymentNameEditor<T> settingsEditor,
-                                   CloudGitDeploymentDetector detector) {
-    myDeploymentSource = deploymentSource;
-    myServer = server;
-    mySettingsEditor = settingsEditor;
+  public CloudGitDeploymentChecker(CloudGitDeploymentDetector detector) {
     myDetector = detector;
   }
 
-  public void checkGitUrl(final T settings) throws ConfigurationException {
-    if (!(myDeploymentSource instanceof ModuleDeploymentSource)) {
+  public void checkGitUrl(final RemoteServer<SC> server,
+                          final DeploymentSource deploymentSource,
+                          final T settings) throws RuntimeConfigurationException {
+    if (!(deploymentSource instanceof ModuleDeploymentSource)) {
       return;
     }
 
-    ModuleDeploymentSource moduleSource = (ModuleDeploymentSource)myDeploymentSource;
+    ModuleDeploymentSource moduleSource = (ModuleDeploymentSource)deploymentSource;
     Module module = moduleSource.getModule();
     if (module == null) {
       return;
     }
 
-    File contentRootFile = myDeploymentSource.getFile();
+    File contentRootFile = deploymentSource.getFile();
     if (contentRootFile == null) {
       return;
     }
 
     final Project project = module.getProject();
 
-    if (myGitRepositoryManager == null) {
-      myGitRepositoryManager = GitUtil.getRepositoryManager(project);
-    }
-
     VirtualFile contentRoot = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(contentRootFile);
     if (contentRoot == null) {
       return;
     }
 
-    GitRepository repository = myGitRepositoryManager.getRepositoryForRoot(contentRoot);
+    GitRepository repository = GitUtil.getRepositoryManager(project).getRepositoryForRoot(contentRoot);
     if (repository == null) {
       return;
     }
 
 
-    String expectedName = settings.getDeploymentSourceName(myDeploymentSource);
+    String expectedName = settings.getDeploymentSourceName(deploymentSource);
 
     List<String> appNames = myDetector.collectApplicationNames(repository);
     if (appNames.isEmpty() || appNames.contains(expectedName)) {
@@ -107,24 +93,22 @@
       @Override
       public void run() {
         CloudGitApplication application
-          = new CloudConnectionTask<CloudGitApplication, SC, T, SR>(project, "Searching for application", myServer) {
+          = new CloudConnectionTask<CloudGitApplication, SC, T, SR>(project, "Searching for application", server) {
 
           @Override
           protected CloudGitApplication run(SR serverRuntime) throws ServerRuntimeException {
             CloudGitDeploymentRuntime deploymentRuntime
-              = (CloudGitDeploymentRuntime)serverRuntime.createDeploymentRuntime(myDeploymentSource, settings, project);
+              = (CloudGitDeploymentRuntime)serverRuntime.createDeploymentRuntime(deploymentSource, settings, project);
             return deploymentRuntime.findApplication4Repository();
           }
         }.performSync();
 
         if (application == null) {
-          Messages.showErrorDialog(mySettingsEditor.getComponent(), "No application matching repository URL(s) found in account");
+          Messages.showErrorDialog(project, "No application matching repository URL(s) found in account", server.getName());
         }
         else {
-          T fixedSettings = mySettingsEditor.getFactory().create();
-          fixedSettings.setDefaultDeploymentName(false);
-          fixedSettings.setDeploymentName(application.getName());
-          mySettingsEditor.resetFrom(fixedSettings);
+          settings.setDefaultDeploymentName(false);
+          settings.setDeploymentName(application.getName());
         }
       }
     });
diff --git a/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/CloudGitDeploymentRuntime.java b/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/CloudGitDeploymentRuntime.java
index 74c0232..43a1c6c 100644
--- a/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/CloudGitDeploymentRuntime.java
+++ b/plugins/git4idea/remote-servers-git/src/com/intellij/remoteServer/util/CloudGitDeploymentRuntime.java
@@ -1,14 +1,20 @@
 package com.intellij.remoteServer.util;
 
 import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.application.ModalityState;
 import com.intellij.openapi.components.ServiceManager;
 import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.Messages;
 import com.intellij.openapi.util.Computable;
 import com.intellij.openapi.util.Key;
 import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.vcs.AbstractVcsHelper;
 import com.intellij.openapi.vcs.VcsException;
+import com.intellij.openapi.vcs.changes.*;
 import com.intellij.openapi.vfs.LocalFileSystem;
+import com.intellij.openapi.vfs.VfsUtilCore;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.remoteServer.agent.util.CloudGitApplication;
 import com.intellij.remoteServer.configuration.deployment.DeploymentSource;
@@ -16,6 +22,7 @@
 import com.intellij.remoteServer.runtime.deployment.DeploymentTask;
 import com.intellij.util.ArrayUtil;
 import com.intellij.util.concurrency.Semaphore;
+import git4idea.GitPlatformFacade;
 import git4idea.GitUtil;
 import git4idea.actions.GitInit;
 import git4idea.commands.*;
@@ -29,6 +36,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 /**
@@ -38,13 +46,17 @@
 
   private static final Logger LOG = Logger.getInstance("#" + CloudGitDeploymentRuntime.class.getName());
 
+  private static final String COMMIT_MESSAGE = "Deploy";
+
   private final GitRepositoryManager myGitRepositoryManager;
   private final Git myGit;
+  private final AbstractVcsHelper myVcsHelper;
 
   private final VirtualFile myContentRoot;
   private final File myRepositoryRootFile;
 
   private final String myDefaultRemoteName;
+  private final ChangeListManagerEx myChangeListManager;
   private String myRemoteName;
   private final String myCloudName;
 
@@ -68,23 +80,135 @@
     LOG.assertTrue(contentRoot != null, "Repository root is not found");
     myContentRoot = contentRoot;
 
-    myGitRepositoryManager = GitUtil.getRepositoryManager(getProject());
+    Project project = getProject();
+    myGitRepositoryManager = GitUtil.getRepositoryManager(project);
     myGit = ServiceManager.getService(Git.class);
     if (myGit == null) {
       throw new ServerRuntimeException("Can't initialize GIT");
     }
+    GitPlatformFacade gitPlatformFacade = ServiceManager.getService(GitPlatformFacade.class);
+    myVcsHelper = gitPlatformFacade.getVcsHelper(project);
+    myChangeListManager = gitPlatformFacade.getChangeListManager(project);
   }
 
   @Override
   public CloudGitApplication deploy() throws ServerRuntimeException {
     CloudGitApplication application = findOrCreateApplication();
+    deployApplication(application);
+    return application;
+  }
+
+  private void deployApplication(CloudGitApplication application) throws ServerRuntimeException {
+    boolean firstDeploy = findRepository() == null;
+
     GitRepository repository = findOrCreateRepository();
     addOrResetGitRemote(application, repository);
-    add();
-    commit();
+
+    if (firstDeploy) {
+      add();
+      commit();
+      return;
+    }
+
+    final LocalChangeList activeChangeList = myChangeListManager.getDefaultChangeList();
+    if (activeChangeList == null) {
+      add();
+      commit();
+      return;
+    }
+
+    Collection<Change> changes = activeChangeList.getChanges();
+    final List<Change> relevantChanges = new ArrayList<Change>();
+    for (Change change : changes) {
+      if (isRelevant(change.getBeforeRevision()) || isRelevant(change.getAfterRevision())) {
+        relevantChanges.add(change);
+      }
+    }
+    if (relevantChanges.isEmpty()) {
+      Integer showCommitDialogChoice = runOnEdt(new Computable<Integer>() {
+
+        @Override
+        public Integer compute() {
+          return Messages.showYesNoCancelDialog(getProject(),
+                                                "Active changelist does not contain a relevant change.\n"
+                                                + "Do you want to show commit dialog anyway?\n\n"
+                                                + "Yes - show commit dialog\n"
+                                                + "No - push immediately\n"
+                                                + "Cancel - interrupt deploy",
+                                                "Deploy",
+                                                Messages.getWarningIcon());
+        }
+      });
+      if (showCommitDialogChoice == Messages.YES) {
+        relevantChanges.addAll(changes);
+      }
+      else if (showCommitDialogChoice == Messages.NO) {
+        pushApplication(application);
+        return;
+      }
+      else {
+        throw new ServerRuntimeException("Deploy interrupted");
+      }
+    }
+
+    final Semaphore commitSemaphore = new Semaphore();
+    commitSemaphore.down();
+
+    final Ref<Boolean> commitSucceeded = new Ref<Boolean>(false);
+    Boolean commitStarted = runOnEdt(new Computable<Boolean>() {
+
+      @Override
+      public Boolean compute() {
+        return myVcsHelper.commitChanges(relevantChanges, activeChangeList, COMMIT_MESSAGE,
+                                         new CommitResultHandler() {
+
+                                           @Override
+                                           public void onSuccess(@NotNull String commitMessage) {
+                                             commitSucceeded.set(true);
+                                             commitSemaphore.up();
+                                           }
+
+                                           @Override
+                                           public void onFailure() {
+                                             commitSemaphore.up();
+                                           }
+                                         });
+      }
+    });
+    if (commitStarted != null && commitStarted) {
+      commitSemaphore.waitFor();
+      if (!commitSucceeded.get()) {
+        repository.update();
+        throw new ServerRuntimeException("Commit failed");
+      }
+    }
+    else {
+      getLoggingHandler().println("Commit canceled");
+    }
+
     repository.update();
     pushApplication(application);
-    return application;
+  }
+
+  private boolean isRelevant(ContentRevision contentRevision) throws ServerRuntimeException {
+    if (contentRevision == null) {
+      return false;
+    }
+    GitRepository repository = getRepository();
+    VirtualFile affectedFile = contentRevision.getFile().getVirtualFile();
+    return affectedFile != null && VfsUtilCore.isAncestor(repository.getRoot(), affectedFile, false);
+  }
+
+  private static <T> T runOnEdt(final Computable<T> computable) {
+    final Ref<T> result = new Ref<T>();
+    ApplicationManager.getApplication().invokeAndWait(new Runnable() {
+
+      @Override
+      public void run() {
+        result.set(computable.compute());
+      }
+    }, ModalityState.any());
+    return result.get();
   }
 
   public void undeploy() throws ServerRuntimeException {
@@ -273,7 +397,7 @@
         GitSimpleHandler handler = new GitSimpleHandler(getProject(), myContentRoot, GitCommand.COMMIT);
         handler.setSilent(false);
         handler.setStdoutSuppressed(false);
-        handler.addParameters("-m", "Deploy");
+        handler.addParameters("-m", COMMIT_MESSAGE);
         handler.endOptions();
         handler.run();
       }
diff --git a/plugins/git4idea/rt/src/org/jetbrains/git4idea/ssh/GitSSHHandler.java b/plugins/git4idea/rt/src/org/jetbrains/git4idea/ssh/GitSSHHandler.java
index 0ddcffa..2bc849d 100644
--- a/plugins/git4idea/rt/src/org/jetbrains/git4idea/ssh/GitSSHHandler.java
+++ b/plugins/git4idea/rt/src/org/jetbrains/git4idea/ssh/GitSSHHandler.java
@@ -48,7 +48,15 @@
    * Name of the handler
    */
   @NonNls String HANDLER_NAME = "Git4ideaSSHHandler";
-
+  /**
+   * Proxy settings
+   */
+  @NonNls String SSH_USE_PROXY_ENV = "GIT4IDEA_SSH_USE_PROXY";
+  @NonNls String SSH_PROXY_HOST_ENV = "GIT4IDEA_SSH_PROXY_HOST";
+  @NonNls String SSH_PROXY_PORT_ENV = "GIT4IDEA_SSH_PROXY_PORT";
+  @NonNls String SSH_PROXY_AUTHENTICATION_ENV = "GIT4IDEA_SSH_PROXY_AUTHENTICATION";
+  @NonNls String SSH_PROXY_USER_ENV = "GIT4IDEA_SSH_PROXY_USER";
+  @NonNls String SSH_PROXY_PASSWORD_ENV = "GIT4IDEA_SSH_PROXY_PASSWORD";
   /**
    * Verify server host key
    *
diff --git a/plugins/git4idea/rt/src/org/jetbrains/git4idea/ssh/SSHMain.java b/plugins/git4idea/rt/src/org/jetbrains/git4idea/ssh/SSHMain.java
index 29a6b58..b5bc260 100644
--- a/plugins/git4idea/rt/src/org/jetbrains/git4idea/ssh/SSHMain.java
+++ b/plugins/git4idea/rt/src/org/jetbrains/git4idea/ssh/SSHMain.java
@@ -153,6 +153,21 @@
     Connection c = new Connection(myHost.getHostName(), myHost.getPort());
     try {
       configureKnownHosts(c);
+
+      boolean useHttpProxy = Boolean.valueOf(System.getenv(GitSSHHandler.SSH_USE_PROXY_ENV));
+      if (useHttpProxy) {
+        String proxyHost = System.getenv(GitSSHHandler.SSH_PROXY_HOST_ENV);
+        Integer proxyPort = Integer.valueOf(System.getenv(GitSSHHandler.SSH_PROXY_PORT_ENV));
+        boolean proxyAuthentication = Boolean.valueOf(System.getenv(GitSSHHandler.SSH_PROXY_AUTHENTICATION_ENV));
+        String proxyUser = null;
+        String proxyPassword = null;
+        if (proxyAuthentication) {
+          proxyUser = System.getenv(GitSSHHandler.SSH_PROXY_USER_ENV);
+          proxyPassword = System.getenv(GitSSHHandler.SSH_PROXY_PASSWORD_ENV);
+        }
+        c.setProxyData(new HTTPProxyData(proxyHost, proxyPort, proxyUser, proxyPassword));
+      }
+
       c.connect(new HostKeyVerifier());
       authenticate(c);
       final Session s = c.openSession();
@@ -471,7 +486,7 @@
     }
     String host = args[i++];
     String user;
-    int atIndex = host.indexOf('@');
+    int atIndex = host.lastIndexOf('@');
     if (atIndex == -1) {
       user = null;
     }
diff --git a/plugins/git4idea/src/git4idea/branch/GitBranchWorker.java b/plugins/git4idea/src/git4idea/branch/GitBranchWorker.java
index 3273c57..a6ae9d2 100644
--- a/plugins/git4idea/src/git4idea/branch/GitBranchWorker.java
+++ b/plugins/git4idea/src/git4idea/branch/GitBranchWorker.java
@@ -152,7 +152,7 @@
       // we treat it as critical and report an error
       throw new GitExecutionException("Couldn't get [git log .." + branchName + "] on repository [" + repository.getRoot() + "]", e);
     }
-    return Couple.newOne(headToBranch, branchToHead);
+    return Couple.of(headToBranch, branchToHead);
   }
   
   private void displayCompareDialog(@NotNull String branchName, @NotNull String currentBranch, @NotNull GitCommitCompareInfo compareInfo,
diff --git a/plugins/git4idea/src/git4idea/branch/GitDeleteRemoteBranchOperation.java b/plugins/git4idea/src/git4idea/branch/GitDeleteRemoteBranchOperation.java
index 496382f..5ce85f1 100644
--- a/plugins/git4idea/src/git4idea/branch/GitDeleteRemoteBranchOperation.java
+++ b/plugins/git4idea/src/git4idea/branch/GitDeleteRemoteBranchOperation.java
@@ -149,7 +149,7 @@
     int firstSlash = branchName.indexOf('/');
     String remoteName = firstSlash > -1 ? branchName.substring(0, firstSlash) : branchName;
     String remoteBranchName = branchName.substring(firstSlash + 1);
-    return Couple.newOne(remoteName, remoteBranchName);
+    return Couple.of(remoteName, remoteBranchName);
   }
 
   @NotNull
diff --git a/plugins/git4idea/src/git4idea/checkin/GitCheckinHandlerFactory.java b/plugins/git4idea/src/git4idea/checkin/GitCheckinHandlerFactory.java
index 3df2004..75a6df3 100644
--- a/plugins/git4idea/src/git4idea/checkin/GitCheckinHandlerFactory.java
+++ b/plugins/git4idea/src/git4idea/checkin/GitCheckinHandlerFactory.java
@@ -261,7 +261,7 @@
     private Couple<String> getUserNameAndEmailFromGitConfig(@NotNull Project project, @NotNull VirtualFile root) throws VcsException {
       String name = GitConfigUtil.getValue(project, root, GitConfigUtil.USER_NAME);
       String email = GitConfigUtil.getValue(project, root, GitConfigUtil.USER_EMAIL);
-      return Couple.newOne(name, email);
+      return Couple.of(name, email);
     }
 
     private boolean emptyCommitMessage() {
diff --git a/plugins/git4idea/src/git4idea/commands/GitHandler.java b/plugins/git4idea/src/git4idea/commands/GitHandler.java
index 283c941..3350b74 100644
--- a/plugins/git4idea/src/git4idea/commands/GitHandler.java
+++ b/plugins/git4idea/src/git4idea/commands/GitHandler.java
@@ -32,6 +32,7 @@
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.EventDispatcher;
 import com.intellij.util.Processor;
+import com.intellij.util.net.HttpConfigurable;
 import com.intellij.vcsUtil.VcsFileUtil;
 import git4idea.GitVcs;
 import git4idea.config.GitVcsApplicationSettings;
@@ -436,6 +437,22 @@
         int port = ssh.getXmlRcpPort();
         myEnv.put(GitSSHHandler.SSH_PORT_ENV, Integer.toString(port));
         LOG.debug(String.format("handler=%s, port=%s", myHandlerNo, port));
+
+        final HttpConfigurable httpConfigurable = HttpConfigurable.getInstance();
+        boolean useHttpProxy = httpConfigurable.USE_HTTP_PROXY;
+        myEnv.put(GitSSHHandler.SSH_USE_PROXY_ENV, String.valueOf(useHttpProxy));
+
+        if (useHttpProxy) {
+          myEnv.put(GitSSHHandler.SSH_PROXY_HOST_ENV, httpConfigurable.PROXY_HOST);
+          myEnv.put(GitSSHHandler.SSH_PROXY_PORT_ENV, String.valueOf(httpConfigurable.PROXY_PORT));
+          boolean proxyAuthentication = httpConfigurable.PROXY_AUTHENTICATION;
+          myEnv.put(GitSSHHandler.SSH_PROXY_AUTHENTICATION_ENV, String.valueOf(proxyAuthentication));
+
+          if (proxyAuthentication) {
+            myEnv.put(GitSSHHandler.SSH_PROXY_USER_ENV, httpConfigurable.PROXY_LOGIN);
+            myEnv.put(GitSSHHandler.SSH_PROXY_PASSWORD_ENV, httpConfigurable.getPlainProxyPassword());
+          }
+        }
       }
       else if (remoteProtocol == GitRemoteProtocol.HTTP) {
         GitHttpAuthService service = ServiceManager.getService(GitHttpAuthService.class);
diff --git a/plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java b/plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java
index 1f41c13..141adca 100644
--- a/plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java
+++ b/plugins/git4idea/src/git4idea/commands/GitHttpGuiAuthenticator.java
@@ -64,7 +64,7 @@
   @Nullable private String myPasswordKey;
   @Nullable private String myUrl;
   @Nullable private String myLogin;
-  private boolean myRememberOnDisk;
+  private boolean mySaveOnDisk;
   @Nullable private GitHttpAuthDataProvider myDataProvider;
   private boolean myWasCancelled;
 
@@ -143,7 +143,7 @@
     myPassword = dialog.getPassword();
     myLogin = dialog.getUsername();
     myUrl = url;
-    myRememberOnDisk = dialog.isRememberPassword();
+    mySaveOnDisk = dialog.isRememberPassword();
     myPasswordKey = makeKey(myUrl, myLogin);
 
     return myLogin;
@@ -161,7 +161,7 @@
       PasswordSafeImpl passwordSafe = (PasswordSafeImpl)PasswordSafe.getInstance();
       try {
         passwordSafe.getMemoryProvider().storePassword(myProject, PASS_REQUESTER, myPasswordKey, myPassword);
-        if (myRememberOnDisk) {
+        if (mySaveOnDisk) {
           passwordSafe.getMasterKeyProvider().storePassword(myProject, PASS_REQUESTER, myPasswordKey, myPassword);
         }
       }
diff --git a/plugins/git4idea/src/git4idea/config/GitConfigUtil.java b/plugins/git4idea/src/git4idea/config/GitConfigUtil.java
index ec1a769..4870a36 100644
--- a/plugins/git4idea/src/git4idea/config/GitConfigUtil.java
+++ b/plugins/git4idea/src/git4idea/config/GitConfigUtil.java
@@ -97,7 +97,7 @@
     while ((pos = output.indexOf('\u0000', start)) != -1) {
       String value = output.substring(start, pos);
       start = pos + 1;
-      result.add(Couple.newOne(key, value));
+      result.add(Couple.of(key, value));
     }
     return result;
   }
diff --git a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java
index d3ecb86..114b4be 100644
--- a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java
+++ b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java
@@ -356,11 +356,11 @@
             revisionPath = currentPath.get();
           }
 
-          final Couple<String> authorPair = Couple.newOne(record.getAuthorName(), record.getAuthorEmail());
+          final Couple<String> authorPair = Couple.of(record.getAuthorName(), record.getAuthorEmail());
           final Couple<String> committerPair =
-            record.getCommitterName() == null ? null : Couple.newOne(record.getCommitterName(), record.getCommitterEmail());
+            record.getCommitterName() == null ? null : Couple.of(record.getCommitterName(), record.getCommitterEmail());
           Collection<String> parents = parentHashes == null ? Collections.<String>emptyList() : Arrays.asList(parentHashes);
-          consumer.consume(new GitFileRevision(project, revisionPath, revision, Couple.newOne(authorPair, committerPair), message, null,
+          consumer.consume(new GitFileRevision(project, revisionPath, revision, Couple.of(authorPair, committerPair), message, null,
                                                new Date(record.getAuthorTimeStamp()), parents));
           List<GitLogStatusInfo> statusInfos = record.getStatusInfos();
           if (statusInfos.isEmpty()) {
@@ -1026,7 +1026,7 @@
           indexCommit = parentsShortHashes[0];
         }
       }
-      return Couple.newOne(AbstractHash.create(gitLogRecord.getHash()), indexCommit == null ? null : AbstractHash.create(indexCommit));
+      return Couple.of(AbstractHash.create(gitLogRecord.getHash()), indexCommit == null ? null : AbstractHash.create(indexCommit));
     }
     return null;
   }
diff --git a/plugins/git4idea/src/git4idea/history/wholeTree/GitTableScrollChangeListener.java b/plugins/git4idea/src/git4idea/history/wholeTree/GitTableScrollChangeListener.java
index f656710..ec6168f 100644
--- a/plugins/git4idea/src/git4idea/history/wholeTree/GitTableScrollChangeListener.java
+++ b/plugins/git4idea/src/git4idea/history/wholeTree/GitTableScrollChangeListener.java
@@ -67,7 +67,7 @@
             // todo check
             // we cut the table, so leading/trailing compare number of rows, returned by model, with point and get incorrect results
             if (visibleRows.getFirst() < 0) return; // nothing to do
-            visibleRows = Couple.newOne(visibleRows.getFirst(), myTableModel.getRowCount() - 1);
+            visibleRows = Couple.of(visibleRows.getFirst(), myTableModel.getRowCount() - 1);
           }
           int difference = visibleRows.getSecond() - visibleRows.getFirst();
           int start = Math.max(0, visibleRows.getFirst() - difference);
diff --git a/plugins/git4idea/src/git4idea/push/GitPushDialog.java b/plugins/git4idea/src/git4idea/push/GitPushDialog.java
index ba3af4d..5647607 100644
--- a/plugins/git4idea/src/git4idea/push/GitPushDialog.java
+++ b/plugins/git4idea/src/git4idea/push/GitPushDialog.java
@@ -179,7 +179,7 @@
         GitBranch currentBranch = repository.getCurrentBranch();
         assert currentBranch != null;
         if (myGitCommitsToPush.get(repository).get(currentBranch).getDestBranch() == GitPusher.NO_TARGET_BRANCH) { // push to branch with the same name
-          return Couple.newOne(DEFAULT_REMOTE, currentBranch.getName());
+          return Couple.of(DEFAULT_REMOTE, currentBranch.getName());
         }
         String remoteName;
         try {
@@ -193,10 +193,10 @@
           remoteName = DEFAULT_REMOTE;
         }
         String targetBranch = myGitCommitsToPush.get(repository).get(currentBranch).getDestBranch().getNameForRemoteOperations();
-        return Couple.newOne(remoteName, targetBranch);
+        return Couple.of(remoteName, targetBranch);
       }
     }
-    return Couple.newOne(DEFAULT_REMOTE, "");
+    return Couple.of(DEFAULT_REMOTE, "");
   }
 
   @Nullable
diff --git a/plugins/git4idea/src/git4idea/util/GitCommitCompareInfo.java b/plugins/git4idea/src/git4idea/util/GitCommitCompareInfo.java
index b10e566..2986fb7 100644
--- a/plugins/git4idea/src/git4idea/util/GitCommitCompareInfo.java
+++ b/plugins/git4idea/src/git4idea/util/GitCommitCompareInfo.java
@@ -16,7 +16,7 @@
 package git4idea.util;
 
 import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.Couple;
+import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.vcs.changes.Change;
 import git4idea.GitCommit;
 import git4idea.repo.GitRepository;
@@ -31,7 +31,7 @@
   
   private static final Logger LOG = Logger.getInstance(GitCommitCompareInfo.class);
   
-  private final Map<GitRepository, Couple<List<GitCommit>>> myInfo = new HashMap<GitRepository, Couple<List<GitCommit>>>();
+  private final Map<GitRepository, Pair<List<GitCommit>, List<GitCommit>>> myInfo = new HashMap<GitRepository, Pair<List<GitCommit>, List<GitCommit>>>();
   private final Map<GitRepository, Collection<Change>> myTotalDiff = new HashMap<GitRepository, Collection<Change>>();
   private final InfoType myInfoType;
 
@@ -43,7 +43,7 @@
     myInfoType = infoType;
   }
 
-  public void put(@NotNull GitRepository repository, @NotNull Couple<List<GitCommit>> commits) {
+  public void put(@NotNull GitRepository repository, @NotNull Pair<List<GitCommit>, List<GitCommit>> commits) {
     myInfo.put(repository, commits);
   }
 
@@ -62,11 +62,11 @@
   }
 
   @NotNull
-  private Couple<List<GitCommit>> getCompareInfo(@NotNull GitRepository repo) {
-    Couple<List<GitCommit>> pair = myInfo.get(repo);
+  private Pair<List<GitCommit>, List<GitCommit>> getCompareInfo(@NotNull GitRepository repo) {
+    Pair<List<GitCommit>, List<GitCommit>> pair = myInfo.get(repo);
     if (pair == null) {
       LOG.error("Compare info not found for repository " + repo);
-      return Couple.newOne(Collections.<GitCommit>emptyList(), Collections.<GitCommit>emptyList());
+      return Pair.create(Collections.<GitCommit>emptyList(), Collections.<GitCommit>emptyList());
     }
     return pair;
   }
diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubCreatePullRequestWorker.java b/plugins/github/src/org/jetbrains/plugins/github/GithubCreatePullRequestWorker.java
index bc96aa9..bf9803b 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/GithubCreatePullRequestWorker.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/GithubCreatePullRequestWorker.java
@@ -451,7 +451,7 @@
       Collection<Change> diff = GitChangeUtils.getDiff(repository.getProject(), repository.getRoot(), targetBranch, currentBranch, null);
       GitCommitCompareInfo info = new GitCommitCompareInfo(GitCommitCompareInfo.InfoType.BRANCH_TO_HEAD);
       info.put(repository, diff);
-      info.put(repository, Couple.newOne(commits1, commits2));
+      info.put(repository, Couple.of(commits1, commits2));
       return new DiffInfo(info, currentBranch, targetBranch);
     }
     catch (VcsException e) {
diff --git a/plugins/github/src/org/jetbrains/plugins/github/util/GithubUrlUtil.java b/plugins/github/src/org/jetbrains/plugins/github/util/GithubUrlUtil.java
index d65b5d7..6b3165f 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/util/GithubUrlUtil.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/util/GithubUrlUtil.java
@@ -48,7 +48,13 @@
 
   @NotNull
   public static String getApiUrl(@NotNull String urlFromSettings) {
-    return "https://" + getApiUrlWithoutProtocol(urlFromSettings);
+    return getApiProtocolFromUrl(urlFromSettings) + getApiUrlWithoutProtocol(urlFromSettings);
+  }
+
+  @NotNull
+  public static String getApiProtocolFromUrl(@NotNull String urlFromSettings) {
+    if (StringUtil.startsWithIgnoreCase(urlFromSettings.trim(), "http://")) return "http://";
+    return "https://";
   }
 
   /**
diff --git a/plugins/github/test/org/jetbrains/plugins/github/GithubUrlUtilTest.java b/plugins/github/test/org/jetbrains/plugins/github/GithubUrlUtilTest.java
index 636d14d..f240302 100644
--- a/plugins/github/test/org/jetbrains/plugins/github/GithubUrlUtilTest.java
+++ b/plugins/github/test/org/jetbrains/plugins/github/GithubUrlUtilTest.java
@@ -282,4 +282,34 @@
       }
     });
   }
+
+  public void testGetApiUrl() throws Throwable {
+    TestCase<String> tests = new TestCase<String>();
+
+    tests.add("github.com", "https://api.github.com");
+    tests.add("https://github.com/", "https://api.github.com");
+    tests.add("api.github.com/", "https://api.github.com");
+
+    tests.add("https://my.site.com/", "https://my.site.com/api/v3");
+    tests.add("https://api.site.com/", "https://api.site.com/api/v3");
+    tests.add("https://url.github.com/", "https://url.github.com/api/v3");
+
+    tests.add("my.site.com/", "https://my.site.com/api/v3");
+    tests.add("api.site.com/", "https://api.site.com/api/v3");
+    tests.add("url.github.com/", "https://url.github.com/api/v3");
+
+    tests.add("http://my.site.com/", "http://my.site.com/api/v3");
+    tests.add("http://api.site.com/", "http://api.site.com/api/v3");
+    tests.add("http://url.github.com/", "http://url.github.com/api/v3");
+
+    tests.add("HTTP://GITHUB.com", "http://api.github.com");
+    tests.add("HttP://GitHub.com/", "http://api.github.com");
+
+    runTestCase(tests, new Convertor<String, String>() {
+      @Override
+      public String convert(String in) {
+        return getApiUrl(in);
+      }
+    });
+  }
 }
diff --git a/plugins/google-app-engine/resources/META-INF/google-app-engine-plugin.xml b/plugins/google-app-engine/resources/META-INF/google-app-engine-plugin.xml
index 4454074..910b6fa 100644
--- a/plugins/google-app-engine/resources/META-INF/google-app-engine-plugin.xml
+++ b/plugins/google-app-engine/resources/META-INF/google-app-engine-plugin.xml
@@ -15,7 +15,6 @@
     <facetType implementation="com.intellij.appengine.facet.AppEngineFacetType"/>
     <project.converterProvider implementation="com.intellij.appengine.converter.AppEngineFacetConverterProvider"/>
     <framework.detector implementation="com.intellij.appengine.facet.AppEngineFrameworkDetector"/>
-    <compiler implementation="com.intellij.appengine.enhancement.EnhancerCompiler"/>
     <compileServer.plugin classpath="google-app-engine-jps-plugin.jar;appEngine-runtime.jar"/>
 
     <xml.schemaProvider implementation="com.intellij.appengine.descriptor.AppEngineWebSchemaProvider"/>
diff --git a/plugins/google-app-engine/source/com/intellij/appengine/enhancement/EnhancerCompiler.java b/plugins/google-app-engine/source/com/intellij/appengine/enhancement/EnhancerCompiler.java
deleted file mode 100644
index 4e3d69f..0000000
--- a/plugins/google-app-engine/source/com/intellij/appengine/enhancement/EnhancerCompiler.java
+++ /dev/null
@@ -1,62 +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.appengine.enhancement;
-
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.generic.*;
-import com.intellij.openapi.project.Project;
-import com.intellij.util.io.DataExternalizer;
-import com.intellij.util.io.KeyDescriptor;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author nik
- */
-public class EnhancerCompiler extends GenericCompiler<String, VirtualFileWithDependenciesState, DummyPersistentState> {
-  public EnhancerCompiler(Project project) {
-    super("appengine-enhancer", 0, CompileOrderPlace.CLASS_POST_PROCESSING);
-  }
-
-  @NotNull
-  @Override
-  public KeyDescriptor<String> getItemKeyDescriptor() {
-    return STRING_KEY_DESCRIPTOR;
-  }
-
-  @NotNull
-  @Override
-  public DataExternalizer<VirtualFileWithDependenciesState> getSourceStateExternalizer() {
-    return VirtualFileWithDependenciesState.EXTERNALIZER;
-  }
-
-  @NotNull
-  @Override
-  public DataExternalizer<DummyPersistentState> getOutputStateExternalizer() {
-    return DummyPersistentState.EXTERNALIZER;
-  }
-
-  @NotNull
-  @Override
-  public GenericCompilerInstance<?, ? extends CompileItem<String, VirtualFileWithDependenciesState, DummyPersistentState>, String, VirtualFileWithDependenciesState, DummyPersistentState> createInstance(
-    @NotNull CompileContext context) {
-    return new EnhancerCompilerInstance(context);
-  }
-
-  @NotNull
-  public String getDescription() {
-    return "Google App Engine Enhancer";
-  }
-}
diff --git a/plugins/google-app-engine/source/com/intellij/appengine/enhancement/EnhancerCompilerInstance.java b/plugins/google-app-engine/source/com/intellij/appengine/enhancement/EnhancerCompilerInstance.java
deleted file mode 100644
index b02b6ce..0000000
--- a/plugins/google-app-engine/source/com/intellij/appengine/enhancement/EnhancerCompilerInstance.java
+++ /dev/null
@@ -1,290 +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.appengine.enhancement;
-
-import com.intellij.appengine.facet.AppEngineFacet;
-import com.intellij.appengine.rt.EnhancerRunner;
-import com.intellij.appengine.sdk.AppEngineSdk;
-import com.intellij.compiler.SymbolTable;
-import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.compiler.make.Cache;
-import com.intellij.compiler.make.CacheCorruptedException;
-import com.intellij.execution.CantRunException;
-import com.intellij.execution.configurations.CommandLineBuilder;
-import com.intellij.execution.configurations.GeneralCommandLine;
-import com.intellij.execution.configurations.JavaParameters;
-import com.intellij.execution.configurations.ParametersList;
-import com.intellij.facet.FacetManager;
-import com.intellij.openapi.application.ReadAction;
-import com.intellij.openapi.application.Result;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
-import com.intellij.openapi.compiler.generic.*;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.progress.ProcessCanceledException;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.CompilerModuleExtension;
-import com.intellij.openapi.roots.libraries.LibraryUtil;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.*;
-import com.intellij.util.PathUtil;
-import com.intellij.util.PathsList;
-import com.intellij.util.SmartList;
-import com.intellij.util.ThrowableRunnable;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.jps.appengine.model.PersistenceApi;
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * @author nik
- */
-public class EnhancerCompilerInstance extends GenericCompilerInstance<EnhancementTarget, ClassFileItem, String, VirtualFileWithDependenciesState, DummyPersistentState> {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.appengine.enhancement.EnhancerCompilerInstance");
-  private Project myProject;
-
-  public EnhancerCompilerInstance(CompileContext context) {
-    super(context);
-    myProject = context.getProject();
-  }
-
-  @NotNull
-  @Override
-  public List<EnhancementTarget> getAllTargets() {
-    List<EnhancementTarget> targets = new ArrayList<EnhancementTarget>();
-    for (Module module : ModuleManager.getInstance(myProject).getModules()) {
-      for (AppEngineFacet facet : FacetManager.getInstance(module).getFacetsByType(AppEngineFacet.ID)) {
-        if (facet.getConfiguration().isRunEnhancerOnMake()) {
-          final CompilerModuleExtension moduleExtension = CompilerModuleExtension.getInstance(module);
-          if (moduleExtension != null) {
-            final VirtualFile outputRoot = moduleExtension.getCompilerOutputPath();
-            if (outputRoot != null) {
-              targets.add(new EnhancementTarget(facet, outputRoot));
-            }
-          }
-        }
-      }
-    }
-    return targets;
-  }
-
-  @NotNull
-  @Override
-  public List<EnhancementTarget> getSelectedTargets() {
-    return getAllTargets();
-  }
-
-  @Override
-  public void processObsoleteTarget(@NotNull String targetId,
-                                    @NotNull List<GenericCompilerCacheState<String, VirtualFileWithDependenciesState, DummyPersistentState>> obsoleteItems) {
-  }
-
-  @NotNull
-  @Override
-  public List<ClassFileItem> getItems(@NotNull EnhancementTarget target) {
-    List<ClassFileItem> items = new ArrayList<ClassFileItem>();
-    try {
-      final ClassFilesCollector classFilesCollector = new ClassFilesCollector((CompileContextEx)myContext, items, target.getFacet());
-      classFilesCollector.collectItems(target.getOutputRoot(), "");
-    }
-    catch (CacheCorruptedException e) {
-      myContext.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
-      LOG.info(e);
-    }
-    return items;
-  }
-
-  @Override
-  public void processItems(@NotNull final EnhancementTarget target,
-                           @NotNull final List<GenericCompilerProcessingItem<ClassFileItem, VirtualFileWithDependenciesState, DummyPersistentState>> changedItems,
-                           @NotNull List<GenericCompilerCacheState<String, VirtualFileWithDependenciesState, DummyPersistentState>> obsoleteItems,
-                           @NotNull final OutputConsumer<ClassFileItem> consumer) {
-    CompilerUtil.runInContext(myContext, "Enhancing classes...", new ThrowableRunnable<RuntimeException>() {
-      @Override
-      public void run() {
-        List<ClassFileItem> toEnhance = new ArrayList<ClassFileItem>();
-        for (GenericCompilerProcessingItem<ClassFileItem, VirtualFileWithDependenciesState, DummyPersistentState> item : changedItems) {
-          final ClassFileItem classFileItem = item.getItem();
-          if (myContext.getCompileScope().belongs(classFileItem.getSourceFile().getUrl())) {
-            toEnhance.add(classFileItem);
-          }
-        }
-
-        if (!toEnhance.isEmpty()) {
-          if (runEnhancer(target.getFacet(), toEnhance)) {
-            for (ClassFileItem item : toEnhance) {
-              consumer.addProcessedItem(item);
-            }
-          }
-        }
-      }
-    });
-
-  }
-
-  private boolean runEnhancer(final AppEngineFacet facet, final Collection<ClassFileItem> items) {
-    try {
-      final AppEngineSdk sdk = facet.getSdk();
-      if (!sdk.isValid()) {
-        throw new CantRunException("Valid App Engine SDK isn't specified for '" + facet.getName() + "' facet (module '" + facet.getModule().getName() + "')");
-      }
-
-      final JavaParameters javaParameters = new JavaParameters();
-      new ReadAction() {
-        protected void run(final Result result) throws Throwable {
-          myContext.getProgressIndicator().setText2("'" + facet.getModule().getName() + "' module, processing " + items.size() + " classes...");
-          javaParameters.configureByModule(facet.getModule(), JavaParameters.JDK_AND_CLASSES);
-
-          final PathsList classPath = javaParameters.getClassPath();
-          classPath.addFirst(sdk.getToolsApiJarFile().getAbsolutePath());
-          removeAsmJarFromClasspath(classPath);
-
-          final ParametersList vmParameters = javaParameters.getVMParametersList();
-          vmParameters.add("-Xmx256m");
-
-          javaParameters.setMainClass(EnhancerRunner.class.getName());
-          classPath.addFirst(PathUtil.getJarPathForClass(EnhancerRunner.class));
-
-          final File argsFile = FileUtil.createTempFile("appEngineEnhanceFiles", ".txt");
-          PrintWriter writer = new PrintWriter(argsFile);
-          try {
-            for (ClassFileItem item : items) {
-              writer.println(FileUtil.toSystemDependentName(item.getFile().getPath()));
-            }
-          }
-          finally {
-            writer.close();
-          }
-
-          final ParametersList programParameters = javaParameters.getProgramParametersList();
-          programParameters.add(argsFile.getAbsolutePath());
-          programParameters.add("com.google.appengine.tools.enhancer.Enhance");
-          programParameters.add("-api");
-          PersistenceApi api = facet.getConfiguration().getPersistenceApi();
-          programParameters.add(api.getEnhancerApiName());
-          if (api.getEnhancerVersion() == 2) {
-            programParameters.add("-enhancerVersion");
-            programParameters.add("v2");
-          }
-          programParameters.add("-v");
-
-        }
-      }.execute().throwException();
-
-
-      final GeneralCommandLine commandLine = CommandLineBuilder.createFromJavaParameters(javaParameters);
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("starting enhancer: " + commandLine.getCommandLineString());
-      }
-      final Process process = commandLine.createProcess();
-      EnhancerProcessHandler handler = new EnhancerProcessHandler(process, commandLine.getCommandLineString(), myContext);
-      handler.startNotify();
-      handler.waitFor();
-    }
-    catch (ProcessCanceledException e) {
-      throw e;
-    }
-    catch (Throwable e) {
-      myContext.addMessage(CompilerMessageCategory.ERROR, e.getMessage(), null, -1, -1);
-      LOG.info(e);
-    }
-    return myContext.getMessageCount(CompilerMessageCategory.ERROR) == 0;
-  }
-
-  private static void removeAsmJarFromClasspath(PathsList classPath) {
-    List<String> toRemove = new ArrayList<String>();
-    for (String filePath : classPath.getPathList()) {
-      if (filePath.endsWith(".jar")) {
-        final VirtualFile root =
-          JarFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(filePath) + JarFileSystem.JAR_SEPARATOR);
-        if (root != null && LibraryUtil.isClassAvailableInLibrary(new VirtualFile[]{root}, "org.objectweb.asm.ClassReader")) {
-          toRemove.add(filePath);
-        }
-      }
-    }
-    for (String path : toRemove) {
-      classPath.remove(path);
-    }
-  }
-
-  private static class ClassFilesCollector {
-    private CompileContextEx myContext;
-    private List<ClassFileItem> myItems;
-    private AppEngineFacet myFacet;
-    private final SymbolTable mySymbolTable;
-    private final Cache myCache;
-    private final LocalFileSystem myLocalFileSystem;
-
-    public ClassFilesCollector(CompileContextEx context,
-                               List<ClassFileItem> items,
-                               AppEngineFacet facet) throws CacheCorruptedException {
-      myContext = context;
-      myItems = items;
-      myFacet = facet;
-      mySymbolTable = myContext.getDependencyCache().getSymbolTable();
-      myCache = myContext.getDependencyCache().getCache();
-      myLocalFileSystem = LocalFileSystem.getInstance();
-    }
-
-    public void collectItems(@NotNull VirtualFile file, final String fullName) throws CacheCorruptedException {
-      VfsUtilCore.visitChildrenRecursively(file, new VirtualFileVisitor<String>() {
-        { setValueForChildren(fullName); }
-
-        @Override
-        public boolean visitFile(@NotNull VirtualFile file) {
-          try {
-            final String fullName = getCurrentValue();
-            if (file.isDirectory()) {
-              setValueForChildren(StringUtil.getQualifiedName(fullName, file.getName()));
-            }
-            else if (StdFileTypes.CLASS.equals(file.getFileType())) {
-              final VirtualFile sourceFile = myContext.getSourceFileByOutputFile(file);
-              if (sourceFile != null && myFacet.shouldRunEnhancerFor(sourceFile)) {
-                String className = StringUtil.trimEnd(fullName, ".class");
-                int classId = mySymbolTable.getId(className);
-                List<VirtualFile> dependencies = new SmartList<VirtualFile>();
-                while (classId != Cache.UNKNOWN) {
-                  final String path = myCache.getPath(classId);
-                  if (!StringUtil.isEmpty(path)) {
-                    final VirtualFile classFile = myLocalFileSystem.findFileByPath(FileUtil.toSystemIndependentName(path));
-                    if (classFile != null) {
-                      dependencies.add(classFile);
-                    }
-                  }
-                  classId = myCache.getSuperQualifiedName(classId);
-                }
-                myItems.add(new ClassFileItem(file, sourceFile, dependencies));
-              }
-            }
-            return true;
-          }
-          catch (CacheCorruptedException e) {
-            throw new VisitorException(e);
-          }
-        }
-      }, CacheCorruptedException.class);
-    }
-  }
-}
diff --git a/plugins/gradle/src/META-INF/plugin.xml b/plugins/gradle/src/META-INF/plugin.xml
index 481372d..eb1196f 100644
--- a/plugins/gradle/src/META-INF/plugin.xml
+++ b/plugins/gradle/src/META-INF/plugin.xml
@@ -106,6 +106,7 @@
     <projectService serviceImplementation="org.jetbrains.plugins.gradle.service.project.GradleNotification"/>
     <projectService serviceImplementation="org.jetbrains.plugins.gradle.service.GradleBuildClasspathManager"/>
 
+    <stepsBeforeRunProvider implementation="org.jetbrains.plugins.gradle.execution.GradleBeforeRunTaskProvider" />
     <configurationProducer implementation="org.jetbrains.plugins.gradle.service.execution.GradleRuntimeConfigurationProducer"/>
 
     <toolWindow id="Gradle" anchor="right" icon="GradleIcons.ToolWindowGradle"
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/GradleBeforeRunTaskProvider.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/GradleBeforeRunTaskProvider.java
new file mode 100644
index 0000000..f7e18f0
--- /dev/null
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/GradleBeforeRunTaskProvider.java
@@ -0,0 +1,56 @@
+/*
+ * 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 org.jetbrains.plugins.gradle.execution;
+
+import com.intellij.execution.configurations.RunConfiguration;
+import com.intellij.openapi.externalSystem.service.execution.ExternalSystemBeforeRunTask;
+import com.intellij.openapi.externalSystem.service.execution.ExternalSystemBeforeRunTaskProvider;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Key;
+import icons.GradleIcons;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.gradle.util.GradleConstants;
+
+import javax.swing.*;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 5/30/2014
+ */
+public class GradleBeforeRunTaskProvider extends ExternalSystemBeforeRunTaskProvider {
+  public static final Key<ExternalSystemBeforeRunTask> ID = Key.create("Gradle.BeforeRunTask");
+
+  public GradleBeforeRunTaskProvider(Project project) {
+    super(GradleConstants.SYSTEM_ID, project, ID);
+  }
+
+  @Override
+  public Icon getIcon() {
+    return GradleIcons.Gradle;
+  }
+
+  @Nullable
+  @Override
+  public Icon getTaskIcon(ExternalSystemBeforeRunTask task) {
+    return GradleIcons.Gradle;
+  }
+
+  @Nullable
+  @Override
+  public ExternalSystemBeforeRunTask createTask(RunConfiguration runConfiguration) {
+    return new ExternalSystemBeforeRunTask(ID, GradleConstants.SYSTEM_ID);
+  }
+}
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/events/AfterTestEvent.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/events/AfterTestEvent.java
index 9a3dc15..6e81b8a 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/events/AfterTestEvent.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/events/AfterTestEvent.java
@@ -119,7 +119,7 @@
   private static Couple<String> parseComparisonMessage(String message, final String regex) {
     final Matcher matcher = Pattern.compile(regex, Pattern.DOTALL | Pattern.CASE_INSENSITIVE).matcher(message);
     if (matcher.matches()) {
-      return Couple.newOne(matcher.group(1).replaceAll("\\\\n", "\n"), matcher.group(2).replaceAll("\\\\n", "\n"));
+      return Couple.of(matcher.group(1).replaceAll("\\\\n", "\n"), matcher.group(2).replaceAll("\\\\n", "\n"));
     }
     return null;
   }
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/AbstractProjectResolverExtension.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/AbstractProjectResolverExtension.java
index 2c51b29..946b00b 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/AbstractProjectResolverExtension.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/AbstractProjectResolverExtension.java
@@ -139,6 +139,12 @@
 
   @NotNull
   @Override
+  public List<String> getExtraCommandLineArgs() {
+    return Collections.emptyList();
+  }
+
+  @NotNull
+  @Override
   public ExternalSystemException getUserFriendlyError(@NotNull Throwable error,
                                                       @NotNull String projectPath,
                                                       @Nullable String buildFilePath) {
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java
index 465d6b2..8873f25 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/BaseGradleProjectResolverExtension.java
@@ -48,6 +48,7 @@
 import groovy.lang.GroovyObject;
 import org.gradle.tooling.ProjectConnection;
 import org.gradle.tooling.model.DomainObjectSet;
+import org.gradle.tooling.model.GradleModuleVersion;
 import org.gradle.tooling.model.GradleTask;
 import org.gradle.tooling.model.gradle.BasicGradleProject;
 import org.gradle.tooling.model.gradle.GradleBuild;
@@ -218,23 +219,40 @@
   public void populateModuleCompileOutputSettings(@NotNull IdeaModule gradleModule,
                                                   @NotNull DataNode<ModuleData> ideModule) {
     IdeaCompilerOutput moduleCompilerOutput = gradleModule.getCompilerOutput();
-    if (moduleCompilerOutput == null) {
-      return;
+
+    File sourceCompileOutputPath = null;
+    File testCompileOutputPath = null;
+    boolean inheritOutputDirs = false;
+
+    ModuleData moduleData = ideModule.getData();
+    if (moduleCompilerOutput != null) {
+      sourceCompileOutputPath = moduleCompilerOutput.getOutputDir();
+      testCompileOutputPath = moduleCompilerOutput.getTestOutputDir();
+      inheritOutputDirs = moduleCompilerOutput.getInheritOutputDirs();
     }
 
-    File sourceCompileOutputPath = moduleCompilerOutput.getOutputDir();
-    ModuleData moduleData = ideModule.getData();
+    if (!inheritOutputDirs && (sourceCompileOutputPath == null || testCompileOutputPath == null)) {
+      ModuleExtendedModel moduleExtendedModel = resolverCtx.getExtraProject(gradleModule, ModuleExtendedModel.class);
+      if (moduleExtendedModel != null) {
+        ExtIdeaCompilerOutput output = moduleExtendedModel.getCompilerOutput();
+        if (output != null) {
+          if (sourceCompileOutputPath == null) {
+            sourceCompileOutputPath = output.getMainClassesDir();
+          }
+          if (testCompileOutputPath == null) {
+            testCompileOutputPath = output.getTestClassesDir();
+          }
+        }
+      }
+    }
+
     if (sourceCompileOutputPath != null) {
       moduleData.setCompileOutputPath(ExternalSystemSourceType.SOURCE, sourceCompileOutputPath.getAbsolutePath());
     }
-
-    File testCompileOutputPath = moduleCompilerOutput.getTestOutputDir();
     if (testCompileOutputPath != null) {
       moduleData.setCompileOutputPath(ExternalSystemSourceType.TEST, testCompileOutputPath.getAbsolutePath());
     }
-    moduleData.setInheritProjectCompileOutputPath(
-      moduleCompilerOutput.getInheritOutputDirs() || sourceCompileOutputPath == null || testCompileOutputPath == null
-    );
+    moduleData.setInheritProjectCompileOutputPath(inheritOutputDirs || sourceCompileOutputPath == null);
   }
 
   @Override
@@ -326,6 +344,12 @@
 
   @NotNull
   @Override
+  public List<String> getExtraCommandLineArgs() {
+    return Collections.emptyList();
+  }
+
+  @NotNull
+  @Override
   public ExternalSystemException getUserFriendlyError(@NotNull Throwable error,
                                                       @NotNull String projectPath,
                                                       @Nullable String buildFilePath) {
@@ -516,34 +540,46 @@
       ));
     }
 
-    // Gradle API doesn't provide library name at the moment.
     String libraryName;
-    if (binaryPath.isFile()) {
-      libraryName = FileUtil.getNameWithoutExtension(binaryPath);
-    }
-    else {
-      libraryName = FileUtil.sanitizeFileName(binaryPath.getPath());
-    }
+    final GradleModuleVersion moduleVersion = dependency.getGradleModuleVersion();
+    final LibraryLevel level;
 
     // Gradle API doesn't explicitly provide information about unresolved libraries (http://issues.gradle.org/browse/GRADLE-1995).
     // That's why we use this dirty hack here.
-    boolean unresolved = libraryName.startsWith(UNRESOLVED_DEPENDENCY_PREFIX);
-    if (unresolved) {
-      // Gradle uses names like 'unresolved dependency - commons-collections commons-collections 3.2' for unresolved dependencies.
-      libraryName = binaryPath.getName().substring(UNRESOLVED_DEPENDENCY_PREFIX.length());
-      int i = libraryName.indexOf(' ');
-      if (i >= 0) {
-        i = CharArrayUtil.shiftForward(libraryName, i + 1, " ");
+    boolean unresolved = binaryPath.getPath().startsWith(UNRESOLVED_DEPENDENCY_PREFIX);
+
+    if (moduleVersion == null) {
+      // use module library level if the dependency does not originate from a remote repository.
+      level = LibraryLevel.MODULE;
+
+      if (binaryPath.isFile()) {
+        libraryName = FileUtil.getNameWithoutExtension(binaryPath);
+      }
+      else {
+        libraryName = FileUtil.sanitizeFileName(binaryPath.getPath());
       }
 
-      if (i >= 0 && i < libraryName.length()) {
-        int dependencyNameIndex = i;
-        i = libraryName.indexOf(' ', dependencyNameIndex);
-        if (i > 0) {
-          libraryName = String.format("%s-%s", libraryName.substring(dependencyNameIndex, i), libraryName.substring(i + 1));
+      if (unresolved) {
+        // Gradle uses names like 'unresolved dependency - commons-collections commons-collections 3.2' for unresolved dependencies.
+        libraryName = binaryPath.getName().substring(UNRESOLVED_DEPENDENCY_PREFIX.length());
+        int i = libraryName.indexOf(' ');
+        if (i >= 0) {
+          i = CharArrayUtil.shiftForward(libraryName, i + 1, " ");
+        }
+
+        if (i >= 0 && i < libraryName.length()) {
+          int dependencyNameIndex = i;
+          i = libraryName.indexOf(' ', dependencyNameIndex);
+          if (i > 0) {
+            libraryName = String.format("%s-%s", libraryName.substring(dependencyNameIndex, i), libraryName.substring(i + 1));
+          }
         }
       }
     }
+    else {
+      level = LibraryLevel.PROJECT;
+      libraryName = String.format("%s:%s:%s", moduleVersion.getGroup(), moduleVersion.getName(), moduleVersion.getVersion());
+    }
 
     final LibraryData library = new LibraryData(GradleConstants.SYSTEM_ID, libraryName, unresolved);
     if (!unresolved) {
@@ -564,18 +600,20 @@
       library.addPath(LibraryPathType.DOC, javadocPath.getAbsolutePath());
     }
 
-    DataNode<LibraryData> libraryData =
-      ExternalSystemApiUtil.find(ideProject, ProjectKeys.LIBRARY, new BooleanFunction<DataNode<LibraryData>>() {
-        @Override
-        public boolean fun(DataNode<LibraryData> node) {
-          return library.equals(node.getData());
-        }
-      });
-    if (libraryData == null) {
-      libraryData = ideProject.createChild(ProjectKeys.LIBRARY, library);
+    if(level == LibraryLevel.PROJECT) {
+      DataNode<LibraryData> libraryData =
+        ExternalSystemApiUtil.find(ideProject, ProjectKeys.LIBRARY, new BooleanFunction<DataNode<LibraryData>>() {
+          @Override
+          public boolean fun(DataNode<LibraryData> node) {
+            return library.equals(node.getData());
+          }
+        });
+      if (libraryData == null) {
+        ideProject.createChild(ProjectKeys.LIBRARY, library);
+      }
     }
 
-    return new LibraryDependencyData(ownerModule.getData(), libraryData.getData(), LibraryLevel.PROJECT);
+    return new LibraryDependencyData(ownerModule.getData(), library, level);
   }
 
   private void attachGradleSdkSources(@NotNull IdeaModule gradleModule,
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolver.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolver.java
index ccc3716..1df5e1e 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolver.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolver.java
@@ -144,6 +144,8 @@
     final ProjectImportAction projectImportAction = new ProjectImportAction(resolverCtx.isPreviewMode());
 
     final List<KeyValue<String, String>> extraJvmArgs = new ArrayList<KeyValue<String, String>>();
+    final List<String> commandLineArgs = ContainerUtil.newArrayList();
+
     for (GradleProjectResolverExtension resolverExtension = projectResolverChain;
          resolverExtension != null;
          resolverExtension = resolverExtension.getNext()) {
@@ -155,6 +157,8 @@
       projectImportAction.addExtraProjectModelClasses(resolverExtension.getExtraProjectModelClasses());
       // collect extra JVM arguments provided by gradle project resolver extensions
       extraJvmArgs.addAll(resolverExtension.getExtraJvmArgs());
+      // collect extra command-line arguments
+      commandLineArgs.addAll(resolverExtension.getExtraCommandLineArgs());
     }
 
     final ParametersList parametersList = new ParametersList();
@@ -165,7 +169,6 @@
 
     BuildActionExecuter<ProjectImportAction.AllModels> buildActionExecutor = resolverCtx.getConnection().action(projectImportAction);
 
-    final List<String> commandLineArgs = ContainerUtil.newArrayList();
     // TODO [vlad] remove the check
     if (!GradleEnvironment.DISABLE_ENHANCED_TOOLING_API) {
       File initScript = GradleExecutionHelper.generateInitScript(isBuildSrcProject);
@@ -268,7 +271,7 @@
 
     Set<Couple<String>> rootProjectTaskCandidatesMap = ContainerUtilRt.newHashSet();
     for (final TaskData taskData : rootProjectTaskCandidates) {
-      rootProjectTaskCandidatesMap.add(Couple.newOne(taskData.getName(), taskData.getDescription()));
+      rootProjectTaskCandidatesMap.add(Couple.of(taskData.getName(), taskData.getDescription()));
     }
     for (final Couple<String> p : rootProjectTaskCandidatesMap) {
       projectDataNode.createChild(
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolverExtension.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolverExtension.java
index 1b0af68..145225c 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolverExtension.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolverExtension.java
@@ -102,6 +102,9 @@
   List<KeyValue<String, String>> getExtraJvmArgs();
 
   @NotNull
+  List<String> getExtraCommandLineArgs();
+
+  @NotNull
   ExternalSystemException getUserFriendlyError(@NotNull Throwable error, @NotNull String projectPath, @Nullable String buildFilePath);
 
   /**
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/wizard/GradleModuleBuilder.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/wizard/GradleModuleBuilder.java
index 0f66ebd..e595113 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/wizard/GradleModuleBuilder.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/wizard/GradleModuleBuilder.java
@@ -22,6 +22,7 @@
 import com.intellij.ide.util.projectWizard.WizardContext;
 import com.intellij.openapi.Disposable;
 import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.externalSystem.model.ExternalSystemDataKeys;
 import com.intellij.openapi.externalSystem.service.project.wizard.AbstractExternalModuleBuilder;
 import com.intellij.openapi.externalSystem.service.project.wizard.ExternalModuleSettingsStep;
 import com.intellij.openapi.externalSystem.settings.AbstractExternalSystemSettings;
@@ -111,6 +112,7 @@
       String externalProjectPath = FileUtil.toCanonicalPath(project.getBasePath());
       getExternalProjectSettings().setExternalProjectPath(externalProjectPath);
       AbstractExternalSystemSettings settings = ExternalSystemApiUtil.getSettings(project, GradleConstants.SYSTEM_ID);
+      project.putUserData(ExternalSystemDataKeys.NEWLY_CREATED_PROJECT, Boolean.TRUE);
       //noinspection unchecked
       settings.linkProject(getExternalProjectSettings());
     }
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/resolve/GradleImplicitContributor.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/resolve/GradleImplicitContributor.java
index 9102f8e..cf9a5fc 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/resolve/GradleImplicitContributor.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/resolve/GradleImplicitContributor.java
@@ -50,30 +50,30 @@
  */
 public class GradleImplicitContributor implements GradleMethodContextContributor {
   private final static Map<String, String> BUILT_IN_TASKS = newHashMap(
-    Couple.newOne("assemble", GRADLE_API_DEFAULT_TASK),
-    Couple.newOne("build", GRADLE_API_DEFAULT_TASK),
-    Couple.newOne("buildDependents", GRADLE_API_DEFAULT_TASK),
-    Couple.newOne("buildNeeded", GRADLE_API_DEFAULT_TASK),
-    Couple.newOne("clean", GRADLE_API_TASKS_DELETE),
-    Couple.newOne("jar", GRADLE_API_TASKS_BUNDLING_JAR),
-    Couple.newOne("war", GRADLE_API_TASKS_BUNDLING_WAR),
-    Couple.newOne("classes", GRADLE_API_DEFAULT_TASK),
-    Couple.newOne("compileJava", GRADLE_API_TASKS_COMPILE_JAVA_COMPILE),
-    Couple.newOne("compileTestJava", GRADLE_API_DEFAULT_TASK),
-    Couple.newOne("processTestResources", GRADLE_API_DEFAULT_TASK),
-    Couple.newOne("testClasses", GRADLE_API_DEFAULT_TASK),
-    Couple.newOne("processResources", GRADLE_LANGUAGE_JVM_TASKS_PROCESS_RESOURCES),
-    Couple.newOne("setupBuild", GRADLE_BUILDSETUP_TASKS_SETUP_BUILD),
-    Couple.newOne("wrapper", GRADLE_API_TASKS_WRAPPER_WRAPPER),
-    Couple.newOne("javadoc", GRADLE_API_TASKS_JAVADOC_JAVADOC),
-    Couple.newOne("dependencies", GRADLE_API_TASKS_DIAGNOSTICS_DEPENDENCY_REPORT_TASK),
-    Couple.newOne("dependencyInsight", GRADLE_API_TASKS_DIAGNOSTICS_DEPENDENCY_INSIGHT_REPORT_TASK),
-    Couple.newOne("projects", GRADLE_API_TASKS_DIAGNOSTICS_PROJECT_REPORT_TASK),
-    Couple.newOne("properties", GRADLE_API_TASKS_DIAGNOSTICS_PROPERTY_REPORT_TASK),
-    Couple.newOne("tasks", GRADLE_API_TASKS_DIAGNOSTICS_TASK_REPORT_TASK),
-    Couple.newOne("check", GRADLE_API_DEFAULT_TASK),
-    Couple.newOne("test", GRADLE_API_TASKS_TESTING_TEST),
-    Couple.newOne("uploadArchives", GRADLE_API_TASKS_UPLOAD)
+    Couple.of("assemble", GRADLE_API_DEFAULT_TASK),
+    Couple.of("build", GRADLE_API_DEFAULT_TASK),
+    Couple.of("buildDependents", GRADLE_API_DEFAULT_TASK),
+    Couple.of("buildNeeded", GRADLE_API_DEFAULT_TASK),
+    Couple.of("clean", GRADLE_API_TASKS_DELETE),
+    Couple.of("jar", GRADLE_API_TASKS_BUNDLING_JAR),
+    Couple.of("war", GRADLE_API_TASKS_BUNDLING_WAR),
+    Couple.of("classes", GRADLE_API_DEFAULT_TASK),
+    Couple.of("compileJava", GRADLE_API_TASKS_COMPILE_JAVA_COMPILE),
+    Couple.of("compileTestJava", GRADLE_API_DEFAULT_TASK),
+    Couple.of("processTestResources", GRADLE_API_DEFAULT_TASK),
+    Couple.of("testClasses", GRADLE_API_DEFAULT_TASK),
+    Couple.of("processResources", GRADLE_LANGUAGE_JVM_TASKS_PROCESS_RESOURCES),
+    Couple.of("setupBuild", GRADLE_BUILDSETUP_TASKS_SETUP_BUILD),
+    Couple.of("wrapper", GRADLE_API_TASKS_WRAPPER_WRAPPER),
+    Couple.of("javadoc", GRADLE_API_TASKS_JAVADOC_JAVADOC),
+    Couple.of("dependencies", GRADLE_API_TASKS_DIAGNOSTICS_DEPENDENCY_REPORT_TASK),
+    Couple.of("dependencyInsight", GRADLE_API_TASKS_DIAGNOSTICS_DEPENDENCY_INSIGHT_REPORT_TASK),
+    Couple.of("projects", GRADLE_API_TASKS_DIAGNOSTICS_PROJECT_REPORT_TASK),
+    Couple.of("properties", GRADLE_API_TASKS_DIAGNOSTICS_PROPERTY_REPORT_TASK),
+    Couple.of("tasks", GRADLE_API_TASKS_DIAGNOSTICS_TASK_REPORT_TASK),
+    Couple.of("check", GRADLE_API_DEFAULT_TASK),
+    Couple.of("test", GRADLE_API_TASKS_TESTING_TEST),
+    Couple.of("uploadArchives", GRADLE_API_TASKS_UPLOAD)
   );
 
   @Override
diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java
index b59668e..5837c5c 100644
--- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java
+++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java
@@ -49,20 +49,6 @@
 
   private final GradleExecutionHelper myHelper = new GradleExecutionHelper();
 
-  /**
-   * TODO: remove the method in 13.1
-   */
-  @Override
-  public void executeTasks(@NotNull ExternalSystemTaskId id,
-                           @NotNull List<String> taskNames,
-                           @NotNull String projectPath,
-                           @Nullable GradleExecutionSettings settings,
-                           @Nullable String vmOptions,
-                           @Nullable String debuggerSetup,
-                           @NotNull ExternalSystemTaskNotificationListener listener) throws ExternalSystemException {
-    throw new UnsupportedOperationException();
-  }
-
   @Override
   public void executeTasks(@NotNull final ExternalSystemTaskId id,
                            @NotNull final List<String> taskNames,
diff --git a/plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/model/ExtIdeaCompilerOutput.java b/plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/model/ExtIdeaCompilerOutput.java
new file mode 100644
index 0000000..9ec6882
--- /dev/null
+++ b/plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/model/ExtIdeaCompilerOutput.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * 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 org.jetbrains.plugins.gradle.model;
+
+import org.gradle.api.Nullable;
+
+import java.io.File;
+import java.io.Serializable;
+
+public interface ExtIdeaCompilerOutput extends Serializable {
+  /**
+   * @return the directory to generate the classes of the "main" source set into.
+   */
+  @Nullable
+  File getMainClassesDir();
+
+  /**
+   * @return the directory to generate the resources of the "main" source set into.
+   */
+  @Nullable
+  File getMainResourcesDir();
+
+  /**
+   * @return the directory to generate the classes of the "test" source set into.
+   */
+  @Nullable
+  File getTestClassesDir();
+
+  /**
+   * @return the directory to generate the resources of the "test" source set into.
+   */
+  @Nullable
+  File getTestResourcesDir();
+}
diff --git a/plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/model/ModuleExtendedModel.java b/plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/model/ModuleExtendedModel.java
index e9a99b9..97dfd25 100644
--- a/plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/model/ModuleExtendedModel.java
+++ b/plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/model/ModuleExtendedModel.java
@@ -67,4 +67,11 @@
    * @return the build directory.
    */
   File getBuildDir();
+
+  /**
+   * The compiler output directories.
+   *
+   * @return the compiler output directories.
+   */
+  ExtIdeaCompilerOutput getCompilerOutput();
 }
diff --git a/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/builder/ModelBuildScriptClasspathBuilderImpl.java b/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/builder/ModelBuildScriptClasspathBuilderImpl.java
index 7f21217..71fcdeb 100644
--- a/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/builder/ModelBuildScriptClasspathBuilderImpl.java
+++ b/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/builder/ModelBuildScriptClasspathBuilderImpl.java
@@ -17,6 +17,7 @@
 
 import org.gradle.api.Project;
 import org.gradle.api.artifacts.Configuration;
+import org.gradle.api.artifacts.ResolutionStrategy;
 import org.gradle.plugins.ide.idea.IdeaPlugin;
 import org.gradle.plugins.ide.idea.model.Dependency;
 import org.gradle.plugins.ide.idea.model.ModuleLibrary;
@@ -30,6 +31,7 @@
 import org.jetbrains.plugins.gradle.tooling.ModelBuilderService;
 import org.jetbrains.plugins.gradle.tooling.internal.BuildScriptClasspathModelImpl;
 import org.jetbrains.plugins.gradle.tooling.internal.ClasspathEntryModelImpl;
+import org.jetbrains.plugins.gradle.tooling.internal.ConfigurationDelegate;
 
 import java.io.File;
 import java.util.*;
@@ -72,7 +74,15 @@
       }
       Configuration configuration = project.getBuildscript().getConfigurations().findByName("classpath");
       if (configuration == null) return null;
-      configuration = configuration.copy();
+
+      final ResolutionStrategy resolutionStrategy = configuration.getResolutionStrategy();
+      configuration = new ConfigurationDelegate(configuration.copy()) {
+        @Override
+        public ResolutionStrategy getResolutionStrategy() {
+          return resolutionStrategy;
+        }
+      };
+
       Collection<Configuration> plusConfigurations = Collections.singletonList(configuration);
 
       final Map<String, Map<String, Collection<Configuration>>> scopes =
@@ -111,7 +121,7 @@
   public ErrorMessageBuilder getErrorMessageBuilder(@NotNull Project project, @NotNull Exception e) {
     return ErrorMessageBuilder.create(
       project, e, "Project build classpath resolve errors"
-    ).withDescription("Some codeInsight features may not work for gradle build script");
+    ).withDescription("Unable to resolve additional buildscript classpath dependencies");
   }
 
   private static Set<String> convert(Set<Path> paths) {
diff --git a/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/builder/ModuleExtendedModelBuilderImpl.java b/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/builder/ModuleExtendedModelBuilderImpl.java
index ee9b256..616016d 100644
--- a/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/builder/ModuleExtendedModelBuilderImpl.java
+++ b/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/builder/ModuleExtendedModelBuilderImpl.java
@@ -20,6 +20,7 @@
 import org.gradle.api.Task;
 import org.gradle.api.tasks.SourceSet;
 import org.gradle.api.tasks.SourceSetContainer;
+import org.gradle.api.tasks.SourceSetOutput;
 import org.gradle.api.tasks.bundling.Jar;
 import org.gradle.api.tasks.testing.Test;
 import org.gradle.plugins.ide.idea.IdeaPlugin;
@@ -30,6 +31,7 @@
 import org.jetbrains.plugins.gradle.model.ModuleExtendedModel;
 import org.jetbrains.plugins.gradle.tooling.ErrorMessageBuilder;
 import org.jetbrains.plugins.gradle.tooling.ModelBuilderService;
+import org.jetbrains.plugins.gradle.tooling.internal.IdeaCompilerOutputImpl;
 import org.jetbrains.plugins.gradle.tooling.internal.IdeaContentRootImpl;
 import org.jetbrains.plugins.gradle.tooling.internal.IdeaSourceDirectoryImpl;
 import org.jetbrains.plugins.gradle.tooling.internal.ModuleExtendedModelImpl;
@@ -95,11 +97,24 @@
       }
     }
 
+    IdeaCompilerOutputImpl compilerOutput = new IdeaCompilerOutputImpl();
+
     if (project.hasProperty(SOURCE_SETS_PROPERTY)) {
       Object sourceSets = project.property(SOURCE_SETS_PROPERTY);
       if (sourceSets instanceof SourceSetContainer) {
         SourceSetContainer sourceSetContainer = (SourceSetContainer)sourceSets;
         for (SourceSet sourceSet : sourceSetContainer) {
+
+          SourceSetOutput output = sourceSet.getOutput();
+          if (SourceSet.TEST_SOURCE_SET_NAME.equals(sourceSet.getName())) {
+            compilerOutput.setTestClassesDir(output.getClassesDir());
+            compilerOutput.setTestResourcesDir(output.getResourcesDir());
+          }
+          if (SourceSet.MAIN_SOURCE_SET_NAME.equals(sourceSet.getName())) {
+            compilerOutput.setMainClassesDir(output.getClassesDir());
+            compilerOutput.setMainResourcesDir(output.getResourcesDir());
+          }
+
           for (File javaSrcDir : sourceSet.getAllJava().getSrcDirs()) {
             boolean isTestDir = isTestDir(sourceSet, testClassesDirs);
             addFilePath(isTestDir ? testDirectories : sourceDirectories, javaSrcDir);
@@ -166,6 +181,7 @@
     }
 
     moduleVersionModel.setContentRoots(Collections.<ExtIdeaContentRoot>singleton(contentRoot));
+    moduleVersionModel.setCompilerOutput(compilerOutput);
     return moduleVersionModel;
   }
 
diff --git a/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/ConfigurationDelegate.java b/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/ConfigurationDelegate.java
new file mode 100644
index 0000000..39c087f
--- /dev/null
+++ b/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/ConfigurationDelegate.java
@@ -0,0 +1,318 @@
+/*
+ * 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 org.jetbrains.plugins.gradle.tooling.internal;
+
+import groovy.lang.Closure;
+import org.gradle.api.artifacts.*;
+import org.gradle.api.file.FileCollection;
+import org.gradle.api.file.FileTree;
+import org.gradle.api.specs.Spec;
+import org.gradle.api.tasks.StopExecutionException;
+import org.gradle.api.tasks.TaskDependency;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 5/28/2014
+ */
+public class ConfigurationDelegate implements Configuration {
+  @NotNull
+  private final Configuration delegate;
+
+  public ConfigurationDelegate(@NotNull Configuration configuration) {
+    delegate = configuration;
+  }
+
+  @Override
+  public ResolutionStrategy getResolutionStrategy() {
+    return delegate.getResolutionStrategy();
+  }
+
+  @Override
+  public Configuration resolutionStrategy(Closure closure) {
+    return delegate.resolutionStrategy(closure);
+  }
+
+  @Override
+  public State getState() {
+    return delegate.getState();
+  }
+
+  @Override
+  public String getName() {
+    return delegate.getName();
+  }
+
+  @Override
+  public boolean isVisible() {
+    return delegate.isVisible();
+  }
+
+  @Override
+  public Configuration setVisible(boolean visible) {
+    return delegate.setVisible(visible);
+  }
+
+  @Override
+  public Set<Configuration> getExtendsFrom() {
+    return delegate.getExtendsFrom();
+  }
+
+  @Override
+  public Configuration setExtendsFrom(Set<Configuration> superConfigs) {
+    return delegate.setExtendsFrom(superConfigs);
+  }
+
+  @Override
+  public Configuration extendsFrom(Configuration... superConfigs) {
+    return delegate.extendsFrom(superConfigs);
+  }
+
+  @Override
+  public boolean isTransitive() {
+    return delegate.isTransitive();
+  }
+
+  @Override
+  public Configuration setTransitive(boolean t) {
+    return delegate.setTransitive(t);
+  }
+
+  @Override
+  public String getDescription() {
+    return delegate.getDescription();
+  }
+
+  @Override
+  public Configuration setDescription(String description) {
+    return delegate.setDescription(description);
+  }
+
+  @Override
+  public Set<Configuration> getHierarchy() {
+    return delegate.getHierarchy();
+  }
+
+  @Override
+  public Set<File> resolve() {
+    return delegate.resolve();
+  }
+
+  @Override
+  public Set<File> files(Closure dependencySpecClosure) {
+    return delegate.files(dependencySpecClosure);
+  }
+
+  @Override
+  public Set<File> files(Spec<? super Dependency> dependencySpec) {
+    return delegate.files(dependencySpec);
+  }
+
+  @Override
+  public Set<File> files(Dependency... dependencies) {
+    return delegate.files(dependencies);
+  }
+
+  @Override
+  public FileCollection fileCollection(Spec<? super Dependency> dependencySpec) {
+    return delegate.fileCollection(dependencySpec);
+  }
+
+  @Override
+  public FileCollection fileCollection(Closure dependencySpecClosure) {
+    return delegate.fileCollection(dependencySpecClosure);
+  }
+
+  @Override
+  public FileCollection fileCollection(Dependency... dependencies) {
+    return delegate.fileCollection(dependencies);
+  }
+
+  @Override
+  public ResolvedConfiguration getResolvedConfiguration() {
+    return delegate.getResolvedConfiguration();
+  }
+
+  @Override
+  public String getUploadTaskName() {
+    return delegate.getUploadTaskName();
+  }
+
+  @Override
+  public TaskDependency getBuildDependencies() {
+    return delegate.getBuildDependencies();
+  }
+
+  @Override
+  public TaskDependency getTaskDependencyFromProjectDependency(boolean useDependedOn, String taskName) {
+    return delegate.getTaskDependencyFromProjectDependency(useDependedOn, taskName);
+  }
+
+  @Override
+  public DependencySet getDependencies() {
+    return delegate.getDependencies();
+  }
+
+  @Override
+  public DependencySet getAllDependencies() {
+    return delegate.getAllDependencies();
+  }
+
+  @Override
+  public PublishArtifactSet getArtifacts() {
+    return delegate.getArtifacts();
+  }
+
+  @Override
+  public PublishArtifactSet getAllArtifacts() {
+    return delegate.getAllArtifacts();
+  }
+
+  @Override
+  public Set<ExcludeRule> getExcludeRules() {
+    return delegate.getExcludeRules();
+  }
+
+  @Override
+  public Configuration exclude(Map<String, String> excludeProperties) {
+    return delegate.exclude(excludeProperties);
+  }
+
+  @Override
+  public Set<Configuration> getAll() {
+    return delegate.getAll();
+  }
+
+  @Override
+  public ResolvableDependencies getIncoming() {
+    return delegate.getIncoming();
+  }
+
+  @Override
+  public Configuration copy() {
+    return delegate.copy();
+  }
+
+  @Override
+  public Configuration copyRecursive() {
+    return delegate.copyRecursive();
+  }
+
+  @Override
+  public Configuration copy(Spec<? super Dependency> dependencySpec) {
+    return delegate.copy(dependencySpec);
+  }
+
+  @Override
+  public Configuration copyRecursive(Spec<? super Dependency> dependencySpec) {
+    return delegate.copyRecursive(dependencySpec);
+  }
+
+  @Override
+  public Configuration copy(Closure dependencySpec) {
+    return delegate.copy(dependencySpec);
+  }
+
+  @Override
+  public Configuration copyRecursive(Closure dependencySpec) {
+    return delegate.copyRecursive(dependencySpec);
+  }
+
+  @Override
+  public File getSingleFile() throws IllegalStateException {
+    return delegate.getSingleFile();
+  }
+
+  @Override
+  public Set<File> getFiles() {
+    return delegate.getFiles();
+  }
+
+  @Override
+  public boolean contains(File file) {
+    return delegate.contains(file);
+  }
+
+  @Override
+  public String getAsPath() {
+    return delegate.getAsPath();
+  }
+
+  @Override
+  public FileCollection plus(FileCollection collection) {
+    return delegate.plus(collection);
+  }
+
+  @Override
+  public FileCollection minus(FileCollection collection) {
+    return delegate.minus(collection);
+  }
+
+  @Override
+  public FileCollection filter(Closure filterClosure) {
+    return delegate.filter(filterClosure);
+  }
+
+  @Override
+  public FileCollection filter(Spec<? super File> filterSpec) {
+    return delegate.filter(filterSpec);
+  }
+
+  @Override
+  public Object asType(Class<?> type) throws UnsupportedOperationException {
+    return delegate.asType(type);
+  }
+
+  @Override
+  public FileCollection add(FileCollection collection) throws UnsupportedOperationException {
+    return delegate.add(collection);
+  }
+
+  @Override
+  public boolean isEmpty() {
+    return delegate.isEmpty();
+  }
+
+  @Override
+  public FileCollection stopExecutionIfEmpty() throws StopExecutionException {
+    return delegate.stopExecutionIfEmpty();
+  }
+
+  @Override
+  public FileTree getAsFileTree() {
+    return delegate.getAsFileTree();
+  }
+
+  @Override
+  public void addToAntBuilder(Object builder, String nodeName, AntType type) {
+    delegate.addToAntBuilder(builder, nodeName, type);
+  }
+
+  @Override
+  public Object addToAntBuilder(Object builder, String nodeName) {
+    return delegate.addToAntBuilder(builder, nodeName);
+  }
+
+  @Override
+  public Iterator<File> iterator() {
+    return delegate.iterator();
+  }
+}
diff --git a/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/IdeaCompilerOutputImpl.java b/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/IdeaCompilerOutputImpl.java
new file mode 100644
index 0000000..214e999
--- /dev/null
+++ b/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/IdeaCompilerOutputImpl.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * 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 org.jetbrains.plugins.gradle.tooling.internal;
+
+import org.jetbrains.plugins.gradle.model.ExtIdeaCompilerOutput;
+
+import java.io.File;
+
+public class IdeaCompilerOutputImpl implements ExtIdeaCompilerOutput {
+  private File myMainClassesDir;
+  private File myMainResourcesDir;
+  private File myTestClassesDir;
+  private File myTestResourcesDir;
+
+  @Override
+  public File getMainClassesDir() {
+    return myMainClassesDir;
+  }
+
+  @Override
+  public File getMainResourcesDir() {
+    return myMainResourcesDir;
+  }
+
+  @Override
+  public File getTestClassesDir() {
+    return myTestClassesDir;
+  }
+
+  @Override
+  public File getTestResourcesDir() {
+    return myTestResourcesDir;
+  }
+
+  public void setMainClassesDir(File mainClassesDir) {
+    myMainClassesDir = mainClassesDir;
+  }
+
+  public void setMainResourcesDir(File mainResourcesDir) {
+    myMainResourcesDir = mainResourcesDir;
+  }
+
+  public void setTestClassesDir(File testClassesDir) {
+    myTestClassesDir = testClassesDir;
+  }
+
+  public void setTestResourcesDir(File testResourcesDir) {
+    myTestResourcesDir = testResourcesDir;
+  }
+}
diff --git a/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/ModuleExtendedModelImpl.java b/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/ModuleExtendedModelImpl.java
index 4eea475..547029c 100644
--- a/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/ModuleExtendedModelImpl.java
+++ b/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/ModuleExtendedModelImpl.java
@@ -17,6 +17,7 @@
 
 import org.gradle.tooling.model.DomainObjectSet;
 import org.gradle.tooling.model.internal.ImmutableDomainObjectSet;
+import org.jetbrains.plugins.gradle.model.ExtIdeaCompilerOutput;
 import org.jetbrains.plugins.gradle.model.ExtIdeaContentRoot;
 import org.jetbrains.plugins.gradle.model.ModuleExtendedModel;
 
@@ -36,6 +37,7 @@
   private final File myBuildDir;
   private List<File> myArtifacts;
   private Set<ExtIdeaContentRoot> myContentRoots;
+  private ExtIdeaCompilerOutput myCompilerOutput;
 
   public ModuleExtendedModelImpl(String name, String group, String version, File buildDir) {
     myName = name;
@@ -83,4 +85,13 @@
   public void setContentRoots(Set<ExtIdeaContentRoot> contentRoots) {
     myContentRoots = contentRoots == null ? Collections.<ExtIdeaContentRoot>emptySet() : contentRoots;
   }
+
+  @Override
+  public ExtIdeaCompilerOutput getCompilerOutput() {
+    return myCompilerOutput;
+  }
+
+  public void setCompilerOutput(ExtIdeaCompilerOutput compilerOutput) {
+    myCompilerOutput = compilerOutput;
+  }
 }
diff --git a/plugins/gradle/tooling-extension-impl/testData/testModelBuildScriptClasspathBuilder/build.gradle b/plugins/gradle/tooling-extension-impl/testData/testModelBuildScriptClasspathBuilder/build.gradle
index 45214e3..c7e94c2 100644
--- a/plugins/gradle/tooling-extension-impl/testData/testModelBuildScriptClasspathBuilder/build.gradle
+++ b/plugins/gradle/tooling-extension-impl/testData/testModelBuildScriptClasspathBuilder/build.gradle
@@ -15,3 +15,16 @@
     }
   }
 }
+
+allprojects {
+  configurations.all {
+
+    // check for configuration which is not in unresolved state  - http://youtrack.jetbrains.com/issue/IDEA-124839
+    exclude group: 'some-group'
+
+    // check for usage of custom resolutionStrategy - http://youtrack.jetbrains.com/issue/IDEA-125592
+    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
+      println details.target
+    }
+  }
+}
\ No newline at end of file
diff --git a/plugins/groovy/groovy-psi/gen/icons/JetgroovyIcons.java b/plugins/groovy/groovy-psi/gen/icons/JetgroovyIcons.java
index d540e46..622af34 100644
--- a/plugins/groovy/groovy-psi/gen/icons/JetgroovyIcons.java
+++ b/plugins/groovy/groovy-psi/gen/icons/JetgroovyIcons.java
@@ -57,6 +57,7 @@
     public static final Icon Interface = load("/icons/groovy/interface.png"); // 16x16
     public static final Icon Method = load("/icons/groovy/method.png"); // 16x16
     public static final Icon Property = load("/icons/groovy/property.png"); // 16x16
+    public static final Icon Trait = load("/icons/groovy/trait.png"); // 16x16
     public static final Icon Variable = load("/icons/groovy/variable.png"); // 16x16
 
   }
diff --git a/plugins/groovy/groovy-psi/groovy-psi.iml b/plugins/groovy/groovy-psi/groovy-psi.iml
index d2fbec6..48ee78e 100644
--- a/plugins/groovy/groovy-psi/groovy-psi.iml
+++ b/plugins/groovy/groovy-psi/groovy-psi.iml
@@ -15,7 +15,6 @@
     <orderEntry type="module" module-name="testFramework-java" scope="TEST" />
     <orderEntry type="module" module-name="junit" scope="TEST" />
     <orderEntry type="module" module-name="java-indexing-api" />
-    <orderEntry type="module" module-name="properties-psi-api" />
     <orderEntry type="module" module-name="java-psi-impl" />
     <orderEntry type="module" module-name="core-impl" />
     <orderEntry type="module" module-name="extensions" />
@@ -24,6 +23,8 @@
     <orderEntry type="module" module-name="editor-ui-ex" />
     <orderEntry type="module" module-name="java-analysis-impl" />
     <orderEntry type="module" module-name="java-structure-view" />
+    <orderEntry type="module" module-name="properties-psi-impl" />
+    <orderEntry type="module" module-name="properties-psi-api" />
   </component>
 </module>
 
diff --git a/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyAnnotation.groovy.ft b/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyAnnotation.groovy.ft
index 97d88fe..180d18f 100644
--- a/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyAnnotation.groovy.ft
+++ b/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyAnnotation.groovy.ft
@@ -2,6 +2,6 @@
 #end
 #parse("File Header.java")
 
-public @interface ${NAME} {
+@interface ${NAME} {
 
 }
\ No newline at end of file
diff --git a/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyEnum.groovy.ft b/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyEnum.groovy.ft
index 83c6b8c..c3204c2 100644
--- a/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyEnum.groovy.ft
+++ b/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyEnum.groovy.ft
@@ -2,6 +2,6 @@
 #end
 
 #parse("File Header.java")
-public enum ${NAME} {
+enum ${NAME} {
 
 }
\ No newline at end of file
diff --git a/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyInterface.groovy.ft b/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyInterface.groovy.ft
index e5afc85..b13537c 100644
--- a/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyInterface.groovy.ft
+++ b/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyInterface.groovy.ft
@@ -2,6 +2,6 @@
 #end
 
 #parse("File Header.java")
-public interface ${NAME} {
+interface ${NAME} {
 
 }
\ No newline at end of file
diff --git a/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyTrait.groovy.ft b/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyTrait.groovy.ft
new file mode 100644
index 0000000..ee499f1
--- /dev/null
+++ b/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyTrait.groovy.ft
@@ -0,0 +1,7 @@
+#if (${PACKAGE_NAME} && $PACKAGE_NAME != "" )package ${PACKAGE_NAME}
+#end
+
+#parse("File Header.java")
+trait ${NAME} {
+
+}
\ No newline at end of file
diff --git a/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyTrait.groovy.html b/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyTrait.groovy.html
new file mode 100644
index 0000000..42e0eee
--- /dev/null
+++ b/plugins/groovy/groovy-psi/resources/fileTemplates/j2ee/GroovyTrait.groovy.html
@@ -0,0 +1,30 @@
+<!--
+  ~  Copyright 2000-20014 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.
+  ~
+  -->
+
+<html>
+<body>
+<table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
+  <tr>
+    <td colspan="3">
+      <font face="verdana" size="-1">
+        This is a built-in template used each time you create a
+        Groovy trait
+      </font>
+    </td>
+  </tr>
+</table>
+</body>
+</html>
\ No newline at end of file
diff --git a/plugins/groovy/groovy-psi/resources/icons/groovy/trait.png b/plugins/groovy/groovy-psi/resources/icons/groovy/trait.png
new file mode 100644
index 0000000..1552975
--- /dev/null
+++ b/plugins/groovy/groovy-psi/resources/icons/groovy/trait.png
Binary files differ
diff --git a/plugins/groovy/groovy-psi/resources/icons/groovy/trait@2x.png b/plugins/groovy/groovy-psi/resources/icons/groovy/trait@2x.png
new file mode 100644
index 0000000..8f2683c
--- /dev/null
+++ b/plugins/groovy/groovy-psi/resources/icons/groovy/trait@2x.png
Binary files differ
diff --git a/plugins/groovy/groovy-psi/src/META-INF/GroovyPlugin.xml b/plugins/groovy/groovy-psi/src/META-INF/GroovyPlugin.xml
new file mode 100644
index 0000000..9dadde4
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/META-INF/GroovyPlugin.xml
@@ -0,0 +1,1682 @@
+<!--
+  ~  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.
+  ~
+  -->
+
+<idea-plugin>
+  <id>org.intellij.groovy</id>
+  <name>Groovy</name>
+  <description>Plugin for Groovy language support, including Groovy++, Grape, Gant and Griffon</description>
+  <version>9.0</version>
+  <vendor>JetBrains</vendor>
+  <depends>com.intellij.properties</depends>
+
+  <depends optional="true" config-file="groovy-copyright.xml">com.intellij.copyright</depends>
+  <depends optional="true" config-file="intellilang-groovy-support.xml">org.intellij.intelliLang</depends>
+  <depends optional="true">AntSupport</depends>
+  <depends optional="true">cucumber</depends>
+  <depends optional="true">ByteCodeViewer</depends>
+
+  <extensionPoints>
+    <extensionPoint name="methodComparator" interface="org.jetbrains.plugins.groovy.lang.resolve.GrMethodComparator"/>
+    <extensionPoint name="membersContributor" interface="org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor"/>
+    <extensionPoint name="defaultImportContributor" interface="org.jetbrains.plugins.groovy.lang.resolve.DefaultImportContributor"/>
+    <extensionPoint name="astTransformContributor" interface="org.jetbrains.plugins.groovy.lang.resolve.ast.AstTransformContributor"/>
+    <extensionPoint name="closureMissingMethodContributor"
+                    interface="org.jetbrains.plugins.groovy.lang.resolve.ClosureMissingMethodContributor"/>
+    <extensionPoint name="variableEnhancer" interface="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrVariableEnhancer"/>
+    <extensionPoint name="referenceTypeEnhancer" interface="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrReferenceTypeEnhancer"/>
+    <extensionPoint name="typeConverter" interface="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrTypeConverter"/>
+    <extensionPoint name="expectedTypesContributor"
+                    interface="org.jetbrains.plugins.groovy.lang.psi.expectedTypes.GroovyExpectedTypesContributor"/>
+
+    <extensionPoint name="positionManagerDelegate"
+                    interface="org.jetbrains.plugins.groovy.extensions.debugger.ScriptPositionManagerHelper"/>
+    <extensionPoint name="compilerExtension" interface="org.jetbrains.plugins.groovy.compiler.GroovyCompilerExtension"/>
+    <extensionPoint name="scriptTypeDetector" interface="org.jetbrains.plugins.groovy.extensions.GroovyScriptTypeDetector"/>
+
+    <extensionPoint name="namedArgumentProvider" interface="org.jetbrains.plugins.groovy.extensions.GroovyNamedArgumentProvider"/>
+    <extensionPoint name="mapContentProvider" interface="org.jetbrains.plugins.groovy.extensions.GroovyMapContentProvider"/>
+
+    <extensionPoint name="unresolvedHighlightFilter" interface="org.jetbrains.plugins.groovy.extensions.GroovyUnresolvedHighlightFilter"/>
+    <extensionPoint name="unresolvedHighlightFileFilter"
+                    interface="org.jetbrains.plugins.groovy.extensions.GroovyUnresolvedHighlightFileFilter"/>
+    <extensionPoint name="configSlurperSupport" interface="org.jetbrains.plugins.groovy.configSlurper.ConfigSlurperSupport"/>
+
+    <extensionPoint name="callExpressionTypeCalculator"
+                    interface="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrCallExpressionTypeCalculator"/>
+    <extensionPoint name="classDescriptor" beanClass="org.jetbrains.plugins.groovy.extensions.GroovyClassDescriptor"/>
+    <extensionPoint name="methodDescriptor" beanClass="org.jetbrains.plugins.groovy.extensions.GroovyMethodDescriptorExtension"/>
+
+    <extensionPoint name="groovyShellRunner" interface="org.jetbrains.plugins.groovy.console.GroovyShellRunner"/>
+
+    <!-- Groovy DSL extension points -->
+    <extensionPoint name="psiEnhancerCategory" interface="org.jetbrains.plugins.groovy.dsl.psi.PsiEnhancerCategory"/>
+    <extensionPoint name="gdslTopLevelProvider" interface="org.jetbrains.plugins.groovy.dsl.dsltop.GdslMembersProvider"/>
+
+    <extensionPoint name="groovyFrameworkConfigNotification"
+                    interface="org.jetbrains.plugins.groovy.annotator.GroovyFrameworkConfigNotification"/>
+    <extensionPoint name="groovySourceFolderDetector" interface="org.jetbrains.plugins.groovy.actions.GroovySourceFolderDetector"/>
+
+    <extensionPoint name="mvc.framework" interface="org.jetbrains.plugins.groovy.mvc.MvcFramework"/>
+
+    <extensionPoint name="closureCompleter" interface="org.jetbrains.plugins.groovy.lang.completion.ClosureCompleter"/>
+
+    <extensionPoint name="methodMayBeStaticInspectionFilter" interface="org.jetbrains.plugins.groovy.codeInspection.declaration.GrMethodMayBeStaticInspectionFilter"/>
+
+    <extensionPoint name="customAnnotationChecker" interface="org.jetbrains.plugins.groovy.annotator.checkers.CustomAnnotationChecker"/>
+
+    <extensionPoint name="convertToJava.customMethodInvocator" interface="org.jetbrains.plugins.groovy.refactoring.convertToJava.invocators.CustomMethodInvocator"/>
+
+    <extensionPoint name="signatureHintProcessor" interface="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.SignatureHintProcessor"/>
+  </extensionPoints>
+
+  <extensions defaultExtensionNs="org.intellij.groovy">
+
+    <groovyFrameworkConfigNotification order="last"
+                                       implementation="org.jetbrains.plugins.groovy.config.DefaultGroovyFrameworkConfigNotification"/>
+
+    <membersContributor implementation="org.jetbrains.plugins.groovy.annotator.intentions.dynamic.DynamicMembersContributor"/>
+    <membersContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.noncode.GrCollectionTypeMembersProvider"/>
+    <membersContributor implementation="org.jetbrains.plugins.groovy.spock.SpockMemberContributor"/>
+    <membersContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.noncode.MixinMemberContributor"/>
+    <membersContributor implementation="org.jetbrains.plugins.groovy.swingBuilder.SwingBuilderNonCodeMemberContributor"/>
+    <membersContributor implementation="org.jetbrains.plugins.groovy.dgm.DGMMemberContributor"/>
+
+    <membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebSpockTestMemberContributor"/>
+    <membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebPageMemberContributor"/>
+    <membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebModuleMemberContributor"/>
+
+    <membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebJUnitTestMemberContributor"/>
+    <membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebTestNGTestMemberContributor"/>
+    <membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebBrowserMemberContributor"/>
+
+    <membersContributor implementation="org.jetbrains.plugins.groovy.gant.GantMemberContributor"/>
+
+    <membersContributor implementation="org.jetbrains.plugins.groovy.markup.XmlMarkupBuilderNonCodeMemberContributor"/>
+
+    <closureMissingMethodContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.PluginXmlClosureMemberContributor"/>
+
+    <astTransformContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.ast.DelegatedMethodsContributor"/>
+    <astTransformContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.ast.AutoExternalizeContributor"/>
+    <astTransformContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.ast.AutoCloneContributor"/>
+    <astTransformContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.ast.ConstructorAnnotationsProcessor"/>
+    <astTransformContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.ast.GrInheritConstructorContributor"/>
+    <astTransformContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.ast.LoggingContributor"/>
+
+    <positionManagerDelegate implementation="org.jetbrains.plugins.groovy.gant.GantPositionManagerHelper"/>
+
+    <methodDescriptor lightMethodKey="SwingBuilder_builder_method"
+                      namedArgsProvider="org.jetbrains.plugins.groovy.swingBuilder.SwingBuilderNamedArgumentProvider"/>
+
+    <mapContentProvider implementation="org.jetbrains.plugins.groovy.configSlurper.ConfigSlurperMapContentProvider"/>
+    <referenceTypeEnhancer implementation="org.jetbrains.plugins.groovy.configSlurper.GroovyMapValueTypeEnhancer"/>
+
+    <unresolvedHighlightFilter implementation="org.jetbrains.plugins.groovy.extensions.GroovyUnresolvedReferenceFilterByFile"/>
+
+    <callExpressionTypeCalculator
+        implementation="org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.path.DefaultCallExpressionTypeCalculator"
+        order="last"/>
+    <callExpressionTypeCalculator
+        implementation="org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.path.GrDescriptorReturnTypeCalculator"/>
+    <callExpressionTypeCalculator
+        implementation="org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.path.GrDGMTypeCalculator"/>
+
+    <scriptTypeDetector implementation="org.jetbrains.plugins.groovy.gant.GantScriptTypeDetector"/>
+
+    <namedArgumentProvider implementation="org.jetbrains.plugins.groovy.lang.GroovySourceCodeNamedArgumentProvider" order="last"/>
+    <namedArgumentProvider implementation="org.jetbrains.plugins.groovy.lang.GroovyConstructorNamedArgumentProvider"/>
+    <namedArgumentProvider implementation="org.jetbrains.plugins.groovy.lang.GroovyMethodReturnNamedArgumentProvider" order="last"/>
+
+
+
+    <!-- GroovyDSL extensions -->
+    <gdslTopLevelProvider implementation="org.jetbrains.plugins.groovy.dsl.dsltop.GroovyDslDefaultMembers"/>
+    <gdslTopLevelProvider implementation="org.jetbrains.plugins.groovy.lang.resolve.GdkMethodDslProvider"/>
+    <psiEnhancerCategory implementation="org.jetbrains.plugins.groovy.dsl.psi.PsiClassCategory"/>
+    <psiEnhancerCategory implementation="org.jetbrains.plugins.groovy.dsl.psi.PsiElementCategory"/>
+    <psiEnhancerCategory implementation="org.jetbrains.plugins.groovy.dsl.psi.PsiMethodCategory"/>
+    <psiEnhancerCategory implementation="org.jetbrains.plugins.groovy.dsl.psi.PsiExpressionCategory"/>
+
+    <variableEnhancer implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ClosureParameterEnhancer"/>
+    <variableEnhancer implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ClosureAsAnonymousParameterEnhancer"/>
+    <variableEnhancer implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ClosureParamsEnhancer"/>
+
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.FromStringHintProcessor"/>
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.SimpleTypeHintProcessor"/>
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.MapEntryOrKeyValueHintProcessor"/>
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.FromAbstractTypeMethodsHintProcessor"/>
+
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.FirstParamHintProcessor"/>
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.FirstParamHintProcessor$FirstGeneric"/>
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.FirstParamHintProcessor$SecondGeneric"/>
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.FirstParamHintProcessor$ThirdGeneric"/>
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.FirstParamHintProcessor$Component"/>
+
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.SecondParamHintProcessor"/>
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.SecondParamHintProcessor$FirstGeneric"/>
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.SecondParamHintProcessor$SecondGeneric"/>
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.SecondParamHintProcessor$ThirdGeneric"/>
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.SecondParamHintProcessor$Component"/>
+
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ThirdParamHintProcessor"/>
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ThirdParamHintProcessor$FirstGeneric"/>
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ThirdParamHintProcessor$SecondGeneric"/>
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ThirdParamHintProcessor$ThirdGeneric"/>
+    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ThirdParamHintProcessor$Component"/>
+
+    <typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrContainerTypeConverter"/>
+    <typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrStringTypeConverter"/>
+    <typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrBooleanTypeConverter"/>
+    <typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrGenericTypeConverter"/>
+    <typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ClosureToSamConverter"/>
+    <typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrStringConverter"/>
+    <typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrContainerConverter"/>
+    <typeConverter implementation="org.jetbrains.plugins.groovy.gpp.GppTypeConverter"/>
+    <typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrNumberConverter"/>
+
+    <expectedTypesContributor implementation="org.jetbrains.plugins.groovy.gpp.GppExpectedTypesContributor"/>
+    <variableEnhancer implementation="org.jetbrains.plugins.groovy.gpp.GppClosureParameterTypeProvider"/>
+
+    <mvc.framework implementation="org.jetbrains.plugins.groovy.griffon.GriffonFramework"/>
+    <groovyFrameworkConfigNotification implementation="org.jetbrains.plugins.groovy.griffon.GriffonConfigureNotification"/>
+    <defaultImportContributor implementation="org.jetbrains.plugins.groovy.griffon.GriffonDefaultImportContributor"/>
+
+    <groovyShellRunner implementation="org.jetbrains.plugins.groovy.console.GroovyConsoleRunner" order="last"/>
+
+    <closureCompleter implementation="org.jetbrains.plugins.groovy.lang.completion.GdslClosureCompleter"/>
+    <closureCompleter implementation="org.jetbrains.plugins.groovy.lang.completion.EachWithIndexClosureCompleter"/>
+
+    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.annotator.checkers.FieldAnnotationChecker"/>
+    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.annotator.checkers.NewifyAnnotationChecker"/>
+    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.annotator.checkers.GrabAnnotationChecker"/>
+    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.annotator.checkers.GrAliasAnnotationChecker"/>
+    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.annotator.checkers.AnnotationCollectorChecker" order="first"/>
+    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.annotator.checkers.DelegatesToAnnotationChecker"/>
+    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.griffon.GriffonPropertyListenerAnnotationChecker"/>
+    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.annotator.checkers.BaseScriptAnnotationChecker"/>
+
+    <convertToJava.customMethodInvocator implementation="org.jetbrains.plugins.groovy.refactoring.convertToJava.invocators.MapGetterSetterInvocator"/>
+    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.annotator.checkers.TypeCheckedAnnotationChecker"/>
+  </extensions>
+
+  <extensions defaultExtensionNs="com.intellij.properties">
+    <implicitPropertyUsageProvider implementation="org.jetbrains.plugins.groovy.dgm.DGMImplicitPropertyUsageProvider"/>
+  </extensions>
+
+  <extensions defaultExtensionNs="com.intellij">
+    <navbar implementation="org.jetbrains.plugins.groovy.navbar.GrNavBarModelExtension" order="after defaultNavbar"/>
+
+    <fileTypeDetector implementation="org.jetbrains.plugins.groovy.GroovyHashBangFileTypeDetector"/>
+
+
+    <declarationRangeHandler key="org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod"
+                             implementationClass="org.jetbrains.plugins.groovy.codeInsight.hint.GrMethodDeclarationRangeHandler"/>
+    <declarationRangeHandler key="org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition"
+                             implementationClass="org.jetbrains.plugins.groovy.codeInsight.hint.GrTypeDefinitionRangeHandler"/>
+    <declarationRangeHandler key="org.jetbrains.plugins.groovy.lang.psi.api.statements.GrClassInitializer"
+                             implementationClass="org.jetbrains.plugins.groovy.codeInsight.hint.GrClassInitializerDeclarationRangeHandler"/>
+
+
+    <psi.clsCustomNavigationPolicy implementation="org.jetbrains.plugins.groovy.codeInsight.GroovyClsCustomNavigationPolicy"/>
+
+    <moduleBuilder builderClass="org.jetbrains.plugins.groovy.config.GroovyAwareModuleBuilder"/>
+
+    <pom.declarationSearcher implementation="org.jetbrains.plugins.groovy.geb.GebContentDeclarationSearcher"/>
+
+    <itemPresentationProvider forClass="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl"
+                              implementationClass="org.jetbrains.plugins.groovy.findUsages.GrFileItemPresentationProvider"/>
+
+    <testFramework implementation="org.jetbrains.plugins.groovy.testIntegration.GroovyTestFramework" order="first"/>
+    <testFramework implementation="org.jetbrains.plugins.groovy.spock.SpockTestFramework" order="first"/>
+
+    <testCreator language="Groovy" implementationClass="com.intellij.testIntegration.JavaTestCreator"/>
+    <testGenerator language="Groovy" implementationClass="org.jetbrains.plugins.groovy.testIntegration.GroovyTestGenerator"/>
+    <constructorBodyGenerator language="Groovy"
+                              implementationClass="org.jetbrains.plugins.groovy.annotator.intentions.dynamic.GrConstructorBodyGenerator"/>
+    <editorNotificationProvider implementation="org.jetbrains.plugins.groovy.config.ConfigureGroovyLibraryNotificationProvider"/>
+    <refactoring.introduceParameterMethodUsagesProcessor
+        implementation="org.jetbrains.plugins.groovy.refactoring.introduce.parameter.java2groovy.GroovyIntroduceParameterMethodUsagesProcessor"/>
+    <refactoring.changeSignatureUsageProcessor
+        implementation="org.jetbrains.plugins.groovy.refactoring.changeSignature.GrChangeSignatureUsageProcessor" id="groovyProcessor"
+        order="before javaProcessor"/>
+    <safeDelete.importSearcher implementation="org.jetbrains.plugins.groovy.refactoring.safeDelete.GroovyImportSearcher"/>
+    <refactoring.safeDelete.JavaSafeDeleteDelegate implementationClass="org.jetbrains.plugins.groovy.refactoring.safeDelete.JavaSafeDeleteDelegateForGroovy" language="Groovy"/>
+
+    <encapsulateFields.Helper language="Groovy"
+                              implementationClass="org.jetbrains.plugins.groovy.refactoring.encapsulateFields.GroovyEncapsulateFieldHelper"/>
+
+    <constantExpressionEvaluator language="Groovy"
+                                 implementationClass="org.jetbrains.plugins.groovy.lang.psi.util.GroovyConstantExpressionEvaluator"/>
+    <annotationSupport language="Groovy"
+                       implementationClass="org.jetbrains.plugins.groovy.lang.psi.impl.auxiliary.annotation.GroovyAnnotationSupport"/>
+
+    <expressionConverter language="Groovy"
+                         implementationClass="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyExpressionConverter"/>
+
+    <codeInsight.createFieldFromUsageHelper language="Groovy" implementationClass="org.jetbrains.plugins.groovy.annotator.intentions.GroovyCreateFieldFromUsageHelper"/>
+
+    <errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
+    <fileTypeFactory implementation="org.jetbrains.plugins.groovy.GroovyFileTypeLoader"/>
+    <fileTypeFactory implementation="org.jetbrains.plugins.groovy.dgm.DGMFileTypeFactory"/>
+
+    <projectConfigurable instance="org.jetbrains.plugins.groovy.gant.GantConfigurable" id="reference.settingsdialog.project.gant"
+                         displayName="Gant"/>
+
+    <library.presentationProvider implementation="org.jetbrains.plugins.groovy.config.GroovyLibraryPresentationProvider"/>
+    <library.presentationProvider implementation="org.jetbrains.plugins.groovy.gpp.GppLibraryPresentationProvider" order="first"/>
+    <library.presentationProvider implementation="org.jetbrains.plugins.groovy.gant.GantLibraryPresentationProvider" order="last"/>
+
+    <projectService serviceInterface="org.jetbrains.plugins.groovy.gant.GantSettings"
+                    serviceImplementation="org.jetbrains.plugins.groovy.gant.GantSettings"/>
+
+    <spellchecker.support language="Groovy"
+                          implementationClass="org.jetbrains.plugins.groovy.codeInspection.spellchecker.GroovySpellcheckingStrategy"/>
+
+    <colorSettingsPage implementation="org.jetbrains.plugins.groovy.highlighter.GroovyColorsAndFontsPage"/>
+    <framework.type implementation="org.jetbrains.plugins.groovy.config.GroovyFrameworkType"/>
+    <renameHandler implementation="org.jetbrains.plugins.groovy.refactoring.rename.PropertyRenameHandler"/>
+    <renamePsiElementProcessor id="groovyFieldRenameProcessor"
+                               implementation="org.jetbrains.plugins.groovy.refactoring.rename.RenameGrFieldProcessor"
+                               order="first"/>
+    <renamePsiElementProcessor id="groovyPropertyRenameProcessor"
+                               implementation="org.jetbrains.plugins.groovy.refactoring.rename.RenameGroovyPropertyProcessor"
+                               order="first"/>
+    <renamePsiElementProcessor id="groovyLightElementRenamer"
+                               implementation="org.jetbrains.plugins.groovy.refactoring.rename.GrLightElementRenamer"
+                               order="first, after groovyPropertyRenameProcessor"/>
+    <renamePsiElementProcessor implementation="org.jetbrains.plugins.groovy.refactoring.rename.RenameAliasImportedClassProcessor"
+                               order="first"/>
+    <renamePsiElementProcessor implementation="org.jetbrains.plugins.groovy.refactoring.rename.RenameAliasImportedMethodProcessor"
+                               order="first"/>
+    <renamePsiElementProcessor implementation="org.jetbrains.plugins.groovy.refactoring.rename.RenameAliasImportedFieldProcessor"
+                               order="first"/>
+    <renamePsiElementProcessor implementation="org.jetbrains.plugins.groovy.refactoring.rename.RenameGroovyScriptProcessor"/>
+
+    <rename.inplace.resolveSnapshotProvider language="Groovy"
+                                            implementationClass="org.jetbrains.plugins.groovy.refactoring.rename.inplace.GroovyResolveSnapshotProvider"/>
+
+    <renameHandler implementation="org.jetbrains.plugins.groovy.refactoring.rename.inplace.GrVariableInplaceRenameHandler"/>
+    <renameHandler implementation="org.jetbrains.plugins.groovy.refactoring.rename.inplace.GrMethodInplaceRenameHandler"/>
+
+    <nameSuggestionProvider implementation="org.jetbrains.plugins.groovy.refactoring.GroovyNameSuggestionProvider"/>
+
+    <statementUpDownMover implementation="org.jetbrains.plugins.groovy.editor.actions.GroovyStatementMover"/>
+
+    <joinLinesHandler implementation="org.jetbrains.plugins.groovy.editor.actions.joinLines.GrVariableJoinLinesHandler"/>
+    <joinLinesHandler implementation="org.jetbrains.plugins.groovy.editor.actions.joinLines.GrJoinBlockStatementHandler"/>
+    <joinLinesHandler implementation="org.jetbrains.plugins.groovy.editor.actions.joinLines.GrJoinControlStatementHandler"/>
+    <joinLinesHandler implementation="org.jetbrains.plugins.groovy.editor.actions.joinLines.GrJoinStatementsHandler"/>
+
+    <applicationService serviceInterface="org.jetbrains.plugins.groovy.settings.GroovyApplicationSettings"
+                        serviceImplementation="org.jetbrains.plugins.groovy.settings.GroovyApplicationSettings"/>
+    <applicationService serviceInterface="org.jetbrains.plugins.groovy.dsl.DslErrorReporter"
+                        serviceImplementation="org.jetbrains.plugins.groovy.dsl.DslErrorReporterImpl"/>
+
+    <!-- Groovy language -->
+    <syntaxHighlighter key="Groovy" implementationClass="org.jetbrains.plugins.groovy.highlighter.GroovySyntaxHighlighter"/>
+
+    <annotator language="Groovy" implementationClass="org.jetbrains.plugins.groovy.annotator.GrAnnotatorImpl"/>
+    <annotator language="Groovy" implementationClass="org.jetbrains.plugins.groovy.dsl.GroovyDslAnnotator"/>
+
+    <lang.psiStructureViewFactory language="Groovy"
+                                  implementationClass="org.jetbrains.plugins.groovy.structure.GroovyStructureViewFactory"/>
+    <lang.parserDefinition language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.parser.GroovyParserDefinition"/>
+    <lang.commenter language="Groovy" implementationClass="org.jetbrains.plugins.groovy.highlighter.GroovyCommenter"/>
+    <lang.foldingBuilder language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.folding.GroovyFoldingBuilder"/>
+    <lang.formatter language="Groovy" implementationClass="org.jetbrains.plugins.groovy.formatter.GroovyFormattingModelBuilder"/>
+    <lang.whiteSpaceFormattingStrategy language="Groovy"
+                                       implementationClass="org.jetbrains.plugins.groovy.formatter.GroovyWhiteSpaceFormattingStrategy"/>
+    <postFormatProcessor implementation="org.jetbrains.plugins.groovy.formatter.GroovyBracePostFormatProcessor"/>
+
+    <enterHandlerDelegate implementation="org.jetbrains.plugins.groovy.editor.actions.GroovyEnterHandler"
+                          order="before EnterBetweenBracesHandler"/>
+    <typedHandler implementation="org.jetbrains.plugins.groovy.editor.actions.GStringTypedActionHandler"/>
+    <backspaceHandlerDelegate implementation="org.jetbrains.plugins.groovy.editor.actions.GStringBackspaceHandlerDelegate"/>
+
+    <typedHandler implementation="org.jetbrains.plugins.groovy.editor.actions.GroovyTypedHandler"/>
+    <backspaceHandlerDelegate implementation="org.jetbrains.plugins.groovy.editor.actions.GroovyBackspaceHandler"/>
+
+    <liveTemplateContext implementation="org.jetbrains.plugins.groovy.template.GroovyTemplateContextType$Generic"/>
+    <liveTemplateContext implementation="org.jetbrains.plugins.groovy.template.GroovyTemplateContextType$Expression"/>
+    <liveTemplateContext implementation="org.jetbrains.plugins.groovy.template.GroovyTemplateContextType$Statement"/>
+    <liveTemplateContext implementation="org.jetbrains.plugins.groovy.template.GroovyTemplateContextType$Declaration"/>
+
+    <defaultLiveTemplatesProvider implementation="org.jetbrains.plugins.groovy.template.GroovyTemplatesProvider"/>
+
+    <liveTemplateOptionalProcessor implementation="org.jetbrains.plugins.groovy.template.GroovyShortenFQNamesProcessor"/>
+    <variableTypeCalculator implementation="org.jetbrains.plugins.groovy.template.GroovyVariableTypeCalculator"/>
+
+    <gotoSymbolContributor implementation="org.jetbrains.plugins.groovy.gotoclass.GroovyGoToSymbolContributor"/>
+    <lang.refactoringSupport language="Groovy"
+                             implementationClass="org.jetbrains.plugins.groovy.refactoring.GroovyRefactoringSupportProvider"/>
+    <lang.surroundDescriptor language="Groovy"
+                             implementationClass="org.jetbrains.plugins.groovy.lang.surroundWith.GroovySurroundDescriptor"/>
+    <lang.findUsagesProvider language="Groovy" implementationClass="org.jetbrains.plugins.groovy.findUsages.GroovyFindUsagesProvider"/>
+    <importFilteringRule implementation="org.jetbrains.plugins.groovy.findUsages.GrImportFilteringRule"/>
+
+    <readWriteAccessDetector implementation="org.jetbrains.plugins.groovy.findUsages.GroovyReadWriteAccessDetector" order="before java"/>
+    <findUsagesHandlerFactory implementation="org.jetbrains.plugins.groovy.findUsages.GroovyFieldFindUsagesHandlerFactory"/>
+    <highlightUsagesHandlerFactory implementation="org.jetbrains.plugins.groovy.findUsages.GrHighlightHandlerFactory"/>
+    <lang.braceMatcher language="Groovy" implementationClass="org.jetbrains.plugins.groovy.highlighter.GroovyBraceMatcher"/>
+    <lang.importOptimizer language="Groovy" implementationClass="org.jetbrains.plugins.groovy.editor.GroovyImportOptimizer"/>
+    <lang.documentationProvider language="Groovy"
+                                implementationClass="org.jetbrains.plugins.groovy.lang.documentation.GroovyDocumentationProvider"/>
+    <lang.smartEnterProcessor language="Groovy"
+                              implementationClass="org.jetbrains.plugins.groovy.lang.completion.smartEnter.GroovySmartEnterProcessor"/>
+    <codeInsight.overrideMethod language="Groovy"
+                                implementationClass="org.jetbrains.plugins.groovy.overrideImplement.GroovyOverrideMethodsHandler"/>
+    <codeInsight.implementMethod language="Groovy"
+                                 implementationClass="org.jetbrains.plugins.groovy.overrideImplement.GroovyImplementMethodsHandler"/>
+
+    <methodImplementor implementation="org.jetbrains.plugins.groovy.overrideImplement.GroovyMethodImplementor"/>
+    <methodImplementor implementation="org.jetbrains.plugins.groovy.overrideImplement.TraitMethodImplementor"/>
+    <codeInsight.parameterInfo language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.parameterInfo.GroovyParameterInfoHandler"/>
+    <codeInsight.parameterInfo language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.parameterInfo.GroovyAnnotationAttributeInfoHandler"/>
+    <codeInsight.parameterInfo language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.parameterInfo.GroovyTypeParameterInfoHandler"/>
+    <refactoring.inlineHandler language="Groovy" implementationClass="org.jetbrains.plugins.groovy.refactoring.inline.GroovyInlineHandler"/>
+    <inlineActionHandler implementation="org.jetbrains.plugins.groovy.refactoring.inline.GroovyInlineLocalHandler"/>
+
+    <refactoring.moveClassHandler implementation="org.jetbrains.plugins.groovy.refactoring.move.MoveGroovyClassHandler"/>
+    <refactoring.moveClassToInnerHandler implementation="org.jetbrains.plugins.groovy.refactoring.move.GroovyMoveClassToInnerHandler"/>
+    <moveFileHandler implementation="org.jetbrains.plugins.groovy.refactoring.move.MoveGroovyFileHandler"/>
+    <refactoring.moveMemberHandler language="Groovy"
+                                   implementationClass="org.jetbrains.plugins.groovy.refactoring.move.MoveGroovyMemberHandler"/>
+
+    <refactoring.helper implementation="org.jetbrains.plugins.groovy.refactoring.GroovyImportOptimizerRefactoringHelper"/>
+    <codeInsight.lineMarkerProvider language="Groovy"
+                                    implementationClass="org.jetbrains.plugins.groovy.codeInsight.GroovyLineMarkerProvider"/>
+    <codeInsight.gotoSuper language="Groovy"
+                           implementationClass="org.jetbrains.plugins.groovy.codeInsight.navigation.actions.GroovyGotoSuperHandler"/>
+    <lookup.charFilter implementation="org.jetbrains.plugins.groovy.lang.completion.GroovyReferenceCharFilter"/>
+    <completion.contributor language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.completion.GroovyNoVariantsDelegator"
+                            id="groovyBasic2ClassName" order="first, after liveTemplates"/>
+    <completion.contributor language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.completion.GroovyCompletionContributor"
+                            id="groovyBasic" order="before javaClassName"/>
+    <completion.contributor language="Groovy" implementationClass="org.jetbrains.plugins.groovy.console.GroovyShellCompletionContributor"/>
+
+    <completion.contributor language="Groovy"
+                            implementationClass="org.jetbrains.plugins.groovy.lang.completion.GroovySmartCompletionContributor"/>
+    <completion.contributor language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.completion.GrMethodMergingContributor"
+                            id="grMethodMerger" order="before methodMerger"/>
+
+    <completion.contributor language="Properties" implementationClass="org.jetbrains.plugins.groovy.dgm.DGMCompletionContributor"/>
+
+    <completion.confidence language="Groovy" implementationClass="com.intellij.codeInsight.completion.UnfocusedNameIdentifier"
+                           id="groovyNameIdentifier"/>
+    <completion.confidence language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.completion.GroovyCompletionConfidence"
+                           id="groovyAdvanced" order="after groovyNameIdentifier"/>
+    <completion.confidence language="Groovy" implementationClass="com.intellij.codeInsight.completion.UnfocusedComments"
+                           id="groovyComments"/>
+    <completion.confidence language="Groovy" implementationClass="com.intellij.codeInsight.completion.AlwaysFocusLookup" id="groovyTrue"
+                           order="last"/>
+    <completion.contributor language="Groovy" implementationClass="org.jetbrains.plugins.groovy.geb.GebPageFieldNameCompletionContributor"/>
+
+    <cantBeStatic implementation="org.jetbrains.plugins.groovy.codeInspection.declaration.GrCategoryMethodsCantBeStaticExtension" />
+
+    <psi.referenceContributor  language="Properties" implementation="org.jetbrains.plugins.groovy.dgm.DGMReferenceContributor"/>
+
+    <psi.referenceContributor language="Groovy" implementation="org.jetbrains.plugins.groovy.lang.resolve.GroovyMethodArgumentReferenceContributor"/>
+
+    <weigher key="completion" implementationClass="org.jetbrains.plugins.groovy.lang.completion.weighers.GrWithWeigher"
+             id="groovyWithWeigher" order="after prefix"/>
+    <weigher key="completion" implementationClass="org.jetbrains.plugins.groovy.lang.completion.weighers.GrKindWeigher"
+             id="groovyKindWeigher" order="after groovyWithWeigher, before explicitProximity"/>
+
+    <weigher key="proximity" implementationClass="org.jetbrains.plugins.groovy.lang.completion.weighers.GrReferenceListWeigher"
+             id="groovyReferenceListWeigher" order="before openedInEditor"/>
+
+    <debuggerClassFilterProvider implementation="org.jetbrains.plugins.groovy.debugger.filters.GroovyDebuggerClassFilterProvider"/>
+
+    <useScopeEnlarger implementation="org.jetbrains.plugins.groovy.lang.psi.impl.search.GrPrivateFieldScopeEnlarger"/>
+
+    <debuggerEditorTextProvider language="Groovy" implementationClass="org.jetbrains.plugins.groovy.debugger.GroovyEditorTextProvider"/>
+
+    <xdebugger.settings implementation="org.jetbrains.plugins.groovy.debugger.filters.GroovyDebuggerSettings"/>
+    <langCodeStyleSettingsProvider implementation="org.jetbrains.plugins.groovy.codeStyle.GroovyLanguageCodeStyleSettingsProvider"/>
+    <codeStyleSettingsProvider implementation="org.jetbrains.plugins.groovy.codeStyle.GroovyCodeStyleSettingsProvider"/>
+
+    <typeHierarchyProvider language="Groovy" implementationClass="org.jetbrains.plugins.groovy.hierarchy.type.GroovyTypeHierarchyProvider"/>
+    <callHierarchyProvider language="Groovy" implementationClass="org.jetbrains.plugins.groovy.hierarchy.call.GrCallHierarchyProvider"/>
+
+    <lang.unwrapDescriptor language="Groovy" implementationClass="org.jetbrains.plugins.groovy.unwrap.GroovyUnwrapDescriptor"/>
+
+    <lang.elementManipulator forClass="org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral"
+                             implementationClass="org.jetbrains.plugins.groovy.lang.resolve.GroovyStringLiteralManipulator"/>
+    <lang.elementManipulator forClass="org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentLabel"
+                             implementationClass="org.jetbrains.plugins.groovy.lang.psi.impl.statements.arguments.GrArgumentLabelManipulator"/>
+    <lang.elementManipulator forClass="org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrStringContent"
+                             implementationClass="org.jetbrains.plugins.groovy.lang.resolve.GroovyStringLiteralManipulator"/>
+
+
+    <directClassInheritorsSearch implementation="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyDirectInheritorsSearcher"/>
+
+    <pom.declarationSearcher implementation="org.jetbrains.plugins.groovy.spock.SpockPomDeclarationSearcher"/>
+
+    <typeDeclarationProvider implementation="org.jetbrains.plugins.groovy.editor.GroovyTypeDeclarationProvider" order="first"/>
+
+    <!--Run/debug-->
+    <configurationType implementation="org.jetbrains.plugins.groovy.runner.GroovyScriptRunConfigurationType"/>
+    <configurationProducer implementation="org.jetbrains.plugins.groovy.runner.GroovyScriptRunConfigurationProducer"/>
+
+    <quoteHandler fileType="Groovy" className="org.jetbrains.plugins.groovy.editor.GroovyQuoteHandler"/>
+
+    <compileServer.plugin classpath="groovy-jps-plugin.jar"/>
+
+    <indexPatternBuilder implementation="org.jetbrains.plugins.groovy.util.GroovyIndexPatternBuilder"/>
+    <todoIndexer filetype="Groovy" implementationClass="org.jetbrains.plugins.groovy.highlighter.GroovyTodoIndexer"/>
+
+    <basicWordSelectionFilter implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyWordSelectionFilter"/>
+    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyLiteralSelectioner"/>
+    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyMembersWithDocSelectioner"/>
+    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyBlockStatementsSelectioner"/>
+    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyTypeDefinitionBodySelectioner"/>
+    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyTypeCastSelectioner"/>
+    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyDocParamsSelectioner"/>
+    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyArgListSelectioner"/>
+    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyGStringSelectioner"
+                                order="before wordSelectioner"/>
+    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyParameterListSelectioner"/>
+    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyElseSelectioner"/>
+    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyWordSelectionHandler"/>
+    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyStatementSelectioner"/>
+
+
+    <methodReferencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.AccessorMethodReferencesSearcher"/>
+    <methodReferencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.MethodLateBoundReferencesSearcher"/>
+    <methodReferencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.GroovyConstructorUsagesSearcher"/>
+    <methodReferencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.GroovyReflectedMethodReferenceSearcher"/>
+    <methodReferencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.GrLiteralMethodSearcher"/>
+    <annotatedElementsSearch implementation="org.jetbrains.plugins.groovy.findUsages.AnnotatedMembersSearcher"/>
+    <superMethodsSearch implementation="org.jetbrains.plugins.groovy.findUsages.GDKSuperMethodSearcher"/>
+    <definitionsScopedSearch implementation="org.jetbrains.plugins.groovy.findUsages.GroovyImplementationSearch"/>
+
+    <targetElementEvaluator language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyTargetElementEvaluator"/>
+
+    <fileTemplateGroup implementation="org.jetbrains.plugins.groovy.actions.GroovyTemplatesFactory"/>
+
+    <attachSourcesProvider implementation="org.jetbrains.plugins.groovy.ivy.IvyAttachSourceProvider"/>
+
+    <projectConfigurable instance="org.jetbrains.plugins.groovy.compiler.GroovyCompilerConfigurable" id="Groovy compiler"
+                         displayName="Groovy Compiler" parentId="project.propCompiler"/>
+    
+    <vetoSPICondition implementation="org.jetbrains.plugins.groovy.dgm.GroovyExtensionProvider$GroovyExtensionVetoSPI"/>
+
+    <stubElementTypeHolder class="org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes"/>
+    <!--Stubs index-->
+    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrFullClassNameIndex"/>
+    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrFullScriptNameIndex"/>
+    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrFieldNameIndex"/>
+    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrMethodNameIndex"/>
+    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrAnnotationMethodNameIndex"/>
+    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrAnnotatedMemberIndex"/>
+    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrScriptClassNameIndex"/>
+    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrDirectInheritorsIndex"/>
+    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrAnonymousClassIndex"/>
+
+    <referencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.ConstructorReferencesSearcher"/>
+    <referencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.GrAliasedImportedElementSearcher"/>
+    <referencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.AccessorReferencesSearcher"/>
+    <referencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.GroovyTraitFieldSearcher"/>
+
+    <antCustomCompiler implementation="org.jetbrains.plugins.groovy.ant.GroovyAntCustomCompilerProvider"/>
+
+    <project.converterProvider implementation="org.jetbrains.plugins.groovy.config.GroovyModuleConverterProvider"/>
+    <project.converterProvider implementation="org.jetbrains.plugins.groovy.config.GroovyRunConfigurationConverterProvider"/>
+
+    <iconProvider implementation="org.jetbrains.plugins.groovy.GroovyIconProvider"/>
+
+    <projectService serviceInterface="org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory"
+                    serviceImplementation="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementFactoryImpl"/>
+    <projectService serviceInterface="org.jetbrains.plugins.groovy.compiler.GroovyCompilerWorkspaceConfiguration"
+                    serviceImplementation="org.jetbrains.plugins.groovy.compiler.GroovyCompilerWorkspaceConfiguration"/>
+    <projectService serviceInterface="org.jetbrains.plugins.groovy.compiler.GroovyCompilerConfiguration"
+                    serviceImplementation="org.jetbrains.plugins.groovy.compiler.GroovyCompilerConfiguration"/>
+
+    <psi.referenceContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.providers.GroovyReferenceContributor"/>
+
+    <resolveScopeProvider implementation="org.jetbrains.plugins.groovy.lang.resolve.GroovyResolveScopeProvider"/>
+
+    <java.elementFinder implementation="org.jetbrains.plugins.groovy.lang.psi.impl.javaView.GroovyClassFinder"/>
+    <java.elementFinder implementation="org.jetbrains.plugins.groovy.gant.GantClassFinder"/>
+    <java.shortNamesCache implementation="org.jetbrains.plugins.groovy.lang.stubs.GroovyShortNamesCache"/>
+
+    <projectService
+                    serviceImplementation="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiManager"/>
+    <projectService serviceInterface="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyCodeStyleManager"
+                    serviceImplementation="org.jetbrains.plugins.groovy.codeStyle.GroovyCodeStyleManagerImpl"/>
+    <projectService serviceInterface="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyCodeStyleSettingsFacade"
+                    serviceImplementation="org.jetbrains.plugins.groovy.codeStyle.GroovyCodeStyleSettingsFacadeImpl"/>
+
+    <projectService
+                    serviceImplementation="org.jetbrains.plugins.groovy.dgm.GroovyExtensionProvider"/>
+
+    <problemFileHighlightFilter implementation="org.jetbrains.plugins.groovy.GroovyProblemFileHighlightFilter"/>
+
+    <renameInputValidator implementation="org.jetbrains.plugins.groovy.GroovyRenameInputValidator"/>
+    <lang.namesValidator implementationClass="org.jetbrains.plugins.groovy.lang.GroovyNamesValidator" language="Groovy"/>
+
+    <fileBasedIndex implementation="org.jetbrains.plugins.groovy.dsl.GroovyDslFileIndex"/>
+
+    <patterns.patternClass className="org.jetbrains.plugins.groovy.lang.psi.patterns.GroovyPatterns" alias="groovy"/>
+
+    <stacktrace.fold substring="at org.codehaus.groovy."/>
+    <stacktrace.fold substring="at groovy."/>
+    <stacktrace.fold substring="at org.codehaus.groovy.runtime.DefaultGroovyMethods." negate="true"/>
+    <stacktrace.fold substring="at org.codehaus.groovy.vmplugin.v5.PluginDefaultGroovyMethods." negate="true"/>
+    <stacktrace.fold substring="at org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport." negate="true"/>
+
+    <projectStructureDetector implementation="org.jetbrains.plugins.groovy.GroovySourceRootDetector" id="groovyDetector"/>
+
+    <generation.topLevelFactory language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFactoryProvider"/>
+
+    <postStartupActivity implementation="org.jetbrains.plugins.groovy.mvc.MvcProjectWithoutLibraryNotificator"/>
+
+    <treeCopyHandler implementation="org.jetbrains.plugins.groovy.lang.GroovyChangeUtilSupport"/>
+    <treeGenerator implementation="org.jetbrains.plugins.groovy.lang.psi.impl.source.impl.GroovyTreeGenerator" order="first"/>
+
+    <copyPastePreProcessor implementation="org.jetbrains.plugins.groovy.editor.GroovyLiteralCopyPasteProcessor"/>
+    <copyPastePostProcessor implementation="org.jetbrains.plugins.groovy.editor.GroovyReferenceCopyPasteProcessor"/>
+
+    <localInspection shortName="GroovyUnusedDeclaration" displayName="Unused declaration"
+                 groupPath="Groovy"
+                 groupName="Declaration redundancy" enabledByDefault="true" level="WARNING"
+                 implementationClass="org.jetbrains.plugins.groovy.codeInspection.GroovyUnusedDeclarationInspection" unfair="true"/>
+
+    <localInspection language="Groovy" groupPath="Groovy" shortName="SecondUnsafeCall"
+                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
+                     key="second.unsafe.call" groupName="Probable bugs" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.secondUnsafeCall.SecondUnsafeCallInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUnusedAssignment"
+                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
+                     key="unused.assignment" groupKey="groovy.dfa.issues" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.unusedDef.UnusedDefInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUnusedIncOrDec"
+                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
+                     key="unused.inc.dec" groupKey="groovy.dfa.issues" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GrUnusedIncDecInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyVariableNotAssigned"
+                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
+                     key="unassigned.access" groupKey="groovy.dfa.issues" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.unassignedVariable.UnassignedVariableAccessInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyMissingReturnStatement"
+                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
+                     key="no.return.display.name" groupKey="groovy.dfa.issues" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.noReturnMethod.MissingReturnInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="TypeCustomizer"
+                     displayName="Type customizer inspection"
+                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
+                     groupKey="other" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.resources.TypeCustomizerInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyAssignabilityCheck" displayName="Incompatible type assignments"
+                     groupName="Assignment issues"
+                     enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyAssignabilityCheckInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyResultOfAssignmentUsed" displayName="Result of assignment used"
+                     groupName="Assignment issues"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyResultOfAssignmentUsedInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyAssignmentCanBeOperatorAssignment"
+                     displayName="Assignment replaceable with operator assignment"
+                     groupName="Assignment issues" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyAssignmentCanBeOperatorAssignmentInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyAssignmentToForLoopParameter"
+                     displayName="Assignment to for-loop parameter"
+                     groupName="Assignment issues" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyAssignmentToForLoopParameterInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyAssignmentToMethodParameter"
+                     displayName="Assignment to method parameter"
+                     groupName="Assignment issues" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyAssignmentToMethodParameterInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyNestedAssignment" displayName="Nested assignment"
+                     groupName="Assignment issues"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyNestedAssignmentInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovySillyAssignment" displayName="Silly assignment"
+                     groupName="Assignment issues" enabledByDefault="true"
+                     level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.assignment.GroovySillyAssignmentInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUncheckedAssignmentOfMemberOfRawType"
+                     displayName="Unchecked assignment from members of raw type"
+                     groupName="Assignment issues" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyUncheckedAssignmentOfMemberOfRawTypeInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyContinueOrBreakFromFinallyBlock"
+                     displayName="'continue' or 'break' inside 'finally' block"
+                     groupName="Error handling" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.exception.GroovyContinueOrBreakFromFinallyBlockInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GrMethodMayBeStatic"
+                     displayName="Method may be static"
+                     groupName="Declaration" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.declaration.GrMethodMayBeStaticInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyReturnFromFinallyBlock"
+                     displayName="'return' inside 'finally' block" groupName="Error handling"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.exception.GroovyReturnFromFinallyBlockInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyThrowFromFinallyBlock"
+                     displayName="'throw' inside 'finally' block" groupName="Error handling"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.exception.GroovyThrowFromFinallyBlockInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyEmptyCatchBlock" displayName="Empty 'catch' block"
+                     groupName="Error handling" enabledByDefault="false"
+                     level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.exception.GroovyEmptyCatchBlockInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyEmptyFinallyBlock" displayName="Empty 'finally' block"
+                     groupName="Error handling"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.exception.GroovyEmptyFinallyBlockInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyEmptyTryBlock" displayName="Empty 'try' block"
+                     groupName="Error handling" enabledByDefault="false"
+                     level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.exception.GroovyEmptyTryBlockInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUnusedCatchParameter" displayName="Unused catch parameter"
+                     groupName="Error handling"
+                     enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.exception.GroovyUnusedCatchParameterInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyBreak" displayName="Break statement" groupName="Control Flow"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyBreakInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyContinue" displayName="Continue statement"
+                     groupName="Control Flow" enabledByDefault="false"
+                     level="WARNING" implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyContinueInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUnreachableStatement" displayName="Unreachable Statement"
+                     groupName="Validity issues"
+                     enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.validity.GroovyUnreachableStatementInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyLoopStatementThatDoesntLoop"
+                     displayName="Loop statement that doesn't loop" groupName="Control Flow"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyLoopStatementThatDoesntLoopInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyConditionalWithIdenticalBranches"
+                     displayName="Conditional expression with identical branches"
+                     groupName="Control Flow" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyConditionalWithIdenticalBranchesInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyConditionalCanBeElvis"
+                     displayName="Conditional expression can be elvis" groupName="Control Flow"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyConditionalCanBeElvisInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyConditionalCanBeConditionalCall"
+                     displayName="Conditional expression can be conditional call"
+                     groupName="Control Flow" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyConditionalCanBeConditionalCallInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyIfStatementWithIdenticalBranches"
+                     displayName="If statement with identical branches"
+                     groupName="Control Flow" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyIfStatementWithIdenticalBranchesInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyIfStatementWithTooManyBranches"
+                     displayName="If statement with too many branches"
+                     groupName="Control Flow" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyIfStatementWithTooManyBranchesInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyFallthrough" displayName="Fallthrough in switch statement"
+                     groupName="Control Flow"
+                     enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyFallthroughInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUnnecessaryContinue"
+                     displayName="Unnecessary 'continue' statement" groupName="Control Flow"
+                     enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyUnnecessaryContinueInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUnnecessaryReturn" displayName="Unnecessary 'return' statement"
+                     groupName="Control Flow"
+                     enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyUnnecessaryReturnInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GrFinalVariableAccess" displayName="Final variable access"
+                     groupName="Control Flow"
+                     enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.finalVar.GrFinalVariableAccessInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovySwitchStatementWithNoDefault"
+                     displayName="Switch statement with no default case"
+                     groupName="Control Flow" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovySwitchStatementWithNoDefaultInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyReturnFromClosureCanBeImplicit"
+                     displayName="'return' statement can be implicit"
+                     groupName="Control Flow" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyReturnFromClosureCanBeImplicitInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyTrivialConditional"
+                     displayName="Redundant conditional expression" groupName="Control Flow"
+                     enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyTrivialConditionalInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyConstantConditional"
+                     displayName="Constant conditional expression" groupName="Control Flow"
+                     enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyConstantConditionalInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyConstantIfStatement" displayName="Constant if statement"
+                     groupName="Control Flow"
+                     enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyConstantIfStatementInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyTrivialIf" displayName="Redundant 'if' statement"
+                     groupName="Control Flow" enabledByDefault="true"
+                     level="WARNING" implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyTrivialIfInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="JavaStylePropertiesInvocation"
+                     displayName="Java-style property access"
+                     groupName="Style" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.style.JavaStylePropertiesInvocationInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyAccessToStaticFieldLockedOnInstance"
+                     displayName="Access to static field locked on instance data"
+                     groupName="Threading issues" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyAccessToStaticFieldLockedOnInstanceInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyDoubleCheckedLocking" displayName="Double-checked locking"
+                     groupName="Threading issues"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyDoubleCheckedLockingInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUnconditionalWait" displayName="Unconditional 'wait' call"
+                     groupName="Threading issues"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyUnconditionalWaitInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyPublicFieldAccessedInSynchronizedContext"
+                     displayName="Non-private field accessed in synchronized context" groupName="Threading issues" enabledByDefault="false"
+                     level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyPublicFieldAccessedInSynchronizedContextInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyBusyWait" displayName="Busy wait" groupName="Threading issues"
+                     enabledByDefault="false"
+                     level="WARNING" implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyBusyWaitInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyEmptySyncBlock" displayName="Empty 'synchronized' block"
+                     groupName="Threading issues"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyEmptySyncBlockInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovySynchronizationOnThis" displayName="Synchronization on 'this'"
+                     groupName="Threading issues"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovySynchronizationOnThisInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovySynchronizedMethod" displayName="Synchronized method"
+                     groupName="Threading issues"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovySynchronizedMethodInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyNestedSynchronizedStatement"
+                     displayName="Nested 'synchronized' statement"
+                     groupName="Threading issues" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyNestedSynchronizedStatementInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyThreadStopSuspendResume"
+                     displayName="Call to Thread.stop(), Thread.suspend(), or Thread.resume()"
+                     groupName="Threading issues" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyThreadStopSuspendResumeInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovySystemRunFinalizersOnExit"
+                     displayName="Call to System.runFinalizersOnExit()"
+                     groupName="Threading issues" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovySystemRunFinalizersOnExitInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyNotifyWhileNotSynchronized"
+                     displayName="'notify()' or 'notifyAll()' while not synced"
+                     groupName="Threading issues" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyNotifyWhileNotSynchronizedInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyWaitCallNotInLoop" displayName="'wait()' not in loop"
+                     groupName="Threading issues"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyWaitCallNotInLoopInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyWaitWhileNotSynchronized" displayName="'wait()' while not synced"
+                     groupName="Threading issues"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyWaitWhileNotSynchronizedInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovySynchronizationOnNonFinalField"
+                     displayName="Synchronization on non-final field"
+                     groupName="Threading issues" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovySynchronizationOnNonFinalFieldInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovySynchronizationOnVariableInitializedWithLiteral"
+                     displayName="Synchronization on variable initialized with literal" groupName="Threading issues"
+                     enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovySynchronizationOnVariableInitializedWithLiteralInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUnsynchronizedMethodOverridesSynchronizedMethod"
+                     displayName="Unsynchronized method overrides synchronized method" groupName="Threading issues" enabledByDefault="true"
+                     level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyUnsynchronizedMethodOverridesSynchronizedMethodInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyWhileLoopSpinsOnField" displayName="While loop spins on field"
+                     groupName="Threading issues"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyWhileLoopSpinsOnFieldInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyMethodParameterCount"
+                     displayName="Method with too many parameters" groupName="Method Metrics"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.metrics.GroovyMethodParameterCountInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyOverlyComplexMethod" displayName="Overly complex method"
+                     groupName="Method Metrics"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.metrics.GroovyOverlyComplexMethodInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyOverlyLongMethod" displayName="Overly long method"
+                     groupName="Method Metrics" enabledByDefault="false"
+                     level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.metrics.GroovyOverlyLongMethodInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyOverlyNestedMethod" displayName="Overly nested method"
+                     groupName="Method Metrics"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.metrics.GroovyOverlyNestedMethodInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyMethodWithMoreThanThreeNegations"
+                     displayName="Method with more than three negations"
+                     groupName="Method Metrics" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.metrics.GroovyMethodWithMoreThanThreeNegationsInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyMultipleReturnPointsPerMethod"
+                     displayName="Method with multiple return points"
+                     groupName="Method Metrics" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.metrics.GroovyMultipleReturnPointsPerMethodInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyNestedSwitch" displayName="Nested switch statement"
+                     groupName="Potentially confusing code constructs"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyNestedSwitchInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyConditional" displayName="Conditional expression"
+                     groupName="Potentially confusing code constructs"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyConditionalInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GrFieldAlreadyDefined"
+                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
+                     key="field.already.defined" groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GrFieldAlreadyDefinedInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="ClashingGetters"
+                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
+                     key="clashing.getters" groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.ClashingGettersInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GrPackage"
+                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
+                     key="gr.package" groupName="Potentially confusing code constructs" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GrPackageInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GrDeprecatedAPIUsage"
+                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
+                     key="gr.deprecated.api.usage" groupName="Potentially confusing code constructs" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GrDeprecatedAPIUsageInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyNestedConditional" displayName="Nested conditional expression"
+                     groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyNestedConditionalInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyNegatedConditional" displayName="Negated conditional expression"
+                     groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyNegatedConditionalInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyInArgumentCheck" displayName="Incompatible 'in' argument types"
+                     enabledByDefault="true" groupName="Probable bugs" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyInArgumentCheckInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyNegatedIf" displayName="Negated if condition expression"
+                     groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyNegatedIfInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyResultOfIncrementOrDecrementUsed"
+                     displayName="Result of increment or decrement used"
+                     groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyResultOfIncrementOrDecrementUsedInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" enabledByDefault="true" level="WARNING"
+                     shortName="GrReassignedInClosureLocalVar"
+                     displayName="Local variable is reassigned in closure or anonymous class"
+                     groupName="Potentially confusing code constructs"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GrReassignedInClosureLocalVarInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="UnnecessaryQualifiedReference"
+                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
+                     key="unnecessary.qualified.reference" groupName="Potentially confusing code constructs" enabledByDefault="true"
+                     level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.UnnecessaryQualifiedReferenceInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyEmptyStatementBody" displayName="Statement with empty body"
+                     groupName="Potentially confusing code constructs" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyEmptyStatementBodyInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyPointlessBoolean"
+                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
+                     key="pointless.boolean.display.name" groupName="Potentially confusing code constructs" enabledByDefault="true"
+                     level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyPointlessBooleanInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyPointlessArithmetic"
+                     displayName="Pointless arithmetic expression"
+                     groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyPointlessArithmeticInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyDoubleNegation" displayName="Double negation"
+                     groupName="Potentially confusing code constructs"
+                     enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyDoubleNegationInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyOverlyComplexArithmeticExpression"
+                     displayName="Overly complex arithmetic expression"
+                     groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyOverlyComplexArithmeticExpressionInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="ClashingTraitMethods"
+                     displayName="Clashing trait methods"
+                     groupName="Potentially confusing code constructs" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.ClashingTraitMethodsInspection"/>
+
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyOverlyComplexBooleanExpression"
+                     displayName="Overly complex boolean expression"
+                     groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyOverlyComplexBooleanExpressionInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyOctalInteger" displayName="Octal integer"
+                     groupName="Potentially confusing code constructs"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyOctalIntegerInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyDuplicateSwitchBranch" displayName="Duplicate switch case"
+                     groupName="Validity issues"
+                     enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.validity.GroovyDuplicateSwitchBranchInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyNonShortCircuitBoolean" displayName="Non short-circuit boolean"
+                     groupName="Probable bugs"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyNonShortCircuitBooleanInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyInfiniteLoopStatement" displayName="Infinite loop statement"
+                     groupName="Probable bugs"
+                     enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyInfiniteLoopStatementInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyInfiniteRecursion" displayName="Infinite recursion"
+                     groupName="Probable bugs" enabledByDefault="true"
+                     level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyInfiniteRecursionInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyDivideByZero" displayName="Divide by zero"
+                     groupName="Probable bugs" enabledByDefault="true"
+                     level="WARNING" implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyDivideByZeroInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyResultOfObjectAllocationIgnored"
+                     displayName="Result of object allocation ignored"
+                     groupName="Probable bugs" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyResultOfObjectAllocationIgnoredInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyAccessibility"
+                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
+                     key="access.to.inaccessible.element" groupName="Probable bugs" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyAccessibilityInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyConstructorNamedArguments"
+                     displayName="Named arguments of constructor call" groupName="Probable bugs"
+                     enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyConstructorNamedArgumentsInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyDocCheck" displayName="GroovyDoc issues"
+                     groupName="Probable bugs"
+                     enabledByDefault="true" level="ERROR"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyDocCheckInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyRangeTypeCheck"
+                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
+                     key="incorrect.range.argument" groupName="Probable bugs" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyRangeTypeCheckInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="NewInstanceOfSingleton"
+                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
+                     key="new.instance.of.singleton" groupName="Potentially confusing code constructs" enabledByDefault="true"
+                     level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.NewInstanceOfSingletonInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyLabeledStatement"
+                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
+                     key="check.labeled.statement" groupName="Probable bugs" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyLabeledStatementInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyClassNamingConvention" displayName="Class naming convention"
+                     groupName="Naming Conventions"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyClassNamingConventionInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyInterfaceNamingConvention"
+                     displayName="Interface naming convention" groupName="Naming Conventions"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyInterfaceNamingConventionInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyAnnotationNamingConvention"
+                     displayName="Annotation naming convention" groupName="Naming Conventions"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyAnnotationNamingConventionInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyEnumerationNamingConvention"
+                     displayName="Enumeration naming convention"
+                     groupName="Naming Conventions" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyEnumerationNamingConventionInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyLocalVariableNamingConvention"
+                     displayName="Local variable naming convention"
+                     groupName="Naming Conventions" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyLocalVariableNamingConventionInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyStaticMethodNamingConvention"
+                     displayName="Static method naming convention"
+                     groupName="Naming Conventions" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyStaticMethodNamingConventionInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyStaticVariableNamingConvention"
+                     displayName="Static variable naming convention"
+                     groupName="Naming Conventions" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyStaticVariableNamingConventionInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyInstanceMethodNamingConvention"
+                     displayName="Instance method naming convention"
+                     groupName="Naming Conventions" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyInstanceMethodNamingConventionInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyInstanceVariableNamingConvention"
+                     displayName="Instance variable naming convention"
+                     groupName="Naming Conventions" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyInstanceVariableNamingConventionInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyConstantNamingConvention"
+                     displayName="Constant naming convention" groupName="Naming Conventions"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyConstantNamingConventionInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyParameterNamingConvention"
+                     displayName="Method parameter naming convention"
+                     groupName="Naming Conventions" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyParameterNamingConventionInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyMapGetCanBeKeyedAccess"
+                     displayName="Call to Map.get can be keyed access"
+                     groupName="GPath inspections" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.gpath.GroovyMapGetCanBeKeyedAccessInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyMapPutCanBeKeyedAccess"
+                     displayName="Call to Map.put can be keyed access"
+                     groupName="GPath inspections" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.gpath.GroovyMapPutCanBeKeyedAccessInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyListGetCanBeKeyedAccess"
+                     displayName="Call to List.get can be keyed access"
+                     groupName="GPath inspections" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.gpath.GroovyListGetCanBeKeyedAccessInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyListSetCanBeKeyedAccess"
+                     displayName="Call to List.set can be keyed access"
+                     groupName="GPath inspections" enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.gpath.GroovyListSetCanBeKeyedAccessInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUntypedAccess" displayName="Access to untyped expression"
+                     groupName="Probable bugs"
+                     enabledByDefault="false" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.untypedUnresolvedAccess.GroovyUntypedAccessInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GrUnresolvedAccess" displayName="Access to unresolved expression"
+                     groupName="Probable bugs"
+                     enabledByDefault="true" level="WEAK WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.untypedUnresolvedAccess.GrUnresolvedAccessInspection"/>
+    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovySingletonAnnotation"
+                     displayName="Check '@Singleton' annotation conventions"
+                     groupName="Annotations verifying" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.annotator.inspections.GroovySingletonAnnotationInspection"/>
+
+    <localInspection language="Groovy" groupPath="Groovy" shortName="DelegatesTo" displayName="@DelegatesTo inspection"
+                     groupName="Annotations verifying" enabledByDefault="true" level="WARNING"
+                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.DelegatesToInspection"/>
+
+    <implicitUsageProvider implementation="org.jetbrains.plugins.groovy.gpp.GppImplicitUsageProvider"/>
+    <implicitUsageProvider implementation="org.jetbrains.plugins.groovy.findUsages.GrImplicitUsageProvider"/>
+
+    <!-- control flow -->
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.control.flow</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.control.DemorgansLawIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.control.flow</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.control.SplitIfIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.control.flow</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.control.InvertIfIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.control.flow</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.control.GrRedundantElseIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.control.flow</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.control.FlipIfIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.control.flow</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.control.ReplaceTernaryWithIfElseIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.control.flow</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.control.ReplaceIfWithTernaryIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.control.flow</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.control.SimplifyTernaryOperatorIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.control.flow</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.control.CreateParameterForFieldIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.control.flow</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.control.MergeIfAndIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.control.flow</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.control.ExpandBooleanIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.control.flow</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.control.FlipConjunctionIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.control.flow</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.control.FlipComparisonIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.control.flow</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.control.NegateComparisonIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.control.flow</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.control.MergeElseIfIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.control.flow</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.control.SplitElseIfIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.control.flow</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.control.FlipConditionalIntention</className>
+    </intentionAction>
+
+    <!-- closures -->
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.closures</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.closure.MakeClosureCallExplicitIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.closures</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.closure.MakeClosureCallImplicitIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.closures</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.closure.ForToEachIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.closures</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.closure.EachToForIntention</className>
+    </intentionAction>
+    <!--
+    todo make this work
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.closures</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.closure.ConvertClosureArgToItIntention</className>
+    </intentionAction>
+    -->
+
+
+    <!-- comments -->
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.comments</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.comments.ChangeToCStyleCommentIntention</className>
+    </intentionAction>
+    <!--
+    todo make this work
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.comments</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.comments.ChangeToEndOfLineCommentIntention</className>
+    </intentionAction>
+    -->
+
+    <!-- conversions -->
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertJavaStyleArrayIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertIntegerToDecimalIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertIntegerToHexIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertIntegerToOctalIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertIntegerToBinaryIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.IndexingMethodConversionIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.IndexedExpressionConversionIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.ConvertGStringToStringIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.ConvertMultilineStringToSingleLineIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.ConvertToRegexIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.ConvertToDollarSlashRegexIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.GrConvertStringToCharIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.RemoveUnnecessaryEscapeCharactersIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.GrBreakStringOnLineBreaksIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.GrSplitDeclarationIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.RemoveParenthesesFromMethodCallIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.RemoveUnnecessaryBracesInGStringIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertMapToClassIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.ConvertConcatenationToGstringIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.RenameFileWithClassIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.MoveClassToNewFileIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertMethodToClosureIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.ConvertStringToMultilineIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertClosureToMethodIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertSimpleGetterToPropertyIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.GrConvertTypeCastToSafeCastIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.conversions</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertJunitAssertionToAssertStatementIntention</className>
+    </intentionAction>
+
+    <!-- groovy style -->
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.style</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.style.JavaStylePropertiesInvocationIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.style</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.style.RemoveUnnecessarySemicolonsIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.style</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.style.ImportStaticIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.style</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.style.ImportOnDemandIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.style</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.style.ConvertToGeeseBracesIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.style</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.style.RemoveRedundantClassPropertyIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.style</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.style.ConvertFromGeeseBracesIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.style</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.style.RemoveUnnecessaryReturnIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.style</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.style.AddReturnTypeFix</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.style</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.style.parameterToEntry.ConvertParameterToMapEntryIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.style</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.style.ReplaceAbstractClassInstanceByMapIntention</className>
+    </intentionAction>
+
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy</categoryKey>
+      <className>org.jetbrains.plugins.groovy.grape.GrabDependencies</className>
+    </intentionAction>
+
+    <!--declaration-->
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.declaration</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.declaration.GrCreateSubclassAction</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.declaration</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.declaration.GrCreateFieldForParameterIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.declaration</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.declaration.GrSetStrongTypeIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.declaration</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.declaration.GrMakeMemberPublicIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.declaration</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.declaration.GrMakeMemberProtectedIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.declaration</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.declaration.GrMakeMemberPrivateIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.declaration</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.declaration.GrIntroduceLocalVariableIntention</className>
+    </intentionAction>
+
+    <!--other-->
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.other</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.other.GrCreateMissingSwitchBranchesIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.other</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.other.GrAliasImportIntention</className>
+    </intentionAction>
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.other</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.other.GrCopyStringConcatenationContentIntention</className>
+    </intentionAction>
+
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.other</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.other.GrSortMapKeysIntention</className>
+    </intentionAction>
+
+    <intentionAction>
+      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
+      <categoryKey>intention.category.groovy.declaration</categoryKey>
+      <className>org.jetbrains.plugins.groovy.intentions.declaration.GrRemoveExplicitTypeDeclarationIntention</className>
+    </intentionAction>
+
+    <projectService
+                    serviceImplementation="org.jetbrains.plugins.groovy.annotator.intentions.dynamic.DynamicToolWindowWrapper"/>
+
+    <projectService serviceInterface="org.jetbrains.plugins.groovy.griffon.GriffonProjectViewState"
+                    serviceImplementation="org.jetbrains.plugins.groovy.griffon.GriffonProjectViewState"/>
+
+    <java.programPatcher implementation="org.jetbrains.plugins.groovy.debugger.GroovyHotSwapper"/>
+    <psi.referenceContributor implementation="org.jetbrains.plugins.groovy.gpp.GppReferenceContributor"/>
+
+    <library.presentationProvider implementation="org.jetbrains.plugins.groovy.griffon.GriffonLibraryPresentationProvider"/>
+    <moduleBuilder builderClass="org.jetbrains.plugins.groovy.griffon.GriffonModuleBuilder" id="griffonModuleBuilder"/>
+    <projectStructureDetector implementation="org.jetbrains.plugins.groovy.griffon.GriffonProjectStructureDetector" order="before groovyDetector"/>
+    <programRunner implementation="org.jetbrains.plugins.groovy.griffon.GriffonDebuggerRunner"/>
+    <configurationType implementation="org.jetbrains.plugins.groovy.griffon.GriffonRunConfigurationType"/>
+    <toolWindow id="Griffon View" anchor="left" secondary="false" icon="JetgroovyIcons.Griffon.GriffonToolWindow"
+                factoryClass="org.jetbrains.plugins.groovy.griffon.GriffonToolWindowFactory"
+                conditionClass="org.jetbrains.plugins.groovy.griffon.GriffonToolWindowFactory"/>
+
+    <roots.watchedRootsProvider implementation="org.jetbrains.plugins.groovy.mvc.MvcWatchedRootProvider"/>
+    <projectService serviceInterface="org.jetbrains.plugins.groovy.mvc.MvcConsole"
+                    serviceImplementation="org.jetbrains.plugins.groovy.mvc.MvcConsole"/>
+    <selectInTarget implementation="org.jetbrains.plugins.groovy.mvc.projectView.MvcProjectViewSelectInTarget"/>
+    <applicationService serviceImplementation="org.jetbrains.plugins.groovy.mvc.MvcRunTargetHistoryService"
+                        serviceInterface="org.jetbrains.plugins.groovy.mvc.MvcRunTargetHistoryService"/>
+    <applicationService serviceInterface="org.jetbrains.plugins.groovy.codeInspection.GroovyQuickFixFactory"
+                        serviceImplementation="org.jetbrains.plugins.groovy.codeInspection.GroovyQuickFixFactoryImpl"/>
+
+    <debugger.positionManagerFactory id="groovyPositionManager"
+                                     implementation="org.jetbrains.plugins.groovy.debugger.GroovyPositionManagerFactory"/>
+    <debugger.positionManagerFactory order="after groovyPositionManager"
+                                     implementation="org.jetbrains.plugins.groovy.springloaded.SpringLoadedPositionManagerFactory"/>
+    <debugger.nodeRenderer implementation="org.jetbrains.plugins.groovy.debugger.GroovyRefRenderer"/>
+    <codeStyle.ReferenceAdjuster language="Groovy" implementationClass="org.jetbrains.plugins.groovy.codeStyle.GrReferenceAdjuster"/>
+    <codeInsight.unresolvedReferenceQuickFixProvider implementation="org.jetbrains.plugins.groovy.jarFinder.GroovyFindJarQuickFixProvider"/>
+    <lang.refactoringSupport.classMembersRefactoringSupport language="Groovy"
+                                                            implementationClass="org.jetbrains.plugins.groovy.refactoring.classMembers.GroovyClassMembersRefactoringSupport"/>
+    <refactoring.pullUpHelperFactory language="Groovy"
+                                     implementationClass="org.jetbrains.plugins.groovy.refactoring.memberPullUp.GrPullUpHelperFactory"/>
+    <classTypePointerFactory implementation="org.jetbrains.plugins.groovy.lang.psi.impl.smartPointers.GrClassReferenceTypePointerFactory"/>
+    <hierarchy.referenceProcessor implementation="org.jetbrains.plugins.groovy.hierarchy.call.GrCallReferenceProcessor"/>
+  </extensions>
+
+  <extensions defaultExtensionNs="com.intellij.debugger">
+    <codeFragmentFactory implementation="org.jetbrains.plugins.groovy.debugger.GroovyCodeFragmentFactory"/>
+  </extensions>
+
+  <extensions defaultExtensionNs="ByteCodeViewer">
+    <classSearcher implementation="org.jetbrains.plugins.groovy.byteCodeViewer.GroovyScriptClassSearcher"/>
+  </extensions>
+
+  <actions>
+    <action id="Groovy.Shell.Execute" class="com.intellij.openapi.actionSystem.EmptyAction" text="Execute Groovy Code"
+            description="Execute Groovy code in console">
+      <keyboard-shortcut first-keystroke="control ENTER" keymap="$default"/>
+    </action>
+
+    <action id="Groovy.NewClass" class="org.jetbrains.plugins.groovy.actions.NewGroovyClassAction"
+            text="Groovy Class" description="Create new Groovy class">
+      <add-to-group group-id="NewGroup" anchor="after" relative-to-action="NewGroup1"/>
+    </action>
+    <action id="Groovy.NewScript" class="org.jetbrains.plugins.groovy.actions.NewScriptAction"
+            text="Groovy Script" description="Create new Groovy script">
+      <add-to-group group-id="NewGroup" anchor="last"/>
+    </action>
+
+    <action id="Gant.NewScript" class="org.jetbrains.plugins.groovy.gant.NewGantScriptAction"
+            text="Gant Script" description="Create new Gant script">
+      <add-to-group group-id="NewGroup" anchor="last"/>
+    </action>
+
+    <group id="Groovy.Dynamic.Toolbar">
+      <action id="Groovy.Dynamic.Remove" class="org.jetbrains.plugins.groovy.annotator.intentions.dynamic.RemoveDynamicAction"
+              icon="AllIcons.General.Remove" text="Remove" description="Remove dynamic element"/>
+      <separator/>
+      <action id="Groovy.Dynamic.ExpandAll" class="org.jetbrains.plugins.groovy.annotator.intentions.dynamic.ExpandAllAction"
+              icon="AllIcons.Actions.Expandall" text="Expand all" description="Collapse all"/>
+      <action id="Groovy.Dynamic.CollapseAll" class="org.jetbrains.plugins.groovy.annotator.intentions.dynamic.CollapseAllAction"
+              icon="AllIcons.Actions.Collapseall" text="Collapse all" description="Collapse all"/>
+    </group>
+
+
+    <action id="ConvertGroovyToJava"
+            class="org.jetbrains.plugins.groovy.actions.ConvertToJavaAction"
+            text="Convert to Java"
+            description="Convert Groovy files to Java">
+      <add-to-group group-id="RefactoringMenu"/>
+    </action>
+
+    <group id="Internal.Groovy" text="Groovy" popup="true" internal="true">
+      <action id="GetPsiTypeAction" class="org.jetbrains.plugins.groovy.actions.GrGetPsiTypeAction"
+              text="get PsiType" description=""
+              internal="true"/>
+
+      <action id="DumpGroovyControlFlowAction"
+              class="org.jetbrains.plugins.groovy.actions.DumpGroovyControlFlowAction"
+              text="dump groovy control flow"
+              description="" internal="true"/>
+      <action id="DumpGroovyStubsAction"
+              class="org.jetbrains.plugins.groovy.actions.DumpGroovyStubsAction"
+              text="dump groovy stubs"
+              description="" internal="true"/>
+      <add-to-group group-id="Internal"/>
+    </group>
+
+    <action id="ExcludeFromStubGeneration"
+            class="org.jetbrains.plugins.groovy.compiler.ExcludeFromStubGenerationAction"
+            text="Exclude from stub generation" description="Don't generate Java stubs for this Groovy file on compilation">
+      <add-to-group group-id="EditorTabPopupMenu" anchor="after" relative-to-action="RenameJavaFileToGroovyFileAction"/>
+    </action>
+
+
+    <group id="GroovyGenerateGroup1">
+      <action id="org.jetbrains.plugins.groovy.actions.generate.constructors.GroovyGenerateConstructorAction"
+              class="org.jetbrains.plugins.groovy.actions.generate.constructors.GroovyGenerateConstructorAction"
+              text="Constructor" description="Generates constructor"/>
+      <action id="org.jetbrains.plugins.groovy.actions.generate.accessors.GroovyGenerateGetterAction"
+              class="org.jetbrains.plugins.groovy.actions.generate.accessors.GroovyGenerateGetterAction"
+              text="Getter" description="Generates getter"/>
+      <action id="org.jetbrains.plugins.groovy.actions.generate.accessors.GroovyGenerateSetterAction"
+              class="org.jetbrains.plugins.groovy.actions.generate.accessors.GroovyGenerateSetterAction"
+              text="Setter" description="Generates setter"/>
+      <action id="org.jetbrains.plugins.groovy.actions.generate.accessors.GroovyGenerateGetterSetterAction"
+              class="org.jetbrains.plugins.groovy.actions.generate.accessors.GroovyGenerateGetterSetterAction"
+              text="Getter and Setter" description="Generates getter"/>
+      <action id="org.jetbrains.plugins.groovy.actions.generate.equals.GroovyGenerateEqualsAction"
+              class="org.jetbrains.plugins.groovy.actions.generate.equals.GroovyGenerateEqualsAction"
+              text="equals() and hashCode()" description="Action generates equals and hashCode now"/>
+      <action id="org.jetbrains.plugins.groovy.actions.generate.missing.GroovyGenerateMethodMissingAction"
+              class="org.jetbrains.plugins.groovy.actions.generate.missing.GroovyGenerateMethodMissingAction"
+              text="methodMissing()" description="Action generates propertyMissing()"/>
+      <action id="org.jetbrains.plugins.groovy.actions.generate.missing.GroovyGeneratePropertyMissingAction"
+              class="org.jetbrains.plugins.groovy.actions.generate.missing.GroovyGeneratePropertyMissingAction"
+              text="propertyMissing()" description="Action generates propertyMissing()"/>
+
+      <add-to-group group-id="GenerateGroup" anchor="after" relative-to-action="JavaGenerateGroup1"/>
+    </group>
+
+    <action id="Groovy.Doc.Generating"
+            class="org.jetbrains.plugins.groovy.doc.actions.GenerateGroovyDocAction"
+            text="Generate GroovyDoc..." description="Generating Groovy Documentation"
+            icon="JetgroovyIcons.Groovy.GroovyDoc">
+      <add-to-group group-id="ToolsMenu" anchor="last"/>
+    </action>
+    <action id="Groovy.Shell"
+            class="org.jetbrains.plugins.groovy.console.GroovyShellAction"
+            text="Groovy Shell..." description="Launch Groovy Shell"
+            icon="JetgroovyIcons.Groovy.Groovy_16x16">
+      <add-to-group group-id="ToolsMenu" anchor="last"/>
+    </action>
+
+    <action id="Groovy.Console"
+            class="org.jetbrains.plugins.groovy.console.GroovyConsoleAction"
+            text="Groovy Console..." description="Launch Groovy Console"
+            icon="JetgroovyIcons.Groovy.Groovy_16x16">
+      <add-to-group group-id="ToolsMenu" anchor="last"/>
+    </action>
+
+    <group id="Mvc.Actions" popup="true" class="org.jetbrains.plugins.groovy.mvc.MvcActionGroup">
+      <action id="Mvc.Upgrade"
+              class="org.jetbrains.plugins.groovy.mvc.MvcUpgradeAction"
+              text="Change SDK version" description="Change Grails/Griffon SDK version">
+      </action>
+
+      <action id="Griffon.UpdateDependencies" class="org.jetbrains.plugins.groovy.griffon.UpdateGriffonSettingsAction"
+              text="Synchronize Griffon settings"
+              description="Refresh IntelliJ IDEA project structure so that it matches Griffon build settings">
+      </action>
+
+      <action id="Mvc.RunTarget" class="org.jetbrains.plugins.groovy.mvc.MvcRunTarget"
+              text="Run Target" description="Run arbitrary Grails/Griffon target">
+        <keyboard-shortcut keymap="$default" first-keystroke="ctrl alt G"/>
+      </action>
+      <add-to-group group-id="ProjectViewPopupMenu" anchor="after" relative-to-action="AddFrameworkSupport"/>
+      <add-to-group group-id="NavbarPopupMenu" anchor="after" relative-to-action="AddFrameworkSupport"/>
+      <add-to-group group-id="ToolsMenu" anchor="last"/>
+    </group>
+
+  </actions>
+
+  <application-components>
+    <component>
+      <implementation-class>org.jetbrains.plugins.groovy.gant.GantLoader</implementation-class>
+    </component>
+    <component>
+      <implementation-class>org.jetbrains.plugins.groovy.mvc.MvcPathMacros</implementation-class>
+    </component>
+    <component>
+      <implementation-class>org.jetbrains.plugins.groovy.dsl.DslActivationStatus</implementation-class>
+    </component>
+  </application-components>
+
+  <project-components>
+    <component>
+      <implementation-class>org.jetbrains.plugins.groovy.compiler.GroovyCompilerLoader</implementation-class>
+    </component>
+    <component>
+      <implementation-class>org.jetbrains.plugins.groovy.codeInspection.local.GroovyUnusedImportsPassFactory</implementation-class>
+    </component>
+    <component>
+      <implementation-class>org.jetbrains.plugins.groovy.annotator.GrKeywordAndDeclarationHighlightFactory</implementation-class>
+    </component>
+    <component>
+      <implementation-class>org.jetbrains.plugins.groovy.annotator.GrReferenceHighlighterFactory</implementation-class>
+    </component>
+    <component>
+      <interface-class>org.jetbrains.plugins.groovy.annotator.intentions.dynamic.DynamicManager</interface-class>
+      <implementation-class>org.jetbrains.plugins.groovy.annotator.intentions.dynamic.DynamicManagerImpl</implementation-class>
+    </component>
+    <component>
+      <implementation-class>org.jetbrains.plugins.groovy.mvc.MvcModuleStructureSynchronizer</implementation-class>
+    </component>
+  </project-components>
+
+
+</idea-plugin>
diff --git a/plugins/groovy/groovy-psi/src/META-INF/plugin.xml b/plugins/groovy/groovy-psi/src/META-INF/plugin.xml
deleted file mode 100644
index 715cbb3..0000000
--- a/plugins/groovy/groovy-psi/src/META-INF/plugin.xml
+++ /dev/null
@@ -1,1676 +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.
-  ~
-  -->
-
-<idea-plugin>
-  <id>org.intellij.groovy</id>
-  <name>Groovy</name>
-  <description>Plugin for Groovy language support, including Groovy++, Grape, Gant and Griffon</description>
-  <version>9.0</version>
-  <vendor>JetBrains</vendor>
-  <depends>com.intellij.properties</depends>
-
-  <depends optional="true" config-file="groovy-copyright.xml">com.intellij.copyright</depends>
-  <depends optional="true" config-file="intellilang-groovy-support.xml">org.intellij.intelliLang</depends>
-  <depends optional="true">AntSupport</depends>
-  <depends optional="true">cucumber</depends>
-  <depends optional="true">ByteCodeViewer</depends>
-
-  <extensionPoints>
-    <extensionPoint name="methodComparator" interface="org.jetbrains.plugins.groovy.lang.resolve.GrMethodComparator"/>
-    <extensionPoint name="membersContributor" interface="org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor"/>
-    <extensionPoint name="defaultImportContributor" interface="org.jetbrains.plugins.groovy.lang.resolve.DefaultImportContributor"/>
-    <extensionPoint name="astTransformContributor" interface="org.jetbrains.plugins.groovy.lang.resolve.ast.AstTransformContributor"/>
-    <extensionPoint name="closureMissingMethodContributor"
-                    interface="org.jetbrains.plugins.groovy.lang.resolve.ClosureMissingMethodContributor"/>
-    <extensionPoint name="variableEnhancer" interface="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrVariableEnhancer"/>
-    <extensionPoint name="referenceTypeEnhancer" interface="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrReferenceTypeEnhancer"/>
-    <extensionPoint name="typeConverter" interface="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrTypeConverter"/>
-    <extensionPoint name="expectedTypesContributor"
-                    interface="org.jetbrains.plugins.groovy.lang.psi.expectedTypes.GroovyExpectedTypesContributor"/>
-
-    <extensionPoint name="positionManagerDelegate"
-                    interface="org.jetbrains.plugins.groovy.extensions.debugger.ScriptPositionManagerHelper"/>
-    <extensionPoint name="compilerExtension" interface="org.jetbrains.plugins.groovy.compiler.GroovyCompilerExtension"/>
-    <extensionPoint name="scriptTypeDetector" interface="org.jetbrains.plugins.groovy.extensions.GroovyScriptTypeDetector"/>
-
-    <extensionPoint name="namedArgumentProvider" interface="org.jetbrains.plugins.groovy.extensions.GroovyNamedArgumentProvider"/>
-    <extensionPoint name="mapContentProvider" interface="org.jetbrains.plugins.groovy.extensions.GroovyMapContentProvider"/>
-
-    <extensionPoint name="unresolvedHighlightFilter" interface="org.jetbrains.plugins.groovy.extensions.GroovyUnresolvedHighlightFilter"/>
-    <extensionPoint name="unresolvedHighlightFileFilter"
-                    interface="org.jetbrains.plugins.groovy.extensions.GroovyUnresolvedHighlightFileFilter"/>
-    <extensionPoint name="configSlurperSupport" interface="org.jetbrains.plugins.groovy.configSlurper.ConfigSlurperSupport"/>
-
-    <extensionPoint name="callExpressionTypeCalculator"
-                    interface="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrCallExpressionTypeCalculator"/>
-    <extensionPoint name="classDescriptor" beanClass="org.jetbrains.plugins.groovy.extensions.GroovyClassDescriptor"/>
-    <extensionPoint name="methodDescriptor" beanClass="org.jetbrains.plugins.groovy.extensions.GroovyMethodDescriptorExtension"/>
-
-    <extensionPoint name="groovyShellRunner" interface="org.jetbrains.plugins.groovy.console.GroovyShellRunner"/>
-
-    <!-- Groovy DSL extension points -->
-    <extensionPoint name="psiEnhancerCategory" interface="org.jetbrains.plugins.groovy.dsl.psi.PsiEnhancerCategory"/>
-    <extensionPoint name="gdslTopLevelProvider" interface="org.jetbrains.plugins.groovy.dsl.dsltop.GdslMembersProvider"/>
-
-    <extensionPoint name="groovyFrameworkConfigNotification"
-                    interface="org.jetbrains.plugins.groovy.annotator.GroovyFrameworkConfigNotification"/>
-    <extensionPoint name="groovySourceFolderDetector" interface="org.jetbrains.plugins.groovy.actions.GroovySourceFolderDetector"/>
-
-    <extensionPoint name="mvc.framework" interface="org.jetbrains.plugins.groovy.mvc.MvcFramework"/>
-
-    <extensionPoint name="closureCompleter" interface="org.jetbrains.plugins.groovy.lang.completion.ClosureCompleter"/>
-
-    <extensionPoint name="methodMayBeStaticInspectionFilter" interface="org.jetbrains.plugins.groovy.codeInspection.declaration.GrMethodMayBeStaticInspectionFilter"/>
-
-    <extensionPoint name="customAnnotationChecker" interface="org.jetbrains.plugins.groovy.annotator.checkers.CustomAnnotationChecker"/>
-
-    <extensionPoint name="convertToJava.customMethodInvocator" interface="org.jetbrains.plugins.groovy.refactoring.convertToJava.invocators.CustomMethodInvocator"/>
-
-    <extensionPoint name="signatureHintProcessor" interface="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.SignatureHintProcessor"/>
-  </extensionPoints>
-
-  <extensions defaultExtensionNs="org.intellij.groovy">
-
-    <groovyFrameworkConfigNotification order="last"
-                                       implementation="org.jetbrains.plugins.groovy.config.DefaultGroovyFrameworkConfigNotification"/>
-
-    <membersContributor implementation="org.jetbrains.plugins.groovy.annotator.intentions.dynamic.DynamicMembersContributor"/>
-    <membersContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.noncode.GrCollectionTypeMembersProvider"/>
-    <membersContributor implementation="org.jetbrains.plugins.groovy.spock.SpockMemberContributor"/>
-    <membersContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.noncode.MixinMemberContributor"/>
-    <membersContributor implementation="org.jetbrains.plugins.groovy.swingBuilder.SwingBuilderNonCodeMemberContributor"/>
-    <membersContributor implementation="org.jetbrains.plugins.groovy.dgm.DGMMemberContributor"/>
-
-    <membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebSpockTestMemberContributor"/>
-    <membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebPageMemberContributor"/>
-    <membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebModuleMemberContributor"/>
-
-    <membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebJUnitTestMemberContributor"/>
-    <membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebTestNGTestMemberContributor"/>
-    <membersContributor implementation="org.jetbrains.plugins.groovy.geb.GebBrowserMemberContributor"/>
-
-    <membersContributor implementation="org.jetbrains.plugins.groovy.gant.GantMemberContributor"/>
-
-    <membersContributor implementation="org.jetbrains.plugins.groovy.markup.XmlMarkupBuilderNonCodeMemberContributor"/>
-
-    <closureMissingMethodContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.PluginXmlClosureMemberContributor"/>
-
-    <astTransformContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.ast.DelegatedMethodsContributor"/>
-    <astTransformContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.ast.AutoExternalizeContributor"/>
-    <astTransformContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.ast.AutoCloneContributor"/>
-    <astTransformContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.ast.ConstructorAnnotationsProcessor"/>
-    <astTransformContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.ast.GrInheritConstructorContributor"/>
-    <astTransformContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.ast.LoggingContributor"/>
-
-    <positionManagerDelegate implementation="org.jetbrains.plugins.groovy.gant.GantPositionManagerHelper"/>
-
-    <methodDescriptor lightMethodKey="SwingBuilder_builder_method"
-                      namedArgsProvider="org.jetbrains.plugins.groovy.swingBuilder.SwingBuilderNamedArgumentProvider"/>
-
-    <mapContentProvider implementation="org.jetbrains.plugins.groovy.configSlurper.ConfigSlurperMapContentProvider"/>
-    <referenceTypeEnhancer implementation="org.jetbrains.plugins.groovy.configSlurper.GroovyMapValueTypeEnhancer"/>
-
-    <unresolvedHighlightFilter implementation="org.jetbrains.plugins.groovy.extensions.GroovyUnresolvedReferenceFilterByFile"/>
-
-    <callExpressionTypeCalculator
-        implementation="org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.path.DefaultCallExpressionTypeCalculator"
-        order="last"/>
-    <callExpressionTypeCalculator
-        implementation="org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.path.GrDescriptorReturnTypeCalculator"/>
-    <callExpressionTypeCalculator
-        implementation="org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.path.GrDGMTypeCalculator"/>
-
-    <scriptTypeDetector implementation="org.jetbrains.plugins.groovy.gant.GantScriptTypeDetector"/>
-
-    <namedArgumentProvider implementation="org.jetbrains.plugins.groovy.lang.GroovySourceCodeNamedArgumentProvider" order="last"/>
-    <namedArgumentProvider implementation="org.jetbrains.plugins.groovy.lang.GroovyConstructorNamedArgumentProvider"/>
-    <namedArgumentProvider implementation="org.jetbrains.plugins.groovy.lang.GroovyMethodReturnNamedArgumentProvider" order="last"/>
-
-
-
-    <!-- GroovyDSL extensions -->
-    <gdslTopLevelProvider implementation="org.jetbrains.plugins.groovy.dsl.dsltop.GroovyDslDefaultMembers"/>
-    <gdslTopLevelProvider implementation="org.jetbrains.plugins.groovy.lang.resolve.GdkMethodDslProvider"/>
-    <psiEnhancerCategory implementation="org.jetbrains.plugins.groovy.dsl.psi.PsiClassCategory"/>
-    <psiEnhancerCategory implementation="org.jetbrains.plugins.groovy.dsl.psi.PsiElementCategory"/>
-    <psiEnhancerCategory implementation="org.jetbrains.plugins.groovy.dsl.psi.PsiMethodCategory"/>
-    <psiEnhancerCategory implementation="org.jetbrains.plugins.groovy.dsl.psi.PsiExpressionCategory"/>
-
-    <variableEnhancer implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ClosureParameterEnhancer"/>
-    <variableEnhancer implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ClosureAsAnonymousParameterEnhancer"/>
-    <variableEnhancer implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ClosureParamsEnhancer"/>
-
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.FromStringHintProcessor"/>
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.SimpleTypeHintProcessor"/>
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.MapEntryOrKeyValueHintProcessor"/>
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.FromAbstractTypeMethodsHintProcessor"/>
-
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.FirstParamHintProcessor"/>
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.FirstParamHintProcessor$FirstGeneric"/>
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.FirstParamHintProcessor$SecondGeneric"/>
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.FirstParamHintProcessor$ThirdGeneric"/>
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.FirstParamHintProcessor$Component"/>
-
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.SecondParamHintProcessor"/>
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.SecondParamHintProcessor$FirstGeneric"/>
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.SecondParamHintProcessor$SecondGeneric"/>
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.SecondParamHintProcessor$ThirdGeneric"/>
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.SecondParamHintProcessor$Component"/>
-
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ThirdParamHintProcessor"/>
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ThirdParamHintProcessor$FirstGeneric"/>
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ThirdParamHintProcessor$SecondGeneric"/>
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ThirdParamHintProcessor$ThirdGeneric"/>
-    <signatureHintProcessor implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ThirdParamHintProcessor$Component"/>
-
-    <typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrContainerTypeConverter"/>
-    <typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrStringTypeConverter"/>
-    <typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrBooleanTypeConverter"/>
-    <typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrGenericTypeConverter"/>
-    <typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.ClosureToSamConverter"/>
-    <typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrStringConverter"/>
-    <typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrContainerConverter"/>
-    <typeConverter implementation="org.jetbrains.plugins.groovy.gpp.GppTypeConverter"/>
-    <typeConverter implementation="org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrNumberConverter"/>
-
-    <expectedTypesContributor implementation="org.jetbrains.plugins.groovy.gpp.GppExpectedTypesContributor"/>
-    <variableEnhancer implementation="org.jetbrains.plugins.groovy.gpp.GppClosureParameterTypeProvider"/>
-
-    <mvc.framework implementation="org.jetbrains.plugins.groovy.griffon.GriffonFramework"/>
-    <groovyFrameworkConfigNotification implementation="org.jetbrains.plugins.groovy.griffon.GriffonConfigureNotification"/>
-    <defaultImportContributor implementation="org.jetbrains.plugins.groovy.griffon.GriffonDefaultImportContributor"/>
-
-    <groovyShellRunner implementation="org.jetbrains.plugins.groovy.console.GroovyConsoleRunner" order="last"/>
-
-    <closureCompleter implementation="org.jetbrains.plugins.groovy.lang.completion.GdslClosureCompleter"/>
-    <closureCompleter implementation="org.jetbrains.plugins.groovy.lang.completion.EachWithIndexClosureCompleter"/>
-
-    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.annotator.checkers.FieldAnnotationChecker"/>
-    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.annotator.checkers.NewifyAnnotationChecker"/>
-    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.annotator.checkers.GrabAnnotationChecker"/>
-    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.annotator.checkers.GrAliasAnnotationChecker"/>
-    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.annotator.checkers.AnnotationCollectorChecker" order="first"/>
-    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.annotator.checkers.DelegatesToAnnotationChecker"/>
-    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.griffon.GriffonPropertyListenerAnnotationChecker"/>
-    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.annotator.checkers.BaseScriptAnnotationChecker"/>
-
-    <convertToJava.customMethodInvocator implementation="org.jetbrains.plugins.groovy.refactoring.convertToJava.invocators.MapGetterSetterInvocator"/>
-    <customAnnotationChecker implementation="org.jetbrains.plugins.groovy.annotator.checkers.TypeCheckedAnnotationChecker"/>
-  </extensions>
-
-  <extensions defaultExtensionNs="com.intellij.properties">
-    <implicitPropertyUsageProvider implementation="org.jetbrains.plugins.groovy.dgm.DGMImplicitPropertyUsageProvider"/>
-  </extensions>
-
-  <extensions defaultExtensionNs="com.intellij">
-    <navbar implementation="org.jetbrains.plugins.groovy.navbar.GrNavBarModelExtension" order="after defaultNavbar"/>
-
-    <fileTypeDetector implementation="org.jetbrains.plugins.groovy.GroovyHashBangFileTypeDetector"/>
-
-
-    <declarationRangeHandler key="org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod"
-                             implementationClass="org.jetbrains.plugins.groovy.codeInsight.hint.GrMethodDeclarationRangeHandler"/>
-    <declarationRangeHandler key="org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition"
-                             implementationClass="org.jetbrains.plugins.groovy.codeInsight.hint.GrTypeDefinitionRangeHandler"/>
-    <declarationRangeHandler key="org.jetbrains.plugins.groovy.lang.psi.api.statements.GrClassInitializer"
-                             implementationClass="org.jetbrains.plugins.groovy.codeInsight.hint.GrClassInitializerDeclarationRangeHandler"/>
-
-
-    <psi.clsCustomNavigationPolicy implementation="org.jetbrains.plugins.groovy.codeInsight.GroovyClsCustomNavigationPolicy"/>
-
-    <moduleBuilder builderClass="org.jetbrains.plugins.groovy.config.GroovyAwareModuleBuilder"/>
-
-    <pom.declarationSearcher implementation="org.jetbrains.plugins.groovy.geb.GebContentDeclarationSearcher"/>
-
-    <itemPresentationProvider forClass="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl"
-                              implementationClass="org.jetbrains.plugins.groovy.findUsages.GrFileItemPresentationProvider"/>
-
-    <testFramework implementation="org.jetbrains.plugins.groovy.testIntegration.GroovyTestFramework" order="first"/>
-    <testFramework implementation="org.jetbrains.plugins.groovy.spock.SpockTestFramework" order="first"/>
-
-    <testCreator language="Groovy" implementationClass="com.intellij.testIntegration.JavaTestCreator"/>
-    <testGenerator language="Groovy" implementationClass="org.jetbrains.plugins.groovy.testIntegration.GroovyTestGenerator"/>
-    <constructorBodyGenerator language="Groovy"
-                              implementationClass="org.jetbrains.plugins.groovy.annotator.intentions.dynamic.GrConstructorBodyGenerator"/>
-    <editorNotificationProvider implementation="org.jetbrains.plugins.groovy.config.ConfigureGroovyLibraryNotificationProvider"/>
-    <refactoring.introduceParameterMethodUsagesProcessor
-        implementation="org.jetbrains.plugins.groovy.refactoring.introduce.parameter.java2groovy.GroovyIntroduceParameterMethodUsagesProcessor"/>
-    <refactoring.changeSignatureUsageProcessor
-        implementation="org.jetbrains.plugins.groovy.refactoring.changeSignature.GrChangeSignatureUsageProcessor" id="groovyProcessor"
-        order="before javaProcessor"/>
-    <safeDelete.importSearcher implementation="org.jetbrains.plugins.groovy.refactoring.safeDelete.GroovyImportSearcher"/>
-    <refactoring.safeDelete.JavaSafeDeleteDelegate implementationClass="org.jetbrains.plugins.groovy.refactoring.safeDelete.JavaSafeDeleteDelegateForGroovy" language="Groovy"/>
-
-    <encapsulateFields.Helper language="Groovy"
-                              implementationClass="org.jetbrains.plugins.groovy.refactoring.encapsulateFields.GroovyEncapsulateFieldHelper"/>
-
-    <constantExpressionEvaluator language="Groovy"
-                                 implementationClass="org.jetbrains.plugins.groovy.lang.psi.util.GroovyConstantExpressionEvaluator"/>
-    <annotationSupport language="Groovy"
-                       implementationClass="org.jetbrains.plugins.groovy.lang.psi.impl.auxiliary.annotation.GroovyAnnotationSupport"/>
-
-    <expressionConverter language="Groovy"
-                         implementationClass="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyExpressionConverter"/>
-
-    <codeInsight.createFieldFromUsageHelper language="Groovy" implementationClass="org.jetbrains.plugins.groovy.annotator.intentions.GroovyCreateFieldFromUsageHelper"/>
-
-    <errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
-    <fileTypeFactory implementation="org.jetbrains.plugins.groovy.GroovyFileTypeLoader"/>
-    <fileTypeFactory implementation="org.jetbrains.plugins.groovy.dgm.DGMFileTypeFactory"/>
-
-    <projectConfigurable instance="org.jetbrains.plugins.groovy.gant.GantConfigurable" id="reference.settingsdialog.project.gant"
-                         displayName="Gant"/>
-
-    <library.presentationProvider implementation="org.jetbrains.plugins.groovy.config.GroovyLibraryPresentationProvider"/>
-    <library.presentationProvider implementation="org.jetbrains.plugins.groovy.gpp.GppLibraryPresentationProvider" order="first"/>
-    <library.presentationProvider implementation="org.jetbrains.plugins.groovy.gant.GantLibraryPresentationProvider" order="last"/>
-
-    <projectService serviceInterface="org.jetbrains.plugins.groovy.gant.GantSettings"
-                    serviceImplementation="org.jetbrains.plugins.groovy.gant.GantSettings"/>
-
-    <spellchecker.support language="Groovy"
-                          implementationClass="org.jetbrains.plugins.groovy.codeInspection.spellchecker.GroovySpellcheckingStrategy"/>
-
-    <colorSettingsPage implementation="org.jetbrains.plugins.groovy.highlighter.GroovyColorsAndFontsPage"/>
-    <framework.type implementation="org.jetbrains.plugins.groovy.config.GroovyFrameworkType"/>
-    <renameHandler implementation="org.jetbrains.plugins.groovy.refactoring.rename.PropertyRenameHandler"/>
-    <renamePsiElementProcessor id="groovyFieldRenameProcessor"
-                               implementation="org.jetbrains.plugins.groovy.refactoring.rename.RenameGrFieldProcessor"
-                               order="first"/>
-    <renamePsiElementProcessor id="groovyPropertyRenameProcessor"
-                               implementation="org.jetbrains.plugins.groovy.refactoring.rename.RenameGroovyPropertyProcessor"
-                               order="first"/>
-    <renamePsiElementProcessor id="groovyLightElementRenamer"
-                               implementation="org.jetbrains.plugins.groovy.refactoring.rename.GrLightElementRenamer"
-                               order="first, after groovyPropertyRenameProcessor"/>
-    <renamePsiElementProcessor implementation="org.jetbrains.plugins.groovy.refactoring.rename.RenameAliasImportedClassProcessor"
-                               order="first"/>
-    <renamePsiElementProcessor implementation="org.jetbrains.plugins.groovy.refactoring.rename.RenameAliasImportedMethodProcessor"
-                               order="first"/>
-    <renamePsiElementProcessor implementation="org.jetbrains.plugins.groovy.refactoring.rename.RenameAliasImportedFieldProcessor"
-                               order="first"/>
-    <renamePsiElementProcessor implementation="org.jetbrains.plugins.groovy.refactoring.rename.RenameGroovyScriptProcessor"/>
-
-    <rename.inplace.resolveSnapshotProvider language="Groovy"
-                                            implementationClass="org.jetbrains.plugins.groovy.refactoring.rename.inplace.GroovyResolveSnapshotProvider"/>
-
-    <renameHandler implementation="org.jetbrains.plugins.groovy.refactoring.rename.inplace.GrVariableInplaceRenameHandler"/>
-    <renameHandler implementation="org.jetbrains.plugins.groovy.refactoring.rename.inplace.GrMethodInplaceRenameHandler"/>
-
-    <nameSuggestionProvider implementation="org.jetbrains.plugins.groovy.refactoring.GroovyNameSuggestionProvider"/>
-
-    <statementUpDownMover implementation="org.jetbrains.plugins.groovy.editor.actions.GroovyStatementMover"/>
-
-    <joinLinesHandler implementation="org.jetbrains.plugins.groovy.editor.actions.joinLines.GrVariableJoinLinesHandler"/>
-    <joinLinesHandler implementation="org.jetbrains.plugins.groovy.editor.actions.joinLines.GrJoinBlockStatementHandler"/>
-    <joinLinesHandler implementation="org.jetbrains.plugins.groovy.editor.actions.joinLines.GrJoinControlStatementHandler"/>
-    <joinLinesHandler implementation="org.jetbrains.plugins.groovy.editor.actions.joinLines.GrJoinStatementsHandler"/>
-
-    <applicationService serviceInterface="org.jetbrains.plugins.groovy.settings.GroovyApplicationSettings"
-                        serviceImplementation="org.jetbrains.plugins.groovy.settings.GroovyApplicationSettings"/>
-    <applicationService serviceInterface="org.jetbrains.plugins.groovy.dsl.DslErrorReporter"
-                        serviceImplementation="org.jetbrains.plugins.groovy.dsl.DslErrorReporterImpl"/>
-
-    <!-- Groovy language -->
-    <syntaxHighlighter key="Groovy" implementationClass="org.jetbrains.plugins.groovy.highlighter.GroovySyntaxHighlighter"/>
-
-    <annotator language="Groovy" implementationClass="org.jetbrains.plugins.groovy.annotator.GrAnnotatorImpl"/>
-    <annotator language="Groovy" implementationClass="org.jetbrains.plugins.groovy.dsl.GroovyDslAnnotator"/>
-
-    <lang.psiStructureViewFactory language="Groovy"
-                                  implementationClass="org.jetbrains.plugins.groovy.structure.GroovyStructureViewFactory"/>
-    <lang.parserDefinition language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.parser.GroovyParserDefinition"/>
-    <lang.commenter language="Groovy" implementationClass="org.jetbrains.plugins.groovy.highlighter.GroovyCommenter"/>
-    <lang.foldingBuilder language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.folding.GroovyFoldingBuilder"/>
-    <lang.formatter language="Groovy" implementationClass="org.jetbrains.plugins.groovy.formatter.GroovyFormattingModelBuilder"/>
-    <lang.whiteSpaceFormattingStrategy language="Groovy"
-                                       implementationClass="org.jetbrains.plugins.groovy.formatter.GroovyWhiteSpaceFormattingStrategy"/>
-    <postFormatProcessor implementation="org.jetbrains.plugins.groovy.formatter.GroovyBracePostFormatProcessor"/>
-
-    <enterHandlerDelegate implementation="org.jetbrains.plugins.groovy.editor.actions.GroovyEnterHandler"
-                          order="before EnterBetweenBracesHandler"/>
-    <typedHandler implementation="org.jetbrains.plugins.groovy.editor.actions.GStringTypedActionHandler"/>
-    <backspaceHandlerDelegate implementation="org.jetbrains.plugins.groovy.editor.actions.GStringBackspaceHandlerDelegate"/>
-
-    <typedHandler implementation="org.jetbrains.plugins.groovy.editor.actions.GroovyTypedHandler"/>
-    <backspaceHandlerDelegate implementation="org.jetbrains.plugins.groovy.editor.actions.GroovyBackspaceHandler"/>
-
-    <liveTemplateContext implementation="org.jetbrains.plugins.groovy.template.GroovyTemplateContextType$Generic"/>
-    <liveTemplateContext implementation="org.jetbrains.plugins.groovy.template.GroovyTemplateContextType$Expression"/>
-    <liveTemplateContext implementation="org.jetbrains.plugins.groovy.template.GroovyTemplateContextType$Statement"/>
-    <liveTemplateContext implementation="org.jetbrains.plugins.groovy.template.GroovyTemplateContextType$Declaration"/>
-
-    <defaultLiveTemplatesProvider implementation="org.jetbrains.plugins.groovy.template.GroovyTemplatesProvider"/>
-
-    <liveTemplateOptionalProcessor implementation="org.jetbrains.plugins.groovy.template.GroovyShortenFQNamesProcessor"/>
-    <variableTypeCalculator implementation="org.jetbrains.plugins.groovy.template.GroovyVariableTypeCalculator"/>
-
-    <gotoSymbolContributor implementation="org.jetbrains.plugins.groovy.gotoclass.GroovyGoToSymbolContributor"/>
-    <lang.refactoringSupport language="Groovy"
-                             implementationClass="org.jetbrains.plugins.groovy.refactoring.GroovyRefactoringSupportProvider"/>
-    <lang.surroundDescriptor language="Groovy"
-                             implementationClass="org.jetbrains.plugins.groovy.lang.surroundWith.GroovySurroundDescriptor"/>
-    <lang.findUsagesProvider language="Groovy" implementationClass="org.jetbrains.plugins.groovy.findUsages.GroovyFindUsagesProvider"/>
-    <importFilteringRule implementation="org.jetbrains.plugins.groovy.findUsages.GrImportFilteringRule"/>
-
-    <readWriteAccessDetector implementation="org.jetbrains.plugins.groovy.findUsages.GroovyReadWriteAccessDetector" order="before java"/>
-    <findUsagesHandlerFactory implementation="org.jetbrains.plugins.groovy.findUsages.GroovyFieldFindUsagesHandlerFactory"/>
-    <highlightUsagesHandlerFactory implementation="org.jetbrains.plugins.groovy.findUsages.GrHighlightHandlerFactory"/>
-    <lang.braceMatcher language="Groovy" implementationClass="org.jetbrains.plugins.groovy.highlighter.GroovyBraceMatcher"/>
-    <lang.importOptimizer language="Groovy" implementationClass="org.jetbrains.plugins.groovy.editor.GroovyImportOptimizer"/>
-    <lang.documentationProvider language="Groovy"
-                                implementationClass="org.jetbrains.plugins.groovy.lang.documentation.GroovyDocumentationProvider"/>
-    <lang.smartEnterProcessor language="Groovy"
-                              implementationClass="org.jetbrains.plugins.groovy.lang.completion.smartEnter.GroovySmartEnterProcessor"/>
-    <codeInsight.overrideMethod language="Groovy"
-                                implementationClass="org.jetbrains.plugins.groovy.overrideImplement.GroovyOverrideMethodsHandler"/>
-    <codeInsight.implementMethod language="Groovy"
-                                 implementationClass="org.jetbrains.plugins.groovy.overrideImplement.GroovyImplementMethodsHandler"/>
-
-    <methodImplementor implementation="org.jetbrains.plugins.groovy.overrideImplement.GroovyMethodImplementor"/>
-    <codeInsight.parameterInfo language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.parameterInfo.GroovyParameterInfoHandler"/>
-    <codeInsight.parameterInfo language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.parameterInfo.GroovyAnnotationAttributeInfoHandler"/>
-    <codeInsight.parameterInfo language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.parameterInfo.GroovyTypeParameterInfoHandler"/>
-    <refactoring.inlineHandler language="Groovy" implementationClass="org.jetbrains.plugins.groovy.refactoring.inline.GroovyInlineHandler"/>
-    <inlineActionHandler implementation="org.jetbrains.plugins.groovy.refactoring.inline.GroovyInlineLocalHandler"/>
-
-    <refactoring.moveClassHandler implementation="org.jetbrains.plugins.groovy.refactoring.move.MoveGroovyClassHandler"/>
-    <refactoring.moveClassToInnerHandler implementation="org.jetbrains.plugins.groovy.refactoring.move.GroovyMoveClassToInnerHandler"/>
-    <moveFileHandler implementation="org.jetbrains.plugins.groovy.refactoring.move.MoveGroovyFileHandler"/>
-    <refactoring.moveMemberHandler language="Groovy"
-                                   implementationClass="org.jetbrains.plugins.groovy.refactoring.move.MoveGroovyMemberHandler"/>
-
-    <refactoring.helper implementation="org.jetbrains.plugins.groovy.refactoring.GroovyImportOptimizerRefactoringHelper"/>
-    <codeInsight.lineMarkerProvider language="Groovy"
-                                    implementationClass="org.jetbrains.plugins.groovy.codeInsight.GroovyLineMarkerProvider"/>
-    <codeInsight.gotoSuper language="Groovy"
-                           implementationClass="org.jetbrains.plugins.groovy.codeInsight.navigation.actions.GroovyGotoSuperHandler"/>
-    <lookup.charFilter implementation="org.jetbrains.plugins.groovy.lang.completion.GroovyReferenceCharFilter"/>
-    <completion.contributor language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.completion.GroovyNoVariantsDelegator"
-                            id="groovyBasic2ClassName" order="first, after liveTemplates"/>
-    <completion.contributor language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.completion.GroovyCompletionContributor"
-                            id="groovyBasic" order="before javaClassName"/>
-    <completion.contributor language="Groovy" implementationClass="org.jetbrains.plugins.groovy.console.GroovyShellCompletionContributor"/>
-
-    <completion.contributor language="Groovy"
-                            implementationClass="org.jetbrains.plugins.groovy.lang.completion.GroovySmartCompletionContributor"/>
-    <completion.contributor language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.completion.GrMethodMergingContributor"
-                            id="grMethodMerger" order="before methodMerger"/>
-
-    <completion.contributor language="Properties" implementationClass="org.jetbrains.plugins.groovy.dgm.DGMCompletionContributor"/>
-
-    <completion.confidence language="Groovy" implementationClass="com.intellij.codeInsight.completion.UnfocusedNameIdentifier"
-                           id="groovyNameIdentifier"/>
-    <completion.confidence language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.completion.GroovyCompletionConfidence"
-                           id="groovyAdvanced" order="after groovyNameIdentifier"/>
-    <completion.confidence language="Groovy" implementationClass="com.intellij.codeInsight.completion.UnfocusedComments"
-                           id="groovyComments"/>
-    <completion.confidence language="Groovy" implementationClass="com.intellij.codeInsight.completion.AlwaysFocusLookup" id="groovyTrue"
-                           order="last"/>
-    <completion.contributor language="Groovy" implementationClass="org.jetbrains.plugins.groovy.geb.GebPageFieldNameCompletionContributor"/>
-
-    <cantBeStatic implementation="org.jetbrains.plugins.groovy.codeInspection.declaration.GrCategoryMethodsCantBeStaticExtension" />
-
-    <psi.referenceContributor  language="Properties" implementation="org.jetbrains.plugins.groovy.dgm.DGMReferenceContributor"/>
-
-    <psi.referenceContributor language="Groovy" implementation="org.jetbrains.plugins.groovy.lang.resolve.GroovyMethodArgumentReferenceContributor"/>
-
-    <weigher key="completion" implementationClass="org.jetbrains.plugins.groovy.lang.completion.weighers.GrWithWeigher"
-             id="groovyWithWeigher" order="after prefix"/>
-    <weigher key="completion" implementationClass="org.jetbrains.plugins.groovy.lang.completion.weighers.GrKindWeigher"
-             id="groovyKindWeigher" order="after groovyWithWeigher, before explicitProximity"/>
-
-    <weigher key="proximity" implementationClass="org.jetbrains.plugins.groovy.lang.completion.weighers.GrReferenceListWeigher"
-             id="groovyReferenceListWeigher" order="before openedInEditor"/>
-
-    <debuggerClassFilterProvider implementation="org.jetbrains.plugins.groovy.debugger.filters.GroovyDebuggerClassFilterProvider"/>
-
-    <useScopeEnlarger implementation="org.jetbrains.plugins.groovy.lang.psi.impl.search.GrPrivateFieldScopeEnlarger"/>
-
-    <debuggerEditorTextProvider language="Groovy" implementationClass="org.jetbrains.plugins.groovy.debugger.GroovyEditorTextProvider"/>
-
-    <xdebugger.settings implementation="org.jetbrains.plugins.groovy.debugger.filters.GroovyDebuggerSettings"/>
-    <langCodeStyleSettingsProvider implementation="org.jetbrains.plugins.groovy.codeStyle.GroovyLanguageCodeStyleSettingsProvider"/>
-    <codeStyleSettingsProvider implementation="org.jetbrains.plugins.groovy.codeStyle.GroovyCodeStyleSettingsProvider"/>
-
-    <typeHierarchyProvider language="Groovy" implementationClass="org.jetbrains.plugins.groovy.hierarchy.type.GroovyTypeHierarchyProvider"/>
-    <callHierarchyProvider language="Groovy" implementationClass="org.jetbrains.plugins.groovy.hierarchy.call.GrCallHierarchyProvider"/>
-
-    <lang.unwrapDescriptor language="Groovy" implementationClass="org.jetbrains.plugins.groovy.unwrap.GroovyUnwrapDescriptor"/>
-
-    <lang.elementManipulator forClass="org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral"
-                             implementationClass="org.jetbrains.plugins.groovy.lang.resolve.GroovyStringLiteralManipulator"/>
-    <lang.elementManipulator forClass="org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentLabel"
-                             implementationClass="org.jetbrains.plugins.groovy.lang.psi.impl.statements.arguments.GrArgumentLabelManipulator"/>
-    <lang.elementManipulator forClass="org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrStringContent"
-                             implementationClass="org.jetbrains.plugins.groovy.lang.resolve.GroovyStringLiteralManipulator"/>
-
-
-    <directClassInheritorsSearch implementation="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyDirectInheritorsSearcher"/>
-
-    <pom.declarationSearcher implementation="org.jetbrains.plugins.groovy.spock.SpockPomDeclarationSearcher"/>
-
-    <typeDeclarationProvider implementation="org.jetbrains.plugins.groovy.editor.GroovyTypeDeclarationProvider" order="first"/>
-
-    <!--Run/debug-->
-    <configurationType implementation="org.jetbrains.plugins.groovy.runner.GroovyScriptRunConfigurationType"/>
-    <configurationProducer implementation="org.jetbrains.plugins.groovy.runner.GroovyScriptRunConfigurationProducer"/>
-
-    <quoteHandler fileType="Groovy" className="org.jetbrains.plugins.groovy.editor.GroovyQuoteHandler"/>
-
-    <compileServer.plugin classpath="groovy-jps-plugin.jar"/>
-
-    <indexPatternBuilder implementation="org.jetbrains.plugins.groovy.util.GroovyIndexPatternBuilder"/>
-    <todoIndexer filetype="Groovy" implementationClass="org.jetbrains.plugins.groovy.highlighter.GroovyTodoIndexer"/>
-
-    <basicWordSelectionFilter implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyWordSelectionFilter"/>
-    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyLiteralSelectioner"/>
-    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyMembersWithDocSelectioner"/>
-    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyBlockStatementsSelectioner"/>
-    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyTypeDefinitionBodySelectioner"/>
-    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyTypeCastSelectioner"/>
-    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyDocParamsSelectioner"/>
-    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyArgListSelectioner"/>
-    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyGStringSelectioner"
-                                order="before wordSelectioner"/>
-    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyParameterListSelectioner"/>
-    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyElseSelectioner"/>
-    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyWordSelectionHandler"/>
-    <extendWordSelectionHandler implementation="org.jetbrains.plugins.groovy.editor.selection.GroovyStatementSelectioner"/>
-
-
-    <methodReferencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.AccessorMethodReferencesSearcher"/>
-    <methodReferencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.MethodLateBoundReferencesSearcher"/>
-    <methodReferencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.GroovyConstructorUsagesSearcher"/>
-    <methodReferencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.GroovyReflectedMethodReferenceSearcher"/>
-    <methodReferencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.GrLiteralMethodSearcher"/>
-    <annotatedElementsSearch implementation="org.jetbrains.plugins.groovy.findUsages.AnnotatedMembersSearcher"/>
-    <superMethodsSearch implementation="org.jetbrains.plugins.groovy.findUsages.GDKSuperMethodSearcher"/>
-    <definitionsScopedSearch implementation="org.jetbrains.plugins.groovy.findUsages.GroovyImplementationSearch"/>
-
-    <targetElementEvaluator language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyTargetElementEvaluator"/>
-
-    <fileTemplateGroup implementation="org.jetbrains.plugins.groovy.actions.GroovyTemplatesFactory"/>
-
-    <attachSourcesProvider implementation="org.jetbrains.plugins.groovy.ivy.IvyAttachSourceProvider"/>
-
-    <projectConfigurable instance="org.jetbrains.plugins.groovy.compiler.GroovyCompilerConfigurable" id="Groovy compiler"
-                         displayName="Groovy Compiler" parentId="project.propCompiler"/>
-    
-    <vetoSPICondition implementation="org.jetbrains.plugins.groovy.dgm.GroovyExtensionProvider$GroovyExtensionVetoSPI"/>
-
-    <stubElementTypeHolder class="org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes"/>
-    <!--Stubs index-->
-    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrFullClassNameIndex"/>
-    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrFullScriptNameIndex"/>
-    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrFieldNameIndex"/>
-    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrMethodNameIndex"/>
-    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrAnnotationMethodNameIndex"/>
-    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrAnnotatedMemberIndex"/>
-    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrScriptClassNameIndex"/>
-    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrDirectInheritorsIndex"/>
-    <stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrAnonymousClassIndex"/>
-
-    <referencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.ConstructorReferencesSearcher"/>
-    <referencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.GrAliasedImportedElementSearcher"/>
-    <referencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.AccessorReferencesSearcher"/>
-    <referencesSearch implementation="org.jetbrains.plugins.groovy.findUsages.GroovyTraitFieldSearcher"/>
-
-    <antCustomCompiler implementation="org.jetbrains.plugins.groovy.ant.GroovyAntCustomCompilerProvider"/>
-
-    <project.converterProvider implementation="org.jetbrains.plugins.groovy.config.GroovyModuleConverterProvider"/>
-    <project.converterProvider implementation="org.jetbrains.plugins.groovy.config.GroovyRunConfigurationConverterProvider"/>
-
-    <iconProvider implementation="org.jetbrains.plugins.groovy.GroovyIconProvider"/>
-
-    <projectService serviceInterface="org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory"
-                    serviceImplementation="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementFactoryImpl"/>
-    <projectService serviceInterface="org.jetbrains.plugins.groovy.compiler.GroovyCompilerWorkspaceConfiguration"
-                    serviceImplementation="org.jetbrains.plugins.groovy.compiler.GroovyCompilerWorkspaceConfiguration"/>
-    <projectService serviceInterface="org.jetbrains.plugins.groovy.compiler.GroovyCompilerConfiguration"
-                    serviceImplementation="org.jetbrains.plugins.groovy.compiler.GroovyCompilerConfiguration"/>
-
-    <psi.referenceContributor implementation="org.jetbrains.plugins.groovy.lang.resolve.providers.GroovyReferenceContributor"/>
-
-    <resolveScopeProvider implementation="org.jetbrains.plugins.groovy.lang.resolve.GroovyResolveScopeProvider"/>
-
-    <java.elementFinder implementation="org.jetbrains.plugins.groovy.lang.psi.impl.javaView.GroovyClassFinder"/>
-    <java.elementFinder implementation="org.jetbrains.plugins.groovy.gant.GantClassFinder"/>
-    <java.shortNamesCache implementation="org.jetbrains.plugins.groovy.lang.stubs.GroovyShortNamesCache"/>
-
-    <projectService serviceInterface="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiManager"
-                    serviceImplementation="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiManager"/>
-    <projectService serviceInterface="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyCodeStyleManager"
-                    serviceImplementation="org.jetbrains.plugins.groovy.codeStyle.GroovyCodeStyleManagerImpl"/>
-    <projectService serviceInterface="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyCodeStyleSettingsFacade"
-                    serviceImplementation="org.jetbrains.plugins.groovy.codeStyle.GroovyCodeStyleSettingsFacadeImpl"/>
-
-    <projectService serviceInterface="org.jetbrains.plugins.groovy.dgm.GroovyExtensionProvider"
-                    serviceImplementation="org.jetbrains.plugins.groovy.dgm.GroovyExtensionProvider"/>
-
-    <problemFileHighlightFilter implementation="org.jetbrains.plugins.groovy.GroovyProblemFileHighlightFilter"/>
-
-    <renameInputValidator implementation="org.jetbrains.plugins.groovy.GroovyRenameInputValidator"/>
-    <lang.namesValidator implementationClass="org.jetbrains.plugins.groovy.lang.GroovyNamesValidator" language="Groovy"/>
-
-    <fileBasedIndex implementation="org.jetbrains.plugins.groovy.dsl.GroovyDslFileIndex"/>
-
-    <patterns.patternClass className="org.jetbrains.plugins.groovy.lang.psi.patterns.GroovyPatterns" alias="groovy"/>
-
-    <stacktrace.fold substring="at org.codehaus.groovy."/>
-    <stacktrace.fold substring="at groovy."/>
-    <stacktrace.fold substring="at org.codehaus.groovy.runtime.DefaultGroovyMethods." negate="true"/>
-    <stacktrace.fold substring="at org.codehaus.groovy.vmplugin.v5.PluginDefaultGroovyMethods." negate="true"/>
-    <stacktrace.fold substring="at org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport." negate="true"/>
-
-    <projectStructureDetector implementation="org.jetbrains.plugins.groovy.GroovySourceRootDetector" id="groovyDetector"/>
-
-    <generation.topLevelFactory language="Groovy" implementationClass="org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFactoryProvider"/>
-
-    <postStartupActivity implementation="org.jetbrains.plugins.groovy.mvc.MvcProjectWithoutLibraryNotificator"/>
-
-    <treeCopyHandler implementation="org.jetbrains.plugins.groovy.lang.GroovyChangeUtilSupport"/>
-    <treeGenerator implementation="org.jetbrains.plugins.groovy.lang.psi.impl.source.impl.GroovyTreeGenerator" order="first"/>
-
-    <copyPastePreProcessor implementation="org.jetbrains.plugins.groovy.editor.GroovyLiteralCopyPasteProcessor"/>
-    <copyPastePostProcessor implementation="org.jetbrains.plugins.groovy.editor.GroovyReferenceCopyPasteProcessor"/>
-
-    <localInspection shortName="GroovyUnusedDeclaration" displayName="Unused declaration"
-                 groupPath="Groovy"
-                 groupName="Declaration redundancy" enabledByDefault="true" level="WARNING"
-                 implementationClass="org.jetbrains.plugins.groovy.codeInspection.GroovyUnusedDeclarationInspection" unfair="true"/>
-
-    <localInspection language="Groovy" groupPath="Groovy" shortName="SecondUnsafeCall"
-                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
-                     key="second.unsafe.call" groupName="Probable bugs" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.secondUnsafeCall.SecondUnsafeCallInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUnusedAssignment"
-                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
-                     key="unused.assignment" groupKey="groovy.dfa.issues" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.unusedDef.UnusedDefInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUnusedIncOrDec"
-                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
-                     key="unused.inc.dec" groupKey="groovy.dfa.issues" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GrUnusedIncDecInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyVariableNotAssigned"
-                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
-                     key="unassigned.access" groupKey="groovy.dfa.issues" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.unassignedVariable.UnassignedVariableAccessInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyMissingReturnStatement"
-                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
-                     key="no.return.display.name" groupKey="groovy.dfa.issues" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.noReturnMethod.MissingReturnInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="TypeCustomizer"
-                     displayName="Type customizer inspection"
-                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
-                     groupKey="other" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.resources.TypeCustomizerInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyAssignabilityCheck" displayName="Incompatible type assignments"
-                     groupName="Assignment issues"
-                     enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyAssignabilityCheckInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyResultOfAssignmentUsed" displayName="Result of assignment used"
-                     groupName="Assignment issues"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyResultOfAssignmentUsedInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyAssignmentCanBeOperatorAssignment"
-                     displayName="Assignment replaceable with operator assignment"
-                     groupName="Assignment issues" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyAssignmentCanBeOperatorAssignmentInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyAssignmentToForLoopParameter"
-                     displayName="Assignment to for-loop parameter"
-                     groupName="Assignment issues" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyAssignmentToForLoopParameterInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyAssignmentToMethodParameter"
-                     displayName="Assignment to method parameter"
-                     groupName="Assignment issues" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyAssignmentToMethodParameterInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyNestedAssignment" displayName="Nested assignment"
-                     groupName="Assignment issues"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyNestedAssignmentInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovySillyAssignment" displayName="Silly assignment"
-                     groupName="Assignment issues" enabledByDefault="true"
-                     level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.assignment.GroovySillyAssignmentInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUncheckedAssignmentOfMemberOfRawType"
-                     displayName="Unchecked assignment from members of raw type"
-                     groupName="Assignment issues" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyUncheckedAssignmentOfMemberOfRawTypeInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyContinueOrBreakFromFinallyBlock"
-                     displayName="'continue' or 'break' inside 'finally' block"
-                     groupName="Error handling" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.exception.GroovyContinueOrBreakFromFinallyBlockInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GrMethodMayBeStatic"
-                     displayName="Method may be static"
-                     groupName="Declaration" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.declaration.GrMethodMayBeStaticInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyReturnFromFinallyBlock"
-                     displayName="'return' inside 'finally' block" groupName="Error handling"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.exception.GroovyReturnFromFinallyBlockInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyThrowFromFinallyBlock"
-                     displayName="'throw' inside 'finally' block" groupName="Error handling"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.exception.GroovyThrowFromFinallyBlockInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyEmptyCatchBlock" displayName="Empty 'catch' block"
-                     groupName="Error handling" enabledByDefault="false"
-                     level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.exception.GroovyEmptyCatchBlockInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyEmptyFinallyBlock" displayName="Empty 'finally' block"
-                     groupName="Error handling"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.exception.GroovyEmptyFinallyBlockInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyEmptyTryBlock" displayName="Empty 'try' block"
-                     groupName="Error handling" enabledByDefault="false"
-                     level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.exception.GroovyEmptyTryBlockInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUnusedCatchParameter" displayName="Unused catch parameter"
-                     groupName="Error handling"
-                     enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.exception.GroovyUnusedCatchParameterInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyBreak" displayName="Break statement" groupName="Control Flow"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyBreakInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyContinue" displayName="Continue statement"
-                     groupName="Control Flow" enabledByDefault="false"
-                     level="WARNING" implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyContinueInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUnreachableStatement" displayName="Unreachable Statement"
-                     groupName="Validity issues"
-                     enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.validity.GroovyUnreachableStatementInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyLoopStatementThatDoesntLoop"
-                     displayName="Loop statement that doesn't loop" groupName="Control Flow"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyLoopStatementThatDoesntLoopInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyConditionalWithIdenticalBranches"
-                     displayName="Conditional expression with identical branches"
-                     groupName="Control Flow" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyConditionalWithIdenticalBranchesInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyConditionalCanBeElvis"
-                     displayName="Conditional expression can be elvis" groupName="Control Flow"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyConditionalCanBeElvisInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyConditionalCanBeConditionalCall"
-                     displayName="Conditional expression can be conditional call"
-                     groupName="Control Flow" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyConditionalCanBeConditionalCallInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyIfStatementWithIdenticalBranches"
-                     displayName="If statement with identical branches"
-                     groupName="Control Flow" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyIfStatementWithIdenticalBranchesInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyIfStatementWithTooManyBranches"
-                     displayName="If statement with too many branches"
-                     groupName="Control Flow" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyIfStatementWithTooManyBranchesInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyFallthrough" displayName="Fallthrough in switch statement"
-                     groupName="Control Flow"
-                     enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyFallthroughInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUnnecessaryContinue"
-                     displayName="Unnecessary 'continue' statement" groupName="Control Flow"
-                     enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyUnnecessaryContinueInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUnnecessaryReturn" displayName="Unnecessary 'return' statement"
-                     groupName="Control Flow"
-                     enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyUnnecessaryReturnInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GrFinalVariableAccess" displayName="Final variable access"
-                     groupName="Control Flow"
-                     enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.finalVar.GrFinalVariableAccessInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovySwitchStatementWithNoDefault"
-                     displayName="Switch statement with no default case"
-                     groupName="Control Flow" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovySwitchStatementWithNoDefaultInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyReturnFromClosureCanBeImplicit"
-                     displayName="'return' statement can be implicit"
-                     groupName="Control Flow" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyReturnFromClosureCanBeImplicitInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyTrivialConditional"
-                     displayName="Redundant conditional expression" groupName="Control Flow"
-                     enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyTrivialConditionalInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyConstantConditional"
-                     displayName="Constant conditional expression" groupName="Control Flow"
-                     enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyConstantConditionalInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyConstantIfStatement" displayName="Constant if statement"
-                     groupName="Control Flow"
-                     enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyConstantIfStatementInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyTrivialIf" displayName="Redundant 'if' statement"
-                     groupName="Control Flow" enabledByDefault="true"
-                     level="WARNING" implementationClass="org.jetbrains.plugins.groovy.codeInspection.control.GroovyTrivialIfInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="JavaStylePropertiesInvocation"
-                     displayName="Java-style property access"
-                     groupName="Style" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.style.JavaStylePropertiesInvocationInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyAccessToStaticFieldLockedOnInstance"
-                     displayName="Access to static field locked on instance data"
-                     groupName="Threading issues" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyAccessToStaticFieldLockedOnInstanceInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyDoubleCheckedLocking" displayName="Double-checked locking"
-                     groupName="Threading issues"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyDoubleCheckedLockingInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUnconditionalWait" displayName="Unconditional 'wait' call"
-                     groupName="Threading issues"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyUnconditionalWaitInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyPublicFieldAccessedInSynchronizedContext"
-                     displayName="Non-private field accessed in synchronized context" groupName="Threading issues" enabledByDefault="false"
-                     level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyPublicFieldAccessedInSynchronizedContextInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyBusyWait" displayName="Busy wait" groupName="Threading issues"
-                     enabledByDefault="false"
-                     level="WARNING" implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyBusyWaitInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyEmptySyncBlock" displayName="Empty 'synchronized' block"
-                     groupName="Threading issues"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyEmptySyncBlockInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovySynchronizationOnThis" displayName="Synchronization on 'this'"
-                     groupName="Threading issues"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovySynchronizationOnThisInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovySynchronizedMethod" displayName="Synchronized method"
-                     groupName="Threading issues"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovySynchronizedMethodInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyNestedSynchronizedStatement"
-                     displayName="Nested 'synchronized' statement"
-                     groupName="Threading issues" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyNestedSynchronizedStatementInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyThreadStopSuspendResume"
-                     displayName="Call to Thread.stop(), Thread.suspend(), or Thread.resume()"
-                     groupName="Threading issues" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyThreadStopSuspendResumeInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovySystemRunFinalizersOnExit"
-                     displayName="Call to System.runFinalizersOnExit()"
-                     groupName="Threading issues" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovySystemRunFinalizersOnExitInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyNotifyWhileNotSynchronized"
-                     displayName="'notify()' or 'notifyAll()' while not synced"
-                     groupName="Threading issues" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyNotifyWhileNotSynchronizedInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyWaitCallNotInLoop" displayName="'wait()' not in loop"
-                     groupName="Threading issues"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyWaitCallNotInLoopInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyWaitWhileNotSynchronized" displayName="'wait()' while not synced"
-                     groupName="Threading issues"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyWaitWhileNotSynchronizedInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovySynchronizationOnNonFinalField"
-                     displayName="Synchronization on non-final field"
-                     groupName="Threading issues" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovySynchronizationOnNonFinalFieldInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovySynchronizationOnVariableInitializedWithLiteral"
-                     displayName="Synchronization on variable initialized with literal" groupName="Threading issues"
-                     enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovySynchronizationOnVariableInitializedWithLiteralInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUnsynchronizedMethodOverridesSynchronizedMethod"
-                     displayName="Unsynchronized method overrides synchronized method" groupName="Threading issues" enabledByDefault="true"
-                     level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyUnsynchronizedMethodOverridesSynchronizedMethodInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyWhileLoopSpinsOnField" displayName="While loop spins on field"
-                     groupName="Threading issues"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.threading.GroovyWhileLoopSpinsOnFieldInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyMethodParameterCount"
-                     displayName="Method with too many parameters" groupName="Method Metrics"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.metrics.GroovyMethodParameterCountInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyOverlyComplexMethod" displayName="Overly complex method"
-                     groupName="Method Metrics"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.metrics.GroovyOverlyComplexMethodInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyOverlyLongMethod" displayName="Overly long method"
-                     groupName="Method Metrics" enabledByDefault="false"
-                     level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.metrics.GroovyOverlyLongMethodInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyOverlyNestedMethod" displayName="Overly nested method"
-                     groupName="Method Metrics"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.metrics.GroovyOverlyNestedMethodInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyMethodWithMoreThanThreeNegations"
-                     displayName="Method with more than three negations"
-                     groupName="Method Metrics" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.metrics.GroovyMethodWithMoreThanThreeNegationsInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyMultipleReturnPointsPerMethod"
-                     displayName="Method with multiple return points"
-                     groupName="Method Metrics" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.metrics.GroovyMultipleReturnPointsPerMethodInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyNestedSwitch" displayName="Nested switch statement"
-                     groupName="Potentially confusing code constructs"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyNestedSwitchInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyConditional" displayName="Conditional expression"
-                     groupName="Potentially confusing code constructs"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyConditionalInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GrFieldAlreadyDefined"
-                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
-                     key="field.already.defined" groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GrFieldAlreadyDefinedInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="ClashingGetters"
-                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
-                     key="clashing.getters" groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.ClashingGettersInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GrPackage"
-                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
-                     key="gr.package" groupName="Potentially confusing code constructs" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GrPackageInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GrDeprecatedAPIUsage"
-                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
-                     key="gr.deprecated.api.usage" groupName="Potentially confusing code constructs" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GrDeprecatedAPIUsageInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyNestedConditional" displayName="Nested conditional expression"
-                     groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyNestedConditionalInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyNegatedConditional" displayName="Negated conditional expression"
-                     groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyNegatedConditionalInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyInArgumentCheck" displayName="Incompatible 'in' argument types"
-                     enabledByDefault="true" groupName="Probable bugs" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyInArgumentCheckInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyNegatedIf" displayName="Negated if condition expression"
-                     groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyNegatedIfInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyResultOfIncrementOrDecrementUsed"
-                     displayName="Result of increment or decrement used"
-                     groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyResultOfIncrementOrDecrementUsedInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" enabledByDefault="true" level="WARNING"
-                     shortName="GrReassignedInClosureLocalVar"
-                     displayName="Local variable is reassigned in closure or anonymous class"
-                     groupName="Potentially confusing code constructs"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GrReassignedInClosureLocalVarInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="UnnecessaryQualifiedReference"
-                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
-                     key="unnecessary.qualified.reference" groupName="Potentially confusing code constructs" enabledByDefault="true"
-                     level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.UnnecessaryQualifiedReferenceInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyEmptyStatementBody" displayName="Statement with empty body"
-                     groupName="Potentially confusing code constructs" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyEmptyStatementBodyInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyPointlessBoolean"
-                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
-                     key="pointless.boolean.display.name" groupName="Potentially confusing code constructs" enabledByDefault="true"
-                     level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyPointlessBooleanInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyPointlessArithmetic"
-                     displayName="Pointless arithmetic expression"
-                     groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyPointlessArithmeticInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyDoubleNegation" displayName="Double negation"
-                     groupName="Potentially confusing code constructs"
-                     enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyDoubleNegationInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyOverlyComplexArithmeticExpression"
-                     displayName="Overly complex arithmetic expression"
-                     groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyOverlyComplexArithmeticExpressionInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyOverlyComplexBooleanExpression"
-                     displayName="Overly complex boolean expression"
-                     groupName="Potentially confusing code constructs" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyOverlyComplexBooleanExpressionInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyOctalInteger" displayName="Octal integer"
-                     groupName="Potentially confusing code constructs"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.GroovyOctalIntegerInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyDuplicateSwitchBranch" displayName="Duplicate switch case"
-                     groupName="Validity issues"
-                     enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.validity.GroovyDuplicateSwitchBranchInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyNonShortCircuitBoolean" displayName="Non short-circuit boolean"
-                     groupName="Probable bugs"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyNonShortCircuitBooleanInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyInfiniteLoopStatement" displayName="Infinite loop statement"
-                     groupName="Probable bugs"
-                     enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyInfiniteLoopStatementInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyInfiniteRecursion" displayName="Infinite recursion"
-                     groupName="Probable bugs" enabledByDefault="true"
-                     level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyInfiniteRecursionInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyDivideByZero" displayName="Divide by zero"
-                     groupName="Probable bugs" enabledByDefault="true"
-                     level="WARNING" implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyDivideByZeroInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyResultOfObjectAllocationIgnored"
-                     displayName="Result of object allocation ignored"
-                     groupName="Probable bugs" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyResultOfObjectAllocationIgnoredInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyAccessibility"
-                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
-                     key="access.to.inaccessible.element" groupName="Probable bugs" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyAccessibilityInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyConstructorNamedArguments"
-                     displayName="Named arguments of constructor call" groupName="Probable bugs"
-                     enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyConstructorNamedArgumentsInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyDocCheck" displayName="GroovyDoc issues"
-                     groupName="Probable bugs"
-                     enabledByDefault="true" level="ERROR"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyDocCheckInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyRangeTypeCheck"
-                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
-                     key="incorrect.range.argument" groupName="Probable bugs" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyRangeTypeCheckInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="NewInstanceOfSingleton"
-                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
-                     key="new.instance.of.singleton" groupName="Potentially confusing code constructs" enabledByDefault="true"
-                     level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.NewInstanceOfSingletonInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyLabeledStatement"
-                     bundle="org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle"
-                     key="check.labeled.statement" groupName="Probable bugs" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyLabeledStatementInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyClassNamingConvention" displayName="Class naming convention"
-                     groupName="Naming Conventions"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyClassNamingConventionInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyInterfaceNamingConvention"
-                     displayName="Interface naming convention" groupName="Naming Conventions"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyInterfaceNamingConventionInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyAnnotationNamingConvention"
-                     displayName="Annotation naming convention" groupName="Naming Conventions"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyAnnotationNamingConventionInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyEnumerationNamingConvention"
-                     displayName="Enumeration naming convention"
-                     groupName="Naming Conventions" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyEnumerationNamingConventionInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyLocalVariableNamingConvention"
-                     displayName="Local variable naming convention"
-                     groupName="Naming Conventions" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyLocalVariableNamingConventionInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyStaticMethodNamingConvention"
-                     displayName="Static method naming convention"
-                     groupName="Naming Conventions" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyStaticMethodNamingConventionInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyStaticVariableNamingConvention"
-                     displayName="Static variable naming convention"
-                     groupName="Naming Conventions" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyStaticVariableNamingConventionInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyInstanceMethodNamingConvention"
-                     displayName="Instance method naming convention"
-                     groupName="Naming Conventions" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyInstanceMethodNamingConventionInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyInstanceVariableNamingConvention"
-                     displayName="Instance variable naming convention"
-                     groupName="Naming Conventions" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyInstanceVariableNamingConventionInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyConstantNamingConvention"
-                     displayName="Constant naming convention" groupName="Naming Conventions"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyConstantNamingConventionInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyParameterNamingConvention"
-                     displayName="Method parameter naming convention"
-                     groupName="Naming Conventions" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.naming.GroovyParameterNamingConventionInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyMapGetCanBeKeyedAccess"
-                     displayName="Call to Map.get can be keyed access"
-                     groupName="GPath inspections" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.gpath.GroovyMapGetCanBeKeyedAccessInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyMapPutCanBeKeyedAccess"
-                     displayName="Call to Map.put can be keyed access"
-                     groupName="GPath inspections" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.gpath.GroovyMapPutCanBeKeyedAccessInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyListGetCanBeKeyedAccess"
-                     displayName="Call to List.get can be keyed access"
-                     groupName="GPath inspections" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.gpath.GroovyListGetCanBeKeyedAccessInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyListSetCanBeKeyedAccess"
-                     displayName="Call to List.set can be keyed access"
-                     groupName="GPath inspections" enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.gpath.GroovyListSetCanBeKeyedAccessInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovyUntypedAccess" displayName="Access to untyped expression"
-                     groupName="Probable bugs"
-                     enabledByDefault="false" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.untypedUnresolvedAccess.GroovyUntypedAccessInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GrUnresolvedAccess" displayName="Access to unresolved expression"
-                     groupName="Probable bugs"
-                     enabledByDefault="true" level="WEAK WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.untypedUnresolvedAccess.GrUnresolvedAccessInspection"/>
-    <localInspection language="Groovy" groupPath="Groovy" shortName="GroovySingletonAnnotation"
-                     displayName="Check '@Singleton' annotation conventions"
-                     groupName="Annotations verifying" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.annotator.inspections.GroovySingletonAnnotationInspection"/>
-
-    <localInspection language="Groovy" groupPath="Groovy" shortName="DelegatesTo" displayName="@DelegatesTo inspection"
-                     groupName="Annotations verifying" enabledByDefault="true" level="WARNING"
-                     implementationClass="org.jetbrains.plugins.groovy.codeInspection.confusing.DelegatesToInspection"/>
-
-    <implicitUsageProvider implementation="org.jetbrains.plugins.groovy.gpp.GppImplicitUsageProvider"/>
-    <implicitUsageProvider implementation="org.jetbrains.plugins.groovy.findUsages.GrImplicitUsageProvider"/>
-
-    <!-- control flow -->
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.control.flow</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.control.DemorgansLawIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.control.flow</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.control.SplitIfIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.control.flow</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.control.InvertIfIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.control.flow</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.control.GrRedundantElseIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.control.flow</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.control.FlipIfIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.control.flow</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.control.ReplaceTernaryWithIfElseIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.control.flow</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.control.ReplaceIfWithTernaryIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.control.flow</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.control.SimplifyTernaryOperatorIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.control.flow</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.control.CreateParameterForFieldIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.control.flow</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.control.MergeIfAndIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.control.flow</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.control.ExpandBooleanIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.control.flow</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.control.FlipConjunctionIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.control.flow</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.control.FlipComparisonIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.control.flow</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.control.NegateComparisonIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.control.flow</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.control.MergeElseIfIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.control.flow</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.control.SplitElseIfIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.control.flow</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.control.FlipConditionalIntention</className>
-    </intentionAction>
-
-    <!-- closures -->
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.closures</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.closure.MakeClosureCallExplicitIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.closures</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.closure.MakeClosureCallImplicitIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.closures</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.closure.ForToEachIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.closures</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.closure.EachToForIntention</className>
-    </intentionAction>
-    <!--
-    todo make this work
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.closures</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.closure.ConvertClosureArgToItIntention</className>
-    </intentionAction>
-    -->
-
-
-    <!-- comments -->
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.comments</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.comments.ChangeToCStyleCommentIntention</className>
-    </intentionAction>
-    <!--
-    todo make this work
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.comments</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.comments.ChangeToEndOfLineCommentIntention</className>
-    </intentionAction>
-    -->
-
-    <!-- conversions -->
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertJavaStyleArrayIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertIntegerToDecimalIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertIntegerToHexIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertIntegerToOctalIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertIntegerToBinaryIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.IndexingMethodConversionIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.IndexedExpressionConversionIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.ConvertGStringToStringIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.ConvertMultilineStringToSingleLineIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.ConvertToRegexIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.ConvertToDollarSlashRegexIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.GrConvertStringToCharIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.RemoveUnnecessaryEscapeCharactersIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.GrBreakStringOnLineBreaksIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.GrSplitDeclarationIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.RemoveParenthesesFromMethodCallIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.RemoveUnnecessaryBracesInGStringIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertMapToClassIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.ConvertConcatenationToGstringIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.RenameFileWithClassIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.MoveClassToNewFileIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertMethodToClosureIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.strings.ConvertStringToMultilineIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertClosureToMethodIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertSimpleGetterToPropertyIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.GrConvertTypeCastToSafeCastIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.conversions</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.conversions.ConvertJunitAssertionToAssertStatementIntention</className>
-    </intentionAction>
-
-    <!-- groovy style -->
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.style</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.style.JavaStylePropertiesInvocationIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.style</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.style.RemoveUnnecessarySemicolonsIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.style</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.style.ImportStaticIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.style</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.style.ImportOnDemandIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.style</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.style.ConvertToGeeseBracesIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.style</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.style.RemoveRedundantClassPropertyIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.style</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.style.ConvertFromGeeseBracesIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.style</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.style.RemoveUnnecessaryReturnIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.style</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.style.AddReturnTypeFix</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.style</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.style.parameterToEntry.ConvertParameterToMapEntryIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.style</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.style.ReplaceAbstractClassInstanceByMapIntention</className>
-    </intentionAction>
-
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy</categoryKey>
-      <className>org.jetbrains.plugins.groovy.grape.GrabDependencies</className>
-    </intentionAction>
-
-    <!--declaration-->
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.declaration</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.declaration.GrCreateSubclassAction</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.declaration</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.declaration.GrCreateFieldForParameterIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.declaration</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.declaration.GrSetStrongTypeIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.declaration</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.declaration.GrMakeMemberPublicIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.declaration</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.declaration.GrMakeMemberProtectedIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.declaration</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.declaration.GrMakeMemberPrivateIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.declaration</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.declaration.GrIntroduceLocalVariableIntention</className>
-    </intentionAction>
-
-    <!--other-->
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.other</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.other.GrCreateMissingSwitchBranchesIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.other</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.other.GrAliasImportIntention</className>
-    </intentionAction>
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.other</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.other.GrCopyStringConcatenationContentIntention</className>
-    </intentionAction>
-
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.other</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.other.GrSortMapKeysIntention</className>
-    </intentionAction>
-
-    <intentionAction>
-      <bundleName>org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle</bundleName>
-      <categoryKey>intention.category.groovy.declaration</categoryKey>
-      <className>org.jetbrains.plugins.groovy.intentions.declaration.GrRemoveExplicitTypeDeclarationIntention</className>
-    </intentionAction>
-
-    <projectService serviceInterface="org.jetbrains.plugins.groovy.annotator.intentions.dynamic.DynamicToolWindowWrapper"
-                    serviceImplementation="org.jetbrains.plugins.groovy.annotator.intentions.dynamic.DynamicToolWindowWrapper"/>
-
-    <projectService serviceInterface="org.jetbrains.plugins.groovy.griffon.GriffonProjectViewState"
-                    serviceImplementation="org.jetbrains.plugins.groovy.griffon.GriffonProjectViewState"/>
-
-    <java.programPatcher implementation="org.jetbrains.plugins.groovy.debugger.GroovyHotSwapper"/>
-    <psi.referenceContributor implementation="org.jetbrains.plugins.groovy.gpp.GppReferenceContributor"/>
-
-    <library.presentationProvider implementation="org.jetbrains.plugins.groovy.griffon.GriffonLibraryPresentationProvider"/>
-    <moduleBuilder builderClass="org.jetbrains.plugins.groovy.griffon.GriffonModuleBuilder" id="griffonModuleBuilder"/>
-    <projectStructureDetector implementation="org.jetbrains.plugins.groovy.griffon.GriffonProjectStructureDetector" order="before groovyDetector"/>
-    <programRunner implementation="org.jetbrains.plugins.groovy.griffon.GriffonDebuggerRunner"/>
-    <configurationType implementation="org.jetbrains.plugins.groovy.griffon.GriffonRunConfigurationType"/>
-    <toolWindow id="Griffon View" anchor="left" secondary="false" icon="JetgroovyIcons.Griffon.GriffonToolWindow"
-                factoryClass="org.jetbrains.plugins.groovy.griffon.GriffonToolWindowFactory"
-                conditionClass="org.jetbrains.plugins.groovy.griffon.GriffonToolWindowFactory"/>
-
-    <roots.watchedRootsProvider implementation="org.jetbrains.plugins.groovy.mvc.MvcWatchedRootProvider"/>
-    <projectService serviceInterface="org.jetbrains.plugins.groovy.mvc.MvcConsole"
-                    serviceImplementation="org.jetbrains.plugins.groovy.mvc.MvcConsole"/>
-    <selectInTarget implementation="org.jetbrains.plugins.groovy.mvc.projectView.MvcProjectViewSelectInTarget"/>
-    <applicationService serviceImplementation="org.jetbrains.plugins.groovy.mvc.MvcRunTargetHistoryService"
-                        serviceInterface="org.jetbrains.plugins.groovy.mvc.MvcRunTargetHistoryService"/>
-    <applicationService serviceInterface="org.jetbrains.plugins.groovy.codeInspection.GroovyQuickFixFactory"
-                        serviceImplementation="org.jetbrains.plugins.groovy.codeInspection.GroovyQuickFixFactoryImpl"/>
-
-    <debugger.positionManagerFactory id="groovyPositionManager"
-                                     implementation="org.jetbrains.plugins.groovy.debugger.GroovyPositionManagerFactory"/>
-    <debugger.positionManagerFactory order="after groovyPositionManager"
-                                     implementation="org.jetbrains.plugins.groovy.springloaded.SpringLoadedPositionManagerFactory"/>
-    <debugger.nodeRenderer implementation="org.jetbrains.plugins.groovy.debugger.GroovyRefRenderer"/>
-    <codeStyle.ReferenceAdjuster language="Groovy" implementationClass="org.jetbrains.plugins.groovy.codeStyle.GrReferenceAdjuster"/>
-    <codeInsight.unresolvedReferenceQuickFixProvider implementation="org.jetbrains.plugins.groovy.jarFinder.GroovyFindJarQuickFixProvider"/>
-    <lang.refactoringSupport.classMembersRefactoringSupport language="Groovy"
-                                                            implementationClass="org.jetbrains.plugins.groovy.refactoring.classMembers.GroovyClassMembersRefactoringSupport"/>
-    <refactoring.pullUpHelperFactory language="Groovy"
-                                     implementationClass="org.jetbrains.plugins.groovy.refactoring.memberPullUp.GrPullUpHelperFactory"/>
-    <classTypePointerFactory implementation="org.jetbrains.plugins.groovy.lang.psi.impl.smartPointers.GrClassReferenceTypePointerFactory"/>
-    <hierarchy.referenceProcessor implementation="org.jetbrains.plugins.groovy.hierarchy.call.GrCallReferenceProcessor"/>
-  </extensions>
-
-  <extensions defaultExtensionNs="com.intellij.debugger">
-    <codeFragmentFactory implementation="org.jetbrains.plugins.groovy.debugger.GroovyCodeFragmentFactory"/>
-  </extensions>
-
-  <extensions defaultExtensionNs="ByteCodeViewer">
-    <classSearcher implementation="org.jetbrains.plugins.groovy.byteCodeViewer.GroovyScriptClassSearcher"/>
-  </extensions>
-
-  <actions>
-    <action id="Groovy.Shell.Execute" class="com.intellij.openapi.actionSystem.EmptyAction" text="Execute Groovy Code"
-            description="Execute Groovy code in console">
-      <keyboard-shortcut first-keystroke="control ENTER" keymap="$default"/>
-    </action>
-
-    <action id="Groovy.NewClass" class="org.jetbrains.plugins.groovy.actions.NewGroovyClassAction"
-            text="Groovy Class" description="Create new Groovy class">
-      <add-to-group group-id="NewGroup" anchor="after" relative-to-action="NewGroup1"/>
-    </action>
-    <action id="Groovy.NewScript" class="org.jetbrains.plugins.groovy.actions.NewScriptAction"
-            text="Groovy Script" description="Create new Groovy script">
-      <add-to-group group-id="NewGroup" anchor="last"/>
-    </action>
-
-    <action id="Gant.NewScript" class="org.jetbrains.plugins.groovy.gant.NewGantScriptAction"
-            text="Gant Script" description="Create new Gant script">
-      <add-to-group group-id="NewGroup" anchor="last"/>
-    </action>
-
-    <group id="Groovy.Dynamic.Toolbar">
-      <action id="Groovy.Dynamic.Remove" class="org.jetbrains.plugins.groovy.annotator.intentions.dynamic.RemoveDynamicAction"
-              icon="AllIcons.General.Remove" text="Remove" description="Remove dynamic element"/>
-      <separator/>
-      <action id="Groovy.Dynamic.ExpandAll" class="org.jetbrains.plugins.groovy.annotator.intentions.dynamic.ExpandAllAction"
-              icon="AllIcons.Actions.Expandall" text="Expand all" description="Collapse all"/>
-      <action id="Groovy.Dynamic.CollapseAll" class="org.jetbrains.plugins.groovy.annotator.intentions.dynamic.CollapseAllAction"
-              icon="AllIcons.Actions.Collapseall" text="Collapse all" description="Collapse all"/>
-    </group>
-
-
-    <action id="ConvertGroovyToJava"
-            class="org.jetbrains.plugins.groovy.actions.ConvertToJavaAction"
-            text="Convert to Java"
-            description="Convert Groovy files to Java">
-      <add-to-group group-id="RefactoringMenu"/>
-    </action>
-
-    <group id="Internal.Groovy" text="Groovy" popup="true" internal="true">
-      <action id="GetPsiTypeAction" class="org.jetbrains.plugins.groovy.actions.GrGetPsiTypeAction"
-              text="get PsiType" description=""
-              internal="true"/>
-
-      <action id="DumpGroovyControlFlowAction"
-              class="org.jetbrains.plugins.groovy.actions.DumpGroovyControlFlowAction"
-              text="dump groovy control flow"
-              description="" internal="true"/>
-      <action id="DumpGroovyStubsAction"
-              class="org.jetbrains.plugins.groovy.actions.DumpGroovyStubsAction"
-              text="dump groovy stubs"
-              description="" internal="true"/>
-      <add-to-group group-id="Internal"/>
-    </group>
-
-    <action id="ExcludeFromStubGeneration"
-            class="org.jetbrains.plugins.groovy.compiler.ExcludeFromStubGenerationAction"
-            text="Exclude from stub generation" description="Don't generate Java stubs for this Groovy file on compilation">
-      <add-to-group group-id="EditorTabPopupMenu" anchor="after" relative-to-action="RenameJavaFileToGroovyFileAction"/>
-    </action>
-
-
-    <group id="GroovyGenerateGroup1">
-      <action id="org.jetbrains.plugins.groovy.actions.generate.constructors.GroovyGenerateConstructorAction"
-              class="org.jetbrains.plugins.groovy.actions.generate.constructors.GroovyGenerateConstructorAction"
-              text="Constructor" description="Generates constructor"/>
-      <action id="org.jetbrains.plugins.groovy.actions.generate.accessors.GroovyGenerateGetterAction"
-              class="org.jetbrains.plugins.groovy.actions.generate.accessors.GroovyGenerateGetterAction"
-              text="Getter" description="Generates getter"/>
-      <action id="org.jetbrains.plugins.groovy.actions.generate.accessors.GroovyGenerateSetterAction"
-              class="org.jetbrains.plugins.groovy.actions.generate.accessors.GroovyGenerateSetterAction"
-              text="Setter" description="Generates setter"/>
-      <action id="org.jetbrains.plugins.groovy.actions.generate.accessors.GroovyGenerateGetterSetterAction"
-              class="org.jetbrains.plugins.groovy.actions.generate.accessors.GroovyGenerateGetterSetterAction"
-              text="Getter and Setter" description="Generates getter"/>
-      <action id="org.jetbrains.plugins.groovy.actions.generate.equals.GroovyGenerateEqualsAction"
-              class="org.jetbrains.plugins.groovy.actions.generate.equals.GroovyGenerateEqualsAction"
-              text="equals() and hashCode()" description="Action generates equals and hashCode now"/>
-      <action id="org.jetbrains.plugins.groovy.actions.generate.missing.GroovyGenerateMethodMissingAction"
-              class="org.jetbrains.plugins.groovy.actions.generate.missing.GroovyGenerateMethodMissingAction"
-              text="methodMissing()" description="Action generates propertyMissing()"/>
-      <action id="org.jetbrains.plugins.groovy.actions.generate.missing.GroovyGeneratePropertyMissingAction"
-              class="org.jetbrains.plugins.groovy.actions.generate.missing.GroovyGeneratePropertyMissingAction"
-              text="propertyMissing()" description="Action generates propertyMissing()"/>
-
-      <add-to-group group-id="GenerateGroup" anchor="after" relative-to-action="JavaGenerateGroup1"/>
-    </group>
-
-    <action id="Groovy.Doc.Generating"
-            class="org.jetbrains.plugins.groovy.doc.actions.GenerateGroovyDocAction"
-            text="Generate GroovyDoc..." description="Generating Groovy Documentation"
-            icon="JetgroovyIcons.Groovy.GroovyDoc">
-      <add-to-group group-id="ToolsMenu" anchor="last"/>
-    </action>
-    <action id="Groovy.Shell"
-            class="org.jetbrains.plugins.groovy.console.GroovyShellAction"
-            text="Groovy Shell..." description="Launch Groovy Shell"
-            icon="JetgroovyIcons.Groovy.Groovy_16x16">
-      <add-to-group group-id="ToolsMenu" anchor="last"/>
-    </action>
-
-    <action id="Groovy.Console"
-            class="org.jetbrains.plugins.groovy.console.GroovyConsoleAction"
-            text="Groovy Console..." description="Launch Groovy Console"
-            icon="JetgroovyIcons.Groovy.Groovy_16x16">
-      <add-to-group group-id="ToolsMenu" anchor="last"/>
-    </action>
-
-    <group id="Mvc.Actions" popup="true" class="org.jetbrains.plugins.groovy.mvc.MvcActionGroup">
-      <action id="Mvc.Upgrade"
-              class="org.jetbrains.plugins.groovy.mvc.MvcUpgradeAction"
-              text="Change SDK version" description="Change Grails/Griffon SDK version">
-      </action>
-
-      <action id="Griffon.UpdateDependencies" class="org.jetbrains.plugins.groovy.griffon.UpdateGriffonSettingsAction"
-              text="Synchronize Griffon settings"
-              description="Refresh IntelliJ IDEA project structure so that it matches Griffon build settings">
-      </action>
-
-      <action id="Mvc.RunTarget" class="org.jetbrains.plugins.groovy.mvc.MvcRunTarget"
-              text="Run Target" description="Run arbitrary Grails/Griffon target">
-        <keyboard-shortcut keymap="$default" first-keystroke="ctrl alt G"/>
-      </action>
-      <add-to-group group-id="ProjectViewPopupMenu" anchor="after" relative-to-action="AddFrameworkSupport"/>
-      <add-to-group group-id="NavbarPopupMenu" anchor="after" relative-to-action="AddFrameworkSupport"/>
-      <add-to-group group-id="ToolsMenu" anchor="last"/>
-    </group>
-
-  </actions>
-
-  <application-components>
-    <component>
-      <implementation-class>org.jetbrains.plugins.groovy.gant.GantLoader</implementation-class>
-    </component>
-    <component>
-      <implementation-class>org.jetbrains.plugins.groovy.mvc.MvcPathMacros</implementation-class>
-    </component>
-    <component>
-      <implementation-class>org.jetbrains.plugins.groovy.dsl.DslActivationStatus</implementation-class>
-    </component>
-  </application-components>
-
-  <project-components>
-    <component>
-      <implementation-class>org.jetbrains.plugins.groovy.compiler.GroovyCompilerLoader</implementation-class>
-    </component>
-    <component>
-      <implementation-class>org.jetbrains.plugins.groovy.codeInspection.local.GroovyUnusedImportsPassFactory</implementation-class>
-    </component>
-    <component>
-      <implementation-class>org.jetbrains.plugins.groovy.annotator.GrKeywordAndDeclarationHighlightFactory</implementation-class>
-    </component>
-    <component>
-      <implementation-class>org.jetbrains.plugins.groovy.annotator.GrReferenceHighlighterFactory</implementation-class>
-    </component>
-    <component>
-      <interface-class>org.jetbrains.plugins.groovy.annotator.intentions.dynamic.DynamicManager</interface-class>
-      <implementation-class>org.jetbrains.plugins.groovy.annotator.intentions.dynamic.DynamicManagerImpl</implementation-class>
-    </component>
-    <component>
-      <implementation-class>org.jetbrains.plugins.groovy.mvc.MvcModuleStructureSynchronizer</implementation-class>
-    </component>
-  </project-components>
-
-
-</idea-plugin>
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyBundle.properties b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyBundle.properties
index 1ebf746..4e3c0eb 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyBundle.properties
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyBundle.properties
@@ -312,6 +312,7 @@
 exception.0.has.already.been.caught=Exception ''{0}'' has already been caught
 unnecessary.type=Unnecessary exception ''{0}''. ''{1}'' is already declared
 create.enum=Create Enum {0}
+create.trait=Create Trait {0}
 create.inner.class=Create Inner Class {0}
 annotation.field.can.only.be.used.within.a.script.body=Annotation @Field can only be used within a script body
 annotation.field.can.only.be.used.within.a.script=Annotation @Field can only be used within a script
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyFileType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyFileType.java
index 6abff46..96946af 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyFileType.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/GroovyFileType.java
@@ -40,10 +40,9 @@
  * @author ilyas
  */
 public class GroovyFileType extends LanguageFileType {
-
+  public static final List<FileType> GROOVY_FILE_TYPES = new ArrayList<FileType>();
   public static final GroovyFileType GROOVY_FILE_TYPE = new GroovyFileType();
   @NonNls public static final String DEFAULT_EXTENSION = "groovy";
-  public static final List<FileType> GROOVY_FILE_TYPES = new ArrayList<FileType>();
 
   private GroovyFileType() {
     super(GroovyLanguage.INSTANCE);
@@ -55,8 +54,10 @@
         return new GroovyEditorHighlighter(colors);
       }
     });
+    GROOVY_FILE_TYPES.add(this);
   }
 
+  @NotNull
   public static FileType[] getGroovyEnabledFileTypes() {
     return GROOVY_FILE_TYPES.toArray(new FileType[GROOVY_FILE_TYPES.size()]);
   }
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/GrKeywordAndDeclarationHighlightFactory.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/GrKeywordAndDeclarationHighlightFactory.java
index 7c4e61c..f4de7ab 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/GrKeywordAndDeclarationHighlightFactory.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/GrKeywordAndDeclarationHighlightFactory.java
@@ -29,7 +29,7 @@
  * @author Max Medvedev
  */
 public class GrKeywordAndDeclarationHighlightFactory extends AbstractProjectComponent implements TextEditorHighlightingPassFactory {
-  protected GrKeywordAndDeclarationHighlightFactory(Project project) {
+  public GrKeywordAndDeclarationHighlightFactory(Project project) {
     super(project);
 
     TextEditorHighlightingPassRegistrar.getInstance(project).registerTextEditorHighlightingPass(this, null, null, false, -1);
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/GrReferenceHighlighterFactory.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/GrReferenceHighlighterFactory.java
index cfa2e59..73261ab 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/GrReferenceHighlighterFactory.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/GrReferenceHighlighterFactory.java
@@ -29,7 +29,7 @@
  * @author Max Medvedev
  */
 public class GrReferenceHighlighterFactory extends AbstractProjectComponent implements TextEditorHighlightingPassFactory {
-  protected GrReferenceHighlighterFactory(Project project) {
+  public GrReferenceHighlighterFactory(Project project) {
     super(project);
     TextEditorHighlightingPassRegistrar.getInstance(project).registerTextEditorHighlightingPass(this, null, null, false, -1);
   }
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/ResolveHighlightingVisitor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/ResolveHighlightingVisitor.java
index 49fb4f3..88bbefd 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/ResolveHighlightingVisitor.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/ResolveHighlightingVisitor.java
@@ -17,6 +17,7 @@
 
 import com.intellij.codeInsight.daemon.impl.HighlightInfo;
 import com.intellij.openapi.project.Project;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.plugins.groovy.codeInspection.untypedUnresolvedAccess.GrUnresolvedAccessChecker;
 import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
 import org.jetbrains.plugins.groovy.lang.psi.GroovyRecursiveElementVisitor;
@@ -32,7 +33,7 @@
   private final GrUnresolvedAccessChecker myReferenceChecker;
   private final List<HighlightInfo> myInfos;
 
-  public ResolveHighlightingVisitor(GroovyFileBase file, Project project, List<HighlightInfo> collector) {
+  public ResolveHighlightingVisitor(@NotNull GroovyFileBase file, @NotNull Project project, @NotNull List<HighlightInfo> collector) {
     myReferenceChecker = new GrUnresolvedAccessChecker(file, project);
     myInfos = collector;
   }
@@ -44,7 +45,6 @@
     if (size == myInfos.size()) {
       List<HighlightInfo> infos = myReferenceChecker.checkReferenceExpression(referenceExpression);
       if (infos != null) {
-        assert myInfos != null;
         myInfos.addAll(infos);
       }
     }
@@ -57,7 +57,6 @@
     if (size == myInfos.size()) {
       HighlightInfo info = myReferenceChecker.checkCodeReferenceElement(refElement);
       if (info != null) {
-        assert myInfos != null;
         myInfos.add(info);
       }
     }
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/GroovyClsCustomNavigationPolicy.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInsight/GroovyClsCustomNavigationPolicy.java
similarity index 100%
rename from plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/GroovyClsCustomNavigationPolicy.java
rename to plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInsight/GroovyClsCustomNavigationPolicy.java
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/GrInspectionUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/GrInspectionUtil.java
index 5234731..ba60917 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/GrInspectionUtil.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/GrInspectionUtil.java
@@ -15,9 +15,16 @@
  */
 package org.jetbrains.plugins.groovy.codeInspection;
 
+import com.intellij.codeHighlighting.HighlightDisplayLevel;
+import com.intellij.codeInsight.daemon.impl.HighlightInfo;
+import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.psi.PsiElement;
 import com.intellij.psi.tree.IElementType;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.groovy.highlighter.DefaultHighlighter;
 import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
+import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrBinaryExpression;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
 
@@ -38,4 +45,27 @@
     final IElementType tokenType = binaryCondition.getOperationTokenType();
     return GroovyTokenTypes.mNOT_EQUAL == tokenType;
   }
+
+  public static HighlightInfo createAnnotationForRef(@NotNull GrReferenceElement ref,
+                                                     @NotNull HighlightDisplayLevel displayLevel,
+                                                     @NotNull String message) {
+    PsiElement refNameElement = ref.getReferenceNameElement();
+    assert refNameElement != null;
+
+    if (displayLevel == HighlightDisplayLevel.ERROR) {
+      return HighlightInfo.newHighlightInfo(HighlightInfoType.WRONG_REF).range(refNameElement).descriptionAndTooltip(message).create();
+    }
+
+    if (displayLevel == HighlightDisplayLevel.WEAK_WARNING) {
+      boolean isTestMode = ApplicationManager.getApplication().isUnitTestMode();
+      HighlightInfoType infotype = isTestMode ? HighlightInfoType.WARNING : HighlightInfoType.INFORMATION;
+
+      HighlightInfo.Builder builder = HighlightInfo.newHighlightInfo(infotype).range(refNameElement);
+      builder.descriptionAndTooltip(message);
+      return builder.needsUpdateOnTyping(false).textAttributes(DefaultHighlighter.UNRESOLVED_ACCESS).create();
+    }
+
+    HighlightInfoType highlightInfoType = HighlightInfo.convertSeverity(displayLevel.getSeverity());
+    return HighlightInfo.newHighlightInfo(highlightInfoType).range(refNameElement).descriptionAndTooltip(message).create();
+  }
 }
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/GroovyFix.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/GroovyFix.java
index d611bd5..66e223c 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/GroovyFix.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/GroovyFix.java
@@ -32,7 +32,17 @@
 import org.jetbrains.plugins.groovy.lang.psi.api.util.GrStatementOwner;
 
 public abstract class GroovyFix implements LocalQuickFix {
+  public static final GroovyFix EMPTY_FIX = new GroovyFix() {
+    @Override
+    protected void doFix(Project project, ProblemDescriptor descriptor) throws IncorrectOperationException {
+    }
 
+    @NotNull
+    @Override
+    public String getName() {
+      throw new UnsupportedOperationException();
+    }
+  };
   public static final GroovyFix[] EMPTY_ARRAY = new GroovyFix[0];
 
   //to appear in "Apply Fix" statement when multiple Quick Fixes exist
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/GroovyInspectionBundle.properties b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/GroovyInspectionBundle.properties
index f969d94..13fefde 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/GroovyInspectionBundle.properties
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/GroovyInspectionBundle.properties
@@ -112,3 +112,4 @@
 ignore.when.catch.parameter.is.named.ignore.or.ignored=Ignore when catch parameter is named ignore or ignored
 no.applicable.signature.found=No applicable signature found
 expected.type.0=Expected {0}
+declare.explicit.implementations.of.trait=Declare explicit implementations of trait
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/GroovyQuickFixFactory.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/GroovyQuickFixFactory.java
index 5616169..edb0ebb 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/GroovyQuickFixFactory.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/GroovyQuickFixFactory.java
@@ -15,12 +15,12 @@
  */
 package org.jetbrains.plugins.groovy.codeInspection;
 
-import com.intellij.codeInsight.daemon.impl.quickfix.CreateClassKind;
 import com.intellij.codeInsight.intention.IntentionAction;
 import com.intellij.codeInspection.LocalQuickFix;
 import com.intellij.openapi.components.ServiceManager;
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiType;
+import org.jetbrains.plugins.groovy.lang.GrCreateClassKind;
 import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentLabel;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrNamedArgument;
@@ -44,7 +44,7 @@
 
   public abstract IntentionAction createClassFromNewAction(GrNewExpression parent);
 
-  public abstract IntentionAction createClassFixAction(GrReferenceElement element, CreateClassKind anInterface);
+  public abstract IntentionAction createClassFixAction(GrReferenceElement element, GrCreateClassKind anInterface);
 
   public abstract IntentionAction createCreateFieldFromUsageFix(GrReferenceExpression expr);
 
@@ -77,4 +77,6 @@
   public abstract IntentionAction createOptimizeImportsFix(boolean onTheFly);
 
   public abstract IntentionAction createRemoveUnusedGrParameterFix(GrParameter parameter);
+
+  public abstract IntentionAction createInvestigateFix(String reason);
 }
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/bugs/GrAccessibilityChecker.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/bugs/GrAccessibilityChecker.java
index 6b75507..e58bb09 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/bugs/GrAccessibilityChecker.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/bugs/GrAccessibilityChecker.java
@@ -18,13 +18,11 @@
 import com.intellij.codeHighlighting.HighlightDisplayLevel;
 import com.intellij.codeInsight.daemon.HighlightDisplayKey;
 import com.intellij.codeInsight.daemon.impl.HighlightInfo;
-import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
 import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction;
 import com.intellij.codeInspection.InspectionManager;
 import com.intellij.codeInspection.LocalQuickFix;
 import com.intellij.codeInspection.LocalQuickFixAsIntentionAdapter;
 import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.*;
@@ -36,8 +34,8 @@
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.plugins.groovy.GroovyBundle;
+import org.jetbrains.plugins.groovy.codeInspection.GrInspectionUtil;
 import org.jetbrains.plugins.groovy.codeInspection.GroovyFix;
-import org.jetbrains.plugins.groovy.highlighter.DefaultHighlighter;
 import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement;
 import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
 import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
@@ -200,29 +198,8 @@
   private static HighlightInfo createAnnotationForRef(@NotNull GrReferenceElement ref,
                                                       boolean strongError,
                                                       @NotNull String message) {
-    PsiElement refNameElement = ref.getReferenceNameElement();
-    assert refNameElement != null;
-
-    if (strongError) {
-      return HighlightInfo.newHighlightInfo(HighlightInfoType.WRONG_REF).range(refNameElement).descriptionAndTooltip(message).create();
-    }
-
-    HighlightDisplayLevel displayLevel = GroovyAccessibilityInspection.getHighlightDisplayLevel(ref.getProject(), ref);
-
-    if (displayLevel == HighlightDisplayLevel.ERROR) {
-      return HighlightInfo.newHighlightInfo(HighlightInfoType.WRONG_REF).range(refNameElement).descriptionAndTooltip(message).create();
-    }
-
-    if (displayLevel == HighlightDisplayLevel.WEAK_WARNING) {
-      boolean isTestMode = ApplicationManager.getApplication().isUnitTestMode();
-      HighlightInfoType infotype = isTestMode ? HighlightInfoType.WARNING : HighlightInfoType.INFORMATION;
-
-      HighlightInfo.Builder builder = HighlightInfo.newHighlightInfo(infotype).range(refNameElement);
-      builder.descriptionAndTooltip(message);
-      return builder.needsUpdateOnTyping(false).textAttributes(DefaultHighlighter.UNRESOLVED_ACCESS).create();
-    }
-
-    HighlightInfoType highlightInfoType = HighlightInfo.convertSeverity(displayLevel.getSeverity());
-    return HighlightInfo.newHighlightInfo(highlightInfoType).range(refNameElement).descriptionAndTooltip(message).create();
+    HighlightDisplayLevel displayLevel = strongError ? HighlightDisplayLevel.ERROR
+                                                     : GroovyAccessibilityInspection.getHighlightDisplayLevel(ref.getProject(), ref);
+    return GrInspectionUtil.createAnnotationForRef(ref, displayLevel, message);
   }
 }
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/untypedUnresolvedAccess/GrUnresolvedAccessChecker.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/untypedUnresolvedAccess/GrUnresolvedAccessChecker.java
index e0c2409..9a615db 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/untypedUnresolvedAccess/GrUnresolvedAccessChecker.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/untypedUnresolvedAccess/GrUnresolvedAccessChecker.java
@@ -19,12 +19,10 @@
 import com.intellij.codeInsight.daemon.HighlightDisplayKey;
 import com.intellij.codeInsight.daemon.impl.HighlightInfo;
 import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
-import com.intellij.codeInsight.daemon.impl.quickfix.CreateClassKind;
 import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction;
 import com.intellij.codeInsight.intention.EmptyIntentionAction;
 import com.intellij.codeInsight.intention.QuickFixFactory;
 import com.intellij.codeInsight.quickfix.UnresolvedReferenceQuickFixProvider;
-import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Ref;
@@ -41,15 +39,17 @@
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.plugins.groovy.GroovyBundle;
 import org.jetbrains.plugins.groovy.annotator.GrHighlightUtil;
-import org.jetbrains.plugins.groovy.annotator.intentions.*;
+import org.jetbrains.plugins.groovy.annotator.intentions.QuickfixUtil;
+import org.jetbrains.plugins.groovy.codeInspection.GrInspectionUtil;
 import org.jetbrains.plugins.groovy.codeInspection.GroovyQuickFixFactory;
 import org.jetbrains.plugins.groovy.extensions.GroovyUnresolvedHighlightFilter;
 import org.jetbrains.plugins.groovy.findUsages.MissingMethodAndPropertyUtil;
-import org.jetbrains.plugins.groovy.highlighter.DefaultHighlighter;
+import org.jetbrains.plugins.groovy.lang.GrCreateClassKind;
 import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GroovyDocPsiElement;
 import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
 import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement;
 import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
+import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;
 import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
 import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.annotation.GrAnnotation;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentList;
@@ -411,30 +411,8 @@
   private static HighlightInfo createAnnotationForRef(@NotNull GrReferenceElement ref,
                                                       boolean strongError,
                                                       @NotNull String message) {
-    PsiElement refNameElement = ref.getReferenceNameElement();
-    assert refNameElement != null;
-
-    if (strongError) {
-      return HighlightInfo.newHighlightInfo(HighlightInfoType.WRONG_REF).range(refNameElement).descriptionAndTooltip(message).create();
-    }
-
-    HighlightDisplayLevel displayLevel = GrUnresolvedAccessInspection.getHighlightDisplayLevel(ref.getProject(), ref);
-
-    if (displayLevel == HighlightDisplayLevel.ERROR) {
-      return HighlightInfo.newHighlightInfo(HighlightInfoType.WRONG_REF).range(refNameElement).descriptionAndTooltip(message).create();
-    }
-
-    if (displayLevel == HighlightDisplayLevel.WEAK_WARNING) {
-      boolean isTestMode = ApplicationManager.getApplication().isUnitTestMode();
-      HighlightInfoType infotype = isTestMode ? HighlightInfoType.WARNING : HighlightInfoType.INFORMATION;
-
-      HighlightInfo.Builder builder = HighlightInfo.newHighlightInfo(infotype).range(refNameElement);
-      builder.descriptionAndTooltip(message);
-      return builder.needsUpdateOnTyping(false).textAttributes(DefaultHighlighter.UNRESOLVED_ACCESS).create();
-    }
-
-    HighlightInfoType highlightInfoType = HighlightInfo.convertSeverity(displayLevel.getSeverity());
-    return HighlightInfo.newHighlightInfo(highlightInfoType).range(refNameElement).descriptionAndTooltip(message).create();
+    HighlightDisplayLevel displayLevel = strongError ? HighlightDisplayLevel.ERROR : GrUnresolvedAccessInspection.getHighlightDisplayLevel(ref.getProject(), ref);
+    return GrInspectionUtil.createAnnotationForRef(ref, displayLevel, message);
   }
 
   @Nullable
@@ -533,31 +511,44 @@
     }
     else if (canBeClassOrPackage(refElement)) {
       if (shouldBeInterface(refElement)) {
-        QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement,
-                                                                                                             CreateClassKind.INTERFACE), key);
+        QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement, GrCreateClassKind.INTERFACE), key);
+        QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement, GrCreateClassKind.TRAIT), key);
       }
       else if (shouldBeClass(refElement)) {
-        QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement, CreateClassKind.CLASS), key);
-        QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement,
-                                                                                                             CreateClassKind.ENUM), key);
+        QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement, GrCreateClassKind.CLASS), key);
+        QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement, GrCreateClassKind.ENUM), key);
       }
       else if (shouldBeAnnotation(refElement)) {
-        QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement,
-                                                                                                             CreateClassKind.ANNOTATION), key);
+        QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement, GrCreateClassKind.ANNOTATION), key);
       }
       else {
-        QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement,
-                                                                                                             CreateClassKind.CLASS), key);
-        QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement,
-                                                                                                             CreateClassKind.INTERFACE), key);
-        QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement,
-                                                                                                             CreateClassKind.ENUM), key);
-        QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement,
-                                                                                                             CreateClassKind.ANNOTATION), key);
+        QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement, GrCreateClassKind.CLASS), key);
+        QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement, GrCreateClassKind.INTERFACE), key);
+
+        if (!refElement.isQualified() || resolvesToGroovy(refElement.getQualifier())) {
+          QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement, GrCreateClassKind.TRAIT), key);
+        }
+
+        QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement, GrCreateClassKind.ENUM), key);
+        QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createClassFixAction(refElement, GrCreateClassKind.ANNOTATION), key);
       }
     }
   }
 
+  private static boolean resolvesToGroovy(PsiElement qualifier) {
+    if (qualifier instanceof GrReferenceElement) {
+      return ((GrReferenceElement)qualifier).resolve() instanceof GroovyPsiElement;
+    }
+    if (qualifier instanceof GrExpression) {
+      PsiType type = ((GrExpression)qualifier).getType();
+      if (type instanceof PsiClassType) {
+        PsiClass resolved = ((PsiClassType)type).resolve();
+        return resolved instanceof GroovyPsiElement;
+      }
+    }
+    return false;
+  }
+
   private static boolean canBeClassOrPackage(@NotNull GrReferenceElement refElement) {
     return !(refElement instanceof GrReferenceExpression) || ResolveUtil.canBeClassOrPackage((GrReferenceExpression)refElement);
   }
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeStyle/GrReferenceAdjuster.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeStyle/GrReferenceAdjuster.java
new file mode 100644
index 0000000..7d07835
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeStyle/GrReferenceAdjuster.java
@@ -0,0 +1,271 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.codeStyle;
+
+import com.intellij.lang.ASTNode;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.ReferenceAdjuster;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.util.ArrayUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.groovy.debugger.fragments.GroovyCodeFragment;
+import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocComment;
+import org.jetbrains.plugins.groovy.lang.psi.*;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
+import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.imports.GrImportStatement;
+import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement;
+import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeArgumentList;
+import org.jetbrains.plugins.groovy.lang.psi.impl.GrReferenceElementImpl;
+import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyCodeStyleSettingsFacade;
+import org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil;
+import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrBindingVariable;
+import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
+
+/**
+ * @author Max Medvedev
+ */
+public class GrReferenceAdjuster implements ReferenceAdjuster {
+  public GrReferenceAdjuster() {
+    @SuppressWarnings("UnusedDeclaration") int i = 0;
+  }
+
+  public static void shortenAllReferencesIn(@Nullable GroovyPsiElement newTypeElement) {
+    if (newTypeElement != null) {
+      newTypeElement.accept(new GroovyRecursiveElementVisitor() {
+        @Override
+        public void visitCodeReferenceElement(GrCodeReferenceElement refElement) {
+          super.visitCodeReferenceElement(refElement);
+          shortenReference(refElement);
+        }
+      });
+    }
+  }
+
+  @Override
+  public ASTNode process(@NotNull ASTNode element, boolean addImports, boolean incompleteCode, boolean useFqInJavadoc, boolean useFqInCode) {
+    final TextRange range = element.getTextRange();
+    process(element.getPsi(), range.getStartOffset(), range.getEndOffset(), addImports, incompleteCode, useFqInJavadoc, useFqInCode);
+    return element;
+  }
+
+  @Override
+  public ASTNode process(@NotNull ASTNode element, boolean addImports, boolean incompleteCode, Project project) {
+    GroovyCodeStyleSettingsFacade facade = GroovyCodeStyleSettingsFacade.getInstance(project);
+    return process(element, addImports, incompleteCode, facade.useFqClassNamesInJavadoc(), facade.useFqClassNames());
+  }
+
+  @Override
+  public void processRange(@NotNull ASTNode element, int startOffset, int endOffset, boolean useFqInJavadoc, boolean useFqInCode) {
+    process(element.getPsi(), startOffset, endOffset, true, true, useFqInJavadoc, useFqInCode);
+  }
+
+  @Override
+  public void processRange(@NotNull ASTNode element, int startOffset, int endOffset, Project project) {
+    GroovyCodeStyleSettingsFacade facade = GroovyCodeStyleSettingsFacade.getInstance(project);
+    processRange(element, startOffset, endOffset, facade.useFqClassNamesInJavadoc(), facade.useFqClassNames());
+  }
+
+  private static boolean process(@NotNull PsiElement element,
+                                 int start,
+                                 int end,
+                                 boolean addImports,
+                                 boolean incomplete,
+                                 boolean useFqInJavadoc,
+                                 boolean useFqInCode) {
+    boolean result = false;
+    if (element instanceof GrQualifiedReference<?> && ((GrQualifiedReference)element).resolve() instanceof PsiClass) {
+      result = shortenReferenceInner((GrQualifiedReference<?>)element, addImports, incomplete, useFqInJavadoc, useFqInCode);
+    }
+    else if (element instanceof GrReferenceExpression && PsiUtil.isSuperReference(((GrReferenceExpression)element).getQualifier())) {
+      result = shortenReferenceInner((GrReferenceExpression)element, addImports, incomplete, useFqInJavadoc, useFqInCode);
+    }
+
+    PsiElement child = element.getFirstChild();
+    while (child != null) {
+      final TextRange range = child.getTextRange();
+      if (start < range.getEndOffset() && range.getStartOffset() < end) {
+        result |= process(child, start, end, addImports, incomplete, useFqInJavadoc, useFqInCode);
+      }
+      child = child.getNextSibling();
+    }
+    return result;
+  }
+
+  public static <T extends PsiElement> boolean shortenReference(@NotNull GrQualifiedReference<T> ref) {
+    GroovyCodeStyleSettingsFacade facade = GroovyCodeStyleSettingsFacade.getInstance(ref.getProject());
+    boolean result = shortenReferenceInner(ref, true, false, facade.useFqClassNamesInJavadoc(), facade.useFqClassNames());
+    final TextRange range = ref.getTextRange();
+    result |= process(ref, range.getStartOffset(), range.getEndOffset(), true, false, facade.useFqClassNamesInJavadoc(), facade.useFqClassNames());
+    return result;
+  }
+
+  private static <Qualifier extends PsiElement> boolean shortenReferenceInner(@NotNull GrQualifiedReference<Qualifier> ref,
+                                                                              boolean addImports,
+                                                                              boolean incomplete,
+                                                                              boolean useFqInJavadoc,
+                                                                              boolean useFqInCode) {
+
+    final Qualifier qualifier = ref.getQualifier();
+    if (qualifier == null || PsiUtil.isSuperReference(qualifier) || cannotShortenInContext(ref)) {
+      return false;
+    }
+
+    if (ref instanceof GrReferenceExpression) {
+      final GrTypeArgumentList typeArgs = ((GrReferenceExpression)ref).getTypeArgumentList();
+      if (typeArgs != null && typeArgs.getTypeArgumentElements().length > 0) {
+        return false;
+      }
+    }
+
+    if (!shorteningIsMeaningfully(ref, useFqInJavadoc, useFqInCode)) return false;
+
+    final PsiElement resolved = resolveRef(ref, incomplete);
+    if (resolved == null) return false;
+
+    if (!checkCopyWithoutQualifier(ref, addImports, resolved)) return false;
+    ref.setQualifier(null);
+    return true;
+  }
+
+  private static <Qualifier extends PsiElement> boolean checkCopyWithoutQualifier(@NotNull GrQualifiedReference<Qualifier> ref,
+                                                                                  boolean addImports,
+                                                                                  @NotNull PsiElement resolved) {
+    final GrQualifiedReference<Qualifier> copy = getCopy(ref);
+    if (copy == null) return false;
+    copy.setQualifier(null);
+
+    final PsiElement resolvedCopy = copy.resolve();
+    if (ref.getManager().areElementsEquivalent(resolved, resolvedCopy)) {
+      return true;
+    }
+    else if (resolvedCopy != null && !(resolvedCopy instanceof GrBindingVariable) && !isFromDefaultPackage(resolvedCopy)) {
+      return false;
+    }
+
+    if (resolved instanceof PsiClass) {
+      final PsiClass clazz = (PsiClass)resolved;
+      final String qName = clazz.getQualifiedName();
+      if (qName != null && addImports && checkIsInnerClass(clazz, ref) && mayInsertImport(ref)) {
+        final GroovyFileBase file = (GroovyFileBase)ref.getContainingFile();
+        final GrImportStatement added = file.addImportForClass(clazz);
+        if (added != null) {
+          if (copy.isReferenceTo(resolved)) return true;
+          file.removeImport(added);
+        }
+      }
+    }
+
+    return false;
+  }
+
+  private static boolean isFromDefaultPackage(@Nullable PsiElement element) {
+    if (element instanceof PsiClass) {
+      String qname = ((PsiClass)element).getQualifiedName();
+      if (qname != null) {
+        String packageName = StringUtil.getPackageName(qname);
+        if (ArrayUtil.contains(packageName, GroovyFileBase.IMPLICITLY_IMPORTED_PACKAGES)) {
+          return true;
+        }
+        if (ArrayUtil.contains(qname, GroovyFileBase.IMPLICITLY_IMPORTED_CLASSES)) {
+          return true;
+        }
+      }
+    }
+
+    return false;
+  }
+
+  private static <Qualifier extends PsiElement> boolean checkIsInnerClass(@NotNull PsiClass resolved, GrQualifiedReference<Qualifier> ref) {
+    final PsiClass containingClass = resolved.getContainingClass();
+    return containingClass == null ||
+           PsiTreeUtil.isAncestor(containingClass, ref, true) ||
+           GroovyCodeStyleSettingsFacade.getInstance(containingClass.getProject()).insertInnerClassImports();
+  }
+
+  @Nullable
+  private static <Qualifier extends PsiElement> PsiElement resolveRef(@NotNull GrQualifiedReference<Qualifier> ref, boolean incomplete) {
+    if (!incomplete) return ref.resolve();
+
+    PsiResolveHelper helper = JavaPsiFacade.getInstance(ref.getProject()).getResolveHelper();
+    if (ref instanceof GrReferenceElement) {
+      final String classNameText = ((GrReferenceElement)ref).getClassNameText();
+      return helper.resolveReferencedClass(classNameText, ref);
+    }
+    return null;
+  }
+
+
+  @SuppressWarnings("unchecked")
+  @Nullable
+  private static <Qualifier extends PsiElement> GrQualifiedReference<Qualifier> getCopy(@NotNull GrQualifiedReference<Qualifier> ref) {
+    if (ref.getParent() instanceof GrMethodCall) {
+      final GrMethodCall copy = ((GrMethodCall)ref.getParent().copy());
+      return (GrQualifiedReference<Qualifier>)copy.getInvokedExpression();
+    }
+    return (GrQualifiedReference<Qualifier>)ref.copy();
+  }
+
+  private static <Qualifier extends PsiElement> boolean shorteningIsMeaningfully(@NotNull GrQualifiedReference<Qualifier> ref,
+                                                                                 boolean useFqInJavadoc, boolean useFqInCode) {
+
+    if (ref instanceof GrReferenceElementImpl && ((GrReferenceElementImpl)ref).isFullyQualified()) {
+      final GrDocComment doc = PsiTreeUtil.getParentOfType(ref, GrDocComment.class);
+      if (doc != null) {
+        if (useFqInJavadoc) return false;
+      }
+      else {
+        if (useFqInCode) return false;
+      }
+    }
+
+    final Qualifier qualifier = ref.getQualifier();
+
+    if (qualifier instanceof GrCodeReferenceElement) {
+      return true;
+    }
+
+    if (qualifier instanceof GrExpression) {
+      if (qualifier instanceof GrReferenceExpression && PsiUtil.isThisReference(qualifier)) return true;
+      if (qualifier instanceof GrReferenceExpression &&
+          PsiImplUtil.seemsToBeQualifiedClassName((GrExpression)qualifier)) {
+        final PsiElement resolved = ((GrReferenceExpression)qualifier).resolve();
+        if (resolved instanceof PsiClass || resolved instanceof PsiPackage) return true;
+      }
+    }
+    return false;
+  }
+
+  private static <Qualifier extends PsiElement> boolean cannotShortenInContext(@NotNull GrQualifiedReference<Qualifier> ref) {
+    return PsiTreeUtil.getParentOfType(ref, GrImportStatement.class) != null ||
+           PsiTreeUtil.getParentOfType(ref, GroovyCodeFragment.class) != null;
+  }
+
+  private static <Qualifier extends PsiElement> boolean mayInsertImport(@NotNull GrQualifiedReference<Qualifier> ref) {
+    return !(ref.getContainingFile() instanceof GroovyCodeFragment) &&
+           PsiTreeUtil.getParentOfType(ref, GrImportStatement.class) == null &&
+           ref.getContainingFile() instanceof GroovyFileBase;
+  }
+
+  public static GrReferenceAdjuster getInstance() {
+    return new GrReferenceAdjuster();
+  }
+}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/configSlurper/ConfigSlurperMapContentProvider.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/configSlurper/ConfigSlurperMapContentProvider.java
new file mode 100644
index 0000000..20b4ad2
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/configSlurper/ConfigSlurperMapContentProvider.java
@@ -0,0 +1,125 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.configSlurper;
+
+import com.intellij.openapi.util.Pair;
+import com.intellij.openapi.util.Ref;
+import com.intellij.psi.JavaPsiFacade;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiType;
+import com.intellij.util.PairConsumer;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.groovy.extensions.GroovyMapContentProvider;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
+import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiManager;
+import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
+
+import java.util.*;
+
+/**
+ * @author Sergey Evdokimov
+ */
+public class ConfigSlurperMapContentProvider extends GroovyMapContentProvider {
+
+  @Nullable
+  private static Pair<ConfigSlurperSupport.PropertiesProvider, List<String>> getInfo(@NotNull GrExpression qualifier,
+                                                                                     @Nullable PsiElement resolve) {
+    if (!GroovyPsiManager.isInheritorCached(qualifier.getType(), GroovyCommonClassNames.GROOVY_UTIL_CONFIG_OBJECT)) {
+      return null;
+    }
+
+    GrExpression resolvedQualifier = qualifier;
+    PsiElement resolveResult = resolve;
+    List<String> path = new ArrayList<String>();
+
+    while (resolveResult == null) {
+      if (!(resolvedQualifier instanceof GrReferenceExpression)) return null;
+
+      GrReferenceExpression expr = (GrReferenceExpression)resolvedQualifier;
+      path.add(expr.getReferenceName());
+
+      resolvedQualifier = expr.getQualifierExpression();
+      if (resolvedQualifier instanceof GrReferenceExpression) {
+        resolveResult = ((GrReferenceExpression)resolvedQualifier).resolve();
+      }
+      else if (resolvedQualifier instanceof GrMethodCall) {
+        resolveResult = ((GrMethodCall)resolvedQualifier).resolveMethod();
+      }
+      else {
+        return null;
+      }
+    }
+
+    Collections.reverse(path);
+
+    ConfigSlurperSupport.PropertiesProvider propertiesProvider = null;
+
+    for (ConfigSlurperSupport slurperSupport : ConfigSlurperSupport.EP_NAME.getExtensions()) {
+      propertiesProvider = slurperSupport.getConfigSlurperInfo(resolvedQualifier, resolveResult);
+      if (propertiesProvider != null) break;
+    }
+
+    if (propertiesProvider == null) return null;
+
+    return Pair.create(propertiesProvider, path);
+  }
+
+  @Override
+  protected Collection<String> getKeyVariants(@NotNull GrExpression qualifier, @Nullable PsiElement resolve) {
+    Pair<ConfigSlurperSupport.PropertiesProvider, List<String>> info = getInfo(qualifier, resolve);
+    if (info == null) return Collections.emptyList();
+
+    final Set<String> res = new HashSet<String>();
+
+    info.first.collectVariants(info.second, new PairConsumer<String, Boolean>() {
+      @Override
+      public void consume(String variant, Boolean isFinal) {
+        res.add(variant);
+      }
+    });
+
+    return res;
+  }
+
+  @Override
+  public PsiType getValueType(@NotNull GrExpression qualifier, @Nullable PsiElement resolve, @NotNull final String key) {
+    Pair<ConfigSlurperSupport.PropertiesProvider, List<String>> info = getInfo(qualifier, resolve);
+    if (info == null) return null;
+
+    final Ref<Boolean> res = new Ref<Boolean>();
+
+    info.first.collectVariants(info.second, new PairConsumer<String, Boolean>() {
+      @Override
+      public void consume(String variant, Boolean isFinal) {
+        if (variant.equals(key)) {
+          res.set(isFinal);
+        }
+        else if (variant.startsWith(key) && variant.length() > key.length() && variant.charAt(key.length()) == '.') {
+          res.set(false);
+        }
+      }
+    });
+
+    if (res.get() != null && !res.get()) {
+      return JavaPsiFacade.getElementFactory(qualifier.getProject()).createTypeByFQClassName(GroovyCommonClassNames.GROOVY_UTIL_CONFIG_OBJECT, qualifier.getResolveScope());
+    }
+
+    return null;
+  }
+}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/configSlurper/ConfigSlurperSupport.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/configSlurper/ConfigSlurperSupport.java
new file mode 100644
index 0000000..007d51d
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/configSlurper/ConfigSlurperSupport.java
@@ -0,0 +1,48 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.configSlurper;
+
+import com.intellij.openapi.extensions.ExtensionPointName;
+import com.intellij.psi.PsiElement;
+import com.intellij.util.PairConsumer;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
+
+import java.util.List;
+
+/**
+ * @author Sergey Evdokimov
+ */
+public abstract class ConfigSlurperSupport {
+
+  public static final ExtensionPointName<ConfigSlurperSupport> EP_NAME =
+    ExtensionPointName.create("org.intellij.groovy.configSlurperSupport");
+
+  @Nullable
+  public abstract PropertiesProvider getProvider(@NotNull GroovyFile file);
+
+  @Nullable
+  public PropertiesProvider getConfigSlurperInfo(@NotNull GrExpression qualifier, @NotNull PsiElement qualifierResolve) {
+    return null;
+  }
+
+  public interface PropertiesProvider {
+    void collectVariants(@NotNull List<String> prefix, @NotNull PairConsumer<String, Boolean> consumer);
+  }
+
+}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/configSlurper/GroovyMapValueTypeEnhancer.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/configSlurper/GroovyMapValueTypeEnhancer.java
new file mode 100644
index 0000000..3d4bd66
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/configSlurper/GroovyMapValueTypeEnhancer.java
@@ -0,0 +1,75 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.configSlurper;
+
+import com.intellij.psi.CommonClassNames;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiType;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.groovy.extensions.GroovyMapContentProvider;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
+import org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType;
+import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiManager;
+import org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrReferenceTypeEnhancer;
+
+/**
+ * @author Sergey Evdokimov
+ */
+public class GroovyMapValueTypeEnhancer extends GrReferenceTypeEnhancer {
+  @Override
+  public PsiType getReferenceType(GrReferenceExpression ref, @Nullable PsiElement resolved) {
+    if (resolved != null) return null;
+
+    GrExpression qualifierExpression = ref.getQualifierExpression();
+    if (qualifierExpression == null) return null;
+
+    PsiType mapType = qualifierExpression.getType();
+
+    if (!GroovyPsiManager.isInheritorCached(mapType, CommonClassNames.JAVA_UTIL_MAP)) {
+      return null;
+    }
+
+    PsiElement qResolved;
+
+    if (qualifierExpression instanceof GrReferenceExpression) {
+      qResolved = ((GrReferenceExpression)qualifierExpression).resolve();
+    }
+    else if (qualifierExpression instanceof GrMethodCall) {
+      qResolved = ((GrMethodCall)qualifierExpression).resolveMethod();
+    }
+    else {
+      return null;
+    }
+
+    String key = ref.getReferenceName();
+    if (key == null) return null;
+
+    for (GroovyMapContentProvider provider : GroovyMapContentProvider.EP_NAME.getExtensions()) {
+      PsiType type = provider.getValueType(qualifierExpression, qResolved, key);
+      if (type != null) {
+        return type;
+      }
+    }
+
+    if (mapType instanceof GrMapType) {
+      return ((GrMapType)mapType).getTypeByStringKey(key);
+    }
+
+    return null;
+  }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/fragments/GroovyCodeFragment.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/debugger/fragments/GroovyCodeFragment.java
similarity index 100%
rename from plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/fragments/GroovyCodeFragment.java
rename to plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/debugger/fragments/GroovyCodeFragment.java
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dgm/DGMImplicitPropertyUsageProvider.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dgm/DGMImplicitPropertyUsageProvider.java
new file mode 100644
index 0000000..c9ea204
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dgm/DGMImplicitPropertyUsageProvider.java
@@ -0,0 +1,34 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.dgm;
+
+import com.intellij.codeInspection.unused.ImplicitPropertyUsageProvider;
+import com.intellij.lang.properties.psi.Property;
+import com.intellij.util.ArrayUtil;
+
+/**
+ * @author Max Medvedev
+ */
+public class DGMImplicitPropertyUsageProvider extends ImplicitPropertyUsageProvider {
+  @Override
+  protected boolean isUsed(Property property) {
+    if (DGMUtil.isInDGMFile(property)) {
+      String name = property.getName();
+      return ArrayUtil.find(DGMUtil.KEYS, name) >= 0;
+    }
+    return  false;
+  }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMMemberContributor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dgm/DGMMemberContributor.java
similarity index 100%
rename from plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMMemberContributor.java
rename to plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dgm/DGMMemberContributor.java
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dgm/DGMUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dgm/DGMUtil.java
new file mode 100644
index 0000000..09c00af
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dgm/DGMUtil.java
@@ -0,0 +1,36 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.dgm;
+
+import com.intellij.lang.properties.psi.PropertiesFile;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.SystemInfo;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+
+/**
+ * @author Max Medvedev
+ */
+public class DGMUtil {
+  public static final String[] KEYS = new String[]{"moduleName", "moduleVersion", "extensionClasses", "staticExtensionClasses",};
+
+  public static boolean isInDGMFile(PsiElement e) {
+    PsiFile file = e.getContainingFile();
+    return file instanceof PropertiesFile &&
+           Comparing.equal(file.getName(), GroovyExtensionProvider.ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE,
+                           SystemInfo.isFileSystemCaseSensitive);
+  }
+}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dgm/GroovyExtensionProvider.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dgm/GroovyExtensionProvider.java
new file mode 100644
index 0000000..b77d57f
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dgm/GroovyExtensionProvider.java
@@ -0,0 +1,89 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.dgm;
+
+import com.intellij.lang.properties.IProperty;
+import com.intellij.lang.properties.psi.PropertiesFile;
+import com.intellij.openapi.components.ServiceManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.util.Couple;
+import com.intellij.psi.JavaPsiFacade;
+import com.intellij.psi.PsiDirectory;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiPackage;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NonNls;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Max Medvedev
+ */
+public class GroovyExtensionProvider {
+  @NonNls public static final String ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE = "org.codehaus.groovy.runtime.ExtensionModule";
+  private final Project myProject;
+
+  public GroovyExtensionProvider(Project project) {
+    myProject = project;
+  }
+
+  public static GroovyExtensionProvider getInstance(Project project) {
+    return ServiceManager.getService(project, GroovyExtensionProvider.class);
+  }
+
+  public Couple<List<String>> collectExtensions(GlobalSearchScope resolveScope) {
+    PsiPackage aPackage = JavaPsiFacade.getInstance(myProject).findPackage("META-INF.services");
+    if (aPackage == null) {
+      return Couple.of(Collections.<String>emptyList(), Collections.<String>emptyList());
+    }
+
+
+    List<String> instanceClasses = new ArrayList<String>();
+    List<String> staticClasses = new ArrayList<String>();
+    for (PsiDirectory directory : aPackage.getDirectories(resolveScope)) {
+      PsiFile file = directory.findFile(ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE);
+      if (file instanceof PropertiesFile) {
+        IProperty inst = ((PropertiesFile)file).findPropertyByKey("extensionClasses");
+        IProperty stat = ((PropertiesFile)file).findPropertyByKey("staticExtensionClasses");
+
+        if (inst != null) collectClasses(inst, instanceClasses);
+        if (stat != null) collectClasses(stat, staticClasses);
+      }
+    }
+
+    return Couple.of(instanceClasses, staticClasses);
+  }
+
+  private static void collectClasses(IProperty pr, List<String> classes) {
+    String value = pr.getUnescapedValue();
+    if (value == null) return;
+    value = value.trim();
+    String[] qnames = value.split("\\s*,\\s*");
+    ContainerUtil.addAll(classes, qnames);
+  }
+  
+  public static class GroovyExtensionVetoSPI implements Condition<String> {
+
+    @Override
+    public boolean value(String s) {
+      return ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE.equals(s);
+    }
+  }
+}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslAnnotator.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslAnnotator.java
new file mode 100644
index 0000000..72ba86b
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslAnnotator.java
@@ -0,0 +1,100 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.dsl;
+
+import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
+import com.intellij.codeInsight.intention.IntentionAction;
+import com.intellij.lang.annotation.Annotation;
+import com.intellij.lang.annotation.AnnotationHolder;
+import com.intellij.lang.annotation.Annotator;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.fileEditor.FileDocumentManager;
+import com.intellij.openapi.project.DumbAware;
+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.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.groovy.codeInspection.GroovyQuickFixFactory;
+import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
+
+/**
+ * @author peter
+ */
+public class GroovyDslAnnotator implements Annotator, DumbAware {
+
+  @Override
+  public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder holder) {
+    if (psiElement instanceof GroovyFile) {
+      final VirtualFile vfile = ((GroovyFile)psiElement).getVirtualFile();
+      if (vfile != null && "gdsl".equals(vfile.getExtension()) &&
+          (!GroovyDslFileIndex.isActivated(vfile) || FileDocumentManager.getInstance().isFileModified(vfile))) {
+        final String reason = GroovyDslFileIndex.getInactivityReason(vfile);
+        final String message;
+        boolean modified = reason == null || GroovyDslFileIndex.MODIFIED.equals(reason);
+        if (modified) {
+          message = "DSL descriptor file has been changed and isn't currently executed.";
+        } else {
+          message = "DSL descriptor file has been disabled due to a processing error.";
+        }
+        final Annotation annotation = holder.createWarningAnnotation(psiElement, message);
+        annotation.setFileLevelAnnotation(true);
+        if (!modified) {
+          annotation.registerFix(GroovyQuickFixFactory.getInstance().createInvestigateFix(reason));
+        }
+        annotation.registerFix(new ActivateFix(vfile));
+      }
+    }
+  }
+
+  private static class ActivateFix implements IntentionAction {
+    private final VirtualFile myVfile;
+
+    public ActivateFix(VirtualFile vfile) {
+      myVfile = vfile;
+    }
+
+    @Override
+    @NotNull
+    public String getText() {
+      return "Activate back";
+    }
+
+    @Override
+    @NotNull
+    public String getFamilyName() {
+      return "Activate DSL descriptor";
+    }
+
+    @Override
+    public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
+      return true;
+    }
+
+    @Override
+    public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
+      FileDocumentManager.getInstance().saveAllDocuments();
+      GroovyDslFileIndex.activateUntilModification(myVfile);
+      DaemonCodeAnalyzer.getInstance(project).restart();
+    }
+
+    @Override
+    public boolean startInWriteAction() {
+      return false;
+    }
+  }
+}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java
index a91f8f1..ae0b756 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/dsl/GroovyDslFileIndex.java
@@ -318,12 +318,12 @@
             return;
           }
 
-          Set<Class> classes = ContainerUtil.map2Set(extensions, new Function<GroovyFrameworkConfigNotification, Class>() {
+          Set<Class> classes = new HashSet<Class>(ContainerUtil.map2Set(extensions, new Function<GroovyFrameworkConfigNotification, Class>() {
             @Override
             public Class fun(GroovyFrameworkConfigNotification notification) {
               return notification.getClass();
             }
-          });
+          }));
           classes.add(GroovyFrameworkConfigNotification.class); // for default extension
 
           // perhaps a separate extension for that?
@@ -349,7 +349,7 @@
                       executors.add(Pair.create(child, new GroovyDslExecutor(text, fileName)));
                     }
                     catch (IOException e) {
-                      LOG.error(e);
+                      LOG.error("Error while parsing gdsl file " + fileName, e);
                     }
                   }
                 }
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/extensions/GroovyMapContentProvider.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/extensions/GroovyMapContentProvider.java
new file mode 100644
index 0000000..ee5b3a4
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/extensions/GroovyMapContentProvider.java
@@ -0,0 +1,43 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.extensions;
+
+import com.intellij.openapi.extensions.ExtensionPointName;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiType;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
+
+import java.util.Collection;
+
+/**
+ * @author Sergey Evdokimov
+ */
+public abstract class GroovyMapContentProvider {
+
+  public static final ExtensionPointName<GroovyMapContentProvider> EP_NAME = ExtensionPointName.create("org.intellij.groovy.mapContentProvider");
+
+  protected Collection<String> getKeyVariants(@NotNull GrExpression qualifier, @Nullable PsiElement resolve) {
+    throw new UnsupportedOperationException();
+  }
+
+  @Nullable
+  public PsiType getValueType(@NotNull GrExpression qualifier, @Nullable PsiElement resolve, @NotNull String key) {
+    return null;
+  }
+
+}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/AccessorMethodReferencesSearcher.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/AccessorMethodReferencesSearcher.java
index fe3b1c7..2c4dda5 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/AccessorMethodReferencesSearcher.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/AccessorMethodReferencesSearcher.java
@@ -36,7 +36,7 @@
  */
 public class AccessorMethodReferencesSearcher extends QueryExecutorBase<PsiReference, MethodReferencesSearch.SearchParameters> {
 
-  protected AccessorMethodReferencesSearcher() {
+  public AccessorMethodReferencesSearcher() {
     super(true);
   }
 
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/AccessorReferencesSearcher.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/AccessorReferencesSearcher.java
index bcbc6ab..d79f946 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/AccessorReferencesSearcher.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/AccessorReferencesSearcher.java
@@ -34,7 +34,7 @@
  */
 public class AccessorReferencesSearcher extends QueryExecutorBase<PsiReference, ReferencesSearch.SearchParameters> {
 
-  protected AccessorReferencesSearcher() {
+  public AccessorReferencesSearcher() {
     super(true);
   }
 
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/ConstructorReferencesSearcher.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/ConstructorReferencesSearcher.java
index 6233992..e43ef29 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/ConstructorReferencesSearcher.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/ConstructorReferencesSearcher.java
@@ -27,7 +27,7 @@
  * @author ven
  */
 public class ConstructorReferencesSearcher extends QueryExecutorBase<PsiReference, ReferencesSearch.SearchParameters> {
-  protected ConstructorReferencesSearcher() {
+  public ConstructorReferencesSearcher() {
     super(true);
   }
 
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/GroovyReflectedMethodReferenceSearcher.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/GroovyReflectedMethodReferenceSearcher.java
index 6a91a67..9295182 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/GroovyReflectedMethodReferenceSearcher.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/GroovyReflectedMethodReferenceSearcher.java
@@ -28,7 +28,7 @@
  * @author Max Medvedev
  */
 public class GroovyReflectedMethodReferenceSearcher extends QueryExecutorBase<PsiReference, MethodReferencesSearch.SearchParameters> {
-  protected GroovyReflectedMethodReferenceSearcher() {
+  public GroovyReflectedMethodReferenceSearcher() {
     super(true);
   }
 
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/GroovyScopeUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/GroovyScopeUtil.java
index c503938..81f6b16 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/GroovyScopeUtil.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/GroovyScopeUtil.java
@@ -34,7 +34,7 @@
 
   public static SearchScope restrictScopeToGroovyFiles(SearchScope originalScope, SearchScope effectiveScope) {
     SearchScope restricted = restrictScopeToGroovyFiles(originalScope);
-    return originalScope.intersectWith(effectiveScope);
+    return restricted.intersectWith(effectiveScope);
   }
 
 
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/GroovyTraitFieldSearcher.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/GroovyTraitFieldSearcher.java
index 2861980..fda9712 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/GroovyTraitFieldSearcher.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/GroovyTraitFieldSearcher.java
@@ -15,9 +15,7 @@
  */
 package org.jetbrains.plugins.groovy.findUsages;
 
-import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.QueryExecutorBase;
-import com.intellij.openapi.util.Computable;
 import com.intellij.psi.*;
 import com.intellij.psi.search.RequestResultProcessor;
 import com.intellij.psi.search.UsageSearchContext;
@@ -33,26 +31,21 @@
  * Created by Max Medvedev on 15/04/14
  */
 public class GroovyTraitFieldSearcher extends QueryExecutorBase<PsiReference, ReferencesSearch.SearchParameters> {
+  public GroovyTraitFieldSearcher() {
+    super(true);
+  }
+
   @Override
   public void processQuery(@NotNull ReferencesSearch.SearchParameters p, @NotNull Processor<PsiReference> consumer) {
     final PsiElement target = p.getElementToSearch();
 
-    String traitFieldName = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
-      @Override
-      public String compute() {
-        if (target instanceof GrField && !(target instanceof GrTraitField)) {
-          PsiClass aClass = ((GrField)target).getContainingClass();
-          if (GrTraitUtil.isTrait(aClass)) {
-            return GrTraitUtil.getTraitFieldPrefix(aClass) + ((GrField)target).getName();
-          }
-        }
+    if (target instanceof GrField && !(target instanceof GrTraitField)) {
+      PsiClass aClass = ((GrField)target).getContainingClass();
+      if (GrTraitUtil.isTrait(aClass)) {
+        String traitFieldName = GrTraitUtil.getTraitFieldPrefix(aClass) + ((GrField)target).getName();
 
-        return null;
+        p.getOptimizer().searchWord(traitFieldName, p.getEffectiveSearchScope(), UsageSearchContext.IN_CODE, true, target, new MyProcessor(target));
       }
-    });
-
-    if (traitFieldName != null) {
-      p.getOptimizer().searchWord(traitFieldName, p.getEffectiveSearchScope(), UsageSearchContext.IN_CODE, true, target, new MyProcessor(target));
     }
   }
 
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/CoreGroovyCodeStyleManager.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/CoreGroovyCodeStyleManager.java
new file mode 100644
index 0000000..5660dcb
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/CoreGroovyCodeStyleManager.java
@@ -0,0 +1,36 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.lang;
+
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
+import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
+import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.imports.GrImportStatement;
+import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyCodeStyleManager;
+
+public class CoreGroovyCodeStyleManager extends GroovyCodeStyleManager {
+  @NotNull
+  @Override
+  public GrImportStatement addImport(@NotNull GroovyFile psiFile, @NotNull GrImportStatement statement) throws IncorrectOperationException {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  public void removeImport(@NotNull GroovyFileBase psiFile, @NotNull GrImportStatement importStatement) throws IncorrectOperationException {
+    throw new UnsupportedOperationException();
+  }
+}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/CoreGroovyCodeStyleSettingsFacade.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/CoreGroovyCodeStyleSettingsFacade.java
new file mode 100644
index 0000000..2cc2b0b
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/CoreGroovyCodeStyleSettingsFacade.java
@@ -0,0 +1,70 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.lang;
+
+import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyCodeStyleSettingsFacade;
+
+public class CoreGroovyCodeStyleSettingsFacade extends GroovyCodeStyleSettingsFacade {
+  @Override
+  public boolean useFqClassNames() {
+    return false;
+  }
+
+  @Override
+  public boolean useFqClassNamesInJavadoc() {
+    return false;
+  }
+
+  @Override
+  public int staticFieldsOrderWeight() {
+    return 0;
+  }
+
+  @Override
+  public int fieldsOrderWeight() {
+    return 0;
+  }
+
+  @Override
+  public int staticMethodsOrderWeight() {
+    return 0;
+  }
+
+  @Override
+  public int methodsOrderWeight() {
+    return 0;
+  }
+
+  @Override
+  public int staticInnerClassesOrderWeight() {
+    return 0;
+  }
+
+  @Override
+  public int innerClassesOrderWeight() {
+    return 0;
+  }
+
+  @Override
+  public int constructorsOrderWeight() {
+    return 0;
+  }
+
+  @Override
+  public boolean insertInnerClassImports() {
+    return false;
+  }
+}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/EmptyGroovyQuickFixFactory.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/EmptyGroovyQuickFixFactory.java
new file mode 100644
index 0000000..343b76b
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/EmptyGroovyQuickFixFactory.java
@@ -0,0 +1,145 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.lang;
+
+import com.intellij.codeInsight.intention.IntentionAction;
+import com.intellij.codeInsight.intention.QuickFixes;
+import com.intellij.codeInspection.LocalQuickFix;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiType;
+import org.jetbrains.plugins.groovy.codeInspection.GroovyFix;
+import org.jetbrains.plugins.groovy.codeInspection.GroovyQuickFixFactory;
+import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentLabel;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrNamedArgument;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrNewExpression;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
+import org.jetbrains.plugins.groovy.lang.psi.api.util.GrVariableDeclarationOwner;
+
+public class EmptyGroovyQuickFixFactory extends GroovyQuickFixFactory {
+  @Override
+  public IntentionAction createDynamicMethodFix(GrReferenceExpression expression, PsiType[] types) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public IntentionAction createDynamicPropertyFix(GrReferenceExpression expression) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public IntentionAction createGroovyAddImportAction(GrReferenceElement element) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public IntentionAction createClassFromNewAction(GrNewExpression parent) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public IntentionAction createClassFixAction(GrReferenceElement element, GrCreateClassKind anInterface) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public IntentionAction createCreateFieldFromUsageFix(GrReferenceExpression expr) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public IntentionAction createCreateGetterFromUsageFix(GrReferenceExpression expr, PsiClass aClass) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public IntentionAction createCreateSetterFromUsageFix(GrReferenceExpression expr) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public IntentionAction createCreateMethodFromUsageFix(GrReferenceExpression expr) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public IntentionAction createCreateLocalVariableFromUsageFix(GrReferenceExpression expr, GrVariableDeclarationOwner owner) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public IntentionAction createCreateParameterFromUsageFix(GrReferenceExpression expr) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public IntentionAction createGroovyStaticImportMethodFix(GrMethodCall parent) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public GroovyFix createRenameFix() {
+    return GroovyFix.EMPTY_FIX;
+  }
+
+  @Override
+  public GroovyFix createReplaceWithImportFix() {
+    return GroovyFix.EMPTY_FIX;
+  }
+
+  @Override
+  public LocalQuickFix createGrMoveToDirFix(String actual) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public LocalQuickFix createCreateFieldFromConstructorLabelFix(GrTypeDefinition element, GrNamedArgument argument) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public LocalQuickFix createDynamicPropertyFix(GrArgumentLabel label, PsiClass element) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public GroovyFix createAddMethodFix(String methodName, GrTypeDefinition aClass) {
+    return GroovyFix.EMPTY_FIX;
+  }
+
+  @Override
+  public GroovyFix createAddClassToExtendsFix(GrTypeDefinition aClass, String comparable) {
+    return GroovyFix.EMPTY_FIX;
+  }
+
+  @Override
+  public IntentionAction createOptimizeImportsFix(boolean onTheFly) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public IntentionAction createRemoveUnusedGrParameterFix(GrParameter parameter) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public IntentionAction createInvestigateFix(String reason) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GrCreateClassKind.groovy b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GrCreateClassKind.groovy
new file mode 100644
index 0000000..8728502
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GrCreateClassKind.groovy
@@ -0,0 +1,39 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.lang
+
+import com.intellij.codeInsight.daemon.impl.quickfix.ClassKind
+
+/**
+ * Created by Max Medvedev on 28/05/14
+ */
+enum GrCreateClassKind implements ClassKind {
+  CLASS     ("class"),
+  INTERFACE ("interface"),
+  TRAIT     ("trait"),
+  ENUM      ("enum"),
+  ANNOTATION("annotation");
+
+  private final String myDescription;
+
+  public GrCreateClassKind(final String description) {
+    myDescription = description;
+  }
+
+  public String getDescription() {
+    return myDescription;
+  }
+}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyCoreEnvironment.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyCoreEnvironment.java
new file mode 100644
index 0000000..8fb238f
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovyCoreEnvironment.java
@@ -0,0 +1,333 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.lang;
+
+import com.intellij.codeInsight.daemon.ImplicitUsageProvider;
+import com.intellij.codeInsight.highlighting.ReadWriteAccessDetector;
+import com.intellij.codeInspection.unused.ImplicitPropertyUsageProvider;
+import com.intellij.core.CoreApplicationEnvironment;
+import com.intellij.core.CoreProjectEnvironment;
+import com.intellij.ide.IconProvider;
+import com.intellij.javaee.CoreExternalResourceManager;
+import com.intellij.javaee.ExternalResourceManagerEx;
+import com.intellij.lang.LanguageAnnotators;
+import com.intellij.lang.LanguageParserDefinitions;
+import com.intellij.lang.LanguageStructureViewBuilder;
+import com.intellij.lang.findUsages.LanguageFindUsages;
+import com.intellij.lang.folding.LanguageFolding;
+import com.intellij.mock.MockProject;
+import com.intellij.openapi.extensions.Extensions;
+import com.intellij.openapi.fileTypes.FileTypeRegistry;
+import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.pom.PomDeclarationSearcher;
+import com.intellij.problems.WolfTheProblemSolver;
+import com.intellij.psi.ClassTypePointerFactory;
+import com.intellij.psi.PsiElementFinder;
+import com.intellij.psi.ResolveScopeProvider;
+import com.intellij.psi.codeStyle.ReferenceAdjuster;
+import com.intellij.psi.impl.ExpressionConverter;
+import com.intellij.psi.impl.LanguageConstantExpressionEvaluator;
+import com.intellij.psi.impl.compiled.ClsCustomNavigationPolicy;
+import com.intellij.psi.search.PsiShortNamesCache;
+import com.intellij.psi.search.UseScopeEnlarger;
+import com.intellij.psi.search.searches.*;
+import com.intellij.psi.stubs.StubIndexExtension;
+import com.intellij.util.QueryExecutor;
+import com.intellij.util.indexing.FileBasedIndexExtension;
+import org.jetbrains.plugins.groovy.*;
+import org.jetbrains.plugins.groovy.annotator.GrAnnotatorImpl;
+import org.jetbrains.plugins.groovy.annotator.GrKeywordAndDeclarationHighlightFactory;
+import org.jetbrains.plugins.groovy.annotator.GrReferenceHighlighterFactory;
+import org.jetbrains.plugins.groovy.annotator.GroovyFrameworkConfigNotification;
+import org.jetbrains.plugins.groovy.annotator.checkers.*;
+import org.jetbrains.plugins.groovy.codeInsight.GroovyClsCustomNavigationPolicy;
+import org.jetbrains.plugins.groovy.codeInspection.GroovyQuickFixFactory;
+import org.jetbrains.plugins.groovy.codeInspection.declaration.GrMethodMayBeStaticInspectionFilter;
+import org.jetbrains.plugins.groovy.codeInspection.local.GroovyUnusedImportsPassFactory;
+import org.jetbrains.plugins.groovy.codeStyle.GrReferenceAdjuster;
+import org.jetbrains.plugins.groovy.configSlurper.ConfigSlurperMapContentProvider;
+import org.jetbrains.plugins.groovy.configSlurper.GroovyMapValueTypeEnhancer;
+import org.jetbrains.plugins.groovy.dgm.DGMImplicitPropertyUsageProvider;
+import org.jetbrains.plugins.groovy.dgm.DGMMemberContributor;
+import org.jetbrains.plugins.groovy.dgm.GroovyExtensionProvider;
+import org.jetbrains.plugins.groovy.dsl.DslActivationStatus;
+import org.jetbrains.plugins.groovy.dsl.GroovyDslAnnotator;
+import org.jetbrains.plugins.groovy.dsl.GroovyDslFileIndex;
+import org.jetbrains.plugins.groovy.dsl.dsltop.GdslMembersProvider;
+import org.jetbrains.plugins.groovy.dsl.dsltop.GroovyDslDefaultMembers;
+import org.jetbrains.plugins.groovy.dsl.psi.*;
+import org.jetbrains.plugins.groovy.extensions.*;
+import org.jetbrains.plugins.groovy.findUsages.*;
+import org.jetbrains.plugins.groovy.geb.*;
+import org.jetbrains.plugins.groovy.gpp.GppClosureParameterTypeProvider;
+import org.jetbrains.plugins.groovy.gpp.GppExpectedTypesContributor;
+import org.jetbrains.plugins.groovy.gpp.GppImplicitUsageProvider;
+import org.jetbrains.plugins.groovy.gpp.GppTypeConverter;
+import org.jetbrains.plugins.groovy.lang.folding.GroovyFoldingBuilder;
+import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
+import org.jetbrains.plugins.groovy.lang.parser.GroovyParserDefinition;
+import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory;
+import org.jetbrains.plugins.groovy.lang.psi.expectedTypes.GroovyExpectedTypesContributor;
+import org.jetbrains.plugins.groovy.lang.psi.impl.*;
+import org.jetbrains.plugins.groovy.lang.psi.impl.javaView.GroovyClassFinder;
+import org.jetbrains.plugins.groovy.lang.psi.impl.search.GrPrivateFieldScopeEnlarger;
+import org.jetbrains.plugins.groovy.lang.psi.impl.smartPointers.GrClassReferenceTypePointerFactory;
+import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.path.DefaultCallExpressionTypeCalculator;
+import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.path.GrDGMTypeCalculator;
+import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.path.GrDescriptorReturnTypeCalculator;
+import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.path.GrWithTraitTypeCalculator;
+import org.jetbrains.plugins.groovy.lang.psi.stubs.index.*;
+import org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.*;
+import org.jetbrains.plugins.groovy.lang.psi.util.GroovyConstantExpressionEvaluator;
+import org.jetbrains.plugins.groovy.lang.resolve.*;
+import org.jetbrains.plugins.groovy.lang.resolve.ast.*;
+import org.jetbrains.plugins.groovy.lang.resolve.noncode.GrCollectionTypeMembersProvider;
+import org.jetbrains.plugins.groovy.lang.resolve.noncode.MixinMemberContributor;
+import org.jetbrains.plugins.groovy.lang.stubs.GroovyShortNamesCache;
+import org.jetbrains.plugins.groovy.markup.XmlMarkupBuilderNonCodeMemberContributor;
+import org.jetbrains.plugins.groovy.spock.SpockMemberContributor;
+import org.jetbrains.plugins.groovy.spock.SpockPomDeclarationSearcher;
+import org.jetbrains.plugins.groovy.structure.GroovyStructureViewFactory;
+import org.jetbrains.plugins.groovy.swingBuilder.SwingBuilderNamedArgumentProvider;
+import org.jetbrains.plugins.groovy.swingBuilder.SwingBuilderNonCodeMemberContributor;
+
+/**
+ * Upsource
+ */
+@SuppressWarnings("UnusedDeclaration")
+public class GroovyCoreEnvironment {
+  public static class ApplicationEnvironment {
+    public ApplicationEnvironment(CoreApplicationEnvironment appEnvironment) {
+      appEnvironment.registerFileType(GroovyFileType.GROOVY_FILE_TYPE, GroovyFileType.DEFAULT_EXTENSION);
+
+      appEnvironment.addExplicitExtension(SyntaxHighlighterFactory.LANGUAGE_FACTORY, GroovyLanguage.INSTANCE,
+                                          new GroovySyntaxHighlighterFactory());
+
+      appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, GroovyLanguage.INSTANCE, new GroovyParserDefinition());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GrMethodComparator.EP_NAME, GrMethodComparator.class);
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), NonCodeMembersContributor.EP_NAME, NonCodeMembersContributor.class);
+      appEnvironment.addExtension(NonCodeMembersContributor.EP_NAME, new GebBrowserMemberContributor());
+      appEnvironment.addExtension(NonCodeMembersContributor.EP_NAME, new GebJUnitTestMemberContributor());
+      appEnvironment.addExtension(NonCodeMembersContributor.EP_NAME, new GebModuleMemberContributor());
+      appEnvironment.addExtension(NonCodeMembersContributor.EP_NAME, new GebPageMemberContributor());
+      appEnvironment.addExtension(NonCodeMembersContributor.EP_NAME, new GebSpockTestMemberContributor());
+      appEnvironment.addExtension(NonCodeMembersContributor.EP_NAME, new GebTestNGTestMemberContributor());
+      appEnvironment.addExtension(NonCodeMembersContributor.EP_NAME, new GrCollectionTypeMembersProvider());
+      appEnvironment.addExtension(NonCodeMembersContributor.EP_NAME, new MixinMemberContributor());
+      appEnvironment.addExtension(NonCodeMembersContributor.EP_NAME, new SpockMemberContributor());
+      appEnvironment.addExtension(NonCodeMembersContributor.EP_NAME, new XmlMarkupBuilderNonCodeMemberContributor());
+      appEnvironment.addExtension(NonCodeMembersContributor.EP_NAME, new DGMMemberContributor());
+      appEnvironment.addExtension(NonCodeMembersContributor.EP_NAME, new SwingBuilderNonCodeMemberContributor());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), DefaultImportContributor.EP_NAME, DefaultImportContributor.class);
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), AstTransformContributor.EP_NAME, AstTransformContributor.class);
+      appEnvironment.addExtension(AstTransformContributor.EP_NAME, new AutoCloneContributor());
+      appEnvironment.addExtension(AstTransformContributor.EP_NAME, new AutoExternalizeContributor());
+      appEnvironment.addExtension(AstTransformContributor.EP_NAME, new ConstructorAnnotationsProcessor());
+      appEnvironment.addExtension(AstTransformContributor.EP_NAME, new DelegatedMethodsContributor());
+      appEnvironment.addExtension(AstTransformContributor.EP_NAME, new GrInheritConstructorContributor());
+      appEnvironment.addExtension(AstTransformContributor.EP_NAME, new LoggingContributor());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClosureMissingMethodContributor.EP_NAME, ClosureMissingMethodContributor.class);
+      appEnvironment.addExtension(ClosureMissingMethodContributor.EP_NAME, new PluginXmlClosureMemberContributor());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GrVariableEnhancer.EP_NAME, GrVariableEnhancer.class);
+      appEnvironment.addExtension(GrVariableEnhancer.EP_NAME, new ClosureAsAnonymousParameterEnhancer());
+      appEnvironment.addExtension(GrVariableEnhancer.EP_NAME, new ClosureParameterEnhancer());
+      appEnvironment.addExtension(GrVariableEnhancer.EP_NAME, new ClosureParamsEnhancer());
+      appEnvironment.addExtension(GrVariableEnhancer.EP_NAME, new GppClosureParameterTypeProvider());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GrReferenceTypeEnhancer.EP_NAME, GrReferenceTypeEnhancer.class);
+      appEnvironment.addExtension(GrReferenceTypeEnhancer.EP_NAME, new GroovyMapValueTypeEnhancer());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GrTypeConverter.EP_NAME, GrTypeConverter.class);
+      appEnvironment.addExtension(GrTypeConverter.EP_NAME, new ClosureToSamConverter());
+      appEnvironment.addExtension(GrTypeConverter.EP_NAME, new GrBooleanTypeConverter());
+      appEnvironment.addExtension(GrTypeConverter.EP_NAME, new GrContainerConverter());
+      appEnvironment.addExtension(GrTypeConverter.EP_NAME, new GrContainerTypeConverter());
+      appEnvironment.addExtension(GrTypeConverter.EP_NAME, new GrGenericTypeConverter());
+      appEnvironment.addExtension(GrTypeConverter.EP_NAME, new GrNumberConverter());
+      appEnvironment.addExtension(GrTypeConverter.EP_NAME, new GrStringConverter());
+      appEnvironment.addExtension(GrTypeConverter.EP_NAME, new GrStringTypeConverter());
+      appEnvironment.addExtension(GrTypeConverter.EP_NAME, new GppTypeConverter());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyExpectedTypesContributor.EP_NAME, GroovyExpectedTypesContributor.class);
+      appEnvironment.addExtension(GroovyExpectedTypesContributor.EP_NAME, new GppExpectedTypesContributor());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyScriptTypeDetector.EP_NAME, GroovyScriptTypeDetector.class);
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyNamedArgumentProvider.EP_NAME, GroovyNamedArgumentProvider.class);
+      appEnvironment.addExtension(GroovyNamedArgumentProvider.EP_NAME, new GroovyConstructorNamedArgumentProvider());
+      appEnvironment.addExtension(GroovyNamedArgumentProvider.EP_NAME, new GroovyMethodReturnNamedArgumentProvider());
+      appEnvironment.addExtension(GroovyNamedArgumentProvider.EP_NAME, new GroovySourceCodeNamedArgumentProvider());
+      appEnvironment.addExtension(GroovyNamedArgumentProvider.EP_NAME, new SwingBuilderNamedArgumentProvider());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyMapContentProvider.EP_NAME, GroovyMapContentProvider.class);
+      appEnvironment.addExtension(GroovyMapContentProvider.EP_NAME, new ConfigSlurperMapContentProvider());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyUnresolvedHighlightFilter.EP_NAME, GroovyUnresolvedHighlightFilter.class);
+      appEnvironment.addExtension(GroovyUnresolvedHighlightFilter.EP_NAME, new GroovyUnresolvedReferenceFilterByFile());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyUnresolvedHighlightFileFilter.EP_NAME, GroovyUnresolvedHighlightFileFilter.class);
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GrCallExpressionTypeCalculator.EP_NAME, GrCallExpressionTypeCalculator.class);
+      appEnvironment.addExtension(GrCallExpressionTypeCalculator.EP_NAME, new DefaultCallExpressionTypeCalculator());
+      appEnvironment.addExtension(GrCallExpressionTypeCalculator.EP_NAME, new GrDescriptorReturnTypeCalculator());
+      appEnvironment.addExtension(GrCallExpressionTypeCalculator.EP_NAME, new GrDGMTypeCalculator());
+      appEnvironment.addExtension(GrCallExpressionTypeCalculator.EP_NAME, new GrWithTraitTypeCalculator());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyClassDescriptor.EP_NAME,
+                                                        GroovyClassDescriptor.class);
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyMethodDescriptorExtension.EP_NAME,
+                                                        GroovyMethodDescriptorExtension.class);
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), PsiEnhancerCategory.EP_NAME, PsiEnhancerCategory.class);
+      appEnvironment.addExtension(PsiEnhancerCategory.EP_NAME, new GrExpressionCategory());
+      appEnvironment.addExtension(PsiEnhancerCategory.EP_NAME, new PsiClassCategory());
+      appEnvironment.addExtension(PsiEnhancerCategory.EP_NAME, new PsiElementCategory());
+      appEnvironment.addExtension(PsiEnhancerCategory.EP_NAME, new PsiExpressionCategory());
+      appEnvironment.addExtension(PsiEnhancerCategory.EP_NAME, new PsiMethodCategory());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GdslMembersProvider.EP_NAME, GdslMembersProvider.class);
+      appEnvironment.addExtension(GdslMembersProvider.EP_NAME, new GdkMethodDslProvider());
+      appEnvironment.addExtension(GdslMembersProvider.EP_NAME, new GroovyDslDefaultMembers());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GroovyFrameworkConfigNotification.EP_NAME, GroovyFrameworkConfigNotification.class);
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), GrMethodMayBeStaticInspectionFilter.EP_NAME, GrMethodMayBeStaticInspectionFilter.class);
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), CustomAnnotationChecker.EP_NAME, CustomAnnotationChecker.class);
+      appEnvironment.addExtension(CustomAnnotationChecker.EP_NAME, new AnnotationCollectorChecker());
+      appEnvironment.addExtension(CustomAnnotationChecker.EP_NAME, new BaseScriptAnnotationChecker());
+      appEnvironment.addExtension(CustomAnnotationChecker.EP_NAME, new DelegatesToAnnotationChecker());
+      appEnvironment.addExtension(CustomAnnotationChecker.EP_NAME, new FieldAnnotationChecker());
+      appEnvironment.addExtension(CustomAnnotationChecker.EP_NAME, new GrabAnnotationChecker());
+      appEnvironment.addExtension(CustomAnnotationChecker.EP_NAME, new GrAliasAnnotationChecker());
+      appEnvironment.addExtension(CustomAnnotationChecker.EP_NAME, new NewifyAnnotationChecker());
+      appEnvironment.addExtension(CustomAnnotationChecker.EP_NAME, new TypeCheckedAnnotationChecker());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ImplicitPropertyUsageProvider.EP_NAME, ImplicitPropertyUsageProvider.class);
+      appEnvironment.addExtension(ImplicitPropertyUsageProvider.EP_NAME, new DGMImplicitPropertyUsageProvider());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ImplicitUsageProvider.EP_NAME, ImplicitUsageProvider.class);
+      appEnvironment.addExtension(ImplicitUsageProvider.EP_NAME, new GppImplicitUsageProvider());
+      appEnvironment.addExtension(ImplicitUsageProvider.EP_NAME, new GrImplicitUsageProvider());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), FileTypeRegistry.FileTypeDetector.EP_NAME, FileTypeRegistry.FileTypeDetector.class);
+      appEnvironment.addExtension(FileTypeRegistry.FileTypeDetector.EP_NAME, new GroovyHashBangFileTypeDetector());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClsCustomNavigationPolicy.EP_NAME, ClsCustomNavigationPolicy.class);
+      appEnvironment.addExtension(ClsCustomNavigationPolicy.EP_NAME, new GroovyClsCustomNavigationPolicy());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), PomDeclarationSearcher.EP_NAME, PomDeclarationSearcher.class);
+      appEnvironment.addExtension(PomDeclarationSearcher.EP_NAME, new GebContentDeclarationSearcher());
+      appEnvironment.addExtension(PomDeclarationSearcher.EP_NAME, new SpockPomDeclarationSearcher());
+
+      appEnvironment.addExplicitExtension(LanguageConstantExpressionEvaluator.INSTANCE, GroovyLanguage.INSTANCE, new GroovyConstantExpressionEvaluator());
+
+      appEnvironment.addExplicitExtension(ExpressionConverter.EP, GroovyLanguage.INSTANCE, new GroovyExpressionConverter());
+      appEnvironment.addExplicitExtension(LanguageAnnotators.INSTANCE, GroovyLanguage.INSTANCE, new GrAnnotatorImpl());
+      appEnvironment.addExplicitExtension(LanguageAnnotators.INSTANCE, GroovyLanguage.INSTANCE, new GroovyDslAnnotator());
+
+      appEnvironment.addExplicitExtension(LanguageStructureViewBuilder.INSTANCE, GroovyLanguage.INSTANCE, new GroovyStructureViewFactory());
+      appEnvironment.addExplicitExtension(LanguageFolding.INSTANCE, GroovyLanguage.INSTANCE, new GroovyFoldingBuilder());
+      appEnvironment.addExplicitExtension(LanguageFindUsages.INSTANCE, GroovyLanguage.INSTANCE, new GroovyFindUsagesProvider());
+      appEnvironment.addExplicitExtension(ReferenceAdjuster.Extension.INSTANCE, GroovyLanguage.INSTANCE, new GrReferenceAdjuster());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), UseScopeEnlarger.EP_NAME, UseScopeEnlarger.class);
+      appEnvironment.addExtension(UseScopeEnlarger.EP_NAME, new GrPrivateFieldScopeEnlarger());
+
+      DirectClassInheritorsSearch.INSTANCE.registerExecutor(new GroovyDirectInheritorsSearcher());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), MethodReferencesSearch.EP_NAME, QueryExecutor.class);
+      appEnvironment.addExtension(MethodReferencesSearch.EP_NAME, new AccessorMethodReferencesSearcher());
+      appEnvironment.addExtension(MethodReferencesSearch.EP_NAME, new MethodLateBoundReferencesSearcher());
+      appEnvironment.addExtension(MethodReferencesSearch.EP_NAME, new GroovyConstructorUsagesSearcher());
+      appEnvironment.addExtension(MethodReferencesSearch.EP_NAME, new GroovyReflectedMethodReferenceSearcher());
+      appEnvironment.addExtension(MethodReferencesSearch.EP_NAME, new GrLiteralMethodSearcher());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), AnnotatedElementsSearch.EP_NAME, QueryExecutor.class);
+      appEnvironment.addExtension(AnnotatedElementsSearch.EP_NAME, new AnnotatedMembersSearcher());
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), SuperMethodsSearch.EP_NAME, QueryExecutor.class);
+      appEnvironment.addExtension(SuperMethodsSearch.EP_NAME, new GDKSuperMethodSearcher());
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), DefinitionsScopedSearch.EP_NAME, QueryExecutor.class);
+      appEnvironment.addExtension(DefinitionsScopedSearch.EP_NAME, new GroovyImplementationSearch());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), StubIndexExtension.EP_NAME, StubIndexExtension.class);
+      appEnvironment.addExtension(StubIndexExtension.EP_NAME, new GrAnnotationMethodNameIndex());
+      appEnvironment.addExtension(StubIndexExtension.EP_NAME, new GrAnnotatedMemberIndex());
+      appEnvironment.addExtension(StubIndexExtension.EP_NAME, new GrAnonymousClassIndex());
+      appEnvironment.addExtension(StubIndexExtension.EP_NAME, new GrDirectInheritorsIndex());
+      appEnvironment.addExtension(StubIndexExtension.EP_NAME, new GrFieldNameIndex());
+      appEnvironment.addExtension(StubIndexExtension.EP_NAME, new GrFullClassNameIndex());
+      appEnvironment.addExtension(StubIndexExtension.EP_NAME, new GrFullScriptNameIndex());
+      appEnvironment.addExtension(StubIndexExtension.EP_NAME, new GrMethodNameIndex());
+      appEnvironment.addExtension(StubIndexExtension.EP_NAME, new GrScriptClassNameIndex());
+      appEnvironment.addExtension(StubIndexExtension.EP_NAME, new GrScriptClassNameIndex());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), FileBasedIndexExtension.EXTENSION_POINT_NAME, FileBasedIndexExtension.class);
+      appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new GroovyDslFileIndex());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ReferencesSearch.EP_NAME, QueryExecutor.class);
+      appEnvironment.addExtension(ReferencesSearch.EP_NAME, new ConstructorReferencesSearcher());
+      appEnvironment.addExtension(ReferencesSearch.EP_NAME, new GrAliasedImportedElementSearcher());
+      appEnvironment.addExtension(ReferencesSearch.EP_NAME, new AccessorReferencesSearcher());
+      appEnvironment.addExtension(ReferencesSearch.EP_NAME, new GroovyTraitFieldSearcher());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), IconProvider.EXTENSION_POINT_NAME, IconProvider.class);
+      appEnvironment.addExtension(IconProvider.EXTENSION_POINT_NAME, new GroovyIconProvider());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ResolveScopeProvider.EP_NAME, ResolveScopeProvider.class);
+      appEnvironment.addExtension(ResolveScopeProvider.EP_NAME, new GroovyResolveScopeProvider());
+
+
+      Class<Condition<VirtualFile>> conditionClass = (Class)Condition.class;
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), WolfTheProblemSolver.FILTER_EP_NAME, conditionClass);
+      appEnvironment.addExtension(WolfTheProblemSolver.FILTER_EP_NAME, new GroovyProblemFileHighlightFilter());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClassTypePointerFactory.EP_NAME, ClassTypePointerFactory.class);
+      appEnvironment.addExtension(ClassTypePointerFactory.EP_NAME, new GrClassReferenceTypePointerFactory());
+
+      appEnvironment.registerApplicationService(GroovyQuickFixFactory.class, new EmptyGroovyQuickFixFactory());
+      appEnvironment.registerApplicationComponent(DslActivationStatus.class, new DslActivationStatus());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ReadWriteAccessDetector.EP_NAME, ReadWriteAccessDetector.class);
+      appEnvironment.addExtension(ReadWriteAccessDetector.EP_NAME, new GroovyReadWriteAccessDetector());
+      if (GroovyElementTypes.ADDITIVE_EXPRESSION == null) throw new IllegalStateException(); // initialize tokens
+    }
+
+    protected ExternalResourceManagerEx createExternalResourceManager() {
+      return new CoreExternalResourceManager();
+    }
+  }
+
+  public static class ProjectEnvironment {
+    public ProjectEnvironment(CoreProjectEnvironment projectEnvironment) {
+      MockProject project = projectEnvironment.getProject();
+      project.registerService(GroovyPsiElementFactory.class, GroovyPsiElementFactoryImpl.class);
+
+      project.registerService(GroovyPsiManager.class, GroovyPsiManager.class);
+      project.registerService(GroovyCodeStyleManager.class, CoreGroovyCodeStyleManager.class);
+      project.registerService(GroovyCodeStyleSettingsFacade.class, CoreGroovyCodeStyleSettingsFacade.class);
+      project.registerService(GroovyExtensionProvider.class, GroovyExtensionProvider.class);
+      projectEnvironment.addProjectExtension(PsiShortNamesCache.EP_NAME, new GroovyShortNamesCache(project));
+      projectEnvironment.addProjectExtension(PsiElementFinder.EP_NAME, new GroovyClassFinder(project));
+      projectEnvironment.registerProjectComponent(GroovyUnusedImportsPassFactory.class, new GroovyUnusedImportsPassFactory(project));
+      projectEnvironment.registerProjectComponent(GrKeywordAndDeclarationHighlightFactory.class, new GrKeywordAndDeclarationHighlightFactory(project));
+      projectEnvironment.registerProjectComponent(GrReferenceHighlighterFactory.class, new GrReferenceHighlighterFactory(project));
+    }
+  }
+}
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovySyntaxHighlighterFactory.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovySyntaxHighlighterFactory.java
new file mode 100644
index 0000000..b940bb9
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/GroovySyntaxHighlighterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.lang;
+
+import com.intellij.openapi.fileTypes.SingleLazyInstanceSyntaxHighlighterFactory;
+import com.intellij.openapi.fileTypes.SyntaxHighlighter;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.groovy.highlighter.GroovySyntaxHighlighter;
+
+
+public class GroovySyntaxHighlighterFactory extends SingleLazyInstanceSyntaxHighlighterFactory {
+   @NotNull
+  @Override
+  protected SyntaxHighlighter createHighlighter() {
+    return new GroovySyntaxHighlighter();
+   }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/folding/GroovyFoldingBuilder.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/folding/GroovyFoldingBuilder.java
similarity index 100%
rename from plugins/groovy/src/org/jetbrains/plugins/groovy/lang/folding/GroovyFoldingBuilder.java
rename to plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/folding/GroovyFoldingBuilder.java
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/GrReferenceElement.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/GrReferenceElement.java
index 8377a0f..e56cc95 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/GrReferenceElement.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/GrReferenceElement.java
@@ -47,7 +47,7 @@
   @Nullable
   GrTypeArgumentList getTypeArgumentList();
 
-  @Nullable
+  @NotNull
   String getClassNameText();
 
   PsiElement handleElementRenameSimple(String newElementName) throws IncorrectOperationException;
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/GroovyPsiElementFactory.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/GroovyPsiElementFactory.java
index 9688533..ff89fb3 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/GroovyPsiElementFactory.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/GroovyPsiElementFactory.java
@@ -45,6 +45,7 @@
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrExtendsClause;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrImplementsClause;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTraitTypeDefinition;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrEnumConstant;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
@@ -275,4 +276,6 @@
   @NotNull
   @Override
   public abstract GrField createField(@NotNull @NonNls String name, @NotNull PsiType type) throws IncorrectOperationException;
+
+  public abstract GrTraitTypeDefinition createTrait(String name);
 }
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrClassReferenceType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrClassReferenceType.java
index 67be74d..83f8ae6 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrClassReferenceType.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrClassReferenceType.java
@@ -108,13 +108,16 @@
   @Override
   @NotNull
   public PsiClassType rawType() {
+    final PsiElementFactory factory = JavaPsiFacade.getElementFactory(myReferenceElement.getProject());
+
     final PsiClass clazz = resolve();
     if (clazz != null) {
-      final PsiElementFactory factory = JavaPsiFacade.getElementFactory(clazz.getProject());
       return factory.createType(clazz, factory.createRawSubstitutor(clazz));
     }
-
-    return this;
+    else {
+      String qName = myReferenceElement.getClassNameText();
+      return factory.createTypeByFQClassName(qName, myReferenceElement.getResolveScope());
+    }
   }
 
   @NotNull
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrMapType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrMapType.java
index 5102236..b9d4cf0 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrMapType.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrMapType.java
@@ -183,4 +183,9 @@
   public static GrMapType createFromNamedArgs(PsiElement context, GrNamedArgument[] args) {
     return new GrMapTypeFromNamedArgs(context, args);
   }
+
+  @Override
+  public String toString() {
+    return "map type";
+  }
 }
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrMapTypeFromNamedArgs.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrMapTypeFromNamedArgs.java
index 3282ffc..6159aee 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrMapTypeFromNamedArgs.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrMapTypeFromNamedArgs.java
@@ -15,7 +15,9 @@
  */
 package org.jetbrains.plugins.groovy.lang.psi.impl;
 
+import com.intellij.openapi.util.Computable;
 import com.intellij.openapi.util.Couple;
+import com.intellij.openapi.util.RecursionManager;
 import com.intellij.openapi.util.VolatileNotNullLazyValue;
 import com.intellij.psi.CommonClassNames;
 import com.intellij.psi.JavaPsiFacade;
@@ -50,7 +52,7 @@
       return ContainerUtil.map(myOtherEntries, new Function<Couple<GrExpression>, Couple<PsiType>>() {
         @Override
         public Couple<PsiType> fun(Couple<GrExpression> pair) {
-          return Couple.newOne(pair.first.getType(), pair.second.getType());
+          return Couple.of(inferTypePreventingRecursion(pair.first), inferTypePreventingRecursion(pair.second));
         }
       });
     }
@@ -62,7 +64,7 @@
     protected Map<String, PsiType> compute() {
       HashMap<String, PsiType> result = ContainerUtil.newHashMap();
       for (Map.Entry<String, GrExpression> entry : myStringEntries.entrySet()) {
-        result.put(entry.getKey(), entry.getValue().getType());
+        result.put(entry.getKey(), inferTypePreventingRecursion(entry.getValue()));
       }
       return result;
     }
@@ -90,7 +92,7 @@
         myStringEntries.put(name, expression);
       }
       else if (label.getExpression() != null) {
-        myOtherEntries.add(Couple.newOne(label.getExpression(), expression));
+        myOtherEntries.add(Couple.of(label.getExpression(), expression));
       }
     }
   }
@@ -99,7 +101,7 @@
   @Override
   public PsiType getTypeByStringKey(String key) {
     GrExpression expression = myStringEntries.get(key);
-    return expression != null ? expression.getType() : null;
+    return expression != null ? inferTypePreventingRecursion(expression) : null;
   }
 
   @NotNull
@@ -121,7 +123,7 @@
       result.add(GroovyPsiManager.getInstance(myFacade.getProject()).createTypeByFQClassName(CommonClassNames.JAVA_LANG_STRING, getResolveScope()));
     }
     for (Couple<GrExpression> entry : myOtherEntries) {
-      result.add(entry.first.getType());
+      result.add(inferTypePreventingRecursion(entry.first));
     }
     result.remove(null);
     return result.toArray(createArray(result.size()));
@@ -132,15 +134,25 @@
   protected PsiType[] getAllValueTypes() {
     Set<PsiType> result = ContainerUtil.newHashSet();
     for (GrExpression expression : myStringEntries.values()) {
-      result.add(expression.getType());
+      result.add(inferTypePreventingRecursion(expression));
     }
     for (Couple<GrExpression> entry : myOtherEntries) {
-      result.add(entry.second.getType());
+      result.add(inferTypePreventingRecursion(entry.second));
     }
     result.remove(null);
     return result.toArray(createArray(result.size()));
   }
 
+  @Nullable
+  private static PsiType inferTypePreventingRecursion(final GrExpression expression) {
+    return RecursionManager.doPreventingRecursion(expression, false, new Computable<PsiType>() {
+      @Override
+      public PsiType compute() {
+        return expression.getType();
+      }
+    });
+  }
+
   @NotNull
   @Override
   protected List<Couple<PsiType>> getOtherEntries() {
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrReferenceElementImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrReferenceElementImpl.java
index 9862162..c03dde5 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrReferenceElementImpl.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrReferenceElementImpl.java
@@ -183,6 +183,7 @@
     PsiImplUtil.setQualifier(this, newQualifier);
   }
 
+  @NotNull
   @Override
   public String getClassNameText() {
     String cachedQName = myCachedQName;
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyCodeStyleSettingsFacade.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyCodeStyleSettingsFacade.java
index bebf6e9..d62e119 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyCodeStyleSettingsFacade.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyCodeStyleSettingsFacade.java
@@ -25,6 +25,7 @@
   }
 
   public abstract boolean useFqClassNames();
+  public abstract boolean useFqClassNamesInJavadoc();
 
   public abstract int staticFieldsOrderWeight();
 
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyDirectInheritorsSearcher.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyDirectInheritorsSearcher.java
index 4f32428..52fd8cf 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyDirectInheritorsSearcher.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyDirectInheritorsSearcher.java
@@ -41,7 +41,7 @@
 /**
  * @author ven
  */
-class GroovyDirectInheritorsSearcher implements QueryExecutor<PsiClass, DirectClassInheritorsSearch.SearchParameters> {
+public class GroovyDirectInheritorsSearcher implements QueryExecutor<PsiClass, DirectClassInheritorsSearch.SearchParameters> {
 
   public GroovyDirectInheritorsSearcher() {
   }
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyPsiElementFactoryImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyPsiElementFactoryImpl.java
index 1467b3e..682f55a 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyPsiElementFactoryImpl.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyPsiElementFactoryImpl.java
@@ -33,7 +33,6 @@
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.plugins.groovy.GroovyFileType;
 import org.jetbrains.plugins.groovy.config.GroovyConfigUtils;
-import org.jetbrains.plugins.groovy.lang.psi.util.ErrorUtil;
 import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocComment;
 import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocMemberReference;
 import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocReferenceElement;
@@ -64,6 +63,7 @@
 import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement;
 import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeElement;
 import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
+import org.jetbrains.plugins.groovy.lang.psi.util.ErrorUtil;
 import org.jetbrains.plugins.groovy.lang.psi.util.GrStringUtil;
 
 import java.util.ArrayList;
@@ -1008,6 +1008,11 @@
     return (GrField)fieldDeclaration.getVariables()[0];
   }
 
+  @Override
+  public GrTraitTypeDefinition createTrait(String name) {
+    return (GrTraitTypeDefinition)createTypeDefinition("trait " + name + "{}");
+  }
+
   @NotNull
   @Override
   public GrMethod createMethod(@NotNull @NonNls String name, @Nullable PsiType returnType) throws IncorrectOperationException {
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/PsiImplUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/PsiImplUtil.java
index ddacf2c..0cde75a 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/PsiImplUtil.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/PsiImplUtil.java
@@ -522,7 +522,7 @@
     while (next != null) {
       final ASTNode node = next.getNode();
       final IElementType type = node.getElementType();
-      if (type == GroovyTokenTypes.mSEMI) {
+      if (type == GroovyTokenTypes.mSEMI || type == TokenType.WHITE_SPACE && !next.getText().contains("\n")) {
         final PsiElement nnext = next.getNextSibling();
         container.deleteChildRange(next, next);
         next = nnext;
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/GrListOrMapImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/GrListOrMapImpl.java
index 0ad33ee..952f048 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/GrListOrMapImpl.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/GrListOrMapImpl.java
@@ -17,6 +17,8 @@
 package org.jetbrains.plugins.groovy.lang.psi.impl.auxiliary;
 
 import com.intellij.lang.ASTNode;
+import com.intellij.openapi.util.Computable;
+import com.intellij.openapi.util.RecursionManager;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.source.tree.LeafPsiElement;
 import com.intellij.psi.search.GlobalSearchScope;
@@ -215,8 +217,13 @@
         protected PsiType[] inferComponents() {
           return ContainerUtil.map(initializers, new Function<GrExpression, PsiType>() {
             @Override
-            public PsiType fun(GrExpression expression) {
-              return expression.getType();
+            public PsiType fun(final GrExpression expression) {
+              return RecursionManager.doPreventingRecursion(expression, false, new Computable<PsiType>() {
+                @Override
+                public PsiType compute() {
+                  return expression.getType();
+                }
+              });
             }
           }, new PsiType[initializers.length]);
         }
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/blocks/GrClosableBlockImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/blocks/GrClosableBlockImpl.java
index 7c9b6b0..07eba18 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/blocks/GrClosableBlockImpl.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/blocks/GrClosableBlockImpl.java
@@ -154,10 +154,6 @@
                                   @Nullable final PsiType classToDelegate) {
     if (classToDelegate == null) return true;
 
-    if (state.get(ClassHint.RESOLVE_CONTEXT) == null) {
-      state = state.put(ClassHint.RESOLVE_CONTEXT, this);
-    }
-
     return ResolveUtil.processAllDeclarationsSeparately(classToDelegate, processor, nonCodeProcessor,
                                             state.put(ClassHint.RESOLVE_CONTEXT, this), place);
   }
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrReferenceExpressionImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrReferenceExpressionImpl.java
index d0aff5e..4058906 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrReferenceExpressionImpl.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/GrReferenceExpressionImpl.java
@@ -108,10 +108,12 @@
 
     if (!InheritanceUtil.isInheritor(type, CommonClassNames.JAVA_UTIL_MAP)) return false;
 
-    final String canonicalText = type.getCanonicalText();
-    if (canonicalText.startsWith("java.")) return true;
-    if (GroovyCommonClassNames.GROOVY_UTIL_CONFIG_OBJECT.equals(canonicalText)) return false;
-    if (canonicalText.startsWith("groovy.")) return true;
+    final String qname = TypesUtil.getQualifiedName(type);
+    if (qname != null) {
+      if (qname.startsWith("java.")) return true; //so we have jdk map here
+      if (GroovyCommonClassNames.GROOVY_UTIL_CONFIG_OBJECT.equals(qname)) return false;
+      if (qname.startsWith("groovy.")) return true; //we have gdk map here
+    }
 
     return false;
   }
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/TypesUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/TypesUtil.java
index 59c9f91..f5d4877 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/TypesUtil.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/TypesUtil.java
@@ -422,7 +422,7 @@
 
   public static boolean isNumericType(@Nullable PsiType type) {
     if (type instanceof PsiClassType) {
-      return TYPE_TO_RANK.contains(type.getCanonicalText());
+      return TYPE_TO_RANK.contains(getQualifiedName(type));
     }
 
     return type instanceof PsiPrimitiveType && TypeConversionUtil.isNumericType(type);
@@ -547,12 +547,12 @@
         }
       }
     }
-    else if (GroovyCommonClassNames.GROOVY_LANG_GSTRING.equals(type1.getCanonicalText()) &&
-             CommonClassNames.JAVA_LANG_STRING.equals(type2.getInternalCanonicalText())) {
+    else if (GroovyCommonClassNames.GROOVY_LANG_GSTRING.equals(getQualifiedName(type1)) &&
+             CommonClassNames.JAVA_LANG_STRING.equals(getQualifiedName(type2))) {
       return type2;
     }
-    else if (GroovyCommonClassNames.GROOVY_LANG_GSTRING.equals(type2.getCanonicalText()) &&
-             CommonClassNames.JAVA_LANG_STRING.equals(type1.getInternalCanonicalText())) {
+    else if (GroovyCommonClassNames.GROOVY_LANG_GSTRING.equals(getQualifiedName(type2)) &&
+             CommonClassNames.JAVA_LANG_STRING.equals(getQualifiedName(type1))) {
       return type1;
     }
     return GenericsUtil.getLeastUpperBound(type1, type2, manager);
@@ -628,11 +628,7 @@
   }
 
   public static boolean isClassType(@Nullable PsiType type, @NotNull String qName) {
-    if (type instanceof PsiClassType) {
-      final PsiClass psiClass = ((PsiClassType)type).resolve();
-      return psiClass != null && qName.equals(psiClass.getQualifiedName());
-    }
-    return false;
+    return qName.equals(getQualifiedName(type));
   }
 
   public static PsiSubstitutor composeSubstitutors(PsiSubstitutor s1, PsiSubstitutor s2) {
@@ -751,7 +747,7 @@
   }
 
   @Nullable
-  public static PsiType inferAnnotationMemberValueType(GrAnnotationMemberValue value) {
+  public static PsiType inferAnnotationMemberValueType(final GrAnnotationMemberValue value) {
     if (value instanceof GrExpression) {
       return ((GrExpression)value).getType();
     }
@@ -859,4 +855,23 @@
 
     return GroovyCommonClassNames.GROOVY_LANG_CLOSURE.equals(psiClass.getQualifiedName());
   }
+
+  @Nullable
+  public static String getQualifiedName(@Nullable PsiType type) {
+    if (type instanceof PsiClassType) {
+      PsiClass resolved = ((PsiClassType)type).resolve();
+      if (resolved instanceof PsiAnonymousClass) {
+        return getQualifiedName(((PsiAnonymousClass)resolved).getBaseClassType());
+      }
+      if (resolved != null) {
+        return resolved.getQualifiedName();
+      }
+      else {
+        return PsiNameHelper.getQualifiedClassName(type.getCanonicalText(), true);
+      }
+    }
+
+    return null;
+  }
+
 }
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/types/GrSafeCastExpressionImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/types/GrSafeCastExpressionImpl.java
index b038e81..e21f9f8 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/types/GrSafeCastExpressionImpl.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/types/GrSafeCastExpressionImpl.java
@@ -35,6 +35,7 @@
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrSafeCastExpression;
 import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeElement;
 import org.jetbrains.plugins.groovy.lang.psi.dataFlow.types.TypeInferenceHelper;
+import org.jetbrains.plugins.groovy.lang.psi.impl.GrTraitType;
 import org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil;
 import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.GrExpressionImpl;
 import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
@@ -65,6 +66,11 @@
           return JavaPsiFacade.getElementFactory(cast.getProject()).createType(resolved, substitutor);
         }
 
+        GrTraitType traitClassType = GrTraitType.createTraitClassType(cast);
+        if (traitClassType != null) {
+          return traitClassType;
+        }
+
         return TypesUtil.boxPrimitiveType(castType, cast.getManager(), cast.getResolveScope());
       }
     };
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionImpl.java
index bc52bd6..1f3a617 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionImpl.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/GrTypeDefinitionImpl.java
@@ -65,11 +65,10 @@
 import org.jetbrains.plugins.groovy.lang.psi.impl.GrStubElementBase;
 import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyCodeStyleSettingsFacade;
 import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl;
-import org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil;
 import org.jetbrains.plugins.groovy.lang.psi.stubs.GrTypeDefinitionStub;
 import org.jetbrains.plugins.groovy.lang.psi.util.GrClassImplUtil;
-import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
 import org.jetbrains.plugins.groovy.lang.psi.util.GroovyRunnerPsiUtil;
+import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
 
 import javax.swing.*;
 import java.util.ArrayList;
@@ -234,7 +233,7 @@
     if (stub != null) {
       return stub.getName();
     }
-    return PsiImplUtil.getName(this);
+    return org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil.getName(this);
   }
 
   @Override
@@ -513,6 +512,13 @@
 
   @Override
   public boolean isInheritor(@NotNull PsiClass baseClass, boolean checkDeep) {
+    if (isTrait() && baseClass.isInterface() && !checkDeep) {
+      for (PsiClassType superType : getImplementsListTypes()) {
+        if (getManager().areElementsEquivalent(superType.resolve(), baseClass)) {
+          return true;
+        }
+      }
+    }
     return InheritanceImplUtil.isInheritor(this, baseClass, checkDeep);
   }
 
@@ -546,7 +552,7 @@
     boolean renameFile = isRenameFileOnClassRenaming();
 
     final String oldName = getName();
-    PsiImplUtil.setName(name, getNameIdentifierGroovy());
+    org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil.setName(name, getNameIdentifierGroovy());
 
     final GrTypeDefinitionBody body = getBody();
     if (body != null) {
@@ -592,9 +598,9 @@
   public boolean isDeprecated() {
     final GrTypeDefinitionStub stub = getStub();
     if (stub != null) {
-      return stub.isDeprecatedByDoc() || com.intellij.psi.impl.PsiImplUtil.isDeprecatedByAnnotation(this);
+      return stub.isDeprecatedByDoc() || PsiImplUtil.isDeprecatedByAnnotation(this);
     }
-    return com.intellij.psi.impl.PsiImplUtil.isDeprecatedByDocTag(this) || com.intellij.psi.impl.PsiImplUtil.isDeprecatedByAnnotation(this);
+    return PsiImplUtil.isDeprecatedByDocTag(this) || PsiImplUtil.isDeprecatedByAnnotation(this);
   }
 
   @Override
@@ -644,6 +650,8 @@
   private Icon getIconInner() {
     if (isAnnotationType()) return JetgroovyIcons.Groovy.AnnotationType;
 
+    if (isTrait()) return JetgroovyIcons.Groovy.Trait;
+
     if (isInterface()) return JetgroovyIcons.Groovy.Interface;
 
     if (isEnum()) return JetgroovyIcons.Groovy.Enum;
@@ -666,7 +674,7 @@
   @Nullable
   @Override
   public PsiElement getOriginalElement() {
-    return PsiImplUtil.getOriginalElement(this, getContainingFile());
+    return org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil.getOriginalElement(this, getContainingFile());
   }
 
   @Override
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/members/GrMethodBaseImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/members/GrMethodBaseImpl.java
index a0f9f5a..0b82ae7 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/members/GrMethodBaseImpl.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/typedef/members/GrMethodBaseImpl.java
@@ -69,7 +69,6 @@
 import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
 import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrReflectedMethodImpl;
 import org.jetbrains.plugins.groovy.lang.psi.stubs.GrMethodStub;
-import org.jetbrains.plugins.groovy.lang.psi.util.GrTraitUtil;
 import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
 import org.jetbrains.plugins.groovy.lang.resolve.MethodTypeInferencer;
 import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
@@ -344,7 +343,6 @@
   @Override
   @Nullable
   public PsiCodeBlock getBody() {
-    if (GrTraitUtil.isTrait(getContainingClass())) return null;
     return PsiImplUtil.getOrCreatePsiCodeBlock(getBlock());
   }
 
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightClassReferenceElement.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightClassReferenceElement.java
index fcf19d1..131e338 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightClassReferenceElement.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightClassReferenceElement.java
@@ -91,6 +91,7 @@
     return null;
   }
 
+  @NotNull
   @Override
   public String getClassNameText() {
     return myClassName;
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/MapEntryOrKeyValueHintProcessor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/MapEntryOrKeyValueHintProcessor.java
index 4d7c0ec..10a886b 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/MapEntryOrKeyValueHintProcessor.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/MapEntryOrKeyValueHintProcessor.java
@@ -128,7 +128,7 @@
     String[] splitted = value.split("=");
 
     if (splitted.length == 2) {
-      return Couple.newOne(splitted[0].trim(), splitted[1].trim());
+      return Couple.of(splitted[0].trim(), splitted[1].trim());
     }
 
     return null;
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java
index a339c3a..3e5a91b 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java
@@ -704,7 +704,8 @@
     return nextSibling;
   }
 
-  public static PsiIdentifier getJavaNameIdentifier(GrNamedElement namedElement) {
+  @NotNull
+  public static PsiIdentifier getJavaNameIdentifier(@NotNull GrNamedElement namedElement) {
     final PsiElement element = namedElement.getNameIdentifierGroovy();
     JavaIdentifier identifier = element.getUserData(NAME_IDENTIFIER);
     if (identifier == null) {
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/GrMethodComparator.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/GrMethodComparator.java
index 04af104..c1ef8f0 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/GrMethodComparator.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/GrMethodComparator.java
@@ -27,7 +27,7 @@
  * @author Max Medvedev
  */
 public abstract class GrMethodComparator {
-  private static final ExtensionPointName<GrMethodComparator> EP_NAME = ExtensionPointName.create("org.intellij.groovy.methodComparator");
+  public static final ExtensionPointName<GrMethodComparator> EP_NAME = ExtensionPointName.create("org.intellij.groovy.methodComparator");
 
   public interface Context {
     @Nullable
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/NonCodeMembersContributor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/NonCodeMembersContributor.java
index 8d06c6b..555d41d 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/NonCodeMembersContributor.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/NonCodeMembersContributor.java
@@ -37,7 +37,7 @@
  * @author peter
  */
 public abstract class NonCodeMembersContributor {
-  private static final ExtensionPointName<NonCodeMembersContributor> EP_NAME = ExtensionPointName.create("org.intellij.groovy.membersContributor");
+  public static final ExtensionPointName<NonCodeMembersContributor> EP_NAME = ExtensionPointName.create("org.intellij.groovy.membersContributor");
 
   private static volatile MultiMap<String, NonCodeMembersContributor> ourClassSpecifiedContributors;
   private static NonCodeMembersContributor[] ourAllTypeContributors;
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ResolveUtil.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ResolveUtil.java
index 4e5625d..7dec4e4 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ResolveUtil.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ResolveUtil.java
@@ -374,8 +374,11 @@
     else if (base instanceof GrTraitType) {
       key = ((GrTraitType)base).erasure().getCanonicalText();
     }
+    else if (base instanceof PsiClassType) {
+      key = TypesUtil.getQualifiedName(base);
+    }
     else {
-      key = TypeConversionUtil.erasure(base).getCanonicalText();
+      key = base.getCanonicalText();
     }
     Map<String, PsiType> result = cache.get(key);
     if (result == null) {
@@ -388,10 +391,13 @@
 
   @NotNull
   private static String rawCanonicalText(@NotNull PsiType type) {
-    final String result = type.getCanonicalText();
-    final int i = result.indexOf('<');
-    if (i > 0) return result.substring(0, i);
-    return result;
+    if (type instanceof PsiClassType) {
+      String qname = TypesUtil.getQualifiedName(type);
+      if (qname != null) {
+        return qname;
+      }
+    }
+    return TypeConversionUtil.erasure(type).getCanonicalText();
   }
 
   public static GroovyPsiElement resolveProperty(GroovyPsiElement place, String name) {
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ast/AstTransformContributor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ast/AstTransformContributor.java
index 6a90800..22ddaf5 100644
--- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ast/AstTransformContributor.java
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ast/AstTransformContributor.java
@@ -32,7 +32,7 @@
  * @author Max Medvedev
  */
 public abstract class AstTransformContributor {
-  private static final ExtensionPointName<AstTransformContributor> EP_NAME = ExtensionPointName.create("org.intellij.groovy.astTransformContributor");
+  public static final ExtensionPointName<AstTransformContributor> EP_NAME = ExtensionPointName.create("org.intellij.groovy.astTransformContributor");
 
   public void collectMethods(@NotNull final GrTypeDefinition clazz, Collection<PsiMethod> collector) {
 
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/providers/GroovyReferenceContributor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/providers/GroovyReferenceContributor.java
similarity index 100%
rename from plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/providers/GroovyReferenceContributor.java
rename to plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/providers/GroovyReferenceContributor.java
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/providers/PropertiesReferenceProvider.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/providers/PropertiesReferenceProvider.java
similarity index 100%
rename from plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/providers/PropertiesReferenceProvider.java
rename to plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/providers/PropertiesReferenceProvider.java
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/settings/GroovyApplicationSettings.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/settings/GroovyApplicationSettings.java
similarity index 100%
rename from plugins/groovy/src/org/jetbrains/plugins/groovy/settings/GroovyApplicationSettings.java
rename to plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/settings/GroovyApplicationSettings.java
diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/swingBuilder/SwingBuilderNamedArgumentProvider.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/swingBuilder/SwingBuilderNamedArgumentProvider.java
new file mode 100644
index 0000000..e182885
--- /dev/null
+++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/swingBuilder/SwingBuilderNamedArgumentProvider.java
@@ -0,0 +1,122 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.swingBuilder;
+
+import com.intellij.openapi.util.Pair;
+import com.intellij.psi.*;
+import com.intellij.psi.util.InheritanceUtil;
+import com.intellij.psi.util.PsiTypesUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.groovy.extensions.GroovyNamedArgumentProvider;
+import org.jetbrains.plugins.groovy.extensions.NamedArgumentDescriptor;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrCall;
+import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
+import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
+import org.jetbrains.plugins.groovy.lang.psi.util.GroovyPropertyUtils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Sergey Evdokimov
+ */
+public class SwingBuilderNamedArgumentProvider extends GroovyNamedArgumentProvider {
+
+  @Override
+  public void getNamedArguments(@NotNull GrCall call,
+                                @Nullable PsiElement resolve,
+                                @Nullable String argumentName,
+                                boolean forCompletion,
+                                Map<String, NamedArgumentDescriptor> result) {
+    PsiType returnType = resolve == null ? null : ((PsiMethod)resolve).getReturnType();
+    PsiClass aClass = PsiTypesUtil.getPsiClass(returnType);
+    if (aClass == null) return;
+
+    Map<String, Pair<PsiType, PsiElement>> typeMap = null;
+    if (!forCompletion) {
+      typeMap = new HashMap<String, Pair<PsiType, PsiElement>>();
+    }
+
+    PsiManager manager = aClass.getManager();
+
+    for (PsiMethod method : aClass.getAllMethods()) {
+      String methodName = method.getName();
+      String propertyName = GroovyPropertyUtils.getPropertyNameBySetterName(methodName);
+      if (propertyName != null) {
+        if (argumentName != null && !argumentName.equals(propertyName)) continue;
+
+        PsiType methodReturnType = method.getReturnType();
+        if (methodReturnType != null && !PsiType.VOID.equals(methodReturnType)) continue;
+
+        PsiParameter[] parameters = method.getParameterList().getParameters();
+
+        if (parameters.length != 1) continue;
+
+        if (forCompletion) { // optimization, don't calculate types.
+          result.put(propertyName, NamedArgumentDescriptor.SIMPLE_ON_TOP);
+        }
+        else {
+          PsiType newType = parameters[0].getType();
+
+          Pair<PsiType, PsiElement> oldPair = typeMap.get(propertyName);
+          if (oldPair == null) {
+            typeMap.put(propertyName, new Pair<PsiType, PsiElement>(newType, method));
+          }
+          else {
+            PsiType type = TypesUtil.getLeastUpperBound(oldPair.first, newType, manager);
+            if (type == null) {
+              type = PsiType.getJavaLangObject(manager, aClass.getResolveScope());
+            }
+            typeMap.put(propertyName, new Pair<PsiType, PsiElement>(newType, null));
+          }
+        }
+      }
+      else {
+        PsiType closureType = null;
+
+        if (methodName.startsWith("add")) {
+          PsiParameter[] parameters = method.getParameterList().getParameters();
+          if (parameters.length != 1) continue;
+
+          PsiClass paramClass = PsiTypesUtil.getPsiClass(parameters[0].getType());
+          if (paramClass == null || !InheritanceUtil.isInheritor(paramClass, "java.util.EventListener")) continue;
+
+          for (PsiMethod psiMethod : paramClass.getMethods()) {
+            if (!psiMethod.hasModifierProperty(PsiModifier.ABSTRACT)) continue;
+
+            if (forCompletion) {
+              result.put(psiMethod.getName(), NamedArgumentDescriptor.SIMPLE_ON_TOP);
+            }
+            else {
+              if (closureType == null) {
+                closureType = JavaPsiFacade.getElementFactory(manager.getProject()).createTypeByFQClassName(GroovyCommonClassNames.GROOVY_LANG_CLOSURE, call.getResolveScope());
+              }
+
+              result.put(psiMethod.getName(), new NamedArgumentDescriptor.TypeCondition(closureType, method));
+            }
+          }
+        }
+      }
+    }
+
+    if (!forCompletion) {
+      for (Map.Entry<String, Pair<PsiType, PsiElement>> entry : typeMap.entrySet()) {
+        result.put(entry.getKey(), new NamedArgumentDescriptor.TypeCondition(entry.getValue().first, entry.getValue().second));
+      }
+    }
+  }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/swingBuilder/SwingBuilderNonCodeMemberContributor.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/swingBuilder/SwingBuilderNonCodeMemberContributor.java
similarity index 100%
rename from plugins/groovy/src/org/jetbrains/plugins/groovy/swingBuilder/SwingBuilderNonCodeMemberContributor.java
rename to plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/swingBuilder/SwingBuilderNonCodeMemberContributor.java
diff --git a/plugins/groovy/jetgroovy.iml b/plugins/groovy/jetgroovy.iml
index d7315d8..aa40a30 100644
--- a/plugins/groovy/jetgroovy.iml
+++ b/plugins/groovy/jetgroovy.iml
@@ -3,10 +3,8 @@
   <component name="NewModuleRootManager" inherit-compiler-output="true">
     <exclude-output />
     <content url="file://$MODULE_DIR$">
-      <sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml
new file mode 100644
index 0000000..0fd4427
--- /dev/null
+++ b/plugins/groovy/src/META-INF/plugin.xml
@@ -0,0 +1,3 @@
+<idea-plugin version="2" xmlns:xi="http://www.w3.org/2001/XInclude">
+  <xi:include href="/META-INF/GroovyPlugin.xml" xpointer="xpointer(/idea-plugin/*)"/>
+</idea-plugin>
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/GroovyFileTypeLoader.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/GroovyFileTypeLoader.java
index b5a4e9a..734cae7 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/GroovyFileTypeLoader.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/GroovyFileTypeLoader.java
@@ -50,6 +50,5 @@
   @Override
   public void createFileTypes(@NotNull FileTypeConsumer consumer) {
     consumer.consume(GroovyFileType.GROOVY_FILE_TYPE, StringUtil.join(getAllGroovyExtensions(), ";"));
-    GroovyFileType.GROOVY_FILE_TYPES.add(GroovyFileType.GROOVY_FILE_TYPE);
   }
 }
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/GroovyTemplates.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/GroovyTemplates.java
index 83c08b7..1c28c2a 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/GroovyTemplates.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/GroovyTemplates.java
@@ -23,6 +23,7 @@
 public interface GroovyTemplates {
   @NonNls String GROOVY_CLASS = "GroovyClass.groovy";
   @NonNls String GROOVY_INTERFACE = "GroovyInterface.groovy";
+  @NonNls String GROOVY_TRAIT = "GroovyTrait.groovy";
   @NonNls String GROOVY_ENUM = "GroovyEnum.groovy";
   @NonNls String GROOVY_ANNOTATION = "GroovyAnnotation.groovy";
   @NonNls String GROOVY_SCRIPT = "GroovyScript.groovy";
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/NewGroovyClassAction.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/NewGroovyClassAction.java
index 7171e0f..cd74eb8 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/NewGroovyClassAction.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/actions/NewGroovyClassAction.java
@@ -37,6 +37,7 @@
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.plugins.groovy.GroovyBundle;
 import org.jetbrains.plugins.groovy.GroovyFileType;
+import org.jetbrains.plugins.groovy.config.GroovyConfigUtils;
 import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
 import org.jetbrains.plugins.groovy.util.LibrariesUtil;
@@ -53,7 +54,13 @@
     builder
       .setTitle(GroovyBundle.message("newclass.dlg.title"))
       .addKind("Class", JetgroovyIcons.Groovy.Class, GroovyTemplates.GROOVY_CLASS)
-      .addKind("Interface", JetgroovyIcons.Groovy.Interface, GroovyTemplates.GROOVY_INTERFACE)
+      .addKind("Interface", JetgroovyIcons.Groovy.Interface, GroovyTemplates.GROOVY_INTERFACE);
+
+    if (GroovyConfigUtils.getInstance().isVersionAtLeast(directory, GroovyConfigUtils.GROOVY2_3, true)) {
+      builder.addKind("Trait", JetgroovyIcons.Groovy.Trait, GroovyTemplates.GROOVY_TRAIT);
+    }
+
+    builder
       .addKind("Enum", JetgroovyIcons.Groovy.Enum, GroovyTemplates.GROOVY_ENUM)
       .addKind("Annotation", JetgroovyIcons.Groovy.AnnotationType, GroovyTemplates.GROOVY_ANNOTATION);
 
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateClassActionBase.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateClassActionBase.java
index d1ca56e..451182b 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateClassActionBase.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateClassActionBase.java
@@ -16,7 +16,6 @@
 
 package org.jetbrains.plugins.groovy.annotator.intentions;
 
-import com.intellij.codeInsight.daemon.impl.quickfix.CreateClassKind;
 import com.intellij.codeInsight.intention.impl.CreateClassDialog;
 import com.intellij.openapi.application.AccessToken;
 import com.intellij.openapi.application.ApplicationManager;
@@ -36,6 +35,7 @@
 import org.jetbrains.plugins.groovy.actions.GroovyTemplatesFactory;
 import org.jetbrains.plugins.groovy.intentions.base.Intention;
 import org.jetbrains.plugins.groovy.intentions.base.PsiElementPredicate;
+import org.jetbrains.plugins.groovy.lang.GrCreateClassKind;
 import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
 
@@ -43,12 +43,12 @@
  * @author ilyas
  */
 public abstract class CreateClassActionBase extends Intention {
-  private final CreateClassKind myType;
+  private final GrCreateClassKind myType;
 
   protected final GrReferenceElement myRefElement;
   private static final Logger LOG = Logger.getInstance("#org.jetbrains.plugins.groovy.annotator.intentions.CreateClassActionBase");
 
-  public CreateClassActionBase(CreateClassKind type, GrReferenceElement refElement) {
+  public CreateClassActionBase(GrCreateClassKind type, GrReferenceElement refElement) {
     myType = type;
     myRefElement = refElement;
   }
@@ -58,6 +58,8 @@
   public String getText() {
     String referenceName = myRefElement.getReferenceName();
     switch (getType()) {
+      case TRAIT:
+        return GroovyBundle.message("create.trait", referenceName);
       case ENUM:
         return GroovyBundle.message("create.enum", referenceName);
       case CLASS:
@@ -88,7 +90,7 @@
   }
 
 
-  protected CreateClassKind getType() {
+  protected GrCreateClassKind getType() {
     return myType;
   }
 
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateClassFix.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateClassFix.java
index 2c84fc1..dc0481d 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateClassFix.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateClassFix.java
@@ -17,7 +17,6 @@
 package org.jetbrains.plugins.groovy.annotator.intentions;
 
 import com.intellij.codeInsight.FileModificationService;
-import com.intellij.codeInsight.daemon.impl.quickfix.CreateClassKind;
 import com.intellij.codeInsight.hint.HintManager;
 import com.intellij.codeInsight.intention.IntentionAction;
 import com.intellij.openapi.application.AccessToken;
@@ -37,6 +36,7 @@
 import org.jetbrains.plugins.groovy.actions.GroovyTemplates;
 import org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle;
 import org.jetbrains.plugins.groovy.intentions.base.IntentionUtils;
+import org.jetbrains.plugins.groovy.lang.GrCreateClassKind;
 import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement;
 import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
 import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
@@ -59,7 +59,7 @@
 public abstract class CreateClassFix {
 
   public static IntentionAction createClassFromNewAction(final GrNewExpression expression) {
-    return new CreateClassActionBase(CreateClassKind.CLASS, expression.getReferenceElement()) {
+    return new CreateClassActionBase(GrCreateClassKind.CLASS, expression.getReferenceElement()) {
 
       @Override
       protected void processIntention(@NotNull PsiElement element, Project project, Editor editor) throws IncorrectOperationException {
@@ -144,7 +144,7 @@
     }
   }
 
-  public static IntentionAction createClassFixAction(final GrReferenceElement refElement, CreateClassKind type) {
+  public static IntentionAction createClassFixAction(final GrReferenceElement refElement, GrCreateClassKind type) {
     return new CreateClassActionBase(type, refElement) {
       @Override
       protected void processIntention(@NotNull PsiElement element, Project project, Editor editor) throws IncorrectOperationException {
@@ -228,6 +228,13 @@
         switch (getType()) {
           case ENUM:
             return factory.createEnum(name);
+          case TRAIT:
+            if (factory instanceof GroovyPsiElementFactory) {
+              return ((GroovyPsiElementFactory)factory).createTrait(name);
+            }
+            else {
+              return null;
+            }
           case CLASS:
             return factory.createClass(name);
           case INTERFACE:
@@ -292,8 +299,10 @@
     });
   }
 
-  private static String getTemplateName(CreateClassKind createClassKind) {
+  private static String getTemplateName(GrCreateClassKind createClassKind) {
     switch (createClassKind) {
+      case TRAIT:
+        return GroovyTemplates.GROOVY_TRAIT;
       case ENUM:
         return GroovyTemplates.GROOVY_ENUM;
       case CLASS:
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateGetterFromUsageFix.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateGetterFromUsageFix.java
index f897b7f..8b1fca0 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateGetterFromUsageFix.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateGetterFromUsageFix.java
@@ -15,6 +15,7 @@
  */
 package org.jetbrains.plugins.groovy.annotator.intentions;
 
+import com.intellij.codeInsight.intention.LowPriorityAction;
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiType;
 import org.jetbrains.annotations.NotNull;
@@ -26,7 +27,7 @@
 /**
  * @author Max Medvedev
  */
-public class CreateGetterFromUsageFix extends CreateMethodFromUsageFix {
+public class CreateGetterFromUsageFix extends CreateMethodFromUsageFix implements LowPriorityAction {
   public CreateGetterFromUsageFix(@NotNull GrReferenceExpression refExpression, @NotNull PsiClass targetClass) {
     super(refExpression);
   }
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateMethodFromUsageFix.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateMethodFromUsageFix.java
index 4e621af..a1f356c 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateMethodFromUsageFix.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateMethodFromUsageFix.java
@@ -33,6 +33,7 @@
 import org.jetbrains.plugins.groovy.lang.psi.expectedTypes.TypeConstraint;
 import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
 import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GroovyScriptClass;
+import org.jetbrains.plugins.groovy.lang.psi.util.GrTraitUtil;
 import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
 import org.jetbrains.plugins.groovy.lang.psi.util.StaticChecker;
 import org.jetbrains.plugins.groovy.template.expressions.ChooseTypeExpression;
@@ -100,7 +101,7 @@
   }
 
   protected boolean shouldBeAbstract(PsiClass aClass) {
-    return aClass.isInterface();
+    return aClass.isInterface() && !GrTraitUtil.isTrait(aClass);
   }
 
   @Nullable
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateSetterFromUsageFix.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateSetterFromUsageFix.java
index 2b98f5c..1882b58 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateSetterFromUsageFix.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/intentions/CreateSetterFromUsageFix.java
@@ -15,6 +15,7 @@
  */
 package org.jetbrains.plugins.groovy.annotator.intentions;
 
+import com.intellij.codeInsight.intention.LowPriorityAction;
 import com.intellij.psi.PsiType;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
@@ -28,7 +29,7 @@
 /**
  * @author Max Medvedev
  */
-public class CreateSetterFromUsageFix extends CreateMethodFromUsageFix {
+public class CreateSetterFromUsageFix extends CreateMethodFromUsageFix implements LowPriorityAction {
   public CreateSetterFromUsageFix(@NotNull GrReferenceExpression refExpression) {
     super(refExpression);
   }
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/ant/GroovyAntCustomCompilerProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/ant/GroovyAntCustomCompilerProvider.java
index 81afd67..ddb51e9 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/ant/GroovyAntCustomCompilerProvider.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/ant/GroovyAntCustomCompilerProvider.java
@@ -62,13 +62,13 @@
                                     PatternSetRef compilerExcludes,
                                     Tag srcTag,
                                     String outputPathRef) {
-    Tag groovyc = new Tag("groovyc", Couple.newOne("destdir", outputPathRef), Couple.newOne("fork", "yes"));
+    Tag groovyc = new Tag("groovyc", Couple.of("destdir", outputPathRef), Couple.of("fork", "yes"));
     // note that boot classpath tag is ignored
     groovyc.add(srcTag);
     groovyc.add(classpathTag);
     groovyc.add(compilerExcludes);
     final Tag javac =
-      new Tag("javac", Couple.newOne("debug", BuildProperties.propertyRef(BuildProperties.PROPERTY_COMPILER_GENERATE_DEBUG_INFO)));
+      new Tag("javac", Couple.of("debug", BuildProperties.propertyRef(BuildProperties.PROPERTY_COMPILER_GENERATE_DEBUG_INFO)));
     javac.add(compilerArgs);
     groovyc.add(javac);
     generator.add(groovyc);
@@ -99,8 +99,8 @@
     String groovySdkPathRef = BuildProperties.getLibraryPathId(sdkLib.getName());
     generator.add(new Property(GROOVYC_TASK_SDK_PROPERTY, groovySdkPathRef));
     //noinspection HardCodedStringLiteral
-    Tag taskdef = new Tag("taskdef", Couple.newOne("name", "groovyc"), Couple.newOne("classname", "org.codehaus.groovy.ant.Groovyc"),
-                          Couple.newOne("classpathref", "${" + GROOVYC_TASK_SDK_PROPERTY + "}"));
+    Tag taskdef = new Tag("taskdef", Couple.of("name", "groovyc"), Couple.of("classname", "org.codehaus.groovy.ant.Groovyc"),
+                          Couple.of("classpathref", "${" + GROOVYC_TASK_SDK_PROPERTY + "}"));
     generator.add(taskdef);
   }
 
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyQuickFixFactoryImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyQuickFixFactoryImpl.java
index 9fdb050..1be4df4 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyQuickFixFactoryImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/GroovyQuickFixFactoryImpl.java
@@ -15,7 +15,6 @@
  */
 package org.jetbrains.plugins.groovy.codeInspection;
 
-import com.intellij.codeInsight.daemon.impl.quickfix.CreateClassKind;
 import com.intellij.codeInsight.intention.IntentionAction;
 import com.intellij.codeInspection.LocalQuickFix;
 import com.intellij.psi.PsiClass;
@@ -27,6 +26,8 @@
 import org.jetbrains.plugins.groovy.codeInspection.bugs.AddMethodFix;
 import org.jetbrains.plugins.groovy.codeInspection.confusing.ReplaceWithImportFix;
 import org.jetbrains.plugins.groovy.codeInspection.local.RemoveUnusedGrParameterFix;
+import org.jetbrains.plugins.groovy.dsl.InvestigateFix;
+import org.jetbrains.plugins.groovy.lang.GrCreateClassKind;
 import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentLabel;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrNamedArgument;
@@ -59,7 +60,7 @@
   }
 
   @Override
-  public IntentionAction createClassFixAction(GrReferenceElement element, CreateClassKind anInterface) {
+  public IntentionAction createClassFixAction(GrReferenceElement element, GrCreateClassKind anInterface) {
     return CreateClassFix.createClassFixAction(element, anInterface);
   }
 
@@ -142,4 +143,9 @@
   public IntentionAction createRemoveUnusedGrParameterFix(GrParameter parameter) {
     return new RemoveUnusedGrParameterFix(parameter);
   }
+
+  @Override
+  public IntentionAction createInvestigateFix(String reason) {
+    return new InvestigateFix(reason);
+  }
 }
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/confusing/ClashingTraitMethodsInspection.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/confusing/ClashingTraitMethodsInspection.java
new file mode 100644
index 0000000..a446f38
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/confusing/ClashingTraitMethodsInspection.java
@@ -0,0 +1,200 @@
+package org.jetbrains.plugins.groovy.codeInspection.confusing;
+
+import com.intellij.codeInsight.generation.OverrideImplementUtil;
+import com.intellij.codeInspection.LocalQuickFix;
+import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.codeInspection.ProblemHighlightType;
+import com.intellij.openapi.application.Result;
+import com.intellij.openapi.command.WriteCommandAction;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.psi.util.PsiFormatUtil;
+import com.intellij.psi.util.PsiFormatUtilBase;
+import com.intellij.util.Function;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.groovy.codeInspection.BaseInspection;
+import org.jetbrains.plugins.groovy.codeInspection.BaseInspectionVisitor;
+import org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
+import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrTraitMethod;
+import org.jetbrains.plugins.groovy.lang.psi.util.GrTraitUtil;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Created by Max Medvedev on 03/06/14
+ */
+public class ClashingTraitMethodsInspection extends BaseInspection {
+  private static final Logger LOG = Logger.getInstance(MyQuickFix.class);
+
+  @NotNull
+  @Override
+  protected BaseInspectionVisitor buildVisitor() {
+    return new BaseInspectionVisitor() {
+      @Override
+      public void visitTypeDefinition(GrTypeDefinition typeDefinition) {
+        super.visitTypeDefinition(typeDefinition);
+
+        List<PsiClass> superTraits = collectImplementedTraits(typeDefinition);
+
+        if (superTraits.size() < 2) return;
+
+        List<ClashingMethod> clashingMethods = collectClassingMethods(typeDefinition);
+
+        for (ClashingMethod clashing : clashingMethods) {
+          registerError(typeDefinition.getNameIdentifierGroovy(), buildWarning(clashing), new LocalQuickFix[]{new MyQuickFix()}, ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
+        }
+      }
+
+      @NotNull
+      private String buildWarning(@NotNull ClashingMethod entry) {
+        return "Traits " + buildTraitString(entry) + " contain clashing methods with signature " + buildSignatureString(entry);
+      }
+
+      @NotNull
+      private String buildSignatureString(@NotNull ClashingMethod entry) {
+        HierarchicalMethodSignature signature = entry.getSignature();
+        return PsiFormatUtil.formatMethod(signature.getMethod(), signature.getSubstitutor(),
+                                          PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_PARAMETERS,
+                                          PsiFormatUtilBase.SHOW_TYPE);
+      }
+
+      @NotNull
+      private String buildTraitString(@NotNull ClashingMethod entry) {
+        return StringUtil.join(entry.getSuperTraits(), new Function<GrTypeDefinition, String>() {
+          public String fun(GrTypeDefinition tr) {
+            return tr.getName();
+          }
+        }, ", ");
+      }
+    };
+  }
+
+  @NotNull
+  private static List<ClashingMethod> collectClassingMethods(@NotNull GrTypeDefinition typeDefinition) {
+    Collection<HierarchicalMethodSignature> visibleSignatures = typeDefinition.getVisibleSignatures();
+
+    List<ClashingMethod> clashingMethods = ContainerUtil.newArrayList();
+    for (HierarchicalMethodSignature signature : visibleSignatures) {
+      PsiMethod method = signature.getMethod();
+      if (method instanceof GrTraitMethod && method.getContainingClass() == typeDefinition) {
+        List<HierarchicalMethodSignature> superSignatures = signature.getSuperSignatures();
+        if (superSignatures.size() > 1) {
+          List<GrTypeDefinition> traits = ContainerUtil.newArrayList();
+          for (HierarchicalMethodSignature superSignature : superSignatures) {
+            PsiMethod superMethod = superSignature.getMethod();
+            PsiClass superClass = superMethod.getContainingClass();
+            if (GrTraitUtil.isTrait(superClass) &&
+                !superMethod.getModifierList().hasExplicitModifier(PsiModifier.ABSTRACT)) {
+              traits.add((GrTypeDefinition)superClass);
+            }
+          }
+
+          if (traits.size() > 1) {
+            clashingMethods.add(new ClashingMethod(signature, traits));
+          }
+        }
+      }
+    }
+
+    return clashingMethods;
+  }
+
+  @NotNull
+  private static List<PsiClass> collectImplementedTraits(@NotNull GrTypeDefinition typeDefinition) {
+    return ContainerUtil.findAll(typeDefinition.getSupers(), new Condition<PsiClass>() {
+      @Override
+      public boolean value(PsiClass aClass) {
+        return GrTraitUtil.isTrait(aClass);
+      }
+    });
+  }
+
+  private static class ClashingMethod {
+    private final HierarchicalMethodSignature mySignature;
+    private final List<GrTypeDefinition> mySuperTraits;
+
+    public ClashingMethod(@NotNull HierarchicalMethodSignature signature, @NotNull List<GrTypeDefinition> superTraits) {
+      mySignature = signature;
+      mySuperTraits = superTraits;
+    }
+
+    @NotNull
+    public HierarchicalMethodSignature getSignature() {
+      return mySignature;
+    }
+
+    @NotNull
+    public List<GrTypeDefinition> getSuperTraits() {
+      return mySuperTraits;
+    }
+  }
+
+  private static class MyQuickFix implements LocalQuickFix {
+    private static final int MAX_SIGNATURE_LENGTH = 50;
+
+    private static String buildSignature(HierarchicalMethodSignature signature, int maxLength) {
+      StringBuilder result = new StringBuilder();
+      result.append(signature.getName());
+
+      PsiType[] params = signature.getParameterTypes();
+
+      if (params.length == 0) {
+        result.append("()");
+        return result.toString();
+      }
+
+      result.append("(");
+
+      for (PsiType param : params) {
+        if (result.length() >= maxLength - "...)".length()) {
+          result.append("...)");
+          return result.toString();
+        }
+        result.append(param.getPresentableText());
+        result.append(", ");
+      }
+      result.replace(result.length() - ", ".length(), result.length(), ")");
+      return result.toString();
+    }
+
+    @NotNull
+    @Override
+    public String getName() {
+      return GroovyInspectionBundle.message("declare.explicit.implementations.of.trait");
+    }
+
+    @NotNull
+    @Override
+    public String getFamilyName() {
+      return "Declare explicit implementation of clashing traits";
+    }
+
+    @Override
+    public void applyFix(@NotNull Project project, @NotNull final ProblemDescriptor descriptor) {
+      PsiElement element = descriptor.getPsiElement();
+      PsiElement parent = element.getParent();
+      if (parent instanceof GrTypeDefinition && ((GrTypeDefinition)parent).getNameIdentifierGroovy() == element) {
+        final GrTypeDefinition aClass = (GrTypeDefinition)parent;
+
+        new WriteCommandAction(project, aClass.getContainingFile()) {
+          @Override
+          protected void run(@NotNull Result result) {
+            final List<ClashingMethod> clashingMethods = collectClassingMethods(aClass);
+
+            for (ClashingMethod method : clashingMethods) {
+              PsiMethod traitMethod = method.getSignature().getMethod();
+              LOG.assertTrue(traitMethod instanceof GrTraitMethod);
+              OverrideImplementUtil.overrideOrImplement(aClass, traitMethod);
+            }
+          }
+        }.execute();
+      }
+    }
+  }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeStyle/GrReferenceAdjuster.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeStyle/GrReferenceAdjuster.java
deleted file mode 100644
index cf6d329..0000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeStyle/GrReferenceAdjuster.java
+++ /dev/null
@@ -1,254 +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 org.jetbrains.plugins.groovy.codeStyle;
-
-import com.intellij.lang.ASTNode;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
-import com.intellij.psi.codeStyle.ReferenceAdjuster;
-import com.intellij.psi.util.PsiTreeUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.plugins.groovy.debugger.fragments.GroovyCodeFragment;
-import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocComment;
-import org.jetbrains.plugins.groovy.lang.psi.*;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
-import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.imports.GrImportStatement;
-import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement;
-import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeArgumentList;
-import org.jetbrains.plugins.groovy.lang.psi.impl.GrReferenceElementImpl;
-import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyCodeStyleSettingsFacade;
-import org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil;
-import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrBindingVariable;
-import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
-
-/**
- * @author Max Medvedev
- */
-public class GrReferenceAdjuster implements ReferenceAdjuster {
-
-  public GrReferenceAdjuster() {
-  }
-
-  public static void shortenAllReferencesIn(@Nullable GroovyPsiElement newTypeElement) {
-    if (newTypeElement != null) {
-      newTypeElement.accept(new GroovyRecursiveElementVisitor() {
-        @Override
-        public void visitCodeReferenceElement(GrCodeReferenceElement refElement) {
-          super.visitCodeReferenceElement(refElement);
-          shortenReference(refElement);
-        }
-      });
-    }
-  }
-
-  @Override
-  public ASTNode process(@NotNull ASTNode element, boolean addImports, boolean incompleteCode, boolean useFqInJavadoc, boolean useFqInCode) {
-    final TextRange range = element.getTextRange();
-    process(element.getPsi(), range.getStartOffset(), range.getEndOffset(), addImports, incompleteCode, useFqInJavadoc, useFqInCode);
-    return element;
-  }
-
-  @Override
-  public ASTNode process(@NotNull ASTNode element, boolean addImports, boolean incompleteCode, Project project) {
-    final GroovyCodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project).getCustomSettings(GroovyCodeStyleSettings.class);
-    return process(element, addImports, incompleteCode, settings.USE_FQ_CLASS_NAMES_IN_JAVADOC, settings.USE_FQ_CLASS_NAMES);
-  }
-
-  @Override
-  public void processRange(@NotNull ASTNode element, int startOffset, int endOffset, boolean useFqInJavadoc, boolean useFqInCode) {
-    process(element.getPsi(), startOffset, endOffset, true, true, useFqInJavadoc, useFqInCode);
-  }
-
-  @Override
-  public void processRange(@NotNull ASTNode element, int startOffset, int endOffset, Project project) {
-    final GroovyCodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project).getCustomSettings(GroovyCodeStyleSettings.class);
-    processRange(element, startOffset, endOffset, settings.USE_FQ_CLASS_NAMES_IN_JAVADOC, settings.USE_FQ_CLASS_NAMES);
-  }
-
-  private static boolean process(@NotNull PsiElement element,
-                                 int start,
-                                 int end,
-                                 boolean addImports,
-                                 boolean incomplete,
-                                 boolean useFqInJavadoc,
-                                 boolean useFqInCode) {
-    boolean result = false;
-    if (element instanceof GrQualifiedReference<?> && ((GrQualifiedReference)element).resolve() instanceof PsiClass) {
-      result = shortenReferenceInner((GrQualifiedReference<?>)element, addImports, incomplete, useFqInJavadoc, useFqInCode);
-    }
-    else if (element instanceof GrReferenceExpression && PsiUtil.isSuperReference(((GrReferenceExpression)element).getQualifier())) {
-      result = shortenReferenceInner((GrReferenceExpression)element, addImports, incomplete, useFqInJavadoc, useFqInCode);
-    }
-
-    PsiElement child = element.getFirstChild();
-    while (child != null) {
-      final TextRange range = child.getTextRange();
-      if (start < range.getEndOffset() && range.getStartOffset() < end) {
-        result |= process(child, start, end, addImports, incomplete, useFqInJavadoc, useFqInCode);
-      }
-      child = child.getNextSibling();
-    }
-    return result;
-  }
-
-  public static <T extends PsiElement> boolean shortenReference(@NotNull GrQualifiedReference<T> ref) {
-    final GroovyCodeStyleSettings settings =
-      CodeStyleSettingsManager.getInstance(ref.getProject()).getCurrentSettings().getCustomSettings(GroovyCodeStyleSettings.class);
-    boolean result = shortenReferenceInner(ref, true, false, settings.USE_FQ_CLASS_NAMES_IN_JAVADOC, settings.USE_FQ_CLASS_NAMES);
-    final TextRange range = ref.getTextRange();
-    result |= process(ref, range.getStartOffset(), range.getEndOffset(), true, false, settings.USE_FQ_CLASS_NAMES_IN_JAVADOC, settings.USE_FQ_CLASS_NAMES);
-    return result;
-  }
-
-  private static <Qualifier extends PsiElement> boolean shortenReferenceInner(@NotNull GrQualifiedReference<Qualifier> ref,
-                                                                              boolean addImports,
-                                                                              boolean incomplete,
-                                                                              boolean useFqInJavadoc,
-                                                                              boolean useFqInCode) {
-
-    final Qualifier qualifier = ref.getQualifier();
-    if (qualifier == null || PsiUtil.isSuperReference(qualifier) || cannotShortenInContext(ref)) {
-      return false;
-    }
-
-    if (ref instanceof GrReferenceExpression) {
-      final GrTypeArgumentList typeArgs = ((GrReferenceExpression)ref).getTypeArgumentList();
-      if (typeArgs != null && typeArgs.getTypeArgumentElements().length > 0) {
-        return false;
-      }
-    }
-
-    if (!shorteningIsMeaningfully(ref, useFqInJavadoc, useFqInCode)) return false;
-
-    final PsiElement resolved = resolveRef(ref, incomplete);
-    if (resolved == null) return false;
-
-    if (!checkCopyWithoutQualifier(ref, addImports, resolved)) return false;
-    ref.setQualifier(null);
-    return true;
-  }
-
-  private static <Qualifier extends PsiElement> boolean checkCopyWithoutQualifier(@NotNull GrQualifiedReference<Qualifier> ref,
-                                                                                  boolean addImports,
-                                                                                  @NotNull PsiElement resolved) {
-    final GrQualifiedReference<Qualifier> copy = getCopy(ref);
-    if (copy == null) return false;
-    copy.setQualifier(null);
-
-    final PsiElement resolvedCopy = copy.resolve();
-    if (ref.getManager().areElementsEquivalent(resolved, resolvedCopy)) {
-      return true;
-    }
-    else if (resolvedCopy != null && !(resolvedCopy instanceof GrBindingVariable)) {
-      return false;
-    }
-
-    if (resolved instanceof PsiClass) {
-      final PsiClass clazz = (PsiClass)resolved;
-      final String qName = clazz.getQualifiedName();
-      if (qName != null && addImports && checkIsInnerClass(clazz, ref) && mayInsertImport(ref)) {
-        final GroovyFileBase file = (GroovyFileBase)ref.getContainingFile();
-        final GrImportStatement added = file.addImportForClass(clazz);
-        if (copy.isReferenceTo(resolved)) return true;
-        file.removeImport(added);
-      }
-    }
-
-    return false;
-  }
-
-  private static <Qualifier extends PsiElement> boolean checkIsInnerClass(@NotNull PsiClass resolved, GrQualifiedReference<Qualifier> ref) {
-    final PsiClass containingClass = resolved.getContainingClass();
-    return containingClass == null ||
-           PsiTreeUtil.isAncestor(containingClass, ref, true) ||
-           GroovyCodeStyleSettingsFacade.getInstance(containingClass.getProject()).insertInnerClassImports();
-  }
-
-  @Nullable
-  private static <Qualifier extends PsiElement> PsiElement resolveRef(@NotNull GrQualifiedReference<Qualifier> ref, boolean incomplete) {
-    if (!incomplete) return ref.resolve();
-
-    PsiResolveHelper helper = JavaPsiFacade.getInstance(ref.getProject()).getResolveHelper();
-    if (ref instanceof GrReferenceElement) {
-      final String classNameText = ((GrReferenceElement)ref).getClassNameText();
-      if (classNameText != null) {
-        return helper.resolveReferencedClass(classNameText, ref);
-      }
-    }
-    return null;
-  }
-
-
-  @SuppressWarnings("unchecked")
-  @Nullable
-  private static <Qualifier extends PsiElement> GrQualifiedReference<Qualifier> getCopy(@NotNull GrQualifiedReference<Qualifier> ref) {
-    if (ref.getParent() instanceof GrMethodCall) {
-      final GrMethodCall copy = ((GrMethodCall)ref.getParent().copy());
-      return (GrQualifiedReference<Qualifier>)copy.getInvokedExpression();
-    }
-    return (GrQualifiedReference<Qualifier>)ref.copy();
-  }
-
-  private static <Qualifier extends PsiElement> boolean shorteningIsMeaningfully(@NotNull GrQualifiedReference<Qualifier> ref,
-                                                                                 boolean useFqInJavadoc, boolean useFqInCode) {
-
-    if (ref instanceof GrReferenceElementImpl && ((GrReferenceElementImpl)ref).isFullyQualified()) {
-      final GrDocComment doc = PsiTreeUtil.getParentOfType(ref, GrDocComment.class);
-      if (doc != null) {
-        if (useFqInJavadoc) return false;
-      }
-      else {
-        if (useFqInCode) return false;
-      }
-    }
-
-    final Qualifier qualifier = ref.getQualifier();
-
-    if (qualifier instanceof GrCodeReferenceElement) {
-      return true;
-    }
-
-    if (qualifier instanceof GrExpression) {
-      if (qualifier instanceof GrReferenceExpression && PsiUtil.isThisReference(qualifier)) return true;
-      if (qualifier instanceof GrReferenceExpression &&
-          PsiImplUtil.seemsToBeQualifiedClassName((GrExpression)qualifier)) {
-        final PsiElement resolved = ((GrReferenceExpression)qualifier).resolve();
-        if (resolved instanceof PsiClass || resolved instanceof PsiPackage) return true;
-      }
-    }
-    return false;
-  }
-
-  private static <Qualifier extends PsiElement> boolean cannotShortenInContext(@NotNull GrQualifiedReference<Qualifier> ref) {
-    return PsiTreeUtil.getParentOfType(ref, GrImportStatement.class) != null ||
-           PsiTreeUtil.getParentOfType(ref, GroovyCodeFragment.class) != null;
-  }
-
-  private static <Qualifier extends PsiElement> boolean mayInsertImport(@NotNull GrQualifiedReference<Qualifier> ref) {
-    return !(ref.getContainingFile() instanceof GroovyCodeFragment) &&
-           PsiTreeUtil.getParentOfType(ref, GrImportStatement.class) == null &&
-           ref.getContainingFile() instanceof GroovyFileBase;
-  }
-
-  public static GrReferenceAdjuster getInstance() {
-    return new GrReferenceAdjuster();
-  }
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeStyle/GroovyCodeStyleSettingsFacadeImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeStyle/GroovyCodeStyleSettingsFacadeImpl.java
index 19985ba..5e15205 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeStyle/GroovyCodeStyleSettingsFacadeImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeStyle/GroovyCodeStyleSettingsFacadeImpl.java
@@ -37,6 +37,11 @@
   }
 
   @Override
+  public boolean useFqClassNamesInJavadoc() {
+    return getSettings().USE_FQ_CLASS_NAMES_IN_JAVADOC;
+  }
+
+  @Override
   public int staticFieldsOrderWeight() {
     return CodeStyleSettingsManager.getInstance(myProject).getCurrentSettings().STATIC_FIELDS_ORDER_WEIGHT;
   }
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompiler.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompiler.java
deleted file mode 100644
index 9c714e1..0000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompiler.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.
- */
-
-package org.jetbrains.plugins.groovy.compiler;
-
-import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompileScope;
-import com.intellij.openapi.compiler.CompilerManager;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.JavaSdkType;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.roots.ProjectFileIndex;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.roots.ui.configuration.ClasspathEditor;
-import com.intellij.openapi.roots.ui.configuration.ModulesConfigurator;
-import com.intellij.openapi.ui.Messages;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.search.FilenameIndex;
-import com.intellij.psi.search.GlobalSearchScope;
-import icons.JetgroovyIcons;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.groovy.GroovyBundle;
-import org.jetbrains.plugins.groovy.GroovyFileType;
-import org.jetbrains.plugins.groovy.GroovyFileTypeLoader;
-import org.jetbrains.plugins.groovy.config.GroovyFacetUtil;
-import org.jetbrains.plugins.groovy.util.LibrariesUtil;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author Dmitry.Krasilschikov
- */
-
-public class GroovyCompiler extends GroovyCompilerBase {
-  private static final Logger LOG = Logger.getInstance("#org.jetbrains.plugins.groovy.compiler.GroovyCompiler");
-  private static final String AST_TRANSFORM_FILE_NAME = "org.codehaus.groovy.transform.ASTTransformation";
-
-  public GroovyCompiler(Project project) {
-    super(project);
-  }
-
-  @Override
-  @NotNull
-  public String getDescription() {
-    return "groovy compiler";
-  }
-
-  @Override
-  protected void compileFiles(final CompileContext context, final Module module, List<VirtualFile> toCompile, OutputSink sink, boolean tests) {
-    context.getProgressIndicator().checkCanceled();
-    context.getProgressIndicator().setText("Starting Groovy compiler...");
-
-    runGroovycCompiler(context, module, toCompile, false, getMainOutput(context, module, tests), sink, tests);
-  }
-
-  @Override
-  public boolean validateConfiguration(CompileScope compileScope) {
-    VirtualFile[] files = compileScope.getFiles(GroovyFileType.GROOVY_FILE_TYPE, true);
-    if (files.length == 0) return true;
-
-    final Set<String> scriptExtensions = GroovyFileTypeLoader.getCustomGroovyScriptExtensions();
-
-    final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
-    Set<Module> modules = new HashSet<Module>();
-    for (VirtualFile file : files) {
-      if (scriptExtensions.contains(file.getExtension()) ||
-          compilerManager.isExcludedFromCompilation(file) ||
-          CompilerConfiguration.getInstance(myProject).isResourceFile(file)) {
-        continue;
-      }
-
-      ProjectRootManager rootManager = ProjectRootManager.getInstance(myProject);
-      Module module = rootManager.getFileIndex().getModuleForFile(file);
-      if (module != null) {
-        modules.add(module);
-      }
-    }
-
-    Set<Module> nojdkModules = new HashSet<Module>();
-    for (Module module : modules) {
-      if(!GroovyFacetUtil.isSuitableModule(module)) continue;
-      final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
-      if (sdk == null || !(sdk.getSdkType() instanceof JavaSdkType)) {
-        nojdkModules.add(module);
-        continue;
-      }
-
-      if (!LibrariesUtil.hasGroovySdk(module)) {
-        if (!GroovyFacetUtil.tryToSetUpGroovyFacetOnTheFly(module)) {
-          Messages.showErrorDialog(myProject, GroovyBundle.message("cannot.compile.groovy.files.no.facet", module.getName()),
-                                   GroovyBundle.message("cannot.compile"));
-          ModulesConfigurator.showDialog(module.getProject(), module.getName(), ClasspathEditor.NAME);
-          return false;
-        }
-      }
-    }
-
-    if (!nojdkModules.isEmpty()) {
-      final Module[] noJdkArray = nojdkModules.toArray(new Module[nojdkModules.size()]);
-      if (noJdkArray.length == 1) {
-        Messages.showErrorDialog(myProject, GroovyBundle.message("cannot.compile.groovy.files.no.sdk", noJdkArray[0].getName()),
-                                 GroovyBundle.message("cannot.compile"));
-      }
-      else {
-        StringBuilder modulesList = new StringBuilder();
-        for (int i = 0; i < noJdkArray.length; i++) {
-          if (i > 0) modulesList.append(", ");
-          modulesList.append(noJdkArray[i].getName());
-        }
-        Messages.showErrorDialog(myProject, GroovyBundle.message("cannot.compile.groovy.files.no.sdk.mult", modulesList.toString()),
-                                 GroovyBundle.message("cannot.compile"));
-      }
-      return false;
-    }
-
-    final GroovyCompilerConfiguration configuration = GroovyCompilerConfiguration.getInstance(myProject);
-    if (!configuration.transformsOk && needTransformCopying(compileScope)) {
-      final int result = Messages.showYesNoDialog(myProject,
-                                                  "You seem to have global Groovy AST transformations defined in your project,\n" +
-                                                  "but they won't be applied to your code because they are not marked as compiler resources.\n" +
-                                                  "Do you want to add them to compiler resource list?\n" +
-                                                  "(you can do it yourself later in Settings | Compiler | Resource patterns)",
-                                                  "AST Transformations Found",
-                                                  JetgroovyIcons.Groovy.Groovy_32x32);
-      if (result == Messages.YES) {
-        CompilerConfiguration.getInstance(myProject).addResourceFilePattern(AST_TRANSFORM_FILE_NAME);
-      } else {
-        configuration.transformsOk = true;
-      }
-    }
-
-    return true;
-  }
-
-  private boolean needTransformCopying(CompileScope compileScope) {
-    final CompilerConfiguration configuration = CompilerConfiguration.getInstance(myProject);
-    final ProjectFileIndex index = ProjectRootManager.getInstance(myProject).getFileIndex();
-    for (VirtualFile file : FilenameIndex.getVirtualFilesByName(myProject, AST_TRANSFORM_FILE_NAME, GlobalSearchScope.projectScope(myProject))) {
-      if (compileScope.belongs(file.getUrl()) && index.isInSource(file) && !configuration.isResourceFile(file)) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerBase.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerBase.java
deleted file mode 100644
index b810b68..0000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerBase.java
+++ /dev/null
@@ -1,432 +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 org.jetbrains.plugins.groovy.compiler;
-
-import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.compiler.impl.FileSetCompileScope;
-import com.intellij.compiler.impl.TranslatingCompilerFilesMonitor;
-import com.intellij.compiler.impl.javaCompiler.ModuleChunk;
-import com.intellij.compiler.impl.javaCompiler.OutputItemImpl;
-import com.intellij.compiler.make.CacheCorruptedException;
-import com.intellij.compiler.make.DependencyCache;
-import com.intellij.execution.ExecutionException;
-import com.intellij.execution.configurations.JavaParameters;
-import com.intellij.openapi.application.AccessToken;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.application.PathManager;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompilerMessageCategory;
-import com.intellij.openapi.compiler.CompilerPaths;
-import com.intellij.openapi.compiler.TranslatingCompiler;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.fileTypes.FileType;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.progress.ProgressManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.JavaSdkType;
-import com.intellij.openapi.projectRoots.JdkUtil;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.projectRoots.SdkTypeId;
-import com.intellij.openapi.roots.ContentIterator;
-import com.intellij.openapi.roots.ModuleFileIndex;
-import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.roots.OrderRootType;
-import com.intellij.openapi.roots.libraries.Library;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.CharsetToolkit;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VfsUtilCore;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.encoding.EncodingProjectManager;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiManager;
-import com.intellij.util.*;
-import com.intellij.util.cls.ClsFormatException;
-import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.net.HttpConfigurable;
-import gnu.trove.THashSet;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.groovy.compiler.rt.GroovycRunner;
-import org.jetbrains.jps.incremental.groovy.GroovycOSProcessHandler;
-import org.jetbrains.jps.incremental.messages.BuildMessage;
-import org.jetbrains.jps.incremental.messages.CompilerMessage;
-import org.jetbrains.plugins.groovy.GroovyFileType;
-import org.jetbrains.plugins.groovy.config.GroovyConfigUtils;
-import org.jetbrains.plugins.groovy.config.GroovyFacetUtil;
-import org.jetbrains.plugins.groovy.extensions.GroovyScriptType;
-import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
-import org.jetbrains.plugins.groovy.runner.GroovyScriptUtil;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.*;
-
-/**
- * @author peter
- */
-public abstract class GroovyCompilerBase implements TranslatingCompiler {
-  private static final Logger LOG = Logger.getInstance("#org.jetbrains.plugins.groovy.compiler.GroovyCompilerBase");
-  protected final Project myProject;
-
-  public GroovyCompilerBase(Project project) {
-    myProject = project;
-  }
-
-  protected void runGroovycCompiler(final CompileContext compileContext, final Module module,
-                                    final List<VirtualFile> toCompile,
-                                    boolean forStubs,
-                                    VirtualFile outputDir,
-                                    OutputSink sink, boolean tests) {
-    //assert !ApplicationManager.getApplication().isDispatchThread();
-    final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
-    assert sdk != null; //verified before
-    SdkTypeId sdkType = sdk.getSdkType();
-    assert sdkType instanceof JavaSdkType;
-    final String exePath = ((JavaSdkType)sdkType).getVMExecutablePath(sdk);
-
-    final JavaParameters parameters = new JavaParameters();
-    final PathsList classPathBuilder = parameters.getClassPath();
-
-    // IMPORTANT: must be the first entry to avoid collisions
-    classPathBuilder.add(PathUtil.getJarPathForClass(GroovycRunner.class));
-
-    final ModuleChunk chunk = createChunk(module, compileContext);
-
-    final Library[] libraries = GroovyConfigUtils.getInstance().getSDKLibrariesByModule(module);
-    if (libraries.length > 0) {
-      classPathBuilder.addVirtualFiles(Arrays.asList(libraries[0].getFiles(OrderRootType.CLASSES)));
-    }
-
-    classPathBuilder.addVirtualFiles(chunk.getCompilationBootClasspathFiles(false));
-    classPathBuilder.addVirtualFiles(chunk.getCompilationClasspathFiles(false));
-    appendOutputPath(module, classPathBuilder, false);
-    if (tests) {
-      appendOutputPath(module, classPathBuilder, true);
-    }
-
-    final List<String> patchers = new SmartList<String>();
-
-    AccessToken accessToken = ApplicationManager.getApplication().acquireReadActionLock();
-    try {
-      for (final GroovyCompilerExtension extension : GroovyCompilerExtension.EP_NAME.getExtensions()) {
-        extension.enhanceCompilationClassPath(chunk, classPathBuilder);
-        patchers.addAll(extension.getCompilationUnitPatchers(chunk));
-      }
-    }
-    finally {
-      accessToken.finish();
-    }
-
-    final boolean profileGroovyc = "true".equals(System.getProperty("profile.groovy.compiler"));
-    if (profileGroovyc) {
-      parameters.getVMParametersList().defineProperty("java.library.path", PathManager.getBinPath());
-      parameters.getVMParametersList().defineProperty("profile.groovy.compiler", "true");
-      parameters.getVMParametersList().add("-agentlib:yjpagent=disablej2ee,disablealloc,delay=10000,sessionname=GroovyCompiler");
-      classPathBuilder.add(PathManager.findFileInLibDirectory("yjp-controller-api-redist.jar").getAbsolutePath());
-    }
-
-    final GroovyCompilerConfiguration compilerConfiguration = GroovyCompilerConfiguration.getInstance(myProject);
-    parameters.getVMParametersList().add("-Xmx" + compilerConfiguration.getHeapSize() + "m");
-    if (profileGroovyc) {
-      parameters.getVMParametersList().add("-XX:+HeapDumpOnOutOfMemoryError");
-    }
-    parameters.getVMParametersList().addAll(HttpConfigurable.convertArguments(HttpConfigurable.getJvmPropertiesList(false, null)));
-
-    //debug
-    //parameters.getVMParametersList().add("-Xdebug"); parameters.getVMParametersList().add("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5239");
-
-    // Setting up process encoding according to locale
-    final ArrayList<String> list = new ArrayList<String>();
-    CompilerUtil.addLocaleOptions(list, false);
-    for (String s : list) {
-      parameters.getVMParametersList().add(s);
-    }
-
-    parameters.setMainClass(GroovycRunner.class.getName());
-
-    List<String> finalOutputs = ContainerUtil.newArrayList();
-    for (Module eachModule : chunk.getModules()) {
-      final VirtualFile finalOutputDir = getMainOutput(compileContext, eachModule, tests);
-      if (finalOutputDir == null) {
-        compileContext.addMessage(CompilerMessageCategory.ERROR, "No output directory for module " + eachModule.getName() + (tests ? " tests" : " production"), null, -1, -1);
-        return;
-      }
-      finalOutputs.add(FileUtil.toSystemDependentName(finalOutputDir.getPath()));
-    }
-
-    final Charset ideCharset = EncodingProjectManager.getInstance(myProject).getDefaultCharset();
-    String encoding = ideCharset != null && !Comparing.equal(CharsetToolkit.getDefaultSystemCharset(), ideCharset) ? ideCharset.name() : null;
-    Set<String> paths2Compile = ContainerUtil.map2Set(toCompile, new Function<VirtualFile, String>() {
-      @Override
-      public String fun(VirtualFile file) {
-        return file.getPath();
-      }
-    });
-    Map<String, String> class2Src = new HashMap<String, String>();
-
-    for (VirtualFile file : enumerateGroovyFiles(module)) {
-      if (!paths2Compile.contains(file.getPath())) {
-        for (String name : TranslatingCompilerFilesMonitor.getInstance().getCompiledClassNames(file, myProject)) {
-          class2Src.put(name, file.getPath());
-        }
-      }
-    }
-
-    final File fileWithParameters;
-    try {
-      fileWithParameters = GroovycOSProcessHandler
-        .fillFileWithGroovycParameters(outputDir.getPath(), paths2Compile, finalOutputs,
-                                       class2Src, encoding, patchers, "");
-    }
-    catch (IOException e) {
-      LOG.info(e);
-      compileContext.addMessage(CompilerMessageCategory.ERROR, "Error creating a temp file to launch Groovy compiler: " + e.getMessage(), null, -1, -1);
-      return;
-    }
-
-    parameters.getProgramParametersList().add("do_not_optimize");
-    parameters.getProgramParametersList().add(forStubs ? "stubs" : "groovyc");
-    parameters.getProgramParametersList().add(fileWithParameters.getPath());
-    if (compilerConfiguration.isInvokeDynamic()) {
-      parameters.getProgramParametersList().add("--indy");
-    }
-
-    try {
-      Process process = JdkUtil.setupJVMCommandLine(exePath, parameters, true).createProcess();
-      GroovycOSProcessHandler processHandler = GroovycOSProcessHandler.runGroovyc(process, new Consumer<String>() {
-        @Override
-        public void consume(String s) {
-          compileContext.getProgressIndicator().setText(s);
-        }
-      });
-
-      final List<VirtualFile> toRecompile = new ArrayList<VirtualFile>();
-      for (File toRecompileFile : processHandler.getToRecompileFiles()) {
-        final VirtualFile vFile = LocalFileSystem.getInstance().findFileByIoFile(toRecompileFile);
-        LOG.assertTrue(vFile != null);
-        toRecompile.add(vFile);
-      }
-
-      for (CompilerMessage compilerMessage : processHandler.getCompilerMessages(module.getName())) {
-        final String url = compilerMessage.getSourcePath();
-        compileContext.addMessage(getMessageCategory(compilerMessage), compilerMessage.getMessageText(),
-                                  url == null ? null : VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(url)),
-                                  (int)compilerMessage.getLine(),
-                                  (int)compilerMessage.getColumn());
-      }
-
-      List<GroovycOSProcessHandler.OutputItem> outputItems = processHandler.getSuccessfullyCompiled();
-      ArrayList<OutputItem> items = new ArrayList<OutputItem>();
-      if (forStubs) {
-        List<String> outputPaths = new ArrayList<String>();
-        for (final GroovycOSProcessHandler.OutputItem outputItem : outputItems) {
-          outputPaths.add(outputItem.outputPath);
-        }
-        addStubsToCompileScope(outputPaths, compileContext, module);
-      }
-      else {
-        final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
-        if (indicator != null) {
-          indicator.setText("Updating caches...");
-        }
-
-        final DependencyCache dependencyCache = ((CompileContextEx)compileContext).getDependencyCache();
-        for (GroovycOSProcessHandler.OutputItem outputItem : outputItems) {
-          final VirtualFile sourceVirtualFile = LocalFileSystem.getInstance().findFileByIoFile(new File(outputItem.sourcePath));
-          if (sourceVirtualFile == null) {
-            continue;
-          }
-
-          if (indicator != null) {
-            indicator.setText2(sourceVirtualFile.getName());
-          }
-
-          LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(outputItem.outputPath));
-          items.add(new OutputItemImpl(outputItem.outputPath, sourceVirtualFile));
-
-          final File classFile = new File(outputItem.outputPath);
-          try {
-            dependencyCache.reparseClassFile(classFile, FileUtil.loadFileBytes(classFile));
-          }
-          catch (ClsFormatException e) {
-            LOG.error(e);
-          }
-          catch (CacheCorruptedException e) {
-            LOG.error(e);
-          }
-          catch (FileNotFoundException ignored) {
-          }
-          catch (IOException e) {
-            LOG.error(e);
-          }
-        }
-      }
-
-      sink.add(outputDir.getPath(), items, VfsUtilCore.toVirtualFileArray(toRecompile));
-    }
-    catch (ExecutionException e) {
-      LOG.info(e);
-      compileContext.addMessage(CompilerMessageCategory.ERROR, "Error running Groovy compiler: " + e.getMessage(), null, -1, -1);
-    }
-  }
-
-  protected Set<VirtualFile> enumerateGroovyFiles(final Module module) {
-    final Set<VirtualFile> moduleClasses = new THashSet<VirtualFile>();
-    ModuleRootManager.getInstance(module).getFileIndex().iterateContent(new ContentIterator() {
-      @Override
-      public boolean processFile(final VirtualFile vfile) {
-        if (!vfile.isDirectory() &&
-            GroovyFileType.GROOVY_FILE_TYPE.equals(vfile.getFileType())) {
-
-          AccessToken accessToken = ApplicationManager.getApplication().acquireReadActionLock();
-
-          try {
-            if (PsiManager.getInstance(myProject).findFile(vfile) instanceof GroovyFile) {
-              moduleClasses.add(vfile);
-            }
-          }
-          finally {
-            accessToken.finish();
-          }
-        }
-        return true;
-      }
-    });
-    return moduleClasses;
-  }
-
-  protected static void addStubsToCompileScope(List<String> outputPaths, CompileContext compileContext, Module module) {
-    List<VirtualFile> stubFiles = new ArrayList<VirtualFile>();
-    for (String outputPath : outputPaths) {
-      final File stub = new File(outputPath);
-      CompilerUtil.refreshIOFile(stub);
-      final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(stub);
-      ContainerUtil.addIfNotNull(file, stubFiles);
-    }
-    ((CompileContextEx)compileContext).addScope(new FileSetCompileScope(stubFiles, new Module[]{module}));
-  }
-
-  @Nullable
-  protected static VirtualFile getMainOutput(CompileContext compileContext, Module module, boolean tests) {
-    return tests ? compileContext.getModuleOutputDirectoryForTests(module) : compileContext.getModuleOutputDirectory(module);
-  }
-
-  private static CompilerMessageCategory getMessageCategory(CompilerMessage compilerMessage) {
-    BuildMessage.Kind category = compilerMessage.getKind();
-
-    if (BuildMessage.Kind.ERROR.equals(category)) return CompilerMessageCategory.ERROR;
-    if (BuildMessage.Kind.INFO.equals(category)) return CompilerMessageCategory.INFORMATION;
-    if (BuildMessage.Kind.WARNING.equals(category)) return CompilerMessageCategory.WARNING;
-
-    return CompilerMessageCategory.ERROR;
-  }
-
-  private static void appendOutputPath(Module module, PathsList compileClasspath, final boolean forTestClasses) {
-    String output = CompilerPaths.getModuleOutputPath(module, forTestClasses);
-    if (output != null) {
-      compileClasspath.add(FileUtil.toSystemDependentName(output));
-    }
-  }
-
-  private static ModuleChunk createChunk(Module module, CompileContext context) {
-    return new ModuleChunk((CompileContextEx)context, new Chunk<Module>(module), Collections.<Module, List<VirtualFile>>emptyMap());
-  }
-
-  @Override
-  public void compile(final CompileContext compileContext, Chunk<Module> moduleChunk, final VirtualFile[] virtualFiles, OutputSink sink) {
-    Map<Module, List<VirtualFile>> mapModulesToVirtualFiles;
-    if (moduleChunk.getNodes().size() == 1) {
-      mapModulesToVirtualFiles = Collections.singletonMap(moduleChunk.getNodes().iterator().next(), Arrays.asList(virtualFiles));
-    }
-    else {
-      mapModulesToVirtualFiles = CompilerUtil.buildModuleToFilesMap(compileContext, virtualFiles);
-    }
-    for (final Module module : moduleChunk.getNodes()) {
-      final List<VirtualFile> moduleFiles = mapModulesToVirtualFiles.get(module);
-      if (moduleFiles == null) {
-        continue;
-      }
-
-      final ModuleFileIndex index = ModuleRootManager.getInstance(module).getFileIndex();
-      final List<VirtualFile> toCompile = new ArrayList<VirtualFile>();
-      final List<VirtualFile> toCompileTests = new ArrayList<VirtualFile>();
-      final CompilerConfiguration configuration = CompilerConfiguration.getInstance(myProject);
-      final PsiManager psiManager = PsiManager.getInstance(myProject);
-
-      if (GroovyFacetUtil.isSuitableModule(module)) {
-        for (final VirtualFile file : moduleFiles) {
-          if (shouldCompile(file, configuration, psiManager)) {
-            (index.isInTestSourceContent(file) ? toCompileTests : toCompile).add(file);
-          }
-        }
-      }
-
-      if (!toCompile.isEmpty()) {
-        compileFiles(compileContext, module, toCompile, sink, false);
-      }
-      if (!toCompileTests.isEmpty()) {
-        compileFiles(compileContext, module, toCompileTests, sink, true);
-      }
-
-    }
-
-  }
-
-  private static boolean shouldCompile(final VirtualFile file, CompilerConfiguration configuration, final PsiManager manager) {
-    if (configuration.isResourceFile(file)) {
-      return false;
-    }
-
-    final FileType fileType = file.getFileType();
-    if (fileType == GroovyFileType.GROOVY_FILE_TYPE) {
-      AccessToken accessToken = ApplicationManager.getApplication().acquireReadActionLock();
-
-      try {
-        PsiFile psiFile = manager.findFile(file);
-        if (psiFile instanceof GroovyFile && ((GroovyFile)psiFile).isScript()) {
-          final GroovyScriptType scriptType = GroovyScriptUtil.getScriptType((GroovyFile)psiFile);
-          return scriptType.shouldBeCompiled((GroovyFile)psiFile);
-        }
-        return true;
-      }
-      finally {
-        accessToken.finish();
-      }
-    }
-
-    return fileType == StdFileTypes.JAVA;
-  }
-
-  protected abstract void compileFiles(CompileContext compileContext, Module module,
-                                       List<VirtualFile> toCompile, OutputSink sink, boolean tests);
-
-  @Override
-  public boolean isCompilableFile(VirtualFile file, CompileContext context) {
-    final boolean result = GroovyFileType.GROOVY_FILE_TYPE.equals(file.getFileType());
-    if (result && LOG.isDebugEnabled()) {
-      LOG.debug("compilable file: " + file.getPath());
-    }
-    return result;
-  }
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerLoader.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerLoader.java
index b8f6e94..eafcd9a 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerLoader.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerLoader.java
@@ -21,46 +21,60 @@
 import com.intellij.openapi.fileEditor.FileEditorManager;
 import com.intellij.openapi.fileEditor.FileEditorManagerAdapter;
 import com.intellij.openapi.fileEditor.FileEditorManagerListener;
-import com.intellij.openapi.fileTypes.FileType;
-import com.intellij.openapi.fileTypes.StdFileTypes;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleManager;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.JavaPsiFacade;
 import com.intellij.psi.PsiClass;
+import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.ui.EditorNotificationPanel;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 import org.jetbrains.plugins.groovy.GroovyFileType;
-import org.jetbrains.plugins.groovy.compiler.generator.GroovycStubGenerator;
 
 import java.util.Arrays;
-import java.util.HashSet;
 
 /**
  * @author ilyas
  */
 public class GroovyCompilerLoader extends AbstractProjectComponent {
 
+  public static final String GROOVY_STUBS = "groovyStubs";
+
   public GroovyCompilerLoader(Project project) {
     super(project);
   }
 
+  @Nullable
+  public static PsiClass findClassByStub(Project project, VirtualFile stubFile) {
+    final String[] components = StringUtil.trimEnd(stubFile.getPath(), ".java").split("[\\\\/]");
+    final int stubs = Arrays.asList(components).indexOf(GROOVY_STUBS);
+    if (stubs < 0 || stubs >= components.length - 3) {
+      return null;
+    }
+
+    final String moduleName = components[stubs + 1];
+    final Module module = ModuleManager.getInstance(project).findModuleByName(moduleName);
+    if (module == null) {
+      return null;
+    }
+
+    final String fqn = StringUtil.join(Arrays.asList(components).subList(stubs + 3, components.length), ".");
+    return JavaPsiFacade.getInstance(project).findClass(fqn, GlobalSearchScope.moduleScope(module));
+  }
+
   @Override
   public void projectOpened() {
     CompilerManager compilerManager = CompilerManager.getInstance(myProject);
     compilerManager.addCompilableFileType(GroovyFileType.GROOVY_FILE_TYPE);
 
-    compilerManager.addTranslatingCompiler(new GroovycStubGenerator(myProject),
-                                           new HashSet<FileType>(Arrays.asList(StdFileTypes.JAVA, GroovyFileType.GROOVY_FILE_TYPE)),
-                                           new HashSet<FileType>(Arrays.asList(StdFileTypes.JAVA)));
-
-    compilerManager.addTranslatingCompiler(new GroovyCompiler(myProject),
-                                           new HashSet<FileType>(Arrays.asList(GroovyFileType.GROOVY_FILE_TYPE, StdFileTypes.CLASS)),
-                                           new HashSet<FileType>(Arrays.asList(StdFileTypes.CLASS)));
-
     myProject.getMessageBus().connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
       @Override
       public void fileOpened(@NotNull FileEditorManager source, @NotNull final VirtualFile file) {
-        if (file.getName().endsWith(".java") && file.getPath().contains(GroovycStubGenerator.GROOVY_STUBS)) {
-          final PsiClass psiClass = GroovycStubGenerator.findClassByStub(myProject, file);
+        if (file.getName().endsWith(".java") && file.getPath().contains(GROOVY_STUBS)) {
+          final PsiClass psiClass = findClassByStub(myProject, file);
           if (psiClass != null) {
             final FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject);
             final FileEditor[] editors = fileEditorManager.getEditors(file);
@@ -80,7 +94,7 @@
     panel.createActionLabel("Go to the Groovy class", new Runnable() {
       @Override
       public void run() {
-        final PsiClass original = GroovycStubGenerator.findClassByStub(myProject, file);
+        final PsiClass original = findClassByStub(myProject, file);
         if (original != null) {
           original.navigate(true);
         }
@@ -89,7 +103,7 @@
     panel.createActionLabel("Exclude from stub generation", new Runnable() {
       @Override
       public void run() {
-        final PsiClass psiClass = GroovycStubGenerator.findClassByStub(myProject, file);
+        final PsiClass psiClass = findClassByStub(myProject, file);
         if (psiClass != null) {
           ExcludeFromStubGenerationAction.doExcludeFromStubGeneration(psiClass.getContainingFile());
         }
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/generator/GroovycStubGenerator.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/generator/GroovycStubGenerator.java
deleted file mode 100644
index bfdd0eb..0000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/generator/GroovycStubGenerator.java
+++ /dev/null
@@ -1,270 +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 org.jetbrains.plugins.groovy.compiler.generator;
-
-import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.compiler.impl.FileSetCompileScope;
-import com.intellij.compiler.impl.TranslatingCompilerFilesMonitor;
-import com.intellij.ide.highlighter.JavaFileType;
-import com.intellij.openapi.application.AccessToken;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.application.ModalityState;
-import com.intellij.openapi.application.WriteAction;
-import com.intellij.openapi.compiler.CompileContext;
-import com.intellij.openapi.compiler.CompileScope;
-import com.intellij.openapi.compiler.CompilerPaths;
-import com.intellij.openapi.compiler.ex.CompileContextEx;
-import com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.*;
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VfsUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.JavaPsiFacade;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiManager;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.util.Chunk;
-import com.intellij.util.Processor;
-import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.containers.FactoryMap;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes;
-import org.jetbrains.jps.model.java.JavaSourceRootType;
-import org.jetbrains.plugins.groovy.compiler.GroovyCompilerBase;
-import org.jetbrains.plugins.groovy.compiler.GroovyCompilerConfiguration;
-import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
-import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyNamesUtil;
-import org.jetbrains.plugins.groovy.refactoring.convertToJava.GroovyToJavaGenerator;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-
-/**
- * @author peter
- */
-public class GroovycStubGenerator extends GroovyCompilerBase {
-  private static final Logger LOG = Logger.getInstance("#org.jetbrains.plugins.groovy.compiler.generator.GroovycStubGenerator");
-
-  public static final String GROOVY_STUBS = "groovyStubs";
-
-  public GroovycStubGenerator(Project project) {
-    super(project);
-  }
-
-  @Override
-  public void compile(CompileContext compileContext, Chunk<Module> moduleChunk, VirtualFile[] virtualFiles, OutputSink sink) {
-    final ExcludedEntriesConfiguration excluded = GroovyCompilerConfiguration.getExcludeConfiguration(myProject);
-    
-    @SuppressWarnings("MismatchedQueryAndUpdateOfCollection") FactoryMap<Pair<Module, Boolean>, Boolean> hasJava = new FactoryMap<Pair<Module, Boolean>, Boolean>() {
-      @Override
-      protected Boolean create(Pair<Module, Boolean> key) {
-        return containsJavaSources(key.first, key.second);
-      }
-    };
-
-    ProjectFileIndex index = ProjectRootManager.getInstance(myProject).getFileIndex();
-
-    List<VirtualFile> total = new ArrayList<VirtualFile>();
-    for (final VirtualFile virtualFile : virtualFiles) {
-      if (!excluded.isExcluded(virtualFile) &&
-          GroovyNamesUtil.isIdentifier(virtualFile.getNameWithoutExtension())) {
-        Module module = index.getModuleForFile(virtualFile);
-        if (module == null || hasJava.get(Pair.create(module, index.isInTestSourceContent(virtualFile)))) {
-          total.add(virtualFile);
-        }
-      }
-    }
-
-    if (total.isEmpty()) {
-      return;
-    }
-
-    //long l = System.currentTimeMillis();
-    super.compile(compileContext, moduleChunk, VfsUtil.toVirtualFileArray(total), sink);
-    //System.out.println("Stub generation took " + (System.currentTimeMillis() - l));
-  }
-
-  private static boolean containsJavaSources(Module module, boolean inTests) {
-    ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
-    List<VirtualFile> roots = inTests ? rootManager.getSourceRoots(JavaSourceRootType.TEST_SOURCE) : rootManager.getSourceRoots(JavaModuleSourceRootTypes.SOURCES);
-    for (VirtualFile dir : roots) {
-      if (!rootManager.getFileIndex().iterateContentUnderDirectory(dir, new ContentIterator() {
-        @Override
-        public boolean processFile(VirtualFile fileOrDir) {
-          if (!fileOrDir.isDirectory() && JavaFileType.INSTANCE == fileOrDir.getFileType()) {
-            return false;
-          }
-          return true;
-        }
-      })) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  @Override
-  protected void compileFiles(CompileContext compileContext,
-                              Module module,
-                              final List<VirtualFile> toCompile,
-                              OutputSink sink,
-                              boolean tests) {
-    final File outDir = getStubOutput(module, tests);
-    outDir.mkdirs();
-
-    final VirtualFile tempOutput = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(outDir);
-    assert tempOutput != null;
-    cleanDirectory(tempOutput);
-
-    ((CompileContextEx)compileContext).assignModule(tempOutput, module, tests, this);
-
-    ProgressIndicator indicator = compileContext.getProgressIndicator();
-    indicator.pushState();
-
-    try {
-      final GroovyToJavaGenerator generator = new GroovyToJavaGenerator(myProject, new HashSet<VirtualFile>(toCompile));
-      for (int i = 0; i < toCompile.size(); i++) {
-        indicator.setFraction((double)i / toCompile.size());
-
-        final Collection<VirtualFile> stubFiles = generateItems(generator, toCompile.get(i), tempOutput, compileContext, myProject);
-        ((CompileContextEx)compileContext).addScope(new FileSetCompileScope(stubFiles, new Module[]{module}));
-      }
-    }
-    finally {
-      indicator.popState();
-    }
-  }
-
-  private static File getStubOutput(Module module, boolean tests) {
-    final Project project = module.getProject();
-    final String rootPath = CompilerPaths.getGeneratedDataDirectory(project).getPath() + "/" + GROOVY_STUBS + "/";
-    return new File(rootPath + module.getName() + "/" + (tests ? "tests" : "production") + "/");
-  }
-
-  @Nullable
-  public static PsiClass findClassByStub(Project project, VirtualFile stubFile) {
-    final String[] components = StringUtil.trimEnd(stubFile.getPath(), ".java").split("[\\\\/]");
-    final int stubs = Arrays.asList(components).indexOf(GROOVY_STUBS);
-    if (stubs < 0 || stubs >= components.length - 3) return null;
-
-    final String moduleName = components[stubs + 1];
-    final Module module = ModuleManager.getInstance(project).findModuleByName(moduleName);
-    if (module == null) return null;
-
-    final String fqn = StringUtil.join(Arrays.asList(components).subList(stubs + 3, components.length), ".");
-    return JavaPsiFacade.getInstance(project).findClass(fqn, GlobalSearchScope.moduleScope(module));
-  }
-
-  private void cleanDirectory(final VirtualFile dir) {
-    Runnable runnable = new Runnable() {
-      @Override
-      public void run() {
-        AccessToken token = WriteAction.start();
-        try {
-          VfsUtil.processFilesRecursively(dir, new Processor<VirtualFile>() {
-            @Override
-            public boolean process(VirtualFile virtualFile) {
-              if (!virtualFile.isDirectory()) {
-                TranslatingCompilerFilesMonitor.removeSourceInfo(virtualFile);
-                try {
-                  virtualFile.delete(this);
-                }
-                catch (IOException e) {
-                  LOG.info(e);
-                }
-              }
-              return true;
-            }
-          });
-        }
-        finally {
-          token.finish();
-        }
-      }
-    };
-    if (ApplicationManager.getApplication().isDispatchThread()) {
-      assert ApplicationManager.getApplication().isUnitTestMode();
-      runnable.run();
-    } else {
-      ApplicationManager.getApplication().invokeAndWait(runnable, ModalityState.NON_MODAL);
-    }
-  }
-
-  @Override
-  @NotNull
-  public String getDescription() {
-    return "Groovy to java source code generator";
-  }
-
-  @Override
-  public boolean validateConfiguration(CompileScope scope) {
-    return true;
-  }
-
-  public static Collection<VirtualFile> generateItems(final GroovyToJavaGenerator generator,
-                                                      final VirtualFile item,
-                                                      final VirtualFile outputRootDirectory,
-                                                      CompileContext context,
-                                                      final Project project) {
-    ProgressIndicator indicator = context.getProgressIndicator();
-    indicator.setText("Generating stubs for " + item.getName() + "...");
-
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("Generating stubs for " + item.getName() + "...");
-    }
-
-    final Map<String, CharSequence> output;
-
-    AccessToken accessToken = ApplicationManager.getApplication().acquireReadActionLock();
-
-    try {
-      output = generator.generateStubs((GroovyFile)PsiManager.getInstance(project).findFile(item));
-    }
-    finally {
-      accessToken.finish();
-    }
-
-    return writeStubs(outputRootDirectory, output, item);
-  }
-
-  private static List<VirtualFile> writeStubs(VirtualFile outputRootDirectory, Map<String, CharSequence> output, VirtualFile src) {
-    final ArrayList<VirtualFile> stubs = ContainerUtil.newArrayList();
-    for (String relativePath : output.keySet()) {
-      final File stubFile = new File(outputRootDirectory.getPath(), relativePath);
-      FileUtil.createIfDoesntExist(stubFile);
-      try {
-        FileUtil.writeToFile(stubFile, output.get(relativePath).toString().getBytes(src.getCharset()));
-      }
-      catch (IOException e) {
-        LOG.error(e);
-      }
-      CompilerUtil.refreshIOFile(stubFile);
-      ContainerUtil.addIfNotNull(LocalFileSystem.getInstance().refreshAndFindFileByIoFile(stubFile), stubs);
-    }
-    return stubs;
-  }
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/configSlurper/ConfigSlurperMapContentProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/configSlurper/ConfigSlurperMapContentProvider.java
deleted file mode 100644
index 5b513c9..0000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/configSlurper/ConfigSlurperMapContentProvider.java
+++ /dev/null
@@ -1,125 +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 org.jetbrains.plugins.groovy.configSlurper;
-
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.util.Ref;
-import com.intellij.psi.JavaPsiFacade;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiType;
-import com.intellij.util.PairConsumer;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.plugins.groovy.extensions.GroovyMapContentProvider;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
-import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiManager;
-import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
-
-import java.util.*;
-
-/**
- * @author Sergey Evdokimov
- */
-public class ConfigSlurperMapContentProvider extends GroovyMapContentProvider {
-
-  @Nullable
-  private static Pair<ConfigSlurperSupport.PropertiesProvider, List<String>> getInfo(@NotNull GrExpression qualifier,
-                                                                                     @Nullable PsiElement resolve) {
-    if (!GroovyPsiManager.isInheritorCached(qualifier.getType(), GroovyCommonClassNames.GROOVY_UTIL_CONFIG_OBJECT)) {
-      return null;
-    }
-
-    GrExpression resolvedQualifier = qualifier;
-    PsiElement resolveResult = resolve;
-    List<String> path = new ArrayList<String>();
-
-    while (resolveResult == null) {
-      if (!(resolvedQualifier instanceof GrReferenceExpression)) return null;
-
-      GrReferenceExpression expr = (GrReferenceExpression)resolvedQualifier;
-      path.add(expr.getReferenceName());
-
-      resolvedQualifier = expr.getQualifierExpression();
-      if (resolvedQualifier instanceof GrReferenceExpression) {
-        resolveResult = ((GrReferenceExpression)resolvedQualifier).resolve();
-      }
-      else if (resolvedQualifier instanceof GrMethodCall) {
-        resolveResult = ((GrMethodCall)resolvedQualifier).resolveMethod();
-      }
-      else {
-        return null;
-      }
-    }
-
-    Collections.reverse(path);
-
-    ConfigSlurperSupport.PropertiesProvider propertiesProvider = null;
-
-    for (ConfigSlurperSupport slurperSupport : ConfigSlurperSupport.EP_NAME.getExtensions()) {
-      propertiesProvider = slurperSupport.getConfigSlurperInfo(resolvedQualifier, resolveResult);
-      if (propertiesProvider != null) break;
-    }
-
-    if (propertiesProvider == null) return null;
-
-    return Pair.create(propertiesProvider, path);
-  }
-
-  @Override
-  protected Collection<String> getKeyVariants(@NotNull GrExpression qualifier, @Nullable PsiElement resolve) {
-    Pair<ConfigSlurperSupport.PropertiesProvider, List<String>> info = getInfo(qualifier, resolve);
-    if (info == null) return Collections.emptyList();
-
-    final Set<String> res = new HashSet<String>();
-
-    info.first.collectVariants(info.second, new PairConsumer<String, Boolean>() {
-      @Override
-      public void consume(String variant, Boolean isFinal) {
-        res.add(variant);
-      }
-    });
-
-    return res;
-  }
-
-  @Override
-  public PsiType getValueType(@NotNull GrExpression qualifier, @Nullable PsiElement resolve, @NotNull final String key) {
-    Pair<ConfigSlurperSupport.PropertiesProvider, List<String>> info = getInfo(qualifier, resolve);
-    if (info == null) return null;
-
-    final Ref<Boolean> res = new Ref<Boolean>();
-
-    info.first.collectVariants(info.second, new PairConsumer<String, Boolean>() {
-      @Override
-      public void consume(String variant, Boolean isFinal) {
-        if (variant.equals(key)) {
-          res.set(isFinal);
-        }
-        else if (variant.startsWith(key) && variant.length() > key.length() && variant.charAt(key.length()) == '.') {
-          res.set(false);
-        }
-      }
-    });
-
-    if (res.get() != null && !res.get()) {
-      return JavaPsiFacade.getElementFactory(qualifier.getProject()).createTypeByFQClassName(GroovyCommonClassNames.GROOVY_UTIL_CONFIG_OBJECT, qualifier.getResolveScope());
-    }
-
-    return null;
-  }
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/configSlurper/ConfigSlurperSupport.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/configSlurper/ConfigSlurperSupport.java
deleted file mode 100644
index fed4974..0000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/configSlurper/ConfigSlurperSupport.java
+++ /dev/null
@@ -1,48 +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 org.jetbrains.plugins.groovy.configSlurper;
-
-import com.intellij.openapi.extensions.ExtensionPointName;
-import com.intellij.psi.PsiElement;
-import com.intellij.util.PairConsumer;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
-
-import java.util.List;
-
-/**
- * @author Sergey Evdokimov
- */
-public abstract class ConfigSlurperSupport {
-
-  public static final ExtensionPointName<ConfigSlurperSupport> EP_NAME =
-    ExtensionPointName.create("org.intellij.groovy.configSlurperSupport");
-
-  @Nullable
-  public abstract PropertiesProvider getProvider(@NotNull GroovyFile file);
-
-  @Nullable
-  public PropertiesProvider getConfigSlurperInfo(@NotNull GrExpression qualifier, @NotNull PsiElement qualifierResolve) {
-    return null;
-  }
-
-  public interface PropertiesProvider {
-    void collectVariants(@NotNull List<String> prefix, @NotNull PairConsumer<String, Boolean> consumer);
-  }
-
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/configSlurper/GroovyMapValueTypeEnhancer.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/configSlurper/GroovyMapValueTypeEnhancer.java
deleted file mode 100644
index 8030d5f..0000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/configSlurper/GroovyMapValueTypeEnhancer.java
+++ /dev/null
@@ -1,75 +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 org.jetbrains.plugins.groovy.configSlurper;
-
-import com.intellij.psi.CommonClassNames;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiType;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.plugins.groovy.extensions.GroovyMapContentProvider;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
-import org.jetbrains.plugins.groovy.lang.psi.impl.GrMapType;
-import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiManager;
-import org.jetbrains.plugins.groovy.lang.psi.typeEnhancers.GrReferenceTypeEnhancer;
-
-/**
- * @author Sergey Evdokimov
- */
-public class GroovyMapValueTypeEnhancer extends GrReferenceTypeEnhancer {
-  @Override
-  public PsiType getReferenceType(GrReferenceExpression ref, @Nullable PsiElement resolved) {
-    if (resolved != null) return null;
-
-    GrExpression qualifierExpression = ref.getQualifierExpression();
-    if (qualifierExpression == null) return null;
-
-    PsiType mapType = qualifierExpression.getType();
-
-    if (!GroovyPsiManager.isInheritorCached(mapType, CommonClassNames.JAVA_UTIL_MAP)) {
-      return null;
-    }
-
-    PsiElement qResolved;
-
-    if (qualifierExpression instanceof GrReferenceExpression) {
-      qResolved = ((GrReferenceExpression)qualifierExpression).resolve();
-    }
-    else if (qualifierExpression instanceof GrMethodCall) {
-      qResolved = ((GrMethodCall)qualifierExpression).resolveMethod();
-    }
-    else {
-      return null;
-    }
-
-    String key = ref.getReferenceName();
-    if (key == null) return null;
-
-    for (GroovyMapContentProvider provider : GroovyMapContentProvider.EP_NAME.getExtensions()) {
-      PsiType type = provider.getValueType(qualifierExpression, qResolved, key);
-      if (type != null) {
-        return type;
-      }
-    }
-
-    if (mapType instanceof GrMapType) {
-      return ((GrMapType)mapType).getTypeByStringKey(key);
-    }
-
-    return null;
-  }
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyShellConsoleImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyShellConsoleImpl.java
index e1bf036..b5be809 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyShellConsoleImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyShellConsoleImpl.java
@@ -154,7 +154,6 @@
     GrCodeReferenceElement reference = anImport.getImportReference();
     if (reference == null) return null;
     String qname = reference.getClassNameText();
-    if (qname == null) return null;
     buffer.append(qname);
     if (!anImport.isOnDemand()) {
       String importedName = anImport.getImportedName();
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMImplicitPropertyUsageProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMImplicitPropertyUsageProvider.java
deleted file mode 100644
index 9fc2820..0000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMImplicitPropertyUsageProvider.java
+++ /dev/null
@@ -1,34 +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 org.jetbrains.plugins.groovy.dgm;
-
-import com.intellij.codeInspection.unused.ImplicitPropertyUsageProvider;
-import com.intellij.lang.properties.psi.Property;
-import com.intellij.util.ArrayUtil;
-
-/**
- * @author Max Medvedev
- */
-public class DGMImplicitPropertyUsageProvider extends ImplicitPropertyUsageProvider {
-  @Override
-  protected boolean isUsed(Property property) {
-    if (DGMUtil.isInDGMFile(property)) {
-      String name = property.getName();
-      return ArrayUtil.find(DGMUtil.KEYS, name) >= 0;
-    }
-    return  false;
-  }
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMUtil.java
deleted file mode 100644
index af695a3..0000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMUtil.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 org.jetbrains.plugins.groovy.dgm;
-
-import com.intellij.lang.properties.psi.PropertiesFile;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.SystemInfo;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-
-/**
- * @author Max Medvedev
- */
-public class DGMUtil {
-  public static final String[] KEYS = new String[]{"moduleName", "moduleVersion", "extensionClasses", "staticExtensionClasses",};
-
-  public static boolean isInDGMFile(PsiElement e) {
-    PsiFile file = e.getContainingFile();
-    return file instanceof PropertiesFile &&
-           Comparing.equal(file.getName(), GroovyExtensionProvider.ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE,
-                           SystemInfo.isFileSystemCaseSensitive);
-  }
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/GroovyExtensionProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/GroovyExtensionProvider.java
deleted file mode 100644
index e13a738..0000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/GroovyExtensionProvider.java
+++ /dev/null
@@ -1,89 +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 org.jetbrains.plugins.groovy.dgm;
-
-import com.intellij.lang.properties.IProperty;
-import com.intellij.lang.properties.psi.PropertiesFile;
-import com.intellij.openapi.components.ServiceManager;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.util.Couple;
-import com.intellij.psi.JavaPsiFacade;
-import com.intellij.psi.PsiDirectory;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiPackage;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.util.containers.ContainerUtil;
-import org.jetbrains.annotations.NonNls;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author Max Medvedev
- */
-public class GroovyExtensionProvider {
-  @NonNls public static final String ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE = "org.codehaus.groovy.runtime.ExtensionModule";
-  private final Project myProject;
-
-  public GroovyExtensionProvider(Project project) {
-    myProject = project;
-  }
-
-  public static GroovyExtensionProvider getInstance(Project project) {
-    return ServiceManager.getService(project, GroovyExtensionProvider.class);
-  }
-
-  public Couple<List<String>> collectExtensions(GlobalSearchScope resolveScope) {
-    PsiPackage aPackage = JavaPsiFacade.getInstance(myProject).findPackage("META-INF.services");
-    if (aPackage == null) {
-      return Couple.newOne(Collections.<String>emptyList(), Collections.<String>emptyList());
-    }
-
-
-    List<String> instanceClasses = new ArrayList<String>();
-    List<String> staticClasses = new ArrayList<String>();
-    for (PsiDirectory directory : aPackage.getDirectories(resolveScope)) {
-      PsiFile file = directory.findFile(ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE);
-      if (file instanceof PropertiesFile) {
-        IProperty inst = ((PropertiesFile)file).findPropertyByKey("extensionClasses");
-        IProperty stat = ((PropertiesFile)file).findPropertyByKey("staticExtensionClasses");
-
-        if (inst != null) collectClasses(inst, instanceClasses);
-        if (stat != null) collectClasses(stat, staticClasses);
-      }
-    }
-
-    return Couple.newOne(instanceClasses, staticClasses);
-  }
-
-  private static void collectClasses(IProperty pr, List<String> classes) {
-    String value = pr.getUnescapedValue();
-    if (value == null) return;
-    value = value.trim();
-    String[] qnames = value.split("\\s*,\\s*");
-    ContainerUtil.addAll(classes, qnames);
-  }
-  
-  public static class GroovyExtensionVetoSPI implements Condition<String> {
-
-    @Override
-    public boolean value(String s) {
-      return ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE.equals(s);
-    }
-  }
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/DslErrorReporterImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/DslErrorReporterImpl.java
index b01830a..a731c3a 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/DslErrorReporterImpl.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/DslErrorReporterImpl.java
@@ -57,7 +57,7 @@
                                             @Override
                                             public void hyperlinkUpdate(@NotNull Notification notification,
                                                                         @NotNull HyperlinkEvent event) {
-                                              GroovyDslAnnotator.analyzeStackTrace(project, exceptionText);
+                                              InvestigateFix.analyzeStackTrace(project, exceptionText);
                                               notification.expire();
                                             }
                                           }).notify(project);
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/GroovyDslAnnotator.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/GroovyDslAnnotator.java
deleted file mode 100644
index 4b50f84..0000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/GroovyDslAnnotator.java
+++ /dev/null
@@ -1,141 +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 org.jetbrains.plugins.groovy.dsl;
-
-import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
-import com.intellij.codeInsight.intention.IntentionAction;
-import com.intellij.lang.annotation.Annotation;
-import com.intellij.lang.annotation.AnnotationHolder;
-import com.intellij.lang.annotation.Annotator;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.project.DumbAware;
-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.unscramble.UnscrambleDialog;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
-
-/**
- * @author peter
- */
-public class GroovyDslAnnotator implements Annotator, DumbAware {
-
-  @Override
-  public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder holder) {
-    if (psiElement instanceof GroovyFile) {
-      final VirtualFile vfile = ((GroovyFile)psiElement).getVirtualFile();
-      if (vfile != null && "gdsl".equals(vfile.getExtension()) &&
-          (!GroovyDslFileIndex.isActivated(vfile) || FileDocumentManager.getInstance().isFileModified(vfile))) {
-        final String reason = GroovyDslFileIndex.getInactivityReason(vfile);
-        final String message;
-        boolean modified = reason == null || GroovyDslFileIndex.MODIFIED.equals(reason);
-        if (modified) {
-          message = "DSL descriptor file has been changed and isn't currently executed.";
-        } else {
-          message = "DSL descriptor file has been disabled due to a processing error.";
-        }
-        final Annotation annotation = holder.createWarningAnnotation(psiElement, message);
-        annotation.setFileLevelAnnotation(true);
-        if (!modified) {
-          annotation.registerFix(new InvestigateFix(reason));
-        }
-        annotation.registerFix(new ActivateFix(vfile));
-      }
-    }
-  }
-
-  static void analyzeStackTrace(Project project, String exceptionText) {
-    final UnscrambleDialog dialog = new UnscrambleDialog(project);
-    dialog.setText(exceptionText);
-    dialog.show();
-  }
-
-  private static class InvestigateFix implements IntentionAction {
-    private final String myReason;
-
-    public InvestigateFix(String reason) {
-      myReason = reason;
-    }
-
-    @NotNull
-    @Override
-    public String getText() {
-      return "View details";
-    }
-
-    @NotNull
-    @Override
-    public String getFamilyName() {
-      return "Investigate DSL descriptor processing error";
-    }
-
-    @Override
-    public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
-      return true;
-    }
-
-    @Override
-    public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
-      analyzeStackTrace(project, myReason);
-    }
-
-    @Override
-    public boolean startInWriteAction() {
-      return false;
-    }
-  }
-
-  private static class ActivateFix implements IntentionAction {
-    private final VirtualFile myVfile;
-
-    public ActivateFix(VirtualFile vfile) {
-      myVfile = vfile;
-    }
-
-    @Override
-    @NotNull
-    public String getText() {
-      return "Activate back";
-    }
-
-    @Override
-    @NotNull
-    public String getFamilyName() {
-      return "Activate DSL descriptor";
-    }
-
-    @Override
-    public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
-      return true;
-    }
-
-    @Override
-    public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
-      FileDocumentManager.getInstance().saveAllDocuments();
-      GroovyDslFileIndex.activateUntilModification(myVfile);
-      DaemonCodeAnalyzer.getInstance(project).restart();
-    }
-
-    @Override
-    public boolean startInWriteAction() {
-      return false;
-    }
-  }
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/InvestigateFix.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/InvestigateFix.java
new file mode 100644
index 0000000..b99ea91
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/InvestigateFix.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.dsl;
+
+import com.intellij.codeInsight.intention.IntentionAction;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiFile;
+import com.intellij.unscramble.UnscrambleDialog;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+
+public class InvestigateFix implements IntentionAction {
+  private final String myReason;
+
+  public InvestigateFix(String reason) {
+    myReason = reason;
+  }
+
+  static void analyzeStackTrace(Project project, String exceptionText) {
+    final UnscrambleDialog dialog = new UnscrambleDialog(project);
+    dialog.setText(exceptionText);
+    dialog.show();
+  }
+
+  @NotNull
+  @Override
+  public String getText() {
+    return "View details";
+  }
+
+  @NotNull
+  @Override
+  public String getFamilyName() {
+    return "Investigate DSL descriptor processing error";
+  }
+
+  @Override
+  public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
+    return true;
+  }
+
+  @Override
+  public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
+    analyzeStackTrace(project, myReason);
+  }
+
+  @Override
+  public boolean startInWriteAction() {
+    return false;
+  }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyMapCompletionUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyMapCompletionUtil.java
new file mode 100644
index 0000000..4853279
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyMapCompletionUtil.java
@@ -0,0 +1,35 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.extensions;
+
+import com.intellij.codeInsight.completion.CompletionResultSet;
+import com.intellij.codeInsight.completion.PrioritizedLookupElement;
+import com.intellij.codeInsight.lookup.LookupElement;
+import com.intellij.codeInsight.lookup.LookupElementBuilder;
+import com.intellij.psi.PsiElement;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
+
+public class GroovyMapCompletionUtil {
+  public static void addKeyVariants(@NotNull GroovyMapContentProvider contentProvider, @NotNull GrExpression qualifier, @Nullable PsiElement resolve, @NotNull CompletionResultSet result) {
+    for (String key : contentProvider.getKeyVariants(qualifier, resolve)) {
+      LookupElement lookup = LookupElementBuilder.create(key);
+      lookup = PrioritizedLookupElement.withPriority(lookup, 1);
+      result.addElement(lookup);
+    }
+  }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyMapContentProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyMapContentProvider.java
deleted file mode 100644
index 5837c31..0000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyMapContentProvider.java
+++ /dev/null
@@ -1,55 +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 org.jetbrains.plugins.groovy.extensions;
-
-import com.intellij.codeInsight.completion.CompletionResultSet;
-import com.intellij.codeInsight.completion.PrioritizedLookupElement;
-import com.intellij.codeInsight.lookup.LookupElement;
-import com.intellij.codeInsight.lookup.LookupElementBuilder;
-import com.intellij.openapi.extensions.ExtensionPointName;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiType;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
-
-import java.util.Collection;
-
-/**
- * @author Sergey Evdokimov
- */
-public abstract class GroovyMapContentProvider {
-
-  public static final ExtensionPointName<GroovyMapContentProvider> EP_NAME = ExtensionPointName.create("org.intellij.groovy.mapContentProvider");
-
-  public void addKeyVariants(@NotNull GrExpression qualifier, @Nullable PsiElement resolve, @NotNull CompletionResultSet result) {
-    for (String key : getKeyVariants(qualifier, resolve)) {
-      LookupElement lookup = LookupElementBuilder.create(key);
-      lookup = PrioritizedLookupElement.withPriority(lookup, 1);
-      result.addElement(lookup);
-    }
-  }
-
-  protected Collection<String> getKeyVariants(@NotNull GrExpression qualifier, @Nullable PsiElement resolve) {
-    throw new UnsupportedOperationException();
-  }
-
-  @Nullable
-  public PsiType getValueType(@NotNull GrExpression qualifier, @Nullable PsiElement resolve, @NotNull String key) {
-    return null;
-  }
-
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonDefaultImportContributor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonDefaultImportContributor.java
index a5a7b3b..bb8de83 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonDefaultImportContributor.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/griffon/GriffonDefaultImportContributor.java
@@ -18,7 +18,7 @@
 import com.intellij.lang.properties.IProperty;
 import com.intellij.lang.properties.psi.PropertiesFile;
 import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleUtil;
+import com.intellij.openapi.module.ModuleUtilCore;
 import com.intellij.openapi.util.Couple;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VfsUtilCore;
@@ -56,12 +56,12 @@
             if (file instanceof PropertiesFile) {
               List<String> modelImports = tokenize(((PropertiesFile)file).findPropertyByKey("models"));
               List<String> viewImports = tokenize(((PropertiesFile)file).findPropertyByKey("views"));
-              return Result.create(Couple.newOne(modelImports, viewImports), PsiModificationTracker.MODIFICATION_COUNT);
+              return Result.create(Couple.of(modelImports, viewImports), PsiModificationTracker.MODIFICATION_COUNT);
             }
           }
         }
 
-        return Result.create(Couple.<List<String>>newOne(new ArrayList<String>(), new ArrayList<String>()),
+        return Result.create(Couple.<List<String>>of(new ArrayList<String>(), new ArrayList<String>()),
                              PsiModificationTracker.MODIFICATION_COUNT);
       }
 
@@ -83,7 +83,7 @@
 
   @Override
   public List<String> appendImplicitlyImportedPackages(@NotNull GroovyFile file) {
-    Module module = ModuleUtil.findModuleForPsiElement(file);
+    Module module = ModuleUtilCore.findModuleForPsiElement(file);
     MvcFramework framework = MvcFramework.getInstance(module);
     if (framework instanceof GriffonFramework) {
       ArrayList<String> result = new ArrayList<String>();
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/base/IntentionUtils.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/base/IntentionUtils.java
index b56369c..2b5d378 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/base/IntentionUtils.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/base/IntentionUtils.java
@@ -37,6 +37,7 @@
 import org.jetbrains.plugins.groovy.actions.GroovyTemplates;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
 import org.jetbrains.plugins.groovy.lang.psi.expectedTypes.TypeConstraint;
+import org.jetbrains.plugins.groovy.lang.psi.util.GrTraitUtil;
 import org.jetbrains.plugins.groovy.template.expressions.ChooseTypeExpression;
 import org.jetbrains.plugins.groovy.template.expressions.ParameterNameExpression;
 
@@ -131,7 +132,10 @@
                 if (method.getBody() != null) {
                   FileTemplateManager templateManager = FileTemplateManager.getInstance();
                   FileTemplate fileTemplate = templateManager.getCodeTemplate(GroovyTemplates.GROOVY_FROM_USAGE_METHOD_BODY);
-                  CreateFromUsageUtils.setupMethodBody(method, method.getContainingClass(), fileTemplate);
+
+                  PsiClass containingClass = method.getContainingClass();
+                  LOG.assertTrue(!containingClass.isInterface() || GrTraitUtil.isTrait(containingClass), "Interface bodies should be already set up");
+                  CreateFromUsageUtils.setupMethodBody(method, containingClass, fileTemplate);
                 }
                 if (hasNoReturnType) {
                   ((GrMethod)method).setReturnType(null);
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/ConvertMapToClassIntention.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/ConvertMapToClassIntention.java
index 8c010b2..e7c30b3 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/ConvertMapToClassIntention.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/conversions/ConvertMapToClassIntention.java
@@ -15,12 +15,11 @@
  */
 package org.jetbrains.plugins.groovy.intentions.conversions;
 
-import com.intellij.codeInsight.daemon.impl.quickfix.CreateClassKind;
 import com.intellij.codeInsight.intention.impl.CreateClassDialog;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.module.ModuleUtil;
+import com.intellij.openapi.module.ModuleUtilCore;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.ui.Messages;
@@ -41,6 +40,7 @@
 import org.jetbrains.plugins.groovy.intentions.base.Intention;
 import org.jetbrains.plugins.groovy.intentions.base.IntentionUtils;
 import org.jetbrains.plugins.groovy.intentions.base.PsiElementPredicate;
+import org.jetbrains.plugins.groovy.lang.GrCreateClassKind;
 import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
 import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory;
 import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
@@ -82,8 +82,8 @@
     final String packageName = file instanceof GroovyFileBase ? ((GroovyFileBase)file).getPackageName() : "";
 
     final CreateClassDialog dialog =
-      new CreateClassDialog(project, GroovyBundle.message("create.class.family.name"), "", packageName, CreateClassKind.CLASS, true,
-                            ModuleUtil.findModuleForPsiElement(element));
+      new CreateClassDialog(project, GroovyBundle.message("create.class.family.name"), "", packageName, GrCreateClassKind.CLASS, true,
+                            ModuleUtilCore.findModuleForPsiElement(element));
     dialog.show();
     if (dialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) return;
 
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/declaration/GrSetStrongTypeIntention.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/declaration/GrSetStrongTypeIntention.java
index 1e791ad..c768d2a 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/declaration/GrSetStrongTypeIntention.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/declaration/GrSetStrongTypeIntention.java
@@ -18,12 +18,19 @@
 import com.intellij.codeInsight.CodeInsightUtilCore;
 import com.intellij.codeInsight.template.Template;
 import com.intellij.codeInsight.template.TemplateBuilderImpl;
+import com.intellij.codeInsight.template.TemplateEditingAdapter;
 import com.intellij.codeInsight.template.TemplateManager;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.RangeMarker;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.*;
+import com.intellij.psi.PsiClassType;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiParameter;
+import com.intellij.psi.PsiType;
 import com.intellij.util.IncorrectOperationException;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -53,8 +60,10 @@
  */
 public class GrSetStrongTypeIntention extends Intention {
 
+  private static final Logger LOG = Logger.getInstance(GrSetStrongTypeIntention.class);
+
   @Override
-  protected void processIntention(@NotNull PsiElement element, Project project, Editor editor) throws IncorrectOperationException {
+  protected void processIntention(@NotNull PsiElement element, Project project, final Editor editor) throws IncorrectOperationException {
     PsiElement parent = element.getParent();
 
     PsiElement elementToBuildTemplate;
@@ -107,25 +116,46 @@
       }
     }
 
-    TemplateBuilderImpl builder = new TemplateBuilderImpl(elementToBuildTemplate);
-    PsiManager manager = element.getManager();
+    final String originalText = elementToBuildTemplate.getText();
 
-    PsiElement replaceElement = setType(element, parent, elementToBuildTemplate);
-    assert replaceElement != null;
+    final TypeInfo typeInfo = getOrCreateTypeElement(parent, elementToBuildTemplate);
+    final PsiElement replaceElement = typeInfo.elementToReplace;
 
     TypeConstraint[] constraints = types.toArray(new TypeConstraint[types.size()]);
-    ChooseTypeExpression chooseTypeExpression = new ChooseTypeExpression(constraints, manager, replaceElement.getResolveScope());
+    ChooseTypeExpression chooseTypeExpression = new ChooseTypeExpression(constraints, element.getManager(), replaceElement.getResolveScope());
+
+    TemplateBuilderImpl builder = new TemplateBuilderImpl(elementToBuildTemplate);
     builder.replaceElement(replaceElement, chooseTypeExpression);
 
+    final Document document = editor.getDocument();
+    final RangeMarker rangeMarker = document.createRangeMarker(elementToBuildTemplate.getTextRange());
+    rangeMarker.setGreedyToRight(true);
+    rangeMarker.setGreedyToLeft(true);
 
     final PsiElement afterPostprocess = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(elementToBuildTemplate);
     final Template template = builder.buildTemplate();
+
     TextRange range = afterPostprocess.getTextRange();
-    Document document = editor.getDocument();
     document.deleteString(range.getStartOffset(), range.getEndOffset());
 
     TemplateManager templateManager = TemplateManager.getInstance(project);
-    templateManager.startTemplate(editor, template);
+    templateManager.startTemplate(editor, template, new TemplateEditingAdapter() {
+      @Override
+      public void templateFinished(Template template, boolean brokenOff) {
+        if (brokenOff) {
+          ApplicationManager.getApplication().runWriteAction(new Runnable() {
+            @Override
+            public void run() {
+              if (rangeMarker.isValid()) {
+                document.replaceString(rangeMarker.getStartOffset(), rangeMarker.getEndOffset(), originalText);
+                editor.getCaretModel().moveToOffset(rangeMarker.getStartOffset() + typeInfo.originalOffset);
+              }
+            }
+          });
+        }
+      }
+    });
+
   }
 
   @Nullable
@@ -141,23 +171,44 @@
     return type;
   }
 
-  @Nullable
-  private static PsiElement setType(PsiElement element, PsiElement parent, PsiElement elementToBuildTemplate) {
+  private static class TypeInfo {
+    final PsiElement elementToReplace;
+    final int originalOffset;
+
+    TypeInfo(PsiElement element, int offset) {
+      originalOffset = offset;
+      elementToReplace = element;
+    }
+  }
+
+  @NotNull
+  private static TypeInfo getOrCreateTypeElement(@NotNull PsiElement parent,
+                                                 @NotNull PsiElement elementToBuildTemplateOn) {
     GrModifierList modifierList = getModifierList(parent);
 
     if (modifierList != null && modifierList.hasModifierProperty(GrModifier.DEF) && modifierList.getModifiers().length == 1) {
-      return PsiUtil.findModifierInList(modifierList, GrModifier.DEF);
+      PsiElement modifier = PsiUtil.findModifierInList(modifierList, GrModifier.DEF);
+      LOG.assertTrue(modifier != null);
+      int modifierOffset = modifier.getTextRange().getEndOffset() - elementToBuildTemplateOn.getTextRange().getStartOffset();
+      return new TypeInfo(modifier, modifierOffset);
     }
     else {
-      final PsiClassType typeToUse = TypesUtil.createType("Abc", element);
-      if (elementToBuildTemplate instanceof GrVariableDeclaration) {
-        ((GrVariableDeclaration)elementToBuildTemplate).setType(typeToUse);
+      int nameElementOffset;
+
+      final PsiClassType typeToUse = TypesUtil.createType("Abc", parent);
+      if (elementToBuildTemplateOn instanceof GrVariableDeclaration) {
+        GrVariableDeclaration decl = (GrVariableDeclaration)elementToBuildTemplateOn;
+        decl.setType(typeToUse);
+        nameElementOffset = decl.getModifierList().getTextRange().getEndOffset() - elementToBuildTemplateOn.getTextRange().getStartOffset();
       }
       else {
-        ((GrVariable)parent).setType(typeToUse);
+        GrVariable var = (GrVariable)parent;
+        var.setType(typeToUse);
+        nameElementOffset = var.getNameIdentifierGroovy().getTextRange().getStartOffset() -
+                            elementToBuildTemplateOn.getTextRange().getStartOffset();
       }
 
-      return getTypeElement(parent);
+      return new TypeInfo(getTypeElement(parent), nameElementOffset);
     }
   }
 
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/MapKeysCompletionProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/MapKeysCompletionProvider.java
index b3bd3a9..ece67d8 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/MapKeysCompletionProvider.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/MapKeysCompletionProvider.java
@@ -24,6 +24,7 @@
 import com.intellij.psi.PsiType;
 import com.intellij.util.ProcessingContext;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.groovy.extensions.GroovyMapCompletionUtil;
 import org.jetbrains.plugins.groovy.extensions.GroovyMapContentProvider;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall;
@@ -68,7 +69,7 @@
     }
 
     for (GroovyMapContentProvider provider : GroovyMapContentProvider.EP_NAME.getExtensions()) {
-      provider.addKeyVariants(qualifierExpression, resolve, result);
+      GroovyMapCompletionUtil.addKeyVariants(provider, qualifierExpression, resolve, result);
     }
 
     if (mapType instanceof GrMapType) {
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/overrideImplement/GroovyMethodImplementor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/overrideImplement/GroovyMethodImplementor.java
index 928f1f1..1d86f33 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/overrideImplement/GroovyMethodImplementor.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/overrideImplement/GroovyMethodImplementor.java
@@ -31,6 +31,7 @@
 import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
+import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrTraitMethod;
 
 /**
  * @author Medvedev Max
@@ -46,6 +47,8 @@
   @Override
   public PsiMethod[] createImplementationPrototypes(PsiClass inClass, PsiMethod method) throws IncorrectOperationException {
     if (!(inClass instanceof GrTypeDefinition)) return PsiMethod.EMPTY_ARRAY;
+    if (method instanceof GrTraitMethod) return PsiMethod.EMPTY_ARRAY;
+
     final PsiClass containingClass = method.getContainingClass();
     PsiSubstitutor substitutor = inClass.isInheritor(containingClass, true)
                                  ? TypeConversionUtil.getSuperClassSubstitutor(containingClass, inClass, PsiSubstitutor.EMPTY)
@@ -67,40 +70,54 @@
                                              final PsiMethod baseMethod,
                                              final boolean toCopyJavaDoc,
                                              final boolean insertOverrideIfPossible) {
-    return new Consumer<PsiMethod>() {
-      @Override
-      public void consume(PsiMethod method) {
-        Project project = targetClass.getProject();
+    return new PsiMethodConsumer(targetClass, toCopyJavaDoc, baseMethod, insertOverrideIfPossible);
+  }
 
-        if (toCopyJavaDoc) {
-          PsiDocComment baseMethodDocComment = baseMethod.getDocComment();
-          if (baseMethodDocComment != null) {
-            GrDocComment docComment =
-              GroovyPsiElementFactory.getInstance(project).createDocCommentFromText(baseMethodDocComment.getText());
-            GrDocCommentUtil.setDocComment(((GrMethod)method), docComment);
-          }
-        }
-        else {
-          PsiDocComment docComment = method.getDocComment();
-          if (docComment != null) {
-            docComment.delete();
-          }
-        }
+  static class PsiMethodConsumer implements Consumer<PsiMethod> {
+    private final PsiClass myTargetClass;
+    private final boolean myToCopyJavaDoc;
+    private final PsiMethod myBaseMethod;
+    private final boolean myInsertOverrideIfPossible;
 
-        if (insertOverrideIfPossible) {
-          if (OverrideImplementUtil.canInsertOverride(method, targetClass) &&
-              JavaPsiFacade.getInstance(project).findClass(CommonClassNames.JAVA_LANG_OVERRIDE, targetClass.getResolveScope()) != null &&
-              method.getModifierList().findAnnotation(CommonClassNames.JAVA_LANG_OVERRIDE) == null) {
-            method.getModifierList().addAnnotation(CommonClassNames.JAVA_LANG_OVERRIDE);
-          }
-        }
-        else {
-          PsiAnnotation annotation = method.getModifierList().findAnnotation(CommonClassNames.JAVA_LANG_OVERRIDE);
-          if (annotation != null) {
-            annotation.delete();
-          }
+    public PsiMethodConsumer(PsiClass targetClass, boolean toCopyJavaDoc, PsiMethod baseMethod, boolean insertOverrideIfPossible) {
+      myTargetClass = targetClass;
+      myToCopyJavaDoc = toCopyJavaDoc;
+      myBaseMethod = baseMethod;
+      myInsertOverrideIfPossible = insertOverrideIfPossible;
+    }
+
+    @Override
+    public void consume(PsiMethod method) {
+      Project project = myTargetClass.getProject();
+
+      if (myToCopyJavaDoc) {
+        PsiDocComment baseMethodDocComment = myBaseMethod.getDocComment();
+        if (baseMethodDocComment != null) {
+          GrDocComment docComment =
+            GroovyPsiElementFactory.getInstance(project).createDocCommentFromText(baseMethodDocComment.getText());
+          GrDocCommentUtil.setDocComment(((GrMethod)method), docComment);
         }
       }
-    };
+      else {
+        PsiDocComment docComment = method.getDocComment();
+        if (docComment != null) {
+          docComment.delete();
+        }
+      }
+
+      if (myInsertOverrideIfPossible) {
+        if (OverrideImplementUtil.canInsertOverride(method, myTargetClass) &&
+            JavaPsiFacade.getInstance(project).findClass(CommonClassNames.JAVA_LANG_OVERRIDE, myTargetClass.getResolveScope()) != null &&
+            method.getModifierList().findAnnotation(CommonClassNames.JAVA_LANG_OVERRIDE) == null) {
+          method.getModifierList().addAnnotation(CommonClassNames.JAVA_LANG_OVERRIDE);
+        }
+      }
+      else {
+        PsiAnnotation annotation = method.getModifierList().findAnnotation(CommonClassNames.JAVA_LANG_OVERRIDE);
+        if (annotation != null) {
+          annotation.delete();
+        }
+      }
+    }
   }
 }
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/overrideImplement/GroovyOverrideImplementUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/overrideImplement/GroovyOverrideImplementUtil.java
index 3737d8e..de90622 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/overrideImplement/GroovyOverrideImplementUtil.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/overrideImplement/GroovyOverrideImplementUtil.java
@@ -48,6 +48,7 @@
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
 import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
 import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeElement;
+import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrTraitMethod;
 import org.jetbrains.plugins.groovy.lang.psi.util.GrTraitUtil;
 import org.jetbrains.plugins.groovy.refactoring.GroovyChangeContextUtil;
 
@@ -87,6 +88,22 @@
     return result;
   }
 
+  public static GrMethod generateTraitMethodPrototype(GrTypeDefinition aClass, GrTraitMethod method, PsiSubstitutor substitutor) {
+    final Project project = aClass.getProject();
+
+    final GrMethod result = (GrMethod)GenerateMembersUtil.substituteGenericMethod(method, substitutor, aClass);
+
+    setupModifierList(result);
+    setupTraitMethodBody(project, result, method);
+    setupReturnType(result, method);
+
+    setupAnnotations(aClass, method, result);
+
+    GroovyChangeContextUtil.encodeContextInfo(result);
+    return result;
+  }
+
+
   private static void setupReturnType(GrMethod result, PsiMethod method) {
     if (method instanceof GrMethod && ((GrMethod)method).getReturnTypeElementGroovy() == null) {
       result.setReturnType(null);
@@ -174,6 +191,32 @@
     }
   }
 
+  private static void setupTraitMethodBody(Project project, GrMethod resultMethod, GrTraitMethod traitMethod) {
+    PsiClass traitClass = traitMethod.getPrototype().getContainingClass();
+
+    StringBuilder builder = new StringBuilder();
+    builder.append("\nreturn ");
+    builder.append(traitClass.getQualifiedName());
+    builder.append(".super.");
+    builder.append(traitMethod.getName());
+    builder.append("(");
+    GrParameter[] parameters = resultMethod.getParameters();
+    for (GrParameter parameter : parameters) {
+      builder.append(parameter.getName()).append(",");
+    }
+    if (parameters.length > 0) {
+      builder.replace(builder.length() - 1, builder.length(), ")\n");
+    }
+    else {
+      builder.append(")\n");
+    }
+
+    GroovyFile file = GroovyPsiElementFactory.getInstance(project).createGroovyFile(builder, false, null);
+
+    GrOpenBlock block = resultMethod.getBlock();
+    block.getNode().addChildren(file.getFirstChild().getNode(), null, block.getRBrace().getNode());
+  }
+
   public static void chooseAndOverrideMethods(@NotNull Project project,
                                               @NotNull Editor editor,
                                               @NotNull GrTypeDefinition aClass){
@@ -223,8 +266,7 @@
     new WriteCommandAction(project, aClass.getContainingFile()) {
       @Override
       protected void run(@NotNull Result result) throws Throwable {
-        OverrideImplementUtil.overrideOrImplementMethodsInRightPlace(editor, aClass, selectedElements, chooser.isCopyJavadoc(),
-                                                                     chooser.isInsertOverrideAnnotation());
+        OverrideImplementUtil.overrideOrImplementMethodsInRightPlace(editor, aClass, selectedElements, chooser.isCopyJavadoc(), chooser.isInsertOverrideAnnotation());
       }
     }.execute();
   }
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/overrideImplement/TraitMethodImplementor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/overrideImplement/TraitMethodImplementor.java
new file mode 100644
index 0000000..78f319b
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/overrideImplement/TraitMethodImplementor.java
@@ -0,0 +1,50 @@
+package org.jetbrains.plugins.groovy.overrideImplement;
+
+import com.intellij.codeInsight.MethodImplementor;
+import com.intellij.codeInsight.generation.GenerationInfo;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiSubstitutor;
+import com.intellij.psi.util.TypeConversionUtil;
+import com.intellij.util.Consumer;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
+import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrTraitMethod;
+
+/**
+ * Created by Max Medvedev on 08/06/14
+ */
+public class TraitMethodImplementor implements MethodImplementor {
+  @NotNull
+  @Override
+  public PsiMethod[] createImplementationPrototypes(PsiClass inClass, PsiMethod method) throws IncorrectOperationException {
+    if (!(inClass instanceof GrTypeDefinition && method instanceof GrTraitMethod)) return PsiMethod.EMPTY_ARRAY;
+
+    final PsiClass containingClass = method.getContainingClass();
+    PsiSubstitutor substitutor = inClass.isInheritor(containingClass, true) ? TypeConversionUtil.getSuperClassSubstitutor(containingClass, inClass, PsiSubstitutor.EMPTY)
+                                                                            : PsiSubstitutor.EMPTY;
+    return new GrMethod[]{GroovyOverrideImplementUtil.generateTraitMethodPrototype((GrTypeDefinition)inClass, (GrTraitMethod)method, substitutor)};
+  }
+
+  @Override
+  public GenerationInfo createGenerationInfo(PsiMethod method, boolean mergeIfExists) {
+    return null;
+  }
+
+  @NotNull
+  @Override
+  public Consumer<PsiMethod> createDecorator(PsiClass targetClass,
+                                             PsiMethod baseMethod,
+                                             boolean toCopyJavaDoc,
+                                             boolean insertOverrideIfPossible) {
+    return new GroovyMethodImplementor.PsiMethodConsumer(targetClass, toCopyJavaDoc, baseMethod, insertOverrideIfPossible);
+  }
+
+  @NotNull
+  @Override
+  public PsiMethod[] getMethodsToImplement(PsiClass aClass) {
+    return PsiMethod.EMPTY_ARRAY;
+  }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/SwitchStatementGenerator.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/SwitchStatementGenerator.java
index ae7b4fa..d8159be 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/SwitchStatementGenerator.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/convertToJava/SwitchStatementGenerator.java
@@ -15,8 +15,10 @@
  */
 package org.jetbrains.plugins.groovy.refactoring.convertToJava;
 
-import com.intellij.codeInsight.daemon.impl.analysis.HighlightUtil;
+import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiType;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.psi.util.TypeConversionUtil;
 import com.intellij.util.ArrayUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -39,10 +41,7 @@
  */
 public class SwitchStatementGenerator {
 
-  private static final boolean LANGUAGE_LEVEL_7_OR_HIGHER = false;
-
-  private SwitchStatementGenerator() {
-  }
+  private SwitchStatementGenerator() { }
 
   public static void generate(@NotNull StringBuilder builder,
                               @NotNull ExpressionContext context,
@@ -51,7 +50,7 @@
     final GrCaseSection[] caseSections = switchStatement.getCaseSections();
 
     final PsiType type = condition == null ? null : TypesUtil.unboxPrimitiveTypeWrapper(condition.getType());
-    if (type == null || HighlightUtil.isValidTypeForSwitchSelector(type, LANGUAGE_LEVEL_7_OR_HIGHER)) {
+    if (type == null || isValidTypeForSwitchSelector(type)) {
       generateSwitch(builder, context, condition, caseSections);
     }
     else {
@@ -59,6 +58,19 @@
     }
   }
 
+  private static boolean isValidTypeForSwitchSelector(@NotNull PsiType type) {
+    if (TypeConversionUtil.getTypeRank(type) <= TypeConversionUtil.INT_RANK) {
+      return true;
+    }
+
+    PsiClass aClass = PsiUtil.resolveClassInClassTypeOnly(type);
+    if (aClass != null && aClass.isEnum()) {
+      return true;
+    }
+
+    return false;
+  }
+
   private static void generateIfs(@NotNull StringBuilder builder,
                                   @NotNull ExpressionContext context,
                                   @NotNull GrExpression condition,
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/variable/GrIntroduceVariableHandler.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/variable/GrIntroduceVariableHandler.java
index 7d5f4ae..46d90d2 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/variable/GrIntroduceVariableHandler.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/variable/GrIntroduceVariableHandler.java
@@ -21,6 +21,7 @@
 import com.intellij.openapi.util.Ref;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiModifier;
+import com.intellij.psi.codeStyle.JavaCodeStyleManager;
 import com.intellij.refactoring.HelpID;
 import com.intellij.refactoring.introduce.inplace.OccurrencesChooser;
 import org.jetbrains.annotations.NotNull;
@@ -177,7 +178,9 @@
     GrStatement anchor = findAnchor(context, settings.replaceAllOccurrences());
     PsiElement parent = anchor.getParent();
     assert parent instanceof GrStatementOwner;
-    GrStatement declaration = ((GrStatementOwner)parent).addStatementBefore(generateDeclaration(context, settings), anchor);
+    GrVariableDeclaration generated = generateDeclaration(context, settings);
+    GrStatement declaration = ((GrStatementOwner)parent).addStatementBefore(generated, anchor);
+    declaration = (GrStatement)JavaCodeStyleManager.getInstance(context.getProject()).shortenClassReferences(declaration);
 
     return ((GrVariableDeclaration)declaration).getVariables()[0];
   }
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/swingBuilder/SwingBuilderNamedArgumentProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/swingBuilder/SwingBuilderNamedArgumentProvider.java
deleted file mode 100644
index 09c99b1..0000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/swingBuilder/SwingBuilderNamedArgumentProvider.java
+++ /dev/null
@@ -1,122 +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 org.jetbrains.plugins.groovy.swingBuilder;
-
-import com.intellij.openapi.util.Pair;
-import com.intellij.psi.*;
-import com.intellij.psi.util.InheritanceUtil;
-import com.intellij.psi.util.PsiTypesUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.plugins.groovy.extensions.GroovyNamedArgumentProvider;
-import org.jetbrains.plugins.groovy.extensions.NamedArgumentDescriptor;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrCall;
-import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
-import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
-import org.jetbrains.plugins.groovy.lang.psi.util.GroovyPropertyUtils;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Sergey Evdokimov
- */
-public class SwingBuilderNamedArgumentProvider extends GroovyNamedArgumentProvider {
-
-  @Override
-  public void getNamedArguments(@NotNull GrCall call,
-                                @Nullable PsiElement resolve,
-                                @Nullable String argumentName,
-                                boolean forCompletion,
-                                Map<String, NamedArgumentDescriptor> result) {
-    PsiType returnType = ((PsiMethod)resolve).getReturnType();
-    PsiClass aClass = PsiTypesUtil.getPsiClass(returnType);
-    if (aClass == null) return;
-
-    Map<String, Pair<PsiType, PsiElement>> typeMap = null;
-    if (!forCompletion) {
-      typeMap = new HashMap<String, Pair<PsiType, PsiElement>>();
-    }
-
-    PsiManager manager = aClass.getManager();
-
-    for (PsiMethod method : aClass.getAllMethods()) {
-      String methodName = method.getName();
-      String propertyName = GroovyPropertyUtils.getPropertyNameBySetterName(methodName);
-      if (propertyName != null) {
-        if (argumentName != null && !argumentName.equals(propertyName)) continue;
-
-        PsiType methodReturnType = method.getReturnType();
-        if (methodReturnType != null && !PsiType.VOID.equals(methodReturnType)) continue;
-
-        PsiParameter[] parameters = method.getParameterList().getParameters();
-
-        if (parameters.length != 1) continue;
-
-        if (forCompletion) { // optimization, don't calculate types.
-          result.put(propertyName, NamedArgumentDescriptor.SIMPLE_ON_TOP);
-        }
-        else {
-          PsiType newType = parameters[0].getType();
-
-          Pair<PsiType, PsiElement> oldPair = typeMap.get(propertyName);
-          if (oldPair == null) {
-            typeMap.put(propertyName, new Pair<PsiType, PsiElement>(newType, method));
-          }
-          else {
-            PsiType type = TypesUtil.getLeastUpperBound(oldPair.first, newType, manager);
-            if (type == null) {
-              type = PsiType.getJavaLangObject(manager, aClass.getResolveScope());
-            }
-            typeMap.put(propertyName, new Pair<PsiType, PsiElement>(newType, null));
-          }
-        }
-      }
-      else {
-        PsiType closureType = null;
-
-        if (methodName.startsWith("add")) {
-          PsiParameter[] parameters = method.getParameterList().getParameters();
-          if (parameters.length != 1) continue;
-
-          PsiClass paramClass = PsiTypesUtil.getPsiClass(parameters[0].getType());
-          if (paramClass == null || !InheritanceUtil.isInheritor(paramClass, "java.util.EventListener")) continue;
-
-          for (PsiMethod psiMethod : paramClass.getMethods()) {
-            if (!psiMethod.hasModifierProperty(PsiModifier.ABSTRACT)) continue;
-
-            if (forCompletion) {
-              result.put(psiMethod.getName(), NamedArgumentDescriptor.SIMPLE_ON_TOP);
-            }
-            else {
-              if (closureType == null) {
-                closureType = JavaPsiFacade.getElementFactory(manager.getProject()).createTypeByFQClassName(GroovyCommonClassNames.GROOVY_LANG_CLOSURE, call.getResolveScope());
-              }
-
-              result.put(psiMethod.getName(), new NamedArgumentDescriptor.TypeCondition(closureType, method));
-            }
-          }
-        }
-      }
-    }
-
-    if (!forCompletion) {
-      for (Map.Entry<String, Pair<PsiType, PsiElement>> entry : typeMap.entrySet()) {
-        result.put(entry.getKey(), new NamedArgumentDescriptor.TypeCondition(entry.getValue().first, entry.getValue().second));
-      }
-    }
-  }
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/template/expressions/ChooseTypeExpression.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/template/expressions/ChooseTypeExpression.java
index 91475f3..8ccfed1 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/template/expressions/ChooseTypeExpression.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/template/expressions/ChooseTypeExpression.java
@@ -35,7 +35,6 @@
 import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
 
 import java.util.List;
-import java.util.Set;
 
 /**
  * @author ven
@@ -151,11 +150,7 @@
 
   @Override
   public LookupElement[] calculateLookupItems(ExpressionContext context) {
-    Set<LookupElement> result = ContainerUtil.newHashSet();
-
-    if (myForGroovy) {
-      result.add(LookupElementBuilder.create(GrModifier.DEF).bold());
-    }
+    List<LookupElement> result = ContainerUtil.newArrayList();
 
     for (SmartTypePointer item : myItems) {
       PsiType type = TypesUtil.unboxPrimitiveTypeWrapper(item.getType());
@@ -165,6 +160,16 @@
       result.add(lookupItem);
     }
 
+    if (myForGroovy) {
+      LookupElementBuilder def = LookupElementBuilder.create(GrModifier.DEF).bold();
+      if (mySelectDef) {
+        result.add(0, def);
+      }
+      else {
+        result.add(def);
+      }
+    }
+
     return result.toArray(new LookupElement[result.size()]);
   }
 }
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GeneratorTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GeneratorTest.groovy
index ace29b3..cc2fd81 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GeneratorTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GeneratorTest.groovy
@@ -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.
@@ -14,17 +14,18 @@
  * limitations under the License.
  */
 package org.jetbrains.plugins.groovy.compiler
+
 import com.intellij.openapi.util.text.StringUtil
 import com.intellij.psi.PsiFile
 import org.jetbrains.plugins.groovy.LightGroovyTestCase
 import org.jetbrains.plugins.groovy.refactoring.convertToJava.GroovyToJavaGenerator
 import org.jetbrains.plugins.groovy.util.TestUtils
-/**
- * User: Dmitry.Krasilschikov
- * Date: 06.06.2007
- */
-public class GeneratorTest extends LightGroovyTestCase {
 
+/**
+ * @author Dmitry.Krasilschikov
+ * @since 06.06.2007
+ */
+class GeneratorTest extends LightGroovyTestCase {
   final String basePath = TestUtils.testDataPath + "groovy/stubGenerator"
 
   public void testArrayType1() throws Throwable { doTest(); }
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTest.groovy
index 67ceec5..2b5933f 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTest.groovy
@@ -15,9 +15,9 @@
  */
 
 package org.jetbrains.plugins.groovy.compiler
+
 import com.intellij.compiler.CompilerConfiguration
 import com.intellij.compiler.CompilerConfigurationImpl
-import com.intellij.compiler.server.BuildManager
 import com.intellij.openapi.application.ApplicationManager
 import com.intellij.openapi.compiler.CompilerMessage
 import com.intellij.openapi.compiler.CompilerMessageCategory
@@ -25,16 +25,15 @@
 import com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration
 import com.intellij.openapi.module.Module
 import com.intellij.openapi.roots.ModuleRootModificationUtil
-import com.intellij.openapi.util.io.FileUtil
 import com.intellij.openapi.vfs.VirtualFile
 import com.intellij.psi.PsiFile
 import com.intellij.testFramework.TestLoggerFactory
-import org.jetbrains.plugins.groovy.compiler.generator.GroovycStubGenerator
 import org.jetbrains.plugins.groovy.lang.psi.GroovyFile
+
 /**
  * @author peter
  */
-public abstract class GroovyCompilerTest extends GroovyCompilerTestCase {
+public class GroovyCompilerTest extends GroovyCompilerTestCase {
   @Override protected void setUp() {
     super.setUp();
     addGroovyLibrary(myModule);
@@ -543,9 +542,6 @@
     def main = myFixture.addFileToProject('Main.groovy', 'class Main extends Java {  }').virtualFile
 
     assertEmpty compileModule(myModule)
-    if (!useJps()) {
-      assertEmpty compileFiles(used.virtualFile, main)
-    }
 
     touch(used.virtualFile)
     touch(main)
@@ -727,7 +723,7 @@
     assert messages
     def error = messages.find { it.message.contains('InvalidType') }
     assert error?.virtualFile
-    assert groovyFile.classes[0] == GroovycStubGenerator.findClassByStub(project, error.virtualFile)
+    assert groovyFile.classes[0] == GroovyCompilerLoader.findClassByStub(project, error.virtualFile)
 
   }
 
@@ -819,30 +815,11 @@
     assertOutput 'AppTest', 'b'
   }
 
-  public static class IdeaModeTest extends GroovyCompilerTest {
-    @Override protected boolean useJps() { false }
-  }
+  public void "test no groovy library"() {
+    myFixture.addFileToProject("dependent/a.groovy", "");
+    addModule("dependent", true)
 
-  public static class JpsModeTest extends GroovyCompilerTest {
-    @Override protected boolean useJps() { true }
-
-    @Override
-    protected void tearDown() {
-      File systemRoot = BuildManager.getInstance().getBuildSystemDirectory()
-      try {
-        super.tearDown()
-      }
-      finally {
-        FileUtil.delete(systemRoot);
-      }
-    }
-
-    public void "test no groovy library"() {
-      myFixture.addFileToProject("dependent/a.groovy", "");
-      addModule("dependent", true)
-
-      def messages = make()
-      assert messages.find { it.message.contains("Cannot compile Groovy files: no Groovy library is defined for module 'dependent'") }
-    }
+    def messages = make()
+    assert messages.find { it.message.contains("Cannot compile Groovy files: no Groovy library is defined for module 'dependent'") }
   }
 }
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java
index a768fd4..7cbf9a9 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java
@@ -15,6 +15,7 @@
  */
 package org.jetbrains.plugins.groovy.compiler;
 
+import com.intellij.compiler.server.BuildManager;
 import com.intellij.execution.ExecutionException;
 import com.intellij.execution.Executor;
 import com.intellij.execution.application.ApplicationConfiguration;
@@ -37,6 +38,7 @@
 import com.intellij.openapi.roots.*;
 import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.util.Key;
+import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.PsiFile;
@@ -64,13 +66,11 @@
 public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestCase {
   @SuppressWarnings("AbstractMethodCallInConstructor") private CompilerTester myCompilerTester;
 
-  protected abstract boolean useJps();
-
   @Override
   protected void setUp() throws Exception {
     super.setUp();
     getProject().getComponent(GroovyCompilerLoader.class).projectOpened();
-    myCompilerTester = new CompilerTester(useJps(), myModule);
+    myCompilerTester = new CompilerTester(myModule);
   }
 
   @Override
@@ -87,18 +87,25 @@
 
   @Override
   protected void tearDown() throws Exception {
-    UIUtil.invokeAndWaitIfNeeded(new Runnable() {
-      @Override
-      public void run() {
-        try {
-          myCompilerTester.tearDown();
-          GroovyCompilerTestCase.super.tearDown();
+    final File systemRoot = BuildManager.getInstance().getBuildSystemDirectory();
+    try {
+      UIUtil.invokeAndWaitIfNeeded(new Runnable() {
+        @Override
+        public void run() {
+          try {
+            myCompilerTester.tearDown();
+            myCompilerTester = null;
+            GroovyCompilerTestCase.super.tearDown();
+          }
+          catch (Exception e) {
+            throw new RuntimeException(e);
+          }
         }
-        catch (Exception e) {
-          throw new RuntimeException(e);
-        }
-      }
-    });
+      });
+    }
+    finally {
+      FileUtil.delete(systemRoot);
+    }
   }
 
   protected void setupTestSources() {
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyDebuggerTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyDebuggerTest.groovy
index 6e1a4fa..84e0956 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyDebuggerTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyDebuggerTest.groovy
@@ -58,9 +58,6 @@
  */
 class GroovyDebuggerTest extends GroovyCompilerTestCase {
   @Override
-  protected boolean useJps() { true }
-
-  @Override
   protected void setUp() {
     edt {
       super.setUp()
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GrCompletionWithLibraryTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GrCompletionWithLibraryTest.groovy
index 32291ad..0b3b722 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GrCompletionWithLibraryTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GrCompletionWithLibraryTest.groovy
@@ -14,8 +14,11 @@
  * limitations under the License.
  */
 package org.jetbrains.plugins.groovy.completion
-
 import com.intellij.codeInsight.completion.CompletionType
+import com.intellij.codeInsight.lookup.LookupElement
+import com.intellij.codeInsight.lookup.impl.LookupImpl
+import com.intellij.openapi.application.Result
+import com.intellij.openapi.command.WriteCommandAction
 import com.intellij.openapi.module.Module
 import com.intellij.openapi.roots.ContentEntry
 import com.intellij.openapi.roots.ModifiableRootModel
@@ -23,8 +26,10 @@
 import com.intellij.openapi.roots.libraries.Library
 import com.intellij.openapi.vfs.JarFileSystem
 import com.intellij.openapi.vfs.VirtualFile
+import com.intellij.psi.PsiClass
 import com.intellij.testFramework.LightProjectDescriptor
 import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor
+import org.jetbrains.annotations.NotNull
 import org.jetbrains.plugins.groovy.util.TestUtils
 /**
  * @author Maxim.Medvedev
@@ -233,4 +238,32 @@
   public void testGStringConcatenationCompletion() {
     myFixture.testCompletionVariants(getTestName(false) + ".groovy", "substring", "substring", "subSequence");
   }
+
+  void testCompleteClassClashingWithGroovyUtilTuple() {
+    myFixture.addClass('package p; public class Tuple {}')
+
+    def file = myFixture.configureByText('a.groovy', 'print new Tupl<caret>')
+    LookupElement[] elements = myFixture.completeBasic()
+    LookupElement tuple = elements.find { it.psiElement instanceof PsiClass && it.psiElement.qualifiedName == 'p.Tuple'}
+    assertNotNull(elements as String, tuple)
+
+    LookupElement groovyUtilTuple = elements.find { it.psiElement instanceof PsiClass && it.psiElement.qualifiedName == 'groovy.lang.Tuple'}
+    assertNotNull(elements as String, groovyUtilTuple)
+
+    LookupImpl lookup = getLookup()
+    lookup.setCurrentItem(tuple)
+
+    new WriteCommandAction(myFixture.project, file) {
+      @Override
+      protected void run(@NotNull Result result) throws Throwable {
+        lookup.finishLookup('\n' as char);
+      }
+    }.execute()
+
+    myFixture.checkResult('''\
+import p.Tuple
+
+print new Tuple()\
+''')
+  }
 }
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyCompletionTestBase.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyCompletionTestBase.groovy
index 09e6aeb..eef06ae 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyCompletionTestBase.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyCompletionTestBase.groovy
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -16,6 +16,8 @@
 package org.jetbrains.plugins.groovy.completion
 import com.intellij.codeInsight.CodeInsightSettings
 import com.intellij.codeInsight.completion.CompletionType
+import com.intellij.codeInsight.lookup.LookupManager
+import com.intellij.codeInsight.lookup.impl.LookupImpl
 import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
 
 abstract public class GroovyCompletionTestBase extends LightCodeInsightFixtureTestCase {
@@ -113,4 +115,8 @@
     CodeInsightSettings.instance.COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE
   }
 
+  LookupImpl getLookup() {
+    LookupManager.getActiveLookup(myFixture.editor)
+  }
+
 }
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/ClashingTraitMethodsQuickFixTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/ClashingTraitMethodsQuickFixTest.groovy
new file mode 100644
index 0000000..6383908
--- /dev/null
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/ClashingTraitMethodsQuickFixTest.groovy
@@ -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 org.jetbrains.plugins.groovy.lang.highlighting
+
+import org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle
+import org.jetbrains.plugins.groovy.codeInspection.confusing.ClashingTraitMethodsInspection
+import org.jetbrains.plugins.groovy.intentions.GrIntentionTestCase
+
+/**
+ * Created by Max Medvedev on 09/06/14
+ */
+class ClashingTraitMethodsQuickFixTest extends GrIntentionTestCase {
+  ClashingTraitMethodsQuickFixTest() {
+    super(GroovyInspectionBundle.message("declare.explicit.implementations.of.trait"), ClashingTraitMethodsInspection)
+  }
+
+  void testQuickFix() {
+    doTextTest('''\
+trait T1 {
+    def foo(){}
+}
+
+trait T2 {
+    def foo(){}
+}
+
+class <caret>A implements T1, T2 {
+
+}
+''', '''\
+trait T1 {
+    def foo(){}
+}
+
+trait T2 {
+    def foo(){}
+}
+
+class A implements T1, T2 {
+
+    @Override
+    def foo() {
+        return T2.super.foo()
+    }
+}
+''')
+  }
+}
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/ClashingTraitMethodsTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/ClashingTraitMethodsTest.groovy
new file mode 100644
index 0000000..1428138
--- /dev/null
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/ClashingTraitMethodsTest.groovy
@@ -0,0 +1,117 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.lang.highlighting
+
+import com.intellij.codeInspection.InspectionProfileEntry
+import com.intellij.testFramework.LightProjectDescriptor
+import org.jetbrains.plugins.groovy.GroovyLightProjectDescriptor
+import org.jetbrains.plugins.groovy.codeInspection.confusing.ClashingTraitMethodsInspection
+
+/**
+ * Created by Max Medvedev on 09/06/14
+ */
+class ClashingTraitMethodsTest extends GrHighlightingTestBase {
+
+  @Override
+  protected LightProjectDescriptor getProjectDescriptor() {
+    GroovyLightProjectDescriptor.GROOVY_2_3
+  }
+
+  @Override
+  InspectionProfileEntry[] getCustomInspections() {
+    [new ClashingTraitMethodsInspection()]
+  }
+
+  public void testClash() {
+    testHighlighting('''
+trait T1 {
+  def foo(){}
+}
+
+trait T2 {
+  def foo(){}
+}
+
+class <warning descr="Traits T1, T2 contain clashing methods with signature foo()">A</warning> implements T1, T2 {
+
+}
+''')
+  }
+
+  public void testCustomImplementationNoClash() {
+    testHighlighting('''
+trait T1 {
+  def foo(){}
+}
+
+trait T2 {
+  def foo(){}
+}
+
+class A implements T1, T2 {
+    def foo() {}
+}
+''')
+  }
+
+  public void testNoClash() {
+    testHighlighting('''
+trait T1 {
+  def foo(){}
+}
+
+trait T2 {
+  abstract def foo()
+}
+
+class A implements T1, T2 {
+}
+''')
+  }
+
+  public void testNoClashWithInterface() {
+    testHighlighting('''
+trait T1 {
+  def foo(){}
+}
+
+interface T2 {
+  def foo()
+}
+
+class A implements T1, T2 {
+}
+''')
+  }
+
+
+  public void testNoClashInInheritor() {
+    testHighlighting('''
+trait T1 {
+  def foo(){}
+}
+
+interface T2 {
+  def foo()
+}
+
+class A implements T1, T2 {
+}
+
+class B extends A{}
+''')
+  }
+}
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GrAssignabilityTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GrAssignabilityTest.groovy
index 03ac29a..668af1c 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GrAssignabilityTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GrAssignabilityTest.groovy
@@ -31,10 +31,12 @@
   public void testIncompatibleTypesAssignments() { doTest(); }
 
   public void testDefaultMapConstructorNamedArgs() {
+    addBigDecimal()
     doTest(new GroovyConstructorNamedArgumentsInspection());
   }
 
   public void testDefaultMapConstructorNamedArgsError() {
+    addBigDecimal()
     doTest(new GroovyConstructorNamedArgumentsInspection());
   }
 
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/overriding/FindOverridingMethodsAndClassesTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/overriding/FindOverridingMethodsAndClassesTest.groovy
new file mode 100644
index 0000000..1a94778
--- /dev/null
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/overriding/FindOverridingMethodsAndClassesTest.groovy
@@ -0,0 +1,65 @@
+/*
+ * 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 org.jetbrains.plugins.groovy.lang.overriding
+import com.intellij.psi.PsiClass
+import com.intellij.psi.PsiMethod
+import com.intellij.psi.search.searches.ClassInheritorsSearch
+import com.intellij.psi.search.searches.OverridingMethodsSearch
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
+import org.jetbrains.plugins.groovy.lang.psi.GroovyFile
+import org.jetbrains.plugins.groovy.util.TestUtils
+/**
+ * @author Maxim.Medvedev
+ */
+public class FindOverridingMethodsAndClassesTest extends LightCodeInsightFixtureTestCase {
+  @Override
+  protected String getBasePath() {
+    TestUtils.testDataPath + "overriding/findOverridingMethodsAndClasses"
+  }
+
+  void testSimpleCase() {
+    doTest(1, 1)
+  }
+
+  void testAnonymousClass() {
+    doTest(2, 2)
+  }
+
+  void testTraitImplementsInterface() {
+    doTest(4, 4)
+  }
+
+  void testClassExtendsTrait() {
+    doTest(2, 2)
+  }
+
+  void testTraitExtendsTrait() { doTest 2, 2 }
+  void testTraitImplementsTrait() { doTest 2, 2 }
+
+  private void doTest(int methodCount, int classCount) {
+    myFixture.configureByFile(getTestName(false) + ".groovy")
+    final GroovyFile groovyFile = (GroovyFile)myFixture.file
+    final PsiClass psiClass = groovyFile.classes[0]
+    final PsiMethod method = psiClass.methods[0]
+
+    final Collection<PsiMethod> methods = OverridingMethodsSearch.search(method, psiClass.resolveScope, true).findAll()
+    assertEquals("Method count is wrong", methodCount, methods.size())
+
+    final Collection<PsiClass> classes = ClassInheritorsSearch.search(psiClass).findAll()
+    assertEquals("Class count is wrong", classCount, classes.size())
+  }
+}
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/overriding/FindOverridingMethodsAndClassesTest.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/overriding/FindOverridingMethodsAndClassesTest.java
deleted file mode 100644
index e2792b4..0000000
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/overriding/FindOverridingMethodsAndClassesTest.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 org.jetbrains.plugins.groovy.lang.overriding;
-
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiMethod;
-import com.intellij.psi.search.searches.DirectClassInheritorsSearch;
-import com.intellij.psi.search.searches.OverridingMethodsSearch;
-import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
-import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
-import org.jetbrains.plugins.groovy.util.TestUtils;
-
-import java.util.Collection;
-
-/**
- * @author Maxim.Medvedev
- */
-public class FindOverridingMethodsAndClassesTest extends LightCodeInsightFixtureTestCase {
-  @Override
-  protected String getBasePath() {
-    return TestUtils.getTestDataPath() + "overriding/findOverridingMethodsAndClasses";
-  }
-
-  public void testSimpleCase() throws Throwable {
-    doTest(1, 1);
-  }
-
-  public void testAnonymousClass() throws Throwable {
-    doTest(2, 2);
-  }
-
-  private void doTest(int methodCount, int classCount) throws Throwable {
-    myFixture.configureByFile(getTestName(false) + ".groovy");
-    final PsiFile file = myFixture.getFile();
-    assert file instanceof GroovyFile;
-    final GroovyFile groovyFile = (GroovyFile)file;
-    final PsiClass psiClass = groovyFile.getClasses()[0];
-    final PsiMethod method = psiClass.getMethods()[0];
-
-    final Collection<PsiMethod> methods = OverridingMethodsSearch.search(method, psiClass.getResolveScope(), true).findAll();
-    assertEquals("Method count is wrong", methodCount, methods.size());
-
-    final Collection<PsiClass> classes = DirectClassInheritorsSearch.search(psiClass).findAll();
-    assertEquals("Class count is wrong", classCount, classes.size());
-  }
-}
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/overriding/OverridingTester.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/overriding/OverridingTester.java
index 76c157f..869558a 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/overriding/OverridingTester.java
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/overriding/OverridingTester.java
@@ -24,7 +24,7 @@
     final List<String> strings = TestUtils.readInput(getTestDataPath() + "/" + testFile);
     GroovyFileBase psiFile = (GroovyFileBase) myFixture.addFileToProject("foo.groovy", strings.get(0));
 
-    StringBuffer buffer = new StringBuffer();
+    StringBuilder buffer = new StringBuilder();
 
     GrTypeDefinition[] grTypeDefinitions = psiFile.getTypeDefinitions();
     GrTypeDefinition lastTypeDefinition = psiFile.getTypeDefinitions()[grTypeDefinitions.length - 1];
@@ -33,7 +33,7 @@
 
     for (PsiMethod method : psiMethods) {
       PsiMethod[] superMethods = findMethod(method);
-      String[] classes = sortUseContaingClass(superMethods);
+      String[] classes = sortUseContainingClass(superMethods);
 
       for (String classAsString : classes) {
         buffer.append(classAsString);
@@ -41,12 +41,12 @@
       }
       buffer.append("\n");   //between different methods
     }
-    buffer.append("\n");  //metween class definitions
+    buffer.append("\n");  //between class definitions
 
     assertEquals(strings.get(1), buffer.toString().trim());
   }
 
-  private String[] sortUseContaingClass(PsiMethod[] psiMethods) {
+  private static String[] sortUseContainingClass(PsiMethod[] psiMethods) {
     String[] classes = new String[psiMethods.length];
 
     for (int i = 0; i < psiMethods.length; i++) {
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/TypeInferenceTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/TypeInferenceTest.groovy
index f02b940..40173b3 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/TypeInferenceTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/TypeInferenceTest.groovy
@@ -696,4 +696,22 @@
     doExprTest('1f/2.4', 'java.lang.Double')
   }
 
+  void testRecursionWithMaps() {
+    doTest('''
+def foo(Map map) {
+  while(true)
+    ma<caret>p = [a:map]
+}
+''', 'java.util.Map<java.lang.String, java.util.Map>')
+  }
+
+  void testRecursionWithLists() {
+    doTest('''
+def foo(List list) {
+  while(true)
+    lis<caret>t = [list]
+}
+''', 'java.util.ArrayList<java.util.List>')
+  }
+
 }
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/convertToJava/CodeBlockGenerationTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/convertToJava/CodeBlockGenerationTest.groovy
index f6e5275..07dddce 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/convertToJava/CodeBlockGenerationTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/convertToJava/CodeBlockGenerationTest.groovy
@@ -161,7 +161,10 @@
 
   void testArrayAccess() { doTest() }
 
-  void testCastWithEquality() { doTest() }
+  void testCastWithEquality() {
+    addBigDecimal()
+    doTest()
+  }
 
   void testAsserts() { doTest() }
 
diff --git a/plugins/groovy/testdata/overriding/findOverridingMethodsAndClasses/ClassExtendsTrait.groovy b/plugins/groovy/testdata/overriding/findOverridingMethodsAndClasses/ClassExtendsTrait.groovy
new file mode 100644
index 0000000..61d88ed
--- /dev/null
+++ b/plugins/groovy/testdata/overriding/findOverridingMethodsAndClasses/ClassExtendsTrait.groovy
@@ -0,0 +1,11 @@
+trait Trait {
+  abstract void foo()
+}
+
+class Implementor implements Trait {
+  void foo(){}
+}
+
+class Implementor2 extends Implementor {
+  void foo(){}
+}
\ No newline at end of file
diff --git a/plugins/groovy/testdata/overriding/findOverridingMethodsAndClasses/TraitExtendsTrait.groovy b/plugins/groovy/testdata/overriding/findOverridingMethodsAndClasses/TraitExtendsTrait.groovy
new file mode 100644
index 0000000..03df495
--- /dev/null
+++ b/plugins/groovy/testdata/overriding/findOverridingMethodsAndClasses/TraitExtendsTrait.groovy
@@ -0,0 +1,10 @@
+trait Trait {
+  abstract void foo()
+}
+
+trait T2 extends Trait {
+  void foo() {}
+}
+class Implementor2 implements T2 {
+  void foo(){}
+}
\ No newline at end of file
diff --git a/plugins/groovy/testdata/overriding/findOverridingMethodsAndClasses/TraitImplementsInterface.groovy b/plugins/groovy/testdata/overriding/findOverridingMethodsAndClasses/TraitImplementsInterface.groovy
new file mode 100644
index 0000000..e590b54
--- /dev/null
+++ b/plugins/groovy/testdata/overriding/findOverridingMethodsAndClasses/TraitImplementsInterface.groovy
@@ -0,0 +1,27 @@
+public interface ShowSiblings {
+  void doSmth();
+}
+// ******************************
+trait A implements ShowSiblings {
+  public void doSmth() {
+    println("traitA");
+  }
+}
+
+trait B implements ShowSiblings {
+  public void doSmth() {
+    println("traitB");
+  }
+}
+// ******************************
+class C implements ShowSiblings {
+  public void doSmth() {
+    println("classC");
+  }
+}
+
+class D implements ShowSiblings {
+  public void doSmth() {
+    println("classD");
+  }
+}
\ No newline at end of file
diff --git a/plugins/groovy/testdata/overriding/findOverridingMethodsAndClasses/TraitImplementsTrait.groovy b/plugins/groovy/testdata/overriding/findOverridingMethodsAndClasses/TraitImplementsTrait.groovy
new file mode 100644
index 0000000..800bd82
--- /dev/null
+++ b/plugins/groovy/testdata/overriding/findOverridingMethodsAndClasses/TraitImplementsTrait.groovy
@@ -0,0 +1,11 @@
+trait Trait {
+  abstract void foo()
+}
+
+trait Implementor implements Trait {
+  void foo(){}
+}
+
+class Implementor2 implements Implementor {
+  void foo(){}
+}
\ No newline at end of file
diff --git a/plugins/hg4idea/src/META-INF/plugin.xml b/plugins/hg4idea/src/META-INF/plugin.xml
index 99f3258..9ccc175 100644
--- a/plugins/hg4idea/src/META-INF/plugin.xml
+++ b/plugins/hg4idea/src/META-INF/plugin.xml
@@ -31,6 +31,8 @@
                         serviceImplementation="org.zmlx.hg4idea.HgRememberedInputs"/>
     <projectService serviceInterface="org.zmlx.hg4idea.HgProjectSettings"
                     serviceImplementation="org.zmlx.hg4idea.HgProjectSettings"/>
+    <projectService serviceInterface="org.zmlx.hg4idea.provider.update.HgUpdateConfigurationSettings"
+                    serviceImplementation="org.zmlx.hg4idea.provider.update.HgUpdateConfigurationSettings"/>
     <projectService serviceInterface="org.zmlx.hg4idea.HgRootsHandler"
                     serviceImplementation="org.zmlx.hg4idea.HgRootsHandler" />
   </extensions>
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/HgPusher.java b/plugins/hg4idea/src/org/zmlx/hg4idea/HgPusher.java
index 2e93212..2b6108d 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/HgPusher.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/HgPusher.java
@@ -64,7 +64,6 @@
     final HgPushDialog dialog = new HgPushDialog(myProject, repositories, selectedRepo);
     dialog.show();
     if (dialog.isOK()) {
-      dialog.rememberSettings();
       pushCommand.set(preparePushCommand(myProject, dialog));
       new Task.Backgroundable(myProject, "Pushing...", false) {
         @Override
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgPullAction.java b/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgPullAction.java
index c6650a1..d5a934e 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgPullAction.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgPullAction.java
@@ -34,7 +34,6 @@
     final HgPullDialog dialog = new HgPullDialog(project, repos, selectedRepo);
     dialog.show();
     if (dialog.isOK()) {
-      dialog.rememberSettings();
       final String source = dialog.getSource();
       final HgRepository hgRepository = dialog.getRepository();
       new Task.Backgroundable(project, "Pulling changes from " + source, false) {
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgWorkingCopyRevisionsCommand.java b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgWorkingCopyRevisionsCommand.java
index 2632638..6e5e811 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgWorkingCopyRevisionsCommand.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/command/HgWorkingCopyRevisionsCommand.java
@@ -100,9 +100,9 @@
   public Couple<HgRevisionNumber> parents(@NotNull VirtualFile repo, @Nullable FilePath file, @Nullable HgRevisionNumber revision) {
     final List<HgRevisionNumber> revisions = getRevisions(repo, "parents", file, revision, true);
     switch (revisions.size()) {
-      case 1: return Couple.newOne(revisions.get(0), null);
-      case 2: return Couple.newOne(revisions.get(0), revisions.get(1));
-      default: return Couple.newOne(null, null);
+      case 1: return Couple.of(revisions.get(0), null);
+      case 2: return Couple.of(revisions.get(0), revisions.get(1));
+      default: return Couple.of(null, null);
     }
   }
 
@@ -140,7 +140,7 @@
     commandExecutor.setSilent(true);
     HgCommandResult result = commandExecutor.executeInCurrentThread(repo, "identify", Arrays.asList("--num", "--id"));
     if (result == null) {
-      return Couple.newOne(HgRevisionNumber.NULL_REVISION_NUMBER, null);
+      return Couple.of(HgRevisionNumber.NULL_REVISION_NUMBER, null);
     }
 
     final List<String> lines = result.getOutputLines();
@@ -154,14 +154,14 @@
           // 9f2e6c02913c+b311eb4eb004+ 186+183+
           List<String> chsets = StringUtil.split(changesets, "+");
           List<String> revs = StringUtil.split(revisions, "+");
-          return Couple.newOne(HgRevisionNumber.getInstance(revs.get(0) + "+", chsets.get(0) + "+"),
-                               HgRevisionNumber.getInstance(revs.get(1) + "+", chsets.get(1) + "+"));
+          return Couple.of(HgRevisionNumber.getInstance(revs.get(0) + "+", chsets.get(0) + "+"),
+                           HgRevisionNumber.getInstance(revs.get(1) + "+", chsets.get(1) + "+"));
         } else {
-          return Couple.newOne(HgRevisionNumber.getInstance(revisions, changesets), null);
+          return Couple.of(HgRevisionNumber.getInstance(revisions, changesets), null);
         }
       }
     }
-    return Couple.newOne(HgRevisionNumber.NULL_REVISION_NUMBER, null);
+    return Couple.of(HgRevisionNumber.NULL_REVISION_NUMBER, null);
   }
 
   /**
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java b/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java
index 548cdf6..9a94824 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java
@@ -15,8 +15,6 @@
 import com.intellij.ide.passwordSafe.PasswordSafe;
 import com.intellij.ide.passwordSafe.PasswordSafeException;
 import com.intellij.ide.passwordSafe.impl.PasswordSafeImpl;
-import com.intellij.ide.passwordSafe.impl.PasswordSafeProvider;
-import com.intellij.ide.passwordSafe.impl.providers.masterKey.MasterKeyPasswordSafe;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.ModalityState;
 import com.intellij.openapi.diagnostic.Logger;
@@ -49,16 +47,19 @@
   public void saveCredentials() {
     if (myRunnable == null) return;
 
-    // if checkbox is selected, remember on disk. Otherwise in memory. Don't read password safe settings.
+    // if checkbox is selected, save on disk. Otherwise in memory. Don't read password safe settings.
 
     final PasswordSafeImpl passwordSafe = (PasswordSafeImpl)PasswordSafe.getInstance();
     final String url = VirtualFileManager.extractPath(myRunnable.getURL());
     final String key = keyForUrlAndLogin(url, myRunnable.getUserName());
 
-    final PasswordSafeProvider provider =
-      myRunnable.isRememberPassword() ? passwordSafe.getMasterKeyProvider() : passwordSafe.getMemoryProvider();
     try {
-      provider.storePassword(myProject, HgCommandAuthenticator.class, key, myRunnable.getPassword());
+      if (myRunnable.isRememberPassword()) {
+        //save password to memory, despite of settings-> passwords
+        //todo should be reworked
+        passwordSafe.getMemoryProvider().storePassword(myProject, HgCommandAuthenticator.class, key, myRunnable.getPassword());
+      }
+      passwordSafe.storePassword(myProject, HgCommandAuthenticator.class, key, myRunnable.getPassword());
       final HgVcs vcs = HgVcs.getInstance(myProject);
       if (vcs != null) {
         vcs.getGlobalSettings().addRememberedUrl(url, myRunnable.getUserName());
@@ -129,13 +130,7 @@
           final PasswordSafeImpl passwordSafe = (PasswordSafeImpl)PasswordSafe.getInstance();
           password = passwordSafe.getMemoryProvider().getPassword(myProject, HgCommandAuthenticator.class, key);
           if (password == null) {
-            final MasterKeyPasswordSafe masterKeyProvider = passwordSafe.getMasterKeyProvider();
-            if (!masterKeyProvider.isEmpty()) {
-              // workaround for: don't ask for master password, if the requested password is not there.
-              // this should be fixed in PasswordSafe: don't ask master password to look for keys
-              // until then we assume that is PasswordSafe was used (there is anything there), then it makes sense to look there.
-              password = masterKeyProvider.getPassword(myProject, HgCommandAuthenticator.class, key);
-            }
+            password = passwordSafe.getPassword(myProject, HgCommandAuthenticator.class, key);
           }
         } catch (PasswordSafeException e) {
           LOG.info("Couldn't get password for key [" + key + "]", e);
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgCachingCommittedChangesProvider.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgCachingCommittedChangesProvider.java
index eb54341..37987e1 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgCachingCommittedChangesProvider.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgCachingCommittedChangesProvider.java
@@ -354,7 +354,8 @@
     }
     HgFileRevision localRevision = revisions.get(0);
     HgRevisionNumber vcsRevisionNumber = localRevision.getRevisionNumber();
-    HgRevisionNumber firstParent = vcsRevisionNumber.getParents().get(0);
+    List<HgRevisionNumber> parents = vcsRevisionNumber.getParents();
+    HgRevisionNumber firstParent = parents.isEmpty() ? null : parents.get(0); // can have no parents if it is a root
     List<Change> changes = new ArrayList<Change>();
     for (String file : localRevision.getModifiedFiles()) {
       changes.add(createChange(root, file, firstParent, file, vcsRevisionNumber, FileStatus.MODIFIED));
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgChangeProvider.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgChangeProvider.java
index 9c68605..daaf6ec 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgChangeProvider.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgChangeProvider.java
@@ -152,9 +152,9 @@
       final VirtualFile vf = filePath.getVirtualFile();
       if (vf != null &&  fileDocumentManager.isFileModified(vf)) {
         final VirtualFile root = vcsManager.getVcsRootFor(vf);
-        if (root != null) {
+        if (root != null && HgUtil.isHgRoot(root)) {
           final HgRevisionNumber beforeRevisionNumber = new HgWorkingCopyRevisionsCommand(myProject).tip(root);
-          final ContentRevision beforeRevision = (beforeRevisionNumber == null ? null : 
+          final ContentRevision beforeRevision = (beforeRevisionNumber == null ? null :
                                                   new HgContentRevision(myProject, new HgFile(myProject, vf), beforeRevisionNumber));
           builder.processChange(new Change(beforeRevision, CurrentContentRevision.create(filePath), FileStatus.MODIFIED), myVcsKey);
         }
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgRegularUpdater.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgRegularUpdater.java
index e88b194..c963003 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgRegularUpdater.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgRegularUpdater.java
@@ -35,27 +35,21 @@
 import java.util.Set;
 
 import static org.zmlx.hg4idea.HgErrorHandler.ensureSuccess;
+import static org.zmlx.hg4idea.provider.update.HgUpdateType.MERGE;
+import static org.zmlx.hg4idea.provider.update.HgUpdateType.ONLY_UPDATE;
 
 public class HgRegularUpdater implements HgUpdater {
 
   @NotNull private final Project project;
   @NotNull private final VirtualFile repoRoot;
-  @NotNull private final UpdateConfiguration updateConfiguration;
+  @NotNull private final HgUpdateConfigurationSettings updateConfiguration;
 
-  public HgRegularUpdater(@NotNull Project project, @NotNull VirtualFile repository, @NotNull UpdateConfiguration configuration) {
+  public HgRegularUpdater(@NotNull Project project, @NotNull VirtualFile repository, @NotNull HgUpdateConfigurationSettings configuration) {
     this.project = project;
     this.repoRoot = repository;
     this.updateConfiguration = configuration;
   }
 
-  private boolean shouldMerge() {
-    return updateConfiguration.shouldMerge();
-  }
-
-  private boolean shouldCommitAfterMerge() {
-    return updateConfiguration.shouldCommitAfterMerge();
-  }
-
   public boolean update(final UpdatedFiles updatedFiles, ProgressIndicator indicator, List<VcsException> warnings)
     throws VcsException {
     indicator.setText(HgVcsMessages.message("hg4idea.progress.updating", repoRoot.getPath()));
@@ -81,9 +75,11 @@
 //      throw new VcsException("working dir not at branch tip (use \"Update to...\" to check out branch tip)");
 //    }
 
-    HgCommandExitCode pullResult = pull(repoRoot, indicator);
-    if (pullResult == HgCommandExitCode.ERROR) {
-      return false;
+    if (updateConfiguration.shouldPull()) {
+      HgCommandExitCode pullResult = pull(repoRoot, indicator);
+      if (pullResult == HgCommandExitCode.ERROR) {
+        return false;
+      }
     }
 
     List<HgRevisionNumber> parentsBeforeUpdate = new HgWorkingCopyRevisionsCommand(project).parents(repoRoot);
@@ -97,17 +93,18 @@
     List<HgRevisionNumber> pulledBranchHeads = determinePulledBranchHeads(branchHeadsBeforePull, branchHeadsAfterPull);
     List<HgRevisionNumber> remainingOriginalBranchHeads =
       determingRemainingOriginalBranchHeads(branchHeadsBeforePull, branchHeadsAfterPull);
+    HgUpdateType updateType = updateConfiguration.getUpdateType();
 
-    if (branchHeadsAfterPull.size() > 1) {
+    if (branchHeadsAfterPull.size() > 1 && updateType != ONLY_UPDATE) {
       // merge strategy
-      if (shouldMerge()) {
+      if (updateType == MERGE) {
         abortOnLocalChanges();
         abortOnMultiplePulledHeads(pulledBranchHeads);
         abortOnMultipleLocalHeads(remainingOriginalBranchHeads);
 
         HgCommandResult mergeResult = doMerge(indicator);
 
-        if (shouldCommitAfterMerge()) {
+        if (updateConfiguration.shouldCommitAfterMerge()) {
           commitOrWarnAboutConflicts(warnings, mergeResult);
         }
       }
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateConfigurationSettings.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateConfigurationSettings.java
new file mode 100644
index 0000000..e0b6d4e
--- /dev/null
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateConfigurationSettings.java
@@ -0,0 +1,74 @@
+/*
+ * 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 org.zmlx.hg4idea.provider.update;
+
+import com.intellij.openapi.components.PersistentStateComponent;
+import com.intellij.openapi.components.State;
+import com.intellij.openapi.components.Storage;
+import com.intellij.openapi.components.StoragePathMacros;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+@State(
+  name = "HgUpdateConfigurationSettings",
+  storages = @Storage(file = StoragePathMacros.WORKSPACE_FILE)
+)
+public class HgUpdateConfigurationSettings implements PersistentStateComponent<HgUpdateConfigurationSettings.State> {
+
+
+  private State myState = new State();
+
+  public static class State {
+    public boolean shouldPull = true;
+    @NotNull public HgUpdateType updateType = HgUpdateType.ONLY_UPDATE;
+    public boolean shouldCommitAfterMerge = false;
+  }
+
+  public void setShouldPull(boolean shouldPull) {
+    myState.shouldPull = shouldPull;
+  }
+
+  public void setUpdateType(@NotNull HgUpdateType updateType) {
+    myState.updateType = updateType;
+  }
+
+  public void setShouldCommitAfterMerge(boolean shouldCommitAfterMerge) {
+    myState.shouldCommitAfterMerge = shouldCommitAfterMerge;
+  }
+
+  public boolean shouldPull() {
+    return myState.shouldPull;
+  }
+
+  public HgUpdateType getUpdateType() {
+    return myState.updateType;
+  }
+
+  public boolean shouldCommitAfterMerge() {
+    return myState.updateType == HgUpdateType.MERGE && myState.shouldCommitAfterMerge;
+  }
+
+  @Nullable
+  @Override
+  public HgUpdateConfigurationSettings.State getState() {
+    return myState;
+  }
+
+  @Override
+  public void loadState(HgUpdateConfigurationSettings.State state) {
+    myState = state;
+  }
+}
\ No newline at end of file
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java
index cbb35ea..75387b2 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateEnvironment.java
@@ -12,6 +12,7 @@
 // limitations under the License.
 package org.zmlx.hg4idea.provider.update;
 
+import com.intellij.openapi.components.ServiceManager;
 import com.intellij.openapi.options.Configurable;
 import com.intellij.openapi.options.ConfigurationException;
 import com.intellij.openapi.progress.ProgressIndicator;
@@ -34,10 +35,11 @@
 public class HgUpdateEnvironment implements UpdateEnvironment {
 
   private final Project project;
-  private final HgUpdater.UpdateConfiguration updateConfiguration = new HgUpdater.UpdateConfiguration();
+  private final HgUpdateConfigurationSettings updateConfiguration;
 
   public HgUpdateEnvironment(Project project) {
     this.project = project;
+    updateConfiguration = ServiceManager.getService(project, HgUpdateConfigurationSettings.class);
   }
 
   public void fillGroups(UpdatedFiles updatedFiles) {
@@ -84,10 +86,10 @@
   }
   
   public static class UpdateConfigurable implements Configurable {
-    private final HgUpdater.UpdateConfiguration updateConfiguration;
+    private final HgUpdateConfigurationSettings updateConfiguration;
     protected HgUpdateDialog updateDialog;
 
-    public UpdateConfigurable(HgUpdater.UpdateConfiguration updateConfiguration) {
+    public UpdateConfigurable(HgUpdateConfigurationSettings updateConfiguration) {
       this.updateConfiguration = updateConfiguration;
     }
 
@@ -101,8 +103,8 @@
     }
 
     public JComponent createComponent() {
-      updateDialog = new HgUpdateDialog();
-      return updateDialog.createCenterPanel();
+      updateDialog = new HgUpdateDialog(updateConfiguration);
+      return updateDialog.getContentPanel();
     }
 
     public boolean isModified() {
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateType.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateType.java
new file mode 100644
index 0000000..3ffccb6
--- /dev/null
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdateType.java
@@ -0,0 +1,36 @@
+/*
+ * 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 org.zmlx.hg4idea.provider.update;
+
+/**
+ * The type of update to perform
+ */
+public enum HgUpdateType {
+
+
+  /**
+   * Try to update without merge, fails if conflicts
+   */
+  ONLY_UPDATE,
+  /**
+   * Merge commits with pulled
+   */
+  MERGE,
+  /**
+   * Rebase local commits
+   */
+  REBASE
+}
\ No newline at end of file
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdater.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdater.java
index e8f3d59..ce304df 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdater.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/update/HgUpdater.java
@@ -22,35 +22,4 @@
 
   boolean update(UpdatedFiles updatedFiles, ProgressIndicator indicator, List<VcsException> exceptions)
     throws VcsException;
-
-  class UpdateConfiguration{
-    private boolean shouldMerge = true;
-    private boolean shouldCommitAfterMerge = true;
-    private boolean shouldRebase = false;
-
-
-    public void setShouldMerge(boolean shouldMerge) {
-      this.shouldMerge = shouldMerge;
-    }
-
-    public void setShouldCommitAfterMerge(boolean shouldCommitAfterMerge) {
-      this.shouldCommitAfterMerge = shouldCommitAfterMerge;
-    }
-
-    public void setShouldRebase(boolean shouldRebase) {
-      this.shouldRebase = shouldRebase;
-    }
-
-  public boolean shouldRebase() {
-    return shouldRebase;
-  }
-  
-  public boolean shouldMerge() {
-    return shouldMerge;
-  }
-  
-  public boolean shouldCommitAfterMerge() {
-    return shouldMerge() && shouldCommitAfterMerge;
-  }
-  }
 }
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/status/ui/HgIncomingOutgoingWidget.java b/plugins/hg4idea/src/org/zmlx/hg4idea/status/ui/HgIncomingOutgoingWidget.java
index 31df1c4..5702d29 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/status/ui/HgIncomingOutgoingWidget.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/status/ui/HgIncomingOutgoingWidget.java
@@ -55,6 +55,7 @@
   private MessageBusConnection myBusConnection;
 
   private volatile String myTooltip = "";
+  private Icon myCurrentIcon = AllIcons.Ide.IncomingChangesOff;
 
   public HgIncomingOutgoingWidget(@NotNull HgVcs vcs,
                                   @NotNull Project project,
@@ -136,7 +137,9 @@
         }
 
         emptyTooltip();
+        myCurrentIcon = AllIcons.Ide.IncomingChangesOff;
         if (myChangesStatus.getNumChanges() > 0) {
+          myCurrentIcon = myIsIncoming ? AllIcons.Ide.IncomingChangesOn : AllIcons.Ide.OutgoingChangesOn;
           myTooltip = "\n" + myChangesStatus.getToolTip();
         }
         myStatusBar.updateWidget(ID());
@@ -193,7 +196,7 @@
   @NotNull
   @Override
   public Icon getIcon() {
-    return myIsIncoming ? AllIcons.Ide.IncomingChangesOn : AllIcons.Ide.IncomingChangesOff;
+    return myCurrentIcon;
   }
 
   public HgChangesetStatus getChangesetStatus() {
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgPullDialog.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgPullDialog.java
index e140af3..15d2f71 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgPullDialog.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgPullDialog.java
@@ -12,7 +12,6 @@
 // limitations under the License.
 package org.zmlx.hg4idea.ui;
 
-import com.intellij.dvcs.DvcsRememberedInputs;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.editor.event.DocumentAdapter;
 import com.intellij.openapi.editor.event.DocumentEvent;
@@ -21,11 +20,9 @@
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.ui.EditorComboBox;
-import com.intellij.util.ArrayUtil;
 import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
-import org.zmlx.hg4idea.HgRememberedInputs;
 import org.zmlx.hg4idea.repo.HgRepository;
 import org.zmlx.hg4idea.util.HgUtil;
 
@@ -60,8 +57,6 @@
 
   public void createUIComponents() {
     myRepositoryURL = new EditorComboBox("");
-    final DvcsRememberedInputs rememberedInputs = HgRememberedInputs.getInstance();
-    myRepositoryURL.setHistory(ArrayUtil.toObjectArray(rememberedInputs.getVisitedUrls(), String.class));
     myRepositoryURL.addDocumentListener(new DocumentAdapter() {
       @Override
       public void documentChanged(DocumentEvent e) {
@@ -77,11 +72,6 @@
     }
   }
 
-  public void rememberSettings() {
-    final DvcsRememberedInputs rememberedInputs = HgRememberedInputs.getInstance();
-    rememberedInputs.addUrl(HgUtil.removePasswordIfNeeded(getSource()));
-  }
-
   @NotNull
   public HgRepository getRepository() {
     return hgRepositorySelector.getRepository();
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgPushDialog.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgPushDialog.java
index b346c15..33e4709 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgPushDialog.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgPushDialog.java
@@ -12,7 +12,6 @@
 // limitations under the License.
 package org.zmlx.hg4idea.ui;
 
-import com.intellij.dvcs.DvcsRememberedInputs;
 import com.intellij.openapi.editor.event.DocumentAdapter;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.DialogWrapper;
@@ -20,10 +19,8 @@
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.ui.ComboboxSpeedSearch;
 import com.intellij.ui.EditorComboBox;
-import com.intellij.util.ArrayUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
-import org.zmlx.hg4idea.HgRememberedInputs;
 import org.zmlx.hg4idea.HgVcsMessages;
 import org.zmlx.hg4idea.repo.HgRepository;
 import org.zmlx.hg4idea.util.HgUtil;
@@ -88,8 +85,6 @@
 
   public void createUIComponents() {
     myRepositoryURL = new EditorComboBox("");
-    final DvcsRememberedInputs rememberedInputs = HgRememberedInputs.getInstance();
-    myRepositoryURL.setHistory(ArrayUtil.toObjectArray(rememberedInputs.getVisitedUrls(), String.class));
     myRepositoryURL.addDocumentListener(new DocumentAdapter() {
       @Override
       public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) {
@@ -192,11 +187,6 @@
     return HgPushDialog.class.getName();
   }
 
-  public void rememberSettings() {
-    final DvcsRememberedInputs rememberedInputs = HgRememberedInputs.getInstance();
-    rememberedInputs.addUrl(HgUtil.removePasswordIfNeeded(myRepositoryURL.getText()));
-  }
-
   /**
    * Updates the form on every change.
    */
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgUpdateDialog.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgUpdateDialog.java
index de4b865..16fb9b4 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgUpdateDialog.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgUpdateDialog.java
@@ -13,8 +13,11 @@
 package org.zmlx.hg4idea.ui;
 
 import com.intellij.ui.IdeBorderFactory;
+import com.intellij.ui.components.JBCheckBox;
 import net.miginfocom.swing.MigLayout;
-import org.zmlx.hg4idea.provider.update.HgUpdater;
+import org.jetbrains.annotations.NotNull;
+import org.zmlx.hg4idea.provider.update.HgUpdateConfigurationSettings;
+import org.zmlx.hg4idea.provider.update.HgUpdateType;
 
 import javax.swing.*;
 import java.awt.event.ItemEvent;
@@ -24,62 +27,106 @@
  * Configuration dialog for the update process.
  */
 public class HgUpdateDialog {
+
+  private JComponent myContentPanel;
+  private JCheckBox myPullCheckBox;
   private JCheckBox myCommitAfterMergeCheckBox;
+  private JRadioButton myOnlyUpdateButton;
   private JRadioButton myMergeRadioButton;
   private JRadioButton myRebaseRadioButton;
 
 
-  public HgUpdateDialog() {
-    createCenterPanel();
+  public HgUpdateDialog(@NotNull HgUpdateConfigurationSettings updateSettings) {
+    myContentPanel = createCenterPanel(updateSettings);
+  }
+
+  public JComponent getContentPanel() {
+    return myContentPanel;
   }
 
   private void updateEnabledStates() {
     myCommitAfterMergeCheckBox.setEnabled(myMergeRadioButton.isSelected());
   }
 
-  public void applyTo(HgUpdater.UpdateConfiguration updateConfiguration) {
-    updateConfiguration.setShouldMerge(myMergeRadioButton.isSelected());
+  public void applyTo(HgUpdateConfigurationSettings updateConfiguration) {
+    updateConfiguration.setShouldPull(myPullCheckBox.isSelected());
+    if (myOnlyUpdateButton.isSelected()) {
+      updateConfiguration.setUpdateType(HgUpdateType.ONLY_UPDATE);
+    }
+    if (myMergeRadioButton.isSelected()) {
+      updateConfiguration.setUpdateType(HgUpdateType.MERGE);
+    }
+    if (myRebaseRadioButton.isSelected()) {
+      updateConfiguration.setUpdateType(HgUpdateType.REBASE);
+    }
     updateConfiguration.setShouldCommitAfterMerge(myCommitAfterMergeCheckBox.isSelected());
-    updateConfiguration.setShouldRebase(myRebaseRadioButton.isSelected());
   }
 
-  public JComponent createCenterPanel() {
+  public JComponent createCenterPanel(HgUpdateConfigurationSettings updateSettings) {
     MigLayout migLayout = new MigLayout("flowy,ins 0, fill");
     JPanel contentPane = new JPanel(migLayout);
 
+    myPullCheckBox = new JBCheckBox("Pull", true);
+    myPullCheckBox.setMnemonic('p');
+    myPullCheckBox.setToolTipText("Pull from the default remote repository");
+    myPullCheckBox.setSelected(updateSettings.shouldPull());
 
+    myOnlyUpdateButton = new JRadioButton("Only Update", true);
+    myOnlyUpdateButton.setMnemonic('u');
+    myOnlyUpdateButton.setToolTipText("Update to the head of the current branch");
 
-    contentPane.setBorder(IdeBorderFactory.createTitledBorder("Update Type"));
-
-    myMergeRadioButton = new JRadioButton("Merge", true);
+    myMergeRadioButton = new JRadioButton("Merge", false);
     myMergeRadioButton.setMnemonic('m');
     myMergeRadioButton.setToolTipText("Merge if pulling resulted in extra heads");
-    myCommitAfterMergeCheckBox = new JCheckBox("Commit after merge without conflicts", false);
-    myCommitAfterMergeCheckBox.setMnemonic('c');
-    myCommitAfterMergeCheckBox.setToolTipText("Commit automatically after the merge");
-    myRebaseRadioButton = new JRadioButton("Rebase", false);
-    myRebaseRadioButton.setToolTipText("Rebase changesets to a branch tip as destination");
-    myRebaseRadioButton.setMnemonic('r');
-    final ButtonGroup radioButtonGroup = new ButtonGroup();
-    radioButtonGroup.add(myMergeRadioButton);
-    radioButtonGroup.add(myRebaseRadioButton);
-
-    contentPane.add(myMergeRadioButton, "left");
-    contentPane.add(myCommitAfterMergeCheckBox, "gapx 5%");
-    contentPane.add(myRebaseRadioButton, "left");
     myMergeRadioButton.addItemListener(new ItemListener() {
+      @Override
       public void itemStateChanged(ItemEvent e) {
         updateEnabledStates();
       }
     });
 
+    myCommitAfterMergeCheckBox = new JCheckBox("Commit after merge without conflicts", false);
+    myCommitAfterMergeCheckBox.setMnemonic('c');
+    myCommitAfterMergeCheckBox.setToolTipText("Commit automatically after the merge");
+    myCommitAfterMergeCheckBox.setSelected(updateSettings.shouldCommitAfterMerge());
+
+    myRebaseRadioButton = new JRadioButton("Rebase", false);
+    myRebaseRadioButton.setToolTipText("Rebase changesets to a branch tip as destination");
+    myRebaseRadioButton.setMnemonic('r');
+
+
+    contentPane.add(myPullCheckBox, "left");
+    JPanel strategyPanel = new JPanel(migLayout);
+    strategyPanel.setBorder(IdeBorderFactory.createTitledBorder("Update Strategy"));
+    strategyPanel.add(myOnlyUpdateButton, "left");
+    strategyPanel.add(myMergeRadioButton, "left");
+    strategyPanel.add(myCommitAfterMergeCheckBox, "gapx 5%");
+    strategyPanel.add(myRebaseRadioButton, "left");
+    contentPane.add(strategyPanel);
+    ButtonGroup group = new ButtonGroup();
+    group.add(myOnlyUpdateButton);
+    group.add(myRebaseRadioButton);
+    group.add(myMergeRadioButton);
     updateEnabledStates();
     return contentPane;
   }
 
-  public void updateFrom(HgUpdater.UpdateConfiguration updateConfiguration) {
-    myMergeRadioButton.setSelected(updateConfiguration.shouldMerge());
+  public void updateFrom(@NotNull HgUpdateConfigurationSettings updateConfiguration) {
+    myPullCheckBox.setSelected(updateConfiguration.shouldPull());
+    HgUpdateType updateType = updateConfiguration.getUpdateType();
+    switch (updateType) {
+      case ONLY_UPDATE:
+        myOnlyUpdateButton.setSelected(true);
+        break;
+      case MERGE:
+        myMergeRadioButton.setSelected(true);
+        break;
+      case REBASE:
+        myRebaseRadioButton.setSelected(true);
+        break;
+      default:
+        assert false : "Unknown value of update type: " + updateType;
+    }
     myCommitAfterMergeCheckBox.setSelected(updateConfiguration.shouldCommitAfterMerge());
-    myRebaseRadioButton.setSelected(updateConfiguration.shouldRebase());
   }
 }
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java b/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java
index 649225d..b24b59d 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java
@@ -707,6 +707,6 @@
       userName = authorString.trim();
       email = "";
     }
-    return Couple.newOne(userName, email);
+    return Couple.of(userName, email);
   }
 }
diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMockVcsHelper.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMockVcsHelper.java
index d646170..6e2414f 100644
--- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMockVcsHelper.java
+++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgMockVcsHelper.java
@@ -124,14 +124,14 @@
   }
 
   @Override
-  public void showFileHistory(VcsHistoryProvider vcsHistoryProvider, FilePath path, AbstractVcs vcs, RepositoryLocation repositoryLocation) {
+  public void showFileHistory(VcsHistoryProvider vcsHistoryProvider, FilePath path, AbstractVcs vcs, String repositoryPath) {
   }
 
   @Override
   public void showFileHistory(VcsHistoryProvider vcsHistoryProvider,
                               AnnotationProvider annotationProvider,
                               FilePath path,
-                              RepositoryLocation repositoryLocation,
+                              String repositoryPath,
                               AbstractVcs vcs) {
   }
 
diff --git a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUpdateTest.java b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUpdateTest.java
index c0c4241..6a8b50b 100644
--- a/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUpdateTest.java
+++ b/plugins/hg4idea/testSrc/org/zmlx/hg4idea/test/HgUpdateTest.java
@@ -26,6 +26,7 @@
 import org.zmlx.hg4idea.HgRevisionNumber;
 import org.zmlx.hg4idea.command.*;
 import org.zmlx.hg4idea.provider.update.HgRegularUpdater;
+import org.zmlx.hg4idea.provider.update.HgUpdateConfigurationSettings;
 import org.zmlx.hg4idea.util.HgUtil;
 
 import java.io.File;
@@ -257,7 +258,7 @@
   }
 
   private List<VcsException> updateThroughPlugin() throws VcsException {
-    HgRegularUpdater updater = new HgRegularUpdater(myProject, projectRepoVirtualFile, new org.zmlx.hg4idea.provider.update.HgUpdater.UpdateConfiguration());
+    HgRegularUpdater updater = new HgRegularUpdater(myProject, projectRepoVirtualFile, new HgUpdateConfigurationSettings());
     UpdatedFiles updatedFiles = UpdatedFiles.create();
     EmptyProgressIndicator indicator = new EmptyProgressIndicator();
     ArrayList<VcsException> nonFatalWarnings = new ArrayList<VcsException>();
diff --git a/plugins/javaFX/FxBuilderEmbedder/lib/embedder.jar b/plugins/javaFX/FxBuilderEmbedder/lib/embedder.jar
index e853e97..b18abec 100644
--- a/plugins/javaFX/FxBuilderEmbedder/lib/embedder.jar
+++ b/plugins/javaFX/FxBuilderEmbedder/lib/embedder.jar
Binary files differ
diff --git a/plugins/javaFX/FxBuilderEmbedder/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderKitWrapper.java b/plugins/javaFX/FxBuilderEmbedder/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderKitWrapper.java
index 592401c..96f6c1b 100644
--- a/plugins/javaFX/FxBuilderEmbedder/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderKitWrapper.java
+++ b/plugins/javaFX/FxBuilderEmbedder/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderKitWrapper.java
@@ -15,12 +15,6 @@
  */
 public class SceneBuilderKitWrapper {
   public static SceneBuilder create(URL url, EditorCallback editorCallback) throws Exception {
-    // JavaFX -> Swing drag&drop fix
-    Field identifier = DataFormat.class.getDeclaredField("identifier");
-    identifier.setAccessible(true);
-    identifier.set(AbstractDragSource.INTERNAL_DATA_FORMAT, Collections
-      .unmodifiableSet(new HashSet<String>(Arrays.asList("application/scene.builder.internal"))));
-
     // JavaFX class loading fix
     FXMLLoader.setDefaultClassLoader(SceneBuilderKitWrapper.class.getClassLoader());
 
diff --git a/plugins/javaFX/common-javaFX-plugin/src/org/jetbrains/plugins/javaFX/packaging/JavaFxAntGenerator.java b/plugins/javaFX/common-javaFX-plugin/src/org/jetbrains/plugins/javaFX/packaging/JavaFxAntGenerator.java
index e6d546f..44fa3c4 100644
--- a/plugins/javaFX/common-javaFX-plugin/src/org/jetbrains/plugins/javaFX/packaging/JavaFxAntGenerator.java
+++ b/plugins/javaFX/common-javaFX-plugin/src/org/jetbrains/plugins/javaFX/packaging/JavaFxAntGenerator.java
@@ -47,41 +47,41 @@
     if (!StringUtil.isEmptyOrSpaces(preloaderJar) && !StringUtil.isEmptyOrSpaces(preloaderClass)) {
       preloaderFiles = artifactFileNameWithoutExtension + "_preloader_files";
       topLevelTagsCollector.add(new SimpleTag("fx:fileset",
-                                              Couple.newOne("id", preloaderFiles),
-                                              Couple.newOne("requiredFor", "preloader"),
-                                              Couple.newOne("dir", tempDirPath),
-                                              Couple.newOne("includes", preloaderJar)));
+                                              Couple.of("id", preloaderFiles),
+                                              Couple.of("requiredFor", "preloader"),
+                                              Couple.of("dir", tempDirPath),
+                                              Couple.of("includes", preloaderJar)));
 
       allButPreloader = "all_but_preloader_" + artifactFileNameWithoutExtension;
-      topLevelTagsCollector.add(new SimpleTag("fx:fileset", Couple.newOne("id", allButPreloader),
-                                              Couple.newOne("dir", tempDirPath),
-                                              Couple.newOne("excludes", preloaderJar),
-                                              Couple.newOne("includes", "**/*.jar")));
+      topLevelTagsCollector.add(new SimpleTag("fx:fileset", Couple.of("id", allButPreloader),
+                                              Couple.of("dir", tempDirPath),
+                                              Couple.of("excludes", preloaderJar),
+                                              Couple.of("includes", "**/*.jar")));
     }
 
     final String allButSelf = "all_but_" + artifactFileNameWithoutExtension;
-    final SimpleTag allButSelfAndPreloader = new SimpleTag("fx:fileset", Couple.newOne("id", allButSelf),
-                                                           Couple.newOne("dir", tempDirPath),
-                                                           Couple.newOne("includes", "**/*.jar"));
-    allButSelfAndPreloader.add(new SimpleTag("exclude", Couple.newOne("name", artifactFileName)));
+    final SimpleTag allButSelfAndPreloader = new SimpleTag("fx:fileset", Couple.of("id", allButSelf),
+                                                           Couple.of("dir", tempDirPath),
+                                                           Couple.of("includes", "**/*.jar"));
+    allButSelfAndPreloader.add(new SimpleTag("exclude", Couple.of("name", artifactFileName)));
     if (preloaderJar != null) {
-      allButSelfAndPreloader.add(new SimpleTag("exclude", Couple.newOne("name", preloaderJar)));
+      allButSelfAndPreloader.add(new SimpleTag("exclude", Couple.of("name", preloaderJar)));
     }
     topLevelTagsCollector.add(allButSelfAndPreloader);
 
     final String all = "all_" + artifactFileNameWithoutExtension;
-    final SimpleTag allIncluded = new SimpleTag("fx:fileset", Couple.newOne("id", all),
-                                                Couple.newOne("dir", tempDirPath),
-                                                Couple.newOne("includes", "**/*.jar"));
+    final SimpleTag allIncluded = new SimpleTag("fx:fileset", Couple.of("id", all),
+                                                Couple.of("dir", tempDirPath),
+                                                Couple.of("includes", "**/*.jar"));
     topLevelTagsCollector.add(allIncluded);
 
     //register application
     final String appId = artifactFileNameWithoutExtension + "_id";
-    final SimpleTag applicationTag = new SimpleTag("fx:application", Couple.newOne("id", appId),
-                                                   Couple.newOne("name", artifactName),
-                                                   Couple.newOne("mainClass", packager.getAppClass()));
+    final SimpleTag applicationTag = new SimpleTag("fx:application", Couple.of("id", appId),
+                                                   Couple.of("name", artifactName),
+                                                   Couple.of("mainClass", packager.getAppClass()));
     if (preloaderFiles != null) {
-      applicationTag.addAttribute(Couple.newOne("preloaderClass", preloaderClass));
+      applicationTag.addAttribute(Couple.of("preloaderClass", preloaderClass));
     }
 
     appendValuesFromPropertiesFile(applicationTag, packager.getHtmlParamFile(), "fx:htmlParam", false);
@@ -91,19 +91,19 @@
     topLevelTagsCollector.add(applicationTag);
 
     if (packager.convertCss2Bin()) {
-      final SimpleTag css2binTag = new SimpleTag("fx:csstobin", Couple.newOne("outdir", tempDirPath));
-      css2binTag.add(new SimpleTag("fileset", Couple.newOne("dir", tempDirPath), Couple.newOne("includes", "**/*.css")));
+      final SimpleTag css2binTag = new SimpleTag("fx:csstobin", Couple.of("outdir", tempDirPath));
+      css2binTag.add(new SimpleTag("fileset", Couple.of("dir", tempDirPath), Couple.of("includes", "**/*.css")));
       topLevelTagsCollector.add(css2binTag);
     }
 
     //create jar task
     final SimpleTag createJarTag = new SimpleTag("fx:jar",
-                                                 Couple.newOne("destfile", tempDirPath + File.separator + artifactFileName));
-    createJarTag.add(new SimpleTag("fx:application", Couple.newOne("refid", appId)));
+                                                 Couple.of("destfile", tempDirPath + File.separator + artifactFileName));
+    createJarTag.add(new SimpleTag("fx:application", Couple.of("refid", appId)));
 
     final List<Pair> fileset2Jar = new ArrayList<Pair>();
-    fileset2Jar.add(Couple.newOne("dir", tempDirPath));
-    fileset2Jar.add(Couple.newOne("excludes", "**/*.jar"));
+    fileset2Jar.add(Couple.of("dir", tempDirPath));
+    fileset2Jar.add(Couple.of("excludes", "**/*.jar"));
     createJarTag.add(new SimpleTag("fileset", fileset2Jar.toArray(new Pair[fileset2Jar.size()])));
 
     createJarTag.add(createResourcesTag(preloaderFiles, false, allButPreloader, allButSelf, all));
@@ -113,8 +113,8 @@
       final SimpleTag manifestTag = new SimpleTag("manifest");
       for (JavaFxManifestAttribute pair : manifestAttributes) {
         manifestTag.add(new SimpleTag("attribute",
-                                      Couple.newOne("name", pair.getName()),
-                                      Couple.newOne("value", pair.getValue())));
+                                      Couple.of("name", pair.getName()),
+                                      Couple.of("value", pair.getValue())));
       }
       createJarTag.add(manifestTag);
     }
@@ -123,21 +123,21 @@
 
     //deploy task
     final SimpleTag deployTag = new SimpleTag("fx:deploy",
-                                              Couple.newOne("width", packager.getWidth()),
-                                              Couple.newOne("height", packager.getHeight()),
-                                              Couple.newOne("updatemode", packager.getUpdateMode()),
-                                              Couple.newOne("outdir", tempDirPath + File.separator + "deploy"),
-                                              Couple.newOne("outfile", artifactFileNameWithoutExtension));
+                                              Couple.of("width", packager.getWidth()),
+                                              Couple.of("height", packager.getHeight()),
+                                              Couple.of("updatemode", packager.getUpdateMode()),
+                                              Couple.of("outdir", tempDirPath + File.separator + "deploy"),
+                                              Couple.of("outfile", artifactFileNameWithoutExtension));
     final JavaFxPackagerConstants.NativeBundles bundle = packager.getNativeBundle();
     if (bundle != JavaFxPackagerConstants.NativeBundles.none) {
-      deployTag.addAttribute(Couple.newOne("nativeBundles", bundle.name()));
+      deployTag.addAttribute(Couple.of("nativeBundles", bundle.name()));
     }
 
     if (packager.isEnabledSigning()) {
-      deployTag.add(new SimpleTag("fx:permissions", Couple.newOne("elevated", "true")));
+      deployTag.add(new SimpleTag("fx:permissions", Couple.of("elevated", "true")));
     }
 
-    deployTag.add(new SimpleTag("fx:application", Couple.newOne("refid", appId)));
+    deployTag.add(new SimpleTag("fx:application", Couple.of("refid", appId)));
 
     final List<Pair> infoPairs = new ArrayList<Pair>();
     appendIfNotEmpty(infoPairs, "title", packager.getTitle());
@@ -158,17 +158,17 @@
                                               String all) {
     final SimpleTag resourcesTag = new SimpleTag("fx:resources");
     if (preloaderFiles != null) {
-      resourcesTag.add(new SimpleTag("fx:fileset", Couple.newOne("refid", preloaderFiles)));
-      resourcesTag.add(new SimpleTag("fx:fileset", Couple.newOne("refid", includeSelf ? allButPreloader : allButSelf)));
+      resourcesTag.add(new SimpleTag("fx:fileset", Couple.of("refid", preloaderFiles)));
+      resourcesTag.add(new SimpleTag("fx:fileset", Couple.of("refid", includeSelf ? allButPreloader : allButSelf)));
     } else {
-      resourcesTag.add(new SimpleTag("fx:fileset", Couple.newOne("refid", includeSelf ? all : allButSelf)));
+      resourcesTag.add(new SimpleTag("fx:fileset", Couple.of("refid", includeSelf ? all : allButSelf)));
     }
     return resourcesTag;
   }
 
   private static void appendIfNotEmpty(final List<Pair> pairs, final String propertyName, final String propValue) {
     if (!StringUtil.isEmptyOrSpaces(propValue)) {
-      pairs.add(Couple.newOne(propertyName, propValue));
+      pairs.add(Couple.of(propertyName, propValue));
     }
   }
 
@@ -187,7 +187,7 @@
             final String propValue = properties.getProperty(propName);
             if (!StringUtil.isEmptyOrSpaces(propValue)) {
               applicationTag
-                .add(new SimpleTag(paramTagName, Couple.newOne("name", propName), Couple.newOne("value", propValue)));
+                .add(new SimpleTag(paramTagName, Couple.of("name", propName), Couple.of("value", propValue)));
             }
             else if (allowNoNamed) {
               applicationTag.add(new SimpleTag("fx:argument", propName) {
diff --git a/plugins/javaFX/resources/inspectionDescriptions/JavaFxDefaultTag.html b/plugins/javaFX/resources/inspectionDescriptions/JavaFxDefaultTag.html
index 6fe6739..99bea62 100644
--- a/plugins/javaFX/resources/inspectionDescriptions/JavaFxDefaultTag.html
+++ b/plugins/javaFX/resources/inspectionDescriptions/JavaFxDefaultTag.html
@@ -3,6 +3,5 @@
 Reports usages of tags in .fxml which could be ommitted as these tags correspond to a class property which is declared in @DefaultProperty class annotation.
 <!-- tooltip end -->
 <p>
-  <small>New in 12.1</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/packaging/ant/JavaFxChunkBuildExtension.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/packaging/ant/JavaFxChunkBuildExtension.java
index 15672c6..6228c8c 100644
--- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/packaging/ant/JavaFxChunkBuildExtension.java
+++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/packaging/ant/JavaFxChunkBuildExtension.java
@@ -82,12 +82,12 @@
     }
     if (javaSdk != null) {
       final Tag taskdef = new Tag("taskdef",
-                                  Couple.newOne("resource", "com/sun/javafx/tools/ant/antlib.xml"),
-                                  Couple.newOne("uri", "javafx:com.sun.javafx.tools.ant"),
-                                  Couple.newOne("classpath",
-                                                BuildProperties
-                                                  .propertyRef(BuildProperties.getJdkHomeProperty(javaSdk.getName())) +
-                                                "/lib/ant-javafx.jar"));
+                                  Couple.of("resource", "com/sun/javafx/tools/ant/antlib.xml"),
+                                  Couple.of("uri", "javafx:com.sun.javafx.tools.ant"),
+                                  Couple.of("classpath",
+                                            BuildProperties
+                                              .propertyRef(BuildProperties.getJdkHomeProperty(javaSdk.getName())) +
+                                            "/lib/ant-javafx.jar"));
       generator.add(taskdef);
     }
   }
@@ -175,22 +175,22 @@
       final Pair[] keysDescriptions = createKeysDescriptions(artifactName);
       if (selfSigning) {
         generator.add(new Tag("genkey", 
-                              ArrayUtil.prepend(Couple.newOne("dname", BuildProperties
+                              ArrayUtil.prepend(Couple.of("dname", BuildProperties
                                                   .propertyRef(artifactBasedProperty(ARTIFACT_VENDOR_SIGN_PROPERTY, artifactName))),
                                                 keysDescriptions)));
       }
       
       final Tag signjar = new Tag("signjar", keysDescriptions);
-      final Tag fileset = new Tag("fileset", Couple.newOne("dir", tempDirPath + "/deploy"));
-      fileset.add(new Tag("include", Couple.newOne("name", "*.jar")));
+      final Tag fileset = new Tag("fileset", Couple.of("dir", tempDirPath + "/deploy"));
+      fileset.add(new Tag("include", Couple.of("name", "*.jar")));
       signjar.add(fileset);
       generator.add(signjar);
     }
 
     final DirectoryAntCopyInstructionCreator creator = new DirectoryAntCopyInstructionCreator(BuildProperties.propertyRef(context.getConfiguredArtifactOutputProperty(artifact)));
     generator.add(creator.createDirectoryContentCopyInstruction(tempDirPath + "/deploy"));
-    final Tag deleteTag = new Tag("delete", Couple.newOne("includeemptydirs", "true"));
-    deleteTag.add(new Tag("fileset", Couple.newOne("dir", tempDirPath)));
+    final Tag deleteTag = new Tag("delete", Couple.of("includeemptydirs", "true"));
+    deleteTag.add(new Tag("fileset", Couple.of("dir", tempDirPath)));
     generator.add(deleteTag);
   }
 
@@ -219,17 +219,17 @@
 
   private static Pair[] createKeysDescriptions(String artifactName) {
     return new Pair[]{
-      Couple.newOne("alias", BuildProperties.propertyRef(artifactBasedProperty(ARTIFACT_ALIAS_SIGN_PROPERTY, artifactName))),
-      Couple.newOne("keystore", BuildProperties.propertyRef(artifactBasedProperty(ARTIFACT_KEYSTORE_SIGN_PROPERTY, artifactName))),
-      Couple.newOne("storepass", BuildProperties.propertyRef(artifactBasedProperty(ARTIFACT_STOREPASS_SIGN_PROPERTY, artifactName))),
-      Couple.newOne("keypass", BuildProperties.propertyRef(artifactBasedProperty(ARTIFACTKEYPASS_SIGN_PROPERTY, artifactName)))};
+      Couple.of("alias", BuildProperties.propertyRef(artifactBasedProperty(ARTIFACT_ALIAS_SIGN_PROPERTY, artifactName))),
+      Couple.of("keystore", BuildProperties.propertyRef(artifactBasedProperty(ARTIFACT_KEYSTORE_SIGN_PROPERTY, artifactName))),
+      Couple.of("storepass", BuildProperties.propertyRef(artifactBasedProperty(ARTIFACT_STOREPASS_SIGN_PROPERTY, artifactName))),
+      Couple.of("keypass", BuildProperties.propertyRef(artifactBasedProperty(ARTIFACTKEYPASS_SIGN_PROPERTY, artifactName)))};
   }
 
   @Nullable
   @Override
   public Couple<String> getArtifactXmlNs(ArtifactType artifactType) {
     if (artifactType instanceof JavaFxApplicationArtifactType) {
-      return Couple.newOne("xmlns:fx", "javafx:com.sun.javafx.tools.ant");
+      return Couple.of("xmlns:fx", "javafx:com.sun.javafx.tools.ant");
     }
     return null;
   }
diff --git a/plugins/junit/src/com/intellij/execution/junit/JUnit3Framework.java b/plugins/junit/src/com/intellij/execution/junit/JUnit3Framework.java
index bfad1d0..bc8e4a8 100644
--- a/plugins/junit/src/com/intellij/execution/junit/JUnit3Framework.java
+++ b/plugins/junit/src/com/intellij/execution/junit/JUnit3Framework.java
@@ -43,6 +43,11 @@
     return new FileTemplateDescriptor("JUnit3 Test Class.java");
   }
 
+  @Override
+  public boolean isSingleConfig() {
+    return true;
+  }
+
   @NotNull
   @Override
   public Icon getIcon() {
diff --git a/plugins/junit/src/com/intellij/execution/junit/PatternConfigurationProducer.java b/plugins/junit/src/com/intellij/execution/junit/PatternConfigurationProducer.java
index ef81f52..b0f8424 100644
--- a/plugins/junit/src/com/intellij/execution/junit/PatternConfigurationProducer.java
+++ b/plugins/junit/src/com/intellij/execution/junit/PatternConfigurationProducer.java
@@ -22,16 +22,23 @@
 import com.intellij.execution.configurations.ModuleBasedConfiguration;
 import com.intellij.execution.junit2.info.MethodLocation;
 import com.intellij.execution.testframework.AbstractTestProxy;
+import com.intellij.execution.testframework.TestTreeView;
+import com.intellij.execution.testframework.TestsUIUtil;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.actionSystem.LangDataKeys;
+import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.Condition;
 import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.*;
+import com.intellij.util.ui.Tree;
 
+import javax.swing.*;
+import javax.swing.tree.TreePath;
+import java.awt.*;
 import java.util.ArrayList;
 import java.util.LinkedHashSet;
 import java.util.List;
@@ -98,7 +105,7 @@
   }
 
   public static boolean isMultipleElementsSelected(ConfigurationContext context) {
-    if (AbstractTestProxy.DATA_KEY.getData(context.getDataContext()) != null) return false;
+    if (TestsUIUtil.isMultipleSelectionImpossible(context.getDataContext())) return false;
     final LinkedHashSet<String> classes = new LinkedHashSet<String>();
     final PsiElement[] elements = collectPatternElements(context, classes);
     if (elements != null && collectTestMembers(elements, false).size() > 1) {
diff --git a/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestResultsSender.java b/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestResultsSender.java
index a3a9cc9..35de584 100644
--- a/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestResultsSender.java
+++ b/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestResultsSender.java
@@ -136,6 +136,9 @@
       if (notification == null) {
         notification = createExceptionNotification(assertion, message, "\nExpected: \"(.*)\"\n\\s*but: was \"(.*)\"");
       }
+      if (notification == null) {
+        notification = createExceptionNotification(assertion, message, "\\s*Expected: (.*)\\s*but: was (.*)");
+      }
       if (notification != null) {
         return notification;
       }
diff --git a/plugins/maven/lib/plexus-archiver-2.4.4.jar b/plugins/maven/lib/plexus-archiver-2.4.4.jar
new file mode 100644
index 0000000..1a73adb
--- /dev/null
+++ b/plugins/maven/lib/plexus-archiver-2.4.4.jar
Binary files differ
diff --git a/plugins/maven/maven.iml b/plugins/maven/maven.iml
index 9afe514..231a57e 100644
--- a/plugins/maven/maven.iml
+++ b/plugins/maven/maven.iml
@@ -63,6 +63,15 @@
     <orderEntry type="module" module-name="spellchecker" />
     <orderEntry type="module" module-name="vcs-api" />
     <orderEntry type="module" module-name="properties-psi-api" />
+    <orderEntry type="module-library">
+      <library>
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/plexus-archiver-2.4.4.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
   </component>
   <component name="copyright">
     <Base>
diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/compiler/MavenResourceCompiler.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/compiler/MavenResourceCompiler.java
deleted file mode 100644
index a3ce473..0000000
--- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/compiler/MavenResourceCompiler.java
+++ /dev/null
@@ -1,605 +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 org.jetbrains.idea.maven.compiler;
-
-import com.intellij.compiler.CompilerConfigurationImpl;
-import com.intellij.compiler.CompilerIOUtil;
-import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.openapi.application.AccessToken;
-import com.intellij.openapi.application.ReadAction;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.progress.ProgressIndicator;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.ProjectFileIndex;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.util.Key;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.*;
-import com.intellij.testFramework.LightVirtualFile;
-import com.intellij.util.containers.ContainerUtil;
-import gnu.trove.THashMap;
-import gnu.trove.THashSet;
-import org.jdom.Element;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.idea.maven.dom.MavenPropertyResolver;
-import org.jetbrains.idea.maven.dom.references.MavenPropertyPsiReference;
-import org.jetbrains.idea.maven.model.MavenResource;
-import org.jetbrains.idea.maven.project.MavenProject;
-import org.jetbrains.idea.maven.project.MavenProjectsManager;
-import org.jetbrains.idea.maven.utils.MavenJDOMUtil;
-import org.jetbrains.idea.maven.utils.MavenLog;
-import org.jetbrains.idea.maven.utils.MavenUtil;
-
-import java.io.*;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.regex.Pattern;
-
-public class MavenResourceCompiler implements ClassPostProcessingCompiler {
-  private static final Key<List<String>> FILES_TO_DELETE_KEY = Key.create(MavenResourceCompiler.class.getSimpleName() + ".FILES_TO_DELETE");
-
-  // See org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering#defaultNonFilteredFileExtensions
-  private static final Set<String> DEFAULT_NON_FILTERED_EXTENSIONS = ContainerUtil.newHashSet("jpg", "jpeg", "gif", "bmp", "png");
-
-  private Map<String, Set<String>> myOutputItemsCache = new THashMap<String, Set<String>>();
-
-  public MavenResourceCompiler(Project project) {
-    loadCache(project);
-  }
-
-  private void loadCache(final Project project) {
-    File file = getCacheFile(project);
-    if (!file.exists()) return;
-
-    try {
-      DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
-      try {
-        if (in.readInt() != CompilerConfigurationImpl.DEPENDENCY_FORMAT_VERSION) return;
-        int modulesSize = in.readInt();
-        Map<String, Set<String>> temp = new THashMap<String, Set<String>>();
-        while (modulesSize-- > 0) {
-          String module = CompilerIOUtil.readString(in);
-          int pathsSize = in.readInt();
-          Set<String> paths = createPathsSet();
-          while (pathsSize-- > 0) {
-            paths.add(CompilerIOUtil.readString(in));
-          }
-          temp.put(module, paths);
-        }
-        myOutputItemsCache = temp;
-      }
-      finally {
-        in.close();
-      }
-    }
-    catch (IOException e) {
-      MavenLog.LOG.warn(e);
-    }
-  }
-
-  private static Set<String> createPathsSet() {
-    return new THashSet<String>(FileUtil.PATH_HASHING_STRATEGY);
-  }
-
-  private void saveCache(final Project project) {
-    File file = getCacheFile(project);
-    file.getParentFile().mkdirs();
-    try {
-      DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
-      try {
-        out.writeInt(CompilerConfigurationImpl.DEPENDENCY_FORMAT_VERSION);
-        out.writeInt(myOutputItemsCache.size());
-        for (Map.Entry<String, Set<String>> eachEntry : myOutputItemsCache.entrySet()) {
-          String module = eachEntry.getKey();
-          Set<String> paths = eachEntry.getValue();
-
-          CompilerIOUtil.writeString(module, out);
-          out.writeInt(paths.size());
-          for (String eachPath : paths) {
-            CompilerIOUtil.writeString(eachPath, out);
-          }
-        }
-      }
-      finally {
-        out.close();
-      }
-    }
-    catch (IOException e) {
-      MavenLog.LOG.error(e);
-    }
-  }
-
-  private static File getCacheFile(final Project project) {
-    return new File(CompilerPaths.getCompilerSystemDirectory(project), "maven_compiler_caches.dat");
-  }
-
-  @Override
-  public boolean validateConfiguration(CompileScope scope) {
-    return true;
-  }
-
-  @Override
-  @NotNull
-  public ProcessingItem[] getProcessingItems(final CompileContext context) {
-    final Project project = context.getProject();
-    final MavenProjectsManager mavenProjectManager = MavenProjectsManager.getInstance(project);
-    if (!mavenProjectManager.isMavenizedProject()) return ProcessingItem.EMPTY_ARRAY;
-
-    List<ProcessingItem> allItemsToProcess = new ArrayList<ProcessingItem>();
-    List<String> filesToDelete = new ArrayList<String>();
-
-    Date timestamp = new Date();
-
-    AccessToken accessToken = ReadAction.start();
-    try {
-      for (Module eachModule : context.getCompileScope().getAffectedModules()) {
-        MavenProject mavenProject = mavenProjectManager.findProject(eachModule);
-        if (mavenProject == null) continue;
-
-        Properties properties = loadPropertiesAndFilters(context, mavenProject);
-
-        long propertiesHashCode = calculateHashCode(mavenProject, properties); // hash code MUST NOT contain maven.build.timestamp property!
-
-        String timestampFormat = properties.getProperty("maven.build.timestamp.format");
-        if (timestampFormat == null) {
-          timestampFormat = "yyyyMMdd-HHmm"; // See ModelInterpolator.DEFAULT_BUILD_TIMESTAMP_FORMAT
-        }
-
-        String timestampString = new SimpleDateFormat(timestampFormat).format(timestamp);
-        properties.setProperty(MavenPropertyPsiReference.TIMESTAMP_PROP, timestampString);
-
-        Set<String> nonFilteredExtensions = collectNonFilteredExtensions(mavenProject);
-        String escapeString = MavenJDOMUtil.findChildValueByPath(mavenProject.getPluginConfiguration("org.apache.maven.plugins",
-                                                                                                     "maven-resources-plugin"),
-                                                                 "escapeString", null);
-
-        List<MyProcessingItem> moduleItemsToProcess = new ArrayList<MyProcessingItem>();
-        collectProcessingItems(eachModule, mavenProject, context, properties, propertiesHashCode,
-                               nonFilteredExtensions, escapeString, false, moduleItemsToProcess);
-        collectProcessingItems(eachModule, mavenProject, context, properties, propertiesHashCode,
-                               nonFilteredExtensions, escapeString, true, moduleItemsToProcess);
-        collectItemsToDelete(eachModule, moduleItemsToProcess, filesToDelete);
-        allItemsToProcess.addAll(moduleItemsToProcess);
-      }
-
-      if (!filesToDelete.isEmpty()) {
-        allItemsToProcess.add(new FakeProcessingItem());
-      }
-      context.putUserData(FILES_TO_DELETE_KEY, filesToDelete);
-
-      removeObsoleteModulesFromCache(project);
-      saveCache(project);
-    }
-    finally {
-      accessToken.finish();
-    }
-
-    return allItemsToProcess.toArray(new ProcessingItem[allItemsToProcess.size()]);
-  }
-
-  private static Set<String> collectNonFilteredExtensions(MavenProject mavenProject) {
-    Element config = mavenProject.getPluginConfiguration("org.apache.maven.plugins", "maven-resources-plugin");
-    if (config == null) return DEFAULT_NON_FILTERED_EXTENSIONS;
-
-    List<String> customNonFilteredExtensions = MavenJDOMUtil.findChildrenValuesByPath(config, "nonFilteredFileExtensions", "nonFilteredFileExtension");
-    if (customNonFilteredExtensions.isEmpty()) return DEFAULT_NON_FILTERED_EXTENSIONS;
-
-    Set<String> result = new HashSet<String>();
-    result.addAll(DEFAULT_NON_FILTERED_EXTENSIONS);
-    result.addAll(customNonFilteredExtensions);
-
-    return result;
-  }
-
-  private static long calculateHashCode(MavenProject project, Properties properties) {
-    Map<String, String> sorted = new TreeMap<String, String>();
-    for (Map.Entry<Object, Object> each : properties.entrySet()) {
-      sorted.put(each.getKey().toString(), each.getValue().toString());
-    }
-    return project.getLastReadStamp() + 31 * sorted.hashCode();
-  }
-
-  private static Properties loadPropertiesAndFilters(CompileContext context, MavenProject mavenProject) {
-    Properties properties = new Properties();
-
-    for (String each : mavenProject.getFilterPropertiesFiles()) {
-      try {
-        FileInputStream in = new FileInputStream(each);
-        try {
-          properties.load(in);
-        }
-        finally {
-          in.close();
-        }
-      }
-      catch (IOException e) {
-        String url = VfsUtil.pathToUrl(mavenProject.getFile().getPath());
-        context.addMessage(CompilerMessageCategory.WARNING, "Maven: Cannot read the filter. " + e.getMessage(), url, -1, -1);
-      }
-    }
-
-    properties.putAll(mavenProject.getProperties());
-
-    return properties;
-  }
-
-  private static void collectProcessingItems(Module module,
-                                             MavenProject mavenProject,
-                                             CompileContext context,
-                                             Properties properties,
-                                             long propertiesHashCode,
-                                             Set<String> nonFilteredExtensions,
-                                             @Nullable String escapeString,
-                                             boolean tests,
-                                             List<MyProcessingItem> result) {
-    String outputDir = CompilerPaths.getModuleOutputPath(module, tests);
-    if (outputDir == null) {
-      context.addMessage(CompilerMessageCategory.ERROR, "Maven: Module '" + module.getName() + "'output is not specified", null, -1, -1);
-      return;
-    }
-
-    List<MavenResource> resources = tests ? mavenProject.getTestResources() : mavenProject.getResources();
-
-    for (MavenResource each : resources) {
-      VirtualFile dir = LocalFileSystem.getInstance().findFileByPath(each.getDirectory());
-      if (dir == null) continue;
-
-      List<Pattern> includes = collectPatterns(each.getIncludes(), "**/*");
-      List<Pattern> excludes = collectPatterns(each.getExcludes(), null);
-      String targetPath = each.getTargetPath();
-      String resourceOutputDir = StringUtil.isEmptyOrSpaces(targetPath)
-                                 ? outputDir
-                                 : (FileUtil.isAbsolute(targetPath) ? targetPath : outputDir + "/" + targetPath);
-
-      collectProcessingItems(module,
-                             dir,
-                             dir,
-                             resourceOutputDir,
-                             includes,
-                             excludes,
-                             each.isFiltered(),
-                             properties,
-                             propertiesHashCode,
-                             nonFilteredExtensions,
-                             escapeString,
-                             result,
-                             context.getProgressIndicator());
-    }
-  }
-
-  public static List<Pattern> collectPatterns(@Nullable List<String> values, @Nullable String defaultValue) {
-    List<Pattern> result = new ArrayList<Pattern>();
-    if (values == null || values.isEmpty()) {
-      if (defaultValue == null) return Collections.emptyList();
-      return MavenUtil.collectPattern(defaultValue, result);
-    }
-    for (String each : values) {
-      MavenUtil.collectPattern(each, result);
-    }
-    return result;
-  }
-
-  private static void collectProcessingItems(final Module module,
-                                             final VirtualFile sourceRoot,
-                                             VirtualFile currentDir,
-                                             final String outputDir,
-                                             final List<Pattern> includes,
-                                             final List<Pattern> excludes,
-                                             final boolean isSourceRootFiltered,
-                                             final Properties properties,
-                                             final long propertiesHashCode,
-                                             final Set<String> nonFilteredExtensions,
-                                             @Nullable final String escapeString,
-                                             final List<MyProcessingItem> result,
-                                             final ProgressIndicator indicator) {
-    VfsUtilCore.visitChildrenRecursively(currentDir, new VirtualFileVisitor() {
-      @Override
-      public boolean visitFile(@NotNull VirtualFile file) {
-        indicator.checkCanceled();
-
-        if (!file.isDirectory()) {
-          String relPath = VfsUtilCore.getRelativePath(file, sourceRoot, '/');
-          if (relPath == null) {
-            MavenLog.LOG.error("Cannot calculate relate path for file: " + file + " in root: " + sourceRoot);
-            return true;
-          }
-
-          ProjectFileIndex fileIndex = ProjectRootManager.getInstance(module.getProject()).getFileIndex();
-          if (fileIndex.isIgnored(file)) return true;
-          if (!MavenUtil.isIncluded(relPath, includes, excludes)) return true;
-
-          String outputPath = outputDir + "/" + relPath;
-          long outputFileTimestamp = -1;
-          File outputFile = new File(outputPath);
-          if (outputFile.exists()) {
-            outputFileTimestamp = outputFile.lastModified();
-          }
-          boolean isFiltered = isSourceRootFiltered && !nonFilteredExtensions.contains(file.getExtension());
-          result.add(new MyProcessingItem(module,
-                                          file,
-                                          outputPath,
-                                          outputFileTimestamp,
-                                          isFiltered,
-                                          properties,
-                                          propertiesHashCode,
-                                          escapeString));
-        }
-
-        return true;
-      }
-    });
-  }
-
-  private void collectItemsToDelete(Module module, List<MyProcessingItem> processingItems, List<String> result) {
-    Set<String> currentPaths = createPathsSet();
-    for (MyProcessingItem each : processingItems) {
-      currentPaths.add(each.getOutputPath());
-    }
-
-    Set<String> cachedPaths = myOutputItemsCache.put(module.getName(), currentPaths);
-    if (cachedPaths != null) {
-      for (Set<String> set : myOutputItemsCache.values()) {
-        cachedPaths.removeAll(set);
-      }
-
-      result.addAll(cachedPaths);
-    }
-  }
-
-  private void removeObsoleteModulesFromCache(final Project project) {
-    Set<String> existingModules = new THashSet<String>();
-    for (Module each : ModuleManager.getInstance(project).getModules()) {
-      existingModules.add(each.getName());
-    }
-
-    for (String each : new THashSet<String>(myOutputItemsCache.keySet())) {
-      if (!existingModules.contains(each)) {
-        myOutputItemsCache.remove(each);
-      }
-    }
-  }
-
-  @Override
-  public ProcessingItem[] process(final CompileContext context, ProcessingItem[] items) {
-    context.getProgressIndicator().setText("Processing Maven resources...");
-
-    List<ProcessingItem> result = new ArrayList<ProcessingItem>(items.length);
-    List<File> filesToRefresh = new ArrayList<File>(items.length);
-
-    deleteOutdatedFile(context.getUserData(FILES_TO_DELETE_KEY), filesToRefresh);
-
-    for (int i = 0; i < items.length; i++) {
-      if (!(items[i] instanceof MyProcessingItem)) continue;
-
-      context.getProgressIndicator().setFraction(((double)i) / items.length);
-      context.getProgressIndicator().checkCanceled();
-
-      MyProcessingItem eachItem = (MyProcessingItem)items[i];
-      VirtualFile sourceVirtualFile = eachItem.getFile();
-      File sourceFile = new File(sourceVirtualFile.getPath());
-      File outputFile = new File(eachItem.getOutputPath());
-
-      try {
-        outputFile.getParentFile().mkdirs();
-
-        boolean shouldFilter = eachItem.isFiltered();
-        if (shouldFilter && sourceFile.length() > 10 * 1024 * 1024) {
-          context.addMessage(CompilerMessageCategory.WARNING,
-                             "Maven: File is too big to be filtered. Most likely it is a binary file and should be excluded from filtering.",
-                             sourceVirtualFile.getUrl(), -1, -1);
-          shouldFilter = false;
-        }
-
-        if (shouldFilter) {
-          String charset = sourceVirtualFile.getCharset().name();
-          String text = new String(FileUtil.loadFileBytes(sourceFile), charset);
-
-          PrintWriter printWriter = new PrintWriter(outputFile, charset);
-          try {
-            MavenPropertyResolver.doFilterText(eachItem.getModule(),
-                                               text,
-                                               eachItem.getProperties(),
-                                               eachItem.getEscapeString(),
-                                               printWriter);
-          }
-          finally {
-            printWriter.close();
-          }
-        }
-        else {
-          FileUtil.copy(sourceFile, outputFile);
-        }
-
-        eachItem.getValidityState().setOutputFileTimestamp(outputFile.lastModified());
-        result.add(eachItem);
-        filesToRefresh.add(outputFile);
-      }
-      catch (IOException e) {
-        MavenLog.LOG.info(e);
-        context.addMessage(CompilerMessageCategory.ERROR,
-                           "Maven: Cannot process resource file: " + e.getMessage(),
-                           sourceVirtualFile.getUrl(),
-                           -1,
-                           -1);
-      }
-    }
-    CompilerUtil.refreshIOFiles(filesToRefresh);
-    return result.toArray(new ProcessingItem[result.size()]);
-  }
-
-  private static void deleteOutdatedFile(List<String> filesToDelete, List<File> filesToRefresh) {
-    for (String each : filesToDelete) {
-      File file = new File(each);
-      if (FileUtil.delete(file)) {
-        filesToRefresh.add(file);
-      }
-    }
-  }
-
-  @Override
-  @NotNull
-  public String getDescription() {
-    return "Maven Resource Compiler";
-  }
-
-  @Override
-  public ValidityState createValidityState(DataInput in) throws IOException {
-    return MyValididtyState.load(in);
-  }
-
-  private static class MyProcessingItem implements ProcessingItem {
-    private final Module myModule;
-    private final VirtualFile mySourceFile;
-    private final String myOutputPath;
-    private final boolean myFiltered;
-    private final Properties myProperties;
-    private final String myEscapeString;
-    private final MyValididtyState myState;
-
-    public MyProcessingItem(Module module,
-                            VirtualFile sourceFile,
-                            String outputPath,
-                            long outputFileTimestamp,
-                            boolean isFiltered,
-                            Properties properties,
-                            long propertiesHashCode,
-                            @Nullable String escapeString) {
-      myModule = module;
-      mySourceFile = sourceFile;
-      myOutputPath = outputPath;
-      myFiltered = isFiltered;
-      myProperties = properties;
-      myEscapeString = escapeString;
-      myState = new MyValididtyState(sourceFile.getTimeStamp(), outputFileTimestamp, isFiltered, propertiesHashCode, StringUtil.notNullize(escapeString));
-    }
-
-    @Override
-    @NotNull
-    public VirtualFile getFile() {
-      return mySourceFile;
-    }
-
-    public String getOutputPath() {
-      return myOutputPath;
-    }
-
-    public Module getModule() {
-      return myModule;
-    }
-
-    public boolean isFiltered() {
-      return myFiltered;
-    }
-
-    public Properties getProperties() {
-      return myProperties;
-    }
-
-    @Nullable
-    public String getEscapeString() {
-      return myEscapeString;
-    }
-
-    @Override
-    @NotNull
-    public MyValididtyState getValidityState() {
-      return myState;
-    }
-  }
-
-  private static class FakeProcessingItem implements ProcessingItem {
-    private final LightVirtualFile myFile;
-
-    private FakeProcessingItem() {
-      myFile = new LightVirtualFile(this.getClass().getName());
-    }
-
-    @Override
-    @NotNull
-    public VirtualFile getFile() {
-      return myFile;
-    }
-
-    @Override
-    public ValidityState getValidityState() {
-      return null;
-    }
-  }
-
-  private static class MyValididtyState implements ValidityState {
-    private final long mySourceFileTimestamp;
-    private long myOutputFileTimestamp;
-    private final boolean myFiltered;
-    private final long myPropertiesHashCode;
-    @NotNull private final String myEscapeString;
-
-    public static MyValididtyState load(DataInput in) throws IOException {
-      return new MyValididtyState(in.readLong(), in.readLong(), in.readBoolean(), in.readLong(), in.readUTF());
-    }
-
-    public void setOutputFileTimestamp(long outputFileTimestamp) {
-      myOutputFileTimestamp = outputFileTimestamp;
-    }
-
-    private MyValididtyState(long sourceFileTimestamp,
-                             long outputFileTimestamp,
-                             boolean isFiltered,
-                             long propertiesHashCode,
-                             @NotNull String escapeString) {
-      mySourceFileTimestamp = sourceFileTimestamp;
-      myOutputFileTimestamp = outputFileTimestamp;
-      myFiltered = isFiltered;
-      if (isFiltered) {
-        myPropertiesHashCode = propertiesHashCode;
-        myEscapeString = escapeString;
-      }
-      else {
-        myPropertiesHashCode = 0;
-        myEscapeString = "";
-      }
-    }
-
-    @Override
-    public String toString() {
-      return mySourceFileTimestamp + " " + myOutputFileTimestamp + " " + myFiltered + " " + myPropertiesHashCode + " " + myEscapeString;
-    }
-
-    @Override
-    public boolean equalsTo(ValidityState otherState) {
-      if (!(otherState instanceof MyValididtyState)) return false;
-      MyValididtyState that = (MyValididtyState)otherState;
-
-      return mySourceFileTimestamp == that.mySourceFileTimestamp
-             && myOutputFileTimestamp == that.myOutputFileTimestamp
-             && myFiltered == that.myFiltered
-             && myPropertiesHashCode == that.myPropertiesHashCode
-             && myEscapeString.equals(that.myEscapeString);
-    }
-
-    @Override
-    public void save(DataOutput out) throws IOException {
-      out.writeLong(mySourceFileTimestamp);
-      out.writeLong(myOutputFileTimestamp);
-      out.writeBoolean(myFiltered);
-      out.writeLong(myPropertiesHashCode);
-      out.writeUTF(myEscapeString);
-    }
-  }
-}
diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/execution/MavenExternalParameters.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/execution/MavenExternalParameters.java
index 1bcf2ad..8df8926 100644
--- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/execution/MavenExternalParameters.java
+++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/execution/MavenExternalParameters.java
@@ -34,9 +34,11 @@
 import com.intellij.openapi.options.ShowSettingsUtil;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.projectRoots.JavaSdk;
+import com.intellij.openapi.projectRoots.JavaSdkType;
 import com.intellij.openapi.projectRoots.ProjectJdkTable;
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.projectRoots.impl.JavaAwareProjectJdkTableImpl;
+import com.intellij.openapi.roots.ModuleRootManager;
 import com.intellij.openapi.roots.ProjectRootManager;
 import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService;
 import com.intellij.openapi.util.io.FileUtil;
@@ -307,6 +309,13 @@
         if (res != null) {
           return res;
         }
+        Module[] modules = ModuleManager.getInstance(project).getModules();
+        for (Module module : modules) {
+          Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
+          if (sdk != null && sdk.getSdkType() instanceof JavaSdkType) {
+            return sdk;
+          }
+        }
       }
 
       if (project == null) {
diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/ManifestImporter.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/ManifestImporter.java
new file mode 100644
index 0000000..65fb06c
--- /dev/null
+++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/ManifestImporter.java
@@ -0,0 +1,85 @@
+/*
+ * 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 org.jetbrains.idea.maven.importing;
+
+import com.intellij.openapi.extensions.ExtensionPointName;
+import com.intellij.openapi.roots.DependencyScope;
+import org.jdom.Element;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.maven.model.MavenArtifact;
+import org.jetbrains.idea.maven.project.MavenProject;
+
+import static org.jetbrains.idea.maven.utils.ManifestBuilder.getClasspathPrefix;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 5/26/2014
+ */
+public abstract class ManifestImporter {
+  public static ExtensionPointName<ManifestImporter> EXTENSION_POINT_NAME =
+    ExtensionPointName.create("org.jetbrains.idea.maven.manifestImporter");
+
+  @NotNull
+  public static ManifestImporter getManifestImporter(@NotNull String packaging) {
+    for (ManifestImporter importer : EXTENSION_POINT_NAME.getExtensions()) {
+      if (importer.isApplicable(packaging)) {
+        return importer;
+      }
+    }
+    return new DefaultManifestImporter();
+  }
+
+  @NotNull
+  public String getClasspath(@NotNull MavenProject mavenProject,
+                             @Nullable Element manifestConfiguration) {
+    StringBuilder classpath = new StringBuilder();
+    String classpathPrefix = getClasspathPrefix(manifestConfiguration);
+    for (MavenArtifact mavenArtifact : mavenProject.getDependencies()) {
+      final DependencyScope scope = MavenModuleImporter.selectScope(mavenArtifact.getScope());
+      if (scope.isForProductionRuntime()) {
+        if (classpath.length() > 0) {
+          classpath.append(" ");
+        }
+        classpath.append(classpathPrefix);
+        String artifactFileName = mavenArtifact.getArtifactId() + "-" + mavenArtifact.getVersion() + "." + mavenArtifact.getExtension();
+        classpath.append(doGetClasspathItem(mavenProject, mavenArtifact, artifactFileName));
+      }
+    }
+    return classpath.toString();
+  }
+
+  protected abstract boolean isApplicable(String packaging);
+
+  protected abstract String doGetClasspathItem(@NotNull MavenProject mavenProject,
+                                               @NotNull MavenArtifact mavenArtifact,
+                                               @NotNull String artifactFileName);
+
+  private static class DefaultManifestImporter extends ManifestImporter {
+
+    @Override
+    protected boolean isApplicable(String packaging) {
+      return true;
+    }
+
+    @Override
+    protected String doGetClasspathItem(@NotNull MavenProject mavenProject,
+                                        @NotNull MavenArtifact mavenArtifact,
+                                        @NotNull String artifactFileName) {
+      return artifactFileName;
+    }
+  }
+}
diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenConsoleImpl.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenConsoleImpl.java
index 7773291..a637946 100644
--- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenConsoleImpl.java
+++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenConsoleImpl.java
@@ -15,7 +15,10 @@
  */
 package org.jetbrains.idea.maven.project;
 
-import com.intellij.execution.filters.*;
+import com.intellij.execution.filters.HyperlinkInfo;
+import com.intellij.execution.filters.RegexpFilter;
+import com.intellij.execution.filters.TextConsoleBuilder;
+import com.intellij.execution.filters.TextConsoleBuilderFactory;
 import com.intellij.execution.process.ProcessAdapter;
 import com.intellij.execution.process.ProcessEvent;
 import com.intellij.execution.process.ProcessHandler;
@@ -30,7 +33,6 @@
 import com.intellij.openapi.wm.ToolWindow;
 import com.intellij.openapi.wm.ToolWindowId;
 import com.intellij.openapi.wm.ToolWindowManager;
-import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.ui.content.Content;
 import com.intellij.ui.content.ContentFactory;
 import com.intellij.ui.content.MessageView;
@@ -77,8 +79,6 @@
 
   public static TextConsoleBuilder createConsoleBuilder(final Project project) {
     TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
-
-    builder.filters(ExceptionFilters.getFilters(GlobalSearchScope.allScope(project)));
     builder.addFilter(new RegexpFilter(project, CONSOLE_FILTER_REGEXP) {
       @Nullable
       @Override
diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsManager.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsManager.java
index 2df814f..37a1a47 100644
--- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsManager.java
+++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsManager.java
@@ -15,7 +15,6 @@
  */
 package org.jetbrains.idea.maven.project;
 
-import com.intellij.compiler.CompilerWorkspaceConfiguration;
 import com.intellij.ide.startup.StartupManagerEx;
 import com.intellij.openapi.application.AccessToken;
 import com.intellij.openapi.application.ApplicationManager;
@@ -168,8 +167,6 @@
             AccessToken token = ReadAction.start();
 
             try {
-              if (!CompilerWorkspaceConfiguration.getInstance(myProject).useOutOfProcessBuild()) return true;
-
               new MavenResourceCompilerConfigurationGenerator(myProject, myProjectsTree).generateBuildConfiguration(context.isRebuild());
             }
             finally {
diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenResourceCompilerConfigurationGenerator.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenResourceCompilerConfigurationGenerator.java
index 4a8365c..86f73e9 100644
--- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenResourceCompilerConfigurationGenerator.java
+++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenResourceCompilerConfigurationGenerator.java
@@ -7,14 +7,17 @@
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleManager;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.roots.*;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.JDOMUtil;
 import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.util.io.StreamUtil;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VfsUtil;
 import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.packaging.impl.elements.ManifestFileUtil;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.xmlb.XmlSerializer;
 import org.jdom.Document;
@@ -23,12 +26,14 @@
 import org.jetbrains.idea.maven.dom.references.MavenFilteredPropertyPsiReferenceProvider;
 import org.jetbrains.idea.maven.model.MavenId;
 import org.jetbrains.idea.maven.model.MavenResource;
+import org.jetbrains.idea.maven.utils.ManifestBuilder;
 import org.jetbrains.idea.maven.utils.MavenJDOMUtil;
 import org.jetbrains.idea.maven.utils.MavenUtil;
 import org.jetbrains.jps.maven.model.impl.*;
 
 import java.io.*;
 import java.util.*;
+import java.util.jar.Manifest;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -146,6 +151,8 @@
       }
 
       projectConfig.moduleConfigurations.put(module.getName(), resourceConfig);
+
+      generateManifest(mavenProject, module);
     }
 
     addNonMavenResources(projectConfig);
@@ -175,6 +182,35 @@
     });
   }
 
+  private static void generateManifest(@NotNull MavenProject mavenProject, @NotNull Module module) {
+    try {
+      String jdkVersion = null;
+      Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
+      if (sdk != null && (jdkVersion = sdk.getVersionString()) != null) {
+        final int quoteIndex = jdkVersion.indexOf('"');
+        if (quoteIndex != -1) {
+          jdkVersion = jdkVersion.substring(quoteIndex + 1, jdkVersion.length() - 1);
+        }
+      }
+      Manifest manifest = new ManifestBuilder(mavenProject).withJdkVersion(jdkVersion).build();
+      File manifestFile = new File(mavenProject.getBuildDirectory(), ManifestFileUtil.MANIFEST_FILE_NAME);
+      FileUtil.createIfDoesntExist(manifestFile);
+      OutputStream outputStream = new FileOutputStream(manifestFile);
+      try {
+        manifest.write(outputStream);
+      }
+      finally {
+        StreamUtil.closeStream(outputStream);
+      }
+    }
+    catch (ManifestBuilder.ManifestBuilderException e) {
+      LOG.error("Unable to generate artifact manifest", e);
+    }
+    catch (IOException e) {
+      LOG.error("Unable to save generated artifact manifest", e);
+    }
+  }
+
   private Properties getFilteringProperties(MavenProject mavenProject) {
     final Properties properties = new Properties();
 
diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/ManifestBuilder.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/ManifestBuilder.java
new file mode 100644
index 0000000..356946b
--- /dev/null
+++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/ManifestBuilder.java
@@ -0,0 +1,303 @@
+/*
+ * 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 org.jetbrains.idea.maven.utils;
+
+import com.intellij.openapi.application.ApplicationNamesInfo;
+import com.intellij.openapi.util.Pair;
+import com.intellij.openapi.util.io.StreamUtil;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.util.containers.ContainerUtil;
+import org.codehaus.plexus.archiver.jar.Manifest;
+import org.codehaus.plexus.archiver.jar.ManifestException;
+import org.jdom.Element;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.maven.importing.ManifestImporter;
+import org.jetbrains.idea.maven.project.MavenProject;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.Attributes;
+
+import static org.codehaus.plexus.archiver.jar.Manifest.Attribute;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 5/22/2014
+ */
+public class ManifestBuilder {
+
+  private static final Map<String, String> PACKAGING_PLUGINS = ContainerUtil.newHashMap(
+    Pair.create("jar", "maven-jar-plugin"),
+    Pair.create("ejb", "maven-ejb-plugin"),
+    Pair.create("ejb-client", "maven-ejb-plugin"),
+    Pair.create("war", "maven-war-plugin"),
+    Pair.create("ear", "maven-ear-plugin")
+  );
+
+  @NotNull private final MavenProject myMavenProject;
+  @Nullable private String myJdkVersion;
+
+  public ManifestBuilder(@NotNull MavenProject mavenProject) {
+    myMavenProject = mavenProject;
+  }
+
+  public ManifestBuilder withJdkVersion(String jdkVersion) {
+    myJdkVersion = jdkVersion;
+    return this;
+  }
+
+  @NotNull
+  public java.util.jar.Manifest build() throws ManifestBuilderException {
+    try {
+      Element mavenPackagingPluginConfiguration = null;
+      final String packaging = myMavenProject.getPackaging();
+      if (StringUtil.isEmpty(packaging)) {
+        mavenPackagingPluginConfiguration = myMavenProject.getPluginConfiguration("org.apache.maven.plugins", "maven-jar-plugin");
+      }
+      else {
+        final String pluginArtifactId = PACKAGING_PLUGINS.get(StringUtil.toLowerCase(packaging));
+        if (pluginArtifactId != null) {
+          mavenPackagingPluginConfiguration = myMavenProject.getPluginConfiguration("org.apache.maven.plugins", pluginArtifactId);
+        }
+      }
+
+      final Element mavenArchiveConfiguration =
+        mavenPackagingPluginConfiguration != null ? mavenPackagingPluginConfiguration.getChild("archive") : null;
+
+      if (mavenArchiveConfiguration == null) return getDefaultManifest(Collections.<String, String>emptyMap());
+
+      final Element manifestEntries = mavenArchiveConfiguration.getChild("manifestEntries");
+      Map<String, String> entries = getManifestEntries(manifestEntries);
+
+      final Element manifestConfiguration = mavenArchiveConfiguration.getChild("manifest");
+      final Manifest configuredManifest = getConfiguredManifest(myMavenProject, manifestConfiguration, entries);
+
+      if (!entries.isEmpty()) {
+        addManifestEntries(configuredManifest, entries);
+      }
+
+      addCustomManifestSections(configuredManifest, mavenArchiveConfiguration);
+
+      Manifest finalManifest = getDefaultManifest(entries);
+      // merge configured manifest
+      merge(finalManifest, configuredManifest);
+
+      // merge user supplied manifest
+      final Manifest userSuppliedManifest = getUserSuppliedManifest(mavenArchiveConfiguration);
+      merge(finalManifest, userSuppliedManifest);
+      return finalManifest;
+    }
+    catch (ManifestException e) {
+      throw new ManifestBuilderException(e);
+    }
+  }
+
+  @NotNull
+  public static String getClasspathPrefix(@Nullable Element manifestConfiguration) {
+    String classpathPrefix = MavenJDOMUtil.findChildValueByPath(manifestConfiguration, "classpathPrefix", "").replaceAll("\\\\", "/");
+    if (classpathPrefix.length() != 0 && !classpathPrefix.endsWith("/")) {
+      classpathPrefix += "/";
+    }
+    return classpathPrefix;
+  }
+
+
+  private static Map<String, String> getManifestEntries(Element manifestEntries) {
+    boolean hasManifestEntries = manifestEntries != null && manifestEntries.getContentSize() > 0;
+    Map<String, String> entries = hasManifestEntries ?
+                                  new HashMap<String, String>(manifestEntries.getContentSize()) :
+                                  Collections.<String, String>emptyMap();
+    if (hasManifestEntries) {
+      for (Element element : manifestEntries.getChildren()) {
+        entries.put(element.getName(), element.getTextTrim());
+      }
+    }
+    return entries;
+  }
+
+  private static void addCustomManifestSections(@NotNull Manifest manifest, @NotNull Element mavenArchiveConfiguration)
+    throws ManifestException {
+
+    for (Element section : MavenJDOMUtil.findChildrenByPath(mavenArchiveConfiguration, "manifestSections", "manifestSection")) {
+      Manifest.Section theSection = new Manifest.Section();
+
+      final String sectionName = MavenJDOMUtil.findChildValueByPath(section, "name");
+      theSection.setName(sectionName);
+
+      final Element manifestEntries = section.getChild("manifestEntries");
+      Map<String, String> entries = getManifestEntries(manifestEntries);
+
+      if (!entries.isEmpty()) {
+        for (Map.Entry<String, String> entry : entries.entrySet()) {
+          Attribute attr = new Attribute(entry.getKey(), entry.getValue());
+          theSection.addConfiguredAttribute(attr);
+        }
+      }
+      manifest.addConfiguredSection(theSection);
+    }
+  }
+
+  @NotNull
+  private Manifest getDefaultManifest(@NotNull Map<String, String> entries) throws ManifestException {
+    Manifest finalManifest = new Manifest();
+    addManifestAttribute(finalManifest, entries, "Created-By", ApplicationNamesInfo.getInstance().getFullProductName());
+    addManifestAttribute(finalManifest, entries, "Built-By", System.getProperty("user.name"));
+    if (!StringUtil.isEmpty(myJdkVersion)) {
+      addManifestAttribute(finalManifest, entries, "Build-Jdk", myJdkVersion);
+    }
+    return finalManifest;
+  }
+
+  private static void addManifestEntries(@NotNull Manifest manifest, @NotNull Map<String, String> entries)
+    throws ManifestException {
+    if (!entries.isEmpty()) {
+      for (Map.Entry<String, String> entry : entries.entrySet()) {
+        Attribute attr = manifest.getMainSection().getAttribute(entry.getKey());
+        if ("Class-Path".equals(entry.getKey()) && attr != null) {
+          // Merge the user-supplied Class-Path value with the programmatically
+          // generated Class-Path.  Note that the user-supplied value goes first
+          // so that resources there will override any in the standard Class-Path.
+          attr.setValue(entry.getValue() + " " + attr.getValue());
+        }
+        else {
+          addManifestAttribute(manifest, entry.getKey(), entry.getValue());
+        }
+      }
+    }
+  }
+
+  @Nullable
+  private Manifest getUserSuppliedManifest(@Nullable Element mavenArchiveConfiguration) {
+    Manifest manifest = null;
+    String manifestPath = MavenJDOMUtil.findChildValueByPath(mavenArchiveConfiguration, "manifestFile");
+    if (manifestPath != null) {
+      File manifestFile = new File(manifestPath);
+      if (!manifestFile.isAbsolute()) {
+        manifestFile = new File(myMavenProject.getDirectory(), manifestPath);
+      }
+      if (manifestFile.isFile()) {
+        FileInputStream fis = null;
+        try {
+          //noinspection IOResourceOpenedButNotSafelyClosed
+          fis = new FileInputStream(manifestFile);
+          manifest = new Manifest(fis);
+        }
+        catch (IOException ignore) {
+        }
+        finally {
+          StreamUtil.closeStream(fis);
+        }
+      }
+    }
+
+    return manifest;
+  }
+
+  @NotNull
+  private static Manifest getConfiguredManifest(@NotNull MavenProject mavenProject,
+                                                @Nullable Element manifestConfiguration,
+                                                @NotNull Map<String, String> entries) throws ManifestException {
+    final Manifest manifest = new Manifest();
+
+    boolean isAddDefaultSpecificationEntries =
+      Boolean.valueOf(MavenJDOMUtil.findChildValueByPath(manifestConfiguration, "addDefaultSpecificationEntries", "false"));
+    if (isAddDefaultSpecificationEntries) {
+      addManifestAttribute(manifest, entries, "Specification-Title", mavenProject.getName());
+      addManifestAttribute(manifest, entries, "Specification-Version", mavenProject.getMavenId().getVersion());
+    }
+
+    boolean isAddDefaultImplementationEntries =
+      Boolean.valueOf(MavenJDOMUtil.findChildValueByPath(manifestConfiguration, "addDefaultImplementationEntries", "false"));
+    if (isAddDefaultImplementationEntries) {
+      addManifestAttribute(manifest, entries, "Implementation-Title", mavenProject.getName());
+      addManifestAttribute(manifest, entries, "Implementation-Version", mavenProject.getMavenId().getVersion());
+      addManifestAttribute(manifest, entries, "Implementation-Vendor-Id", mavenProject.getMavenId().getGroupId());
+    }
+
+    String packageName = MavenJDOMUtil.findChildValueByPath(manifestConfiguration, "packageName");
+    if (packageName != null) {
+      addManifestAttribute(manifest, entries, "Package", packageName);
+    }
+
+    String mainClass = MavenJDOMUtil.findChildValueByPath(manifestConfiguration, "mainClass");
+    if (!StringUtil.isEmpty(mainClass)) {
+      addManifestAttribute(manifest, entries, "Main-Class", mainClass);
+    }
+
+    boolean isAddClasspath = Boolean.valueOf(MavenJDOMUtil.findChildValueByPath(manifestConfiguration, "addClasspath", "false"));
+    if (isAddClasspath) {
+      final ManifestImporter manifestImporter = ManifestImporter.getManifestImporter(mavenProject.getPackaging());
+      String classpath = manifestImporter.getClasspath(mavenProject, manifestConfiguration);
+      if (!classpath.isEmpty()) {
+        addManifestAttribute(manifest, "Class-Path", classpath);
+      }
+    }
+    return manifest;
+  }
+
+  private static void addManifestAttribute(@NotNull Manifest manifest, @NotNull Map<String, String> map, String key, String value)
+    throws ManifestException {
+    if (map.containsKey(key)) return;
+    addManifestAttribute(manifest, key, value);
+  }
+
+  private static void addManifestAttribute(@NotNull Manifest manifest, String key, String value) throws ManifestException {
+    if (!StringUtil.isEmpty(value)) {
+      Attribute attr = new Attribute(key, value);
+      manifest.addConfiguredAttribute(attr);
+    }
+  }
+
+  private static void merge(@NotNull java.util.jar.Manifest target, @Nullable java.util.jar.Manifest other) {
+    if (other != null) {
+      mergeAttributes(target.getMainAttributes(), other.getMainAttributes());
+
+      for (Map.Entry<String, Attributes> o : other.getEntries().entrySet()) {
+        Attributes ourSection = target.getAttributes(o.getKey());
+        Attributes otherSection = o.getValue();
+        if (ourSection == null) {
+          if (otherSection != null) {
+            target.getEntries().put(o.getKey(), (Attributes)otherSection.clone());
+          }
+        }
+        else {
+          mergeAttributes(ourSection, otherSection);
+        }
+      }
+    }
+  }
+
+  private static void mergeAttributes(@NotNull Attributes target, @NotNull Attributes section) {
+    for (Object o : section.keySet()) {
+      Attributes.Name key = (Attributes.Name)o;
+      final Object value = section.get(o);
+      target.put(key, value);
+    }
+  }
+
+
+  public static class ManifestBuilderException extends Exception {
+    public ManifestBuilderException(Throwable cause) {
+      super(cause);
+    }
+  }
+}
diff --git a/plugins/maven/src/main/resources/META-INF/plugin.xml b/plugins/maven/src/main/resources/META-INF/plugin.xml
index 303c92f..960cb1c 100644
--- a/plugins/maven/src/main/resources/META-INF/plugin.xml
+++ b/plugins/maven/src/main/resources/META-INF/plugin.xml
@@ -21,6 +21,7 @@
 
   <extensionPoints>
     <extensionPoint name="importer" interface="org.jetbrains.idea.maven.importing.MavenImporter"/>
+    <extensionPoint name="manifestImporter" interface="org.jetbrains.idea.maven.importing.ManifestImporter"/>
     <extensionPoint name="additional.importing.settings" interface="org.jetbrains.idea.maven.project.AdditionalMavenImportingSettings"/>
     <extensionPoint name="archetypesProvider" interface="org.jetbrains.idea.maven.indices.MavenArchetypesProvider"/>
 
@@ -69,7 +70,6 @@
 
     <junitPatcher implementation="org.jetbrains.idea.maven.execution.MavenJUnitPatcher" />
 
-    <compiler implementation="org.jetbrains.idea.maven.compiler.MavenResourceCompiler" order="last"/>
     <compileServer.plugin classpath="maven-jps-plugin.jar;maven3/plexus-utils-2.0.6.jar"/>
 
     <languageInjector implementation="org.jetbrains.idea.maven.plugins.api.MavenPluginConfigurationLanguageInjector"/>
diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java
index 9f49621..6cc0966 100644
--- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java
+++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java
@@ -16,7 +16,6 @@
 
 package org.jetbrains.idea.maven;
 
-import com.intellij.compiler.CompilerTestUtil;
 import com.intellij.compiler.server.BuildManager;
 import com.intellij.openapi.application.AccessToken;
 import com.intellij.openapi.application.ApplicationManager;
@@ -61,21 +60,11 @@
   protected MavenProjectsTree myProjectsTree;
   protected MavenProjectsManager myProjectsManager;
 
-  protected boolean useJps() {
-    return false;
-  }
-
   @Override
   protected void setUpInWriteAction() throws Exception {
     super.setUpInWriteAction();
     myProjectsManager = MavenProjectsManager.getInstance(myProject);
     removeFromLocalRepository("test");
-    if (useJps()) {
-      CompilerTestUtil.enableExternalCompiler(myProject);
-    }
-    else {
-      CompilerTestUtil.disableExternalCompiler(myProject);
-    }
   }
 
   @Override
@@ -84,10 +73,7 @@
       Messages.setTestDialog(TestDialog.DEFAULT);
       myProjectsManager.projectClosed();
       removeFromLocalRepository("test");
-      if (useJps()) {
-        CompilerTestUtil.disableExternalCompiler(myProject);
-        FileUtil.delete(BuildManager.getInstance().getBuildSystemDirectory());
-      }
+      FileUtil.delete(BuildManager.getInstance().getBuildSystemDirectory());
     }
     finally {
       super.tearDown();
@@ -197,7 +183,7 @@
     assertTrue(getCompilerExtension(module).isCompilerOutputPathInherited());
   }
 
-  private CompilerModuleExtension getCompilerExtension(String module) {
+  protected CompilerModuleExtension getCompilerExtension(String module) {
     ModuleRootManager m = getRootManager(module);
     return CompilerModuleExtension.getInstance(m.getModule());
   }
@@ -534,7 +520,7 @@
   }
 
   protected Sdk setupJdkForModule(final String moduleName) {
-    final Sdk sdk = useJps()? JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk() : createJdk("Java 1.5");
+    final Sdk sdk = true ? JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk() : createJdk("Java 1.5");
     ModuleRootModificationUtil.setModuleSdk(getModule(moduleName), sdk);
     return sdk;
   }
diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ManifestGenerationTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ManifestGenerationTest.java
new file mode 100644
index 0000000..6bc5592
--- /dev/null
+++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ManifestGenerationTest.java
@@ -0,0 +1,221 @@
+/*
+ * 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 org.jetbrains.idea.maven.compiler;
+
+import com.intellij.openapi.application.ApplicationNamesInfo;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.openapi.roots.ModuleRootManager;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 5/23/2014
+ */
+public class ManifestGenerationTest extends MavenCompilingTestCase {
+
+  public void testBasic() throws Exception {
+    importProject("<groupId>test</groupId>" +
+                  "<artifactId>project</artifactId>" +
+                  "<version>1</version>");
+
+    compileModules("project");
+
+    assertSameLinesWithFile(getProjectPath() + "/target/MANIFEST.MF",
+                            "Manifest-Version: 1.0\n" +
+                            "Build-Jdk: " + extractJdkVersion(getModule("project")) + "\n" +
+                            "Built-By: " + System.getProperty("user.name") + "\n" +
+                            "Created-By: " + ApplicationNamesInfo.getInstance().getFullProductName());
+  }
+
+  public void testClasspathEntry() throws Exception {
+    importProject("<groupId>test</groupId>" +
+                  "<artifactId>project</artifactId>" +
+                  "<version>1</version>" +
+
+                  "<dependencies>" +
+                  "  <dependency>" +
+                  "    <groupId>test</groupId>" +
+                  "    <artifactId>other-project</artifactId>" +
+                  "    <version>1</version>" +
+                  "  </dependency>" +
+                  "</dependencies>" +
+
+                  "<build>" +
+                  "    <plugins>" +
+                  "        <plugin>" +
+                  "            <artifactId>maven-jar-plugin</artifactId>" +
+                  "            <version>2.4</version>" +
+                  "            <configuration>" +
+                  "                <archive>" +
+                  "                    <manifest>" +
+                  "                        <addClasspath>true</addClasspath>" +
+                  "                        <classpathPrefix>lib</classpathPrefix>" +
+                  "                    </manifest>" +
+                  "                </archive>" +
+                  "            </configuration>" +
+                  "        </plugin>" +
+                  "    </plugins>" +
+                  "</build>");
+
+    compileModules("project");
+
+    assertSameLinesWithFile(getProjectPath() + "/target/MANIFEST.MF",
+                            "Manifest-Version: 1.0\n" +
+                            "Class-Path: lib/other-project-1.jar\n" +
+                            "Build-Jdk: " + extractJdkVersion(getModule("project")) + "\n" +
+                            "Built-By: " + System.getProperty("user.name") + "\n" +
+                            "Created-By: " + ApplicationNamesInfo.getInstance().getFullProductName());
+  }
+
+  public void testDefaultEntries() throws Exception {
+    importProject("<groupId>test</groupId>" +
+                  "<artifactId>project</artifactId>" +
+                  "<version>1</version>" +
+
+                  "<dependencies>" +
+                  "  <dependency>" +
+                  "    <groupId>test</groupId>" +
+                  "    <artifactId>other-project</artifactId>" +
+                  "    <version>1</version>" +
+                  "  </dependency>" +
+                  "</dependencies>" +
+
+                  "<build>" +
+                  "    <plugins>" +
+                  "        <plugin>" +
+                  "            <artifactId>maven-jar-plugin</artifactId>" +
+                  "            <version>2.4</version>" +
+                  "            <configuration>" +
+                  "                <archive>" +
+                  "                    <manifest>" +
+                  "                        <addDefaultImplementationEntries>true</addDefaultImplementationEntries>" +
+                  "                        <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>" +
+                  "                    </manifest>" +
+                  "                </archive>" +
+                  "            </configuration>" +
+                  "        </plugin>" +
+                  "    </plugins>" +
+                  "</build>");
+
+    compileModules("project");
+
+    assertSameLinesWithFile(getProjectPath() + "/target/MANIFEST.MF",
+                            "Manifest-Version: 1.0\n" +
+                            "Implementation-Version: 1\n" +
+                            "Implementation-Vendor-Id: test\n" +
+                            "Build-Jdk: " + extractJdkVersion(getModule("project")) + "\n" +
+                            "Built-By: " + System.getProperty("user.name") + "\n" +
+                            "Created-By: " + ApplicationNamesInfo.getInstance().getFullProductName() + "\n" +
+                            "Specification-Version: 1");
+  }
+
+
+  public void testManifestEntries() throws Exception {
+    importProject("<groupId>test</groupId>" +
+                  "<artifactId>project</artifactId>" +
+                  "<version>1</version>" +
+
+                  "<build>" +
+                  "    <plugins>" +
+                  "        <plugin>" +
+                  "            <artifactId>maven-jar-plugin</artifactId>" +
+                  "            <version>2.4</version>" +
+                  "            <configuration>" +
+                  "                <archive>" +
+                  "                    <manifestEntries>" +
+                  "                        <Dependencies>some.package</Dependencies>" +
+                  "                        <otherEntry>other entry value </otherEntry>" +
+                  "                    </manifestEntries>" +
+                  "                </archive>" +
+                  "            </configuration>" +
+                  "        </plugin>" +
+                  "    </plugins>" +
+                  "</build>");
+
+    compileModules("project");
+
+    assertSameLinesWithFile(getProjectPath() + "/target/MANIFEST.MF",
+                            "Manifest-Version: 1.0\n" +
+                            "otherEntry: other entry value\n" +
+                            "Dependencies: some.package\n" +
+                            "Build-Jdk: " + extractJdkVersion(getModule("project")) + "\n" +
+                            "Built-By: " + System.getProperty("user.name") + "\n" +
+                            "Created-By: " + ApplicationNamesInfo.getInstance().getFullProductName());
+  }
+
+  public void testManifestSections() throws Exception {
+    importProject("<groupId>test</groupId>" +
+                  "<artifactId>project</artifactId>" +
+                  "<version>1</version>" +
+
+                  "<build>" +
+                  "    <plugins>" +
+                  "        <plugin>" +
+                  "            <artifactId>maven-jar-plugin</artifactId>" +
+                  "            <version>2.4</version>" +
+                  "            <configuration>" +
+                  "                <archive>" +
+                  "                    <manifestSections>" +
+                  "                        <manifestSection>" +
+                  "                            <name>org/test/Some.class</name>" +
+                  "                            <manifestEntries>" +
+                  "                                <Java-Bean>true</Java-Bean>" +
+                  "                            </manifestEntries>" +
+                  "                        </manifestSection>" +
+                  "                        <manifestSection>" +
+                  "                            <name>org/test/SomeOther.class</name>" +
+                  "                            <manifestEntries>" +
+                  "                                <Java-Bean>true</Java-Bean>" +
+                  "                            </manifestEntries>" +
+                  "                        </manifestSection>" +
+                  "                    </manifestSections>" +
+                  "                </archive>" +
+                  "            </configuration>" +
+                  "        </plugin>" +
+                  "    </plugins>" +
+                  "</build>");
+
+    compileModules("project");
+
+    assertSameLinesWithFile(getProjectPath() + "/target/MANIFEST.MF",
+                            "Manifest-Version: 1.0\n" +
+                            "Build-Jdk: " + extractJdkVersion(getModule("project")) + "\n" +
+                            "Built-By: " + System.getProperty("user.name") + "\n" +
+                            "Created-By: " + ApplicationNamesInfo.getInstance().getFullProductName() + "\n" +
+                            "\n" +
+                            "Name: org/test/SomeOther.class\n" +
+                            "Java-Bean: true\n" +
+                            "\n" +
+                            "Name: org/test/Some.class\n" +
+                            "Java-Bean: true");
+  }
+
+  @Nullable
+  public static String extractJdkVersion(@NotNull Module module) {
+    String jdkVersion = null;
+    Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
+    if (sdk != null && (jdkVersion = sdk.getVersionString()) != null) {
+      final int quoteIndex = jdkVersion.indexOf('"');
+      if (quoteIndex != -1) {
+        jdkVersion = jdkVersion.substring(quoteIndex + 1, jdkVersion.length() - 1);
+      }
+    }
+
+    return jdkVersion;
+  }
+}
diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/MavenCompilingTestCase.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/MavenCompilingTestCase.java
index 39583dd..aa430ca 100644
--- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/MavenCompilingTestCase.java
+++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/MavenCompilingTestCase.java
@@ -15,17 +15,15 @@
  */
 package org.jetbrains.idea.maven.compiler;
 
-import com.intellij.compiler.CompilerManagerImpl;
+import com.intellij.compiler.CompilerTestUtil;
 import com.intellij.compiler.CompilerWorkspaceConfiguration;
 import com.intellij.compiler.artifacts.ArtifactsTestUtil;
 import com.intellij.compiler.impl.ModuleCompileScope;
-import com.intellij.compiler.impl.TranslatingCompilerFilesMonitor;
 import com.intellij.openapi.compiler.CompileContext;
 import com.intellij.openapi.compiler.CompileScope;
 import com.intellij.openapi.compiler.CompileStatusNotification;
 import com.intellij.openapi.compiler.CompilerManager;
 import com.intellij.openapi.module.Module;
-import com.intellij.openapi.roots.ProjectRootManager;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.packaging.artifacts.Artifact;
@@ -41,13 +39,22 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 /**
  * @author nik
  */
 public abstract class MavenCompilingTestCase extends MavenImportingTestCase {
+
+  protected void tearDown() throws Exception {
+    try {
+      CompilerTestUtil.disableExternalCompiler(myProject);
+    }
+    finally {
+      super.tearDown();
+    }
+  }
+
   protected void compileModules(final String... moduleNames) {
     compile(createModulesCompileScope(moduleNames));
   }
@@ -63,26 +70,18 @@
         for (Module module : scope.getAffectedModules()) {
           setupJdkForModule(module.getName());
         }
-        if (useJps()) {
-          new MavenResourceCompilerConfigurationGenerator(myProject, MavenProjectsManager.getInstance(myProject).getProjectsTreeForTests())
-            .generateBuildConfiguration(false);
-        }
+        new MavenResourceCompilerConfigurationGenerator(myProject, MavenProjectsManager.getInstance(myProject).getProjectsTreeForTests()).generateBuildConfiguration(false);
       }
     });
 
     CompilerWorkspaceConfiguration.getInstance(myProject).CLEAR_OUTPUT_DIRECTORY = true;
-    CompilerManagerImpl.testSetup();
-
-    List<VirtualFile> roots = Arrays.asList(ProjectRootManager.getInstance(myProject).getContentRoots());
-    TranslatingCompilerFilesMonitor.getInstance()
-      .scanSourceContent(new TranslatingCompilerFilesMonitor.ProjectRef(myProject), roots, roots.size(), true);
-
 
     final Semaphore semaphore = new Semaphore();
     semaphore.down();
     UIUtil.invokeAndWaitIfNeeded(new Runnable() {
       @Override
       public void run() {
+        CompilerTestUtil.enableExternalCompiler();
         CompilerManager.getInstance(myProject).make(scope, new CompileStatusNotification() {
           @Override
           public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ResourceCopyingTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ResourceCopyingTest.java
index e9f1f8a..342c1b5 100644
--- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ResourceCopyingTest.java
+++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ResourceCopyingTest.java
@@ -29,10 +29,6 @@
 import java.io.File;
 
 public class ResourceCopyingTest extends MavenCompilingTestCase {
-  @Override
-  protected boolean useJps() {
-    return true;
-  }
 
   @Override
   protected void setUpInWriteAction() throws Exception {
@@ -327,9 +323,6 @@
   }
 
   public void testDoNotCopyExcludedStandardResources() throws Exception {
-    if (!useJps()) {
-      if (ignore()) return;
-    }
 
     CompilerConfigurationImpl configuration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject);
     configuration.addResourceFilePattern("*.zzz");
@@ -360,91 +353,6 @@
     assertNotCopied("target/classes/file.zzz");
   }
 
-  public void testDeletingManuallyCopyedFiles() throws Exception {
-    if (ignore()) return;
-
-    createProjectSubFile("res/file.properties");
-
-    importProject("<groupId>test</groupId>" +
-                  "<artifactId>project</artifactId>" +
-                  "<version>1</version>" +
-
-                  "<build>" +
-                  "  <resources>" +
-                  "    <resource>" +
-                  "      <directory>res</directory>" +
-                  "    </resource>" +
-                  "  </resources>" +
-                  "</build>");
-
-    compileModules("project");
-    assertCopied("target/classes/file.properties");
-    createProjectSubFile("target/classes/file2.properties");
-
-    compileModules("project");
-    assertCopied("target/classes/file.properties");
-    assertNotCopied("target/classes/file2.properties");
-  }
-
-  public void testDeletingFilesCopyiedByIdeaCompiler() throws Exception {
-    if (ignore()) return;
-
-    createProjectSubFile("res/file.properties");
-    createProjectSubFile("res/file.xml");
-
-    importProject("<groupId>test</groupId>" +
-                  "<artifactId>project</artifactId>" +
-                  "<version>1</version>" +
-
-                  "<build>" +
-                  "  <resources>" +
-                  "    <resource>" +
-                  "      <directory>res</directory>" +
-                  "      <includes>" +
-                  "        <include>**/*.properties</include>" +
-                  "      </includes>" +
-                  "    </resource>" +
-                  "  </resources>" +
-                  "</build>");
-
-    compileModules("project");
-    assertCopied("target/classes/file.properties");
-    assertNotCopied("target/classes/file.xml");
-  }
-
-  public void testCopyManuallyDeletedFiles() throws Exception {
-    if (useJps()) {
-      ignore();
-      return;
-    }
-    createProjectSubFile("res/file.properties");
-
-    importProject("<groupId>test</groupId>" +
-                  "<artifactId>project</artifactId>" +
-                  "<version>1</version>" +
-
-                  "<build>" +
-                  "  <resources>" +
-                  "    <resource>" +
-                  "      <directory>res</directory>" +
-                  "    </resource>" +
-                  "  </resources>" +
-                  "</build>");
-
-    compileModules("project");
-    assertCopied("target/classes/file.properties");
-    new WriteCommandAction.Simple(myProject) {
-      @Override
-      protected void run() throws Throwable {
-        myProjectPom.getParent().findFileByRelativePath("target").delete(this);
-      }
-    }.execute().throwException();
-
-
-    compileModules("project");
-    assertCopied("target/classes/file.properties");
-  }
-
   public void testDoNotDeleteFilesFromOtherModulesOutput() throws Exception {
     createProjectSubFile("m1/resources/file.xxx");
     createProjectSubFile("m2/resources/file.yyy");
@@ -706,20 +614,10 @@
   }
 
   private void assertCopied(String path) {
-    if (useJps()) {
-      assertTrue(new File(myProjectPom.getParent().getPath(), path).exists());
-    }
-    else {
-      assertNotNull(myProjectPom.getParent().findFileByRelativePath(path));
-    }
+    assertTrue(new File(myProjectPom.getParent().getPath(), path).exists());
   }
 
   private void assertNotCopied(String path) {
-    if (useJps()) {
-      assertFalse(new File(myProjectPom.getParent().getPath(), path).exists());
-    }
-    else {
-      assertNull(myProjectPom.getParent().findFileByRelativePath(path));
-    }
+    assertFalse(new File(myProjectPom.getParent().getPath(), path).exists());
   }
 }
diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ResourceFilteringTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ResourceFilteringTest.java
index bb1138c..24b6e5f 100644
--- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ResourceFilteringTest.java
+++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ResourceFilteringTest.java
@@ -22,21 +22,7 @@
 
 import java.util.Arrays;
 
-public abstract class ResourceFilteringTest extends MavenCompilingTestCase {
-
-  public static class IdeaModeTest extends ResourceFilteringTest {
-    @Override
-    protected boolean useJps() {
-      return false;
-    }
-  }
-
-  public static class JpsModeTest extends ResourceFilteringTest {
-    @Override
-    protected boolean useJps() {
-      return true;
-    }
-  }
+public class ResourceFilteringTest extends MavenCompilingTestCase {
 
   @Override
   protected boolean runInWriteAction() {
@@ -905,7 +891,7 @@
   }
 
   public void testEscapingFiltering() throws Exception {
-    if (!useJps()) return;
+    if (!true) return;
 
     createProjectSubFile("filters/filter.properties", "xxx=value");
     createProjectSubFile("resources/file.properties",
@@ -1067,7 +1053,7 @@
   }
 
   public void testResourcesOrdering2() throws Exception {
-    if (!useJps()) return;
+    if (!true) return;
 
     createProjectSubFile("resources/file.properties", "value=${project.version}\n");
 
@@ -1095,7 +1081,7 @@
   }
 
   public void testResourcesOrdering3() throws Exception {
-    if (!useJps()) return;
+    if (!true) return;
 
     createProjectSubFile("resources1/a.txt", "1");
     createProjectSubFile("resources2/a.txt", "2");
@@ -1149,7 +1135,7 @@
   }
 
   public void testOverwriteParameter1() throws Exception {
-    if (!useJps()) return;
+    if (!true) return;
 
     createProjectSubFile("resources1/a.txt", "1");
     createProjectSubFile("resources2/a.txt", "2");
@@ -1185,7 +1171,7 @@
   }
 
   public void testOverwriteParameter2() throws Exception {
-    if (!useJps()) return;
+    if (!true) return;
 
     createProjectSubFile("resources1/a.txt", "1");
     createProjectSubFile("resources2/a.txt", "2");
diff --git a/plugins/properties/properties-psi-api/gen/icons/PropertiesIcons.java b/plugins/properties/properties-psi-api/gen/icons/PropertiesIcons.java
new file mode 100644
index 0000000..b75bc8b
--- /dev/null
+++ b/plugins/properties/properties-psi-api/gen/icons/PropertiesIcons.java
@@ -0,0 +1,32 @@
+/*
+ * 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 icons;
+
+import com.intellij.openapi.util.IconLoader;
+
+import javax.swing.*;
+
+/**
+ * NOTE THIS FILE IS AUTO-GENERATED
+ * DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
+ */
+public class PropertiesIcons {
+  private static Icon load(String path) {
+    return IconLoader.getIcon(path, PropertiesIcons.class);
+  }
+
+  public static final Icon XmlProperties = load("/icons/xmlProperties.png"); // 16x16
+}
diff --git a/plugins/properties/properties-psi-api/icon-robots.txt b/plugins/properties/properties-psi-api/icon-robots.txt
new file mode 100644
index 0000000..0b7559b
--- /dev/null
+++ b/plugins/properties/properties-psi-api/icon-robots.txt
@@ -0,0 +1 @@
+name: Properties
diff --git a/plugins/properties/resources/schemas/properties.dtd b/plugins/properties/properties-psi-api/resources/schemas/properties.dtd
similarity index 100%
rename from plugins/properties/resources/schemas/properties.dtd
rename to plugins/properties/properties-psi-api/resources/schemas/properties.dtd
diff --git a/plugins/properties/properties-psi-impl/properties-psi-impl.iml b/plugins/properties/properties-psi-impl/properties-psi-impl.iml
index 1eeaef3..76596cc 100644
--- a/plugins/properties/properties-psi-impl/properties-psi-impl.iml
+++ b/plugins/properties/properties-psi-impl/properties-psi-impl.iml
@@ -7,7 +7,7 @@
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="module" module-name="properties-psi-api" />
+    <orderEntry type="module" module-name="properties-psi-api" exported="" />
     <orderEntry type="module" module-name="core-impl" />
     <orderEntry type="module" module-name="editor-ui-api" />
     <orderEntry type="module" module-name="analysis-api" />
@@ -15,6 +15,7 @@
     <orderEntry type="module" module-name="xml-psi-impl" />
     <orderEntry type="module" module-name="indexing-impl" />
     <orderEntry type="module" module-name="lang-impl" />
+    <orderEntry type="module" module-name="structure-view-impl" />
   </component>
 </module>
 
diff --git a/plugins/properties/properties-psi-impl/src/META-INF/PropertiesPlugin.xml b/plugins/properties/properties-psi-impl/src/META-INF/PropertiesPlugin.xml
new file mode 100644
index 0000000..6b2c0c7
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/META-INF/PropertiesPlugin.xml
@@ -0,0 +1,96 @@
+<idea-plugin version="2">
+  <id>com.intellij.properties</id>
+  <name>Properties Support</name>
+  <depends>com.intellij.modules.xml</depends>
+  <description>
+    This plugin enables smart editing of properties files.
+  </description>
+  <vendor>JetBrains</vendor>
+
+  <extensionPoints>
+    <extensionPoint name="implicitPropertyUsageProvider" interface="com.intellij.codeInspection.unused.ImplicitPropertyUsageProvider"/>
+  </extensionPoints>
+
+  <extensions defaultExtensionNs="com.intellij">
+    <typeIcon className="com.intellij.lang.properties.editor.ResourceBundleAsVirtualFile" icon="AllIcons.Nodes.ResourceBundle"/>
+    <errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
+    <applicationService serviceInterface="com.intellij.lang.properties.LastSelectedPropertiesFileStore"
+                        serviceImplementation="com.intellij.lang.properties.LastSelectedPropertiesFileStore"/>
+    <applicationService serviceInterface="com.intellij.lang.properties.PropertiesQuickFixFactory"
+                        serviceImplementation="com.intellij.lang.properties.PropertiesQuickFixFactoryImpl"/>
+    <applicationService
+                        serviceImplementation="com.intellij.lang.properties.refactoring.PropertiesRefactoringSettings"/>
+    <annotator language="Properties" implementationClass="com.intellij.lang.properties.PropertiesAnnotator"/>
+    <completion.contributor language="any" implementationClass="com.intellij.lang.properties.references.PropertiesCompletionContributor"
+                            id="propertiesCompletion" order="before javaClassReference"/>
+    <lang.refactoringSupport language="Properties" implementationClass="com.intellij.lang.properties.refactoring.PropertiesRefactoringSupportProvider"/>
+    <lang.documentationProvider language="Properties" implementationClass="com.intellij.lang.properties.PropertiesDocumentationProvider"/>
+    <lang.findUsagesProvider language="Properties"
+                                 implementationClass="com.intellij.lang.properties.findUsages.PropertiesFindUsagesProvider"/>
+    <lang.elementManipulator forClass="com.intellij.lang.properties.psi.impl.PropertyValueImpl"
+                             implementationClass="com.intellij.lang.properties.PropertyValueManipulator"/>
+    <lang.elementManipulator forClass="com.intellij.lang.properties.psi.impl.PropertyImpl"
+                             implementationClass="com.intellij.lang.properties.PropertyManipulator"/>
+    <applicationService serviceInterface="com.intellij.lang.properties.structureView.PropertiesSeparatorManager"
+                            serviceImplementation="com.intellij.lang.properties.structureView.PropertiesSeparatorManager"/>
+    <codeInsight.wordCompletionFilter language="Properties"
+                                      implementationClass="com.intellij.lang.properties.PropertiesWordCompletionFilter"/>
+    <lang.psiStructureViewFactory language="Properties"
+                                  implementationClass="com.intellij.lang.properties.structureView.PropertiesStructureViewBuilderFactory"/>
+    <lang.ast.factory language="Properties" implementationClass="com.intellij.lang.properties.psi.impl.PropertiesASTFactory"/>
+    <joinLinesHandler implementation="com.intellij.lang.properties.PropertiesJoinLinesHandler"/>
+    
+    <enterHandlerDelegate implementation="com.intellij.codeInsight.editorActions.enter.EnterInPropertiesFileHandler"/>
+
+    <lang.parserDefinition language="Properties" implementationClass="com.intellij.lang.properties.parsing.PropertiesParserDefinition"/>
+    <renameHandler implementation="com.intellij.lang.properties.refactoring.ResourceBundleRenameHandler"/>
+    <renameHandler implementation="com.intellij.lang.properties.refactoring.ResourceBundleKeyRenameHandler"/>
+    <renameHandler implementation="com.intellij.lang.properties.refactoring.PropertyRenameHandler"/>
+    <stubElementTypeHolder class="com.intellij.lang.properties.parsing.PropertiesElementTypes"/>
+    <renamePsiElementProcessor implementation="com.intellij.lang.properties.refactoring.RenamePropertyProcessor"/>
+    <lang.commenter language="Properties" implementationClass="com.intellij.lang.properties.PropertiesCommenter"/>
+    <stubIndex implementation="com.intellij.lang.properties.psi.PropertyKeyIndex"/>
+    <lang.namesValidator language="Properties" implementationClass="com.intellij.lang.properties.PropertiesNamesValidator"/>
+    <refactoring.safeDeleteProcessor implementation="com.intellij.lang.properties.refactoring.PropertiesSafeDeleteProcessor"/>
+    <refactoring.moveHandler implementation="com.intellij.lang.properties.projectView.ResourceBundleMoveProvider"/>
+    <colorSettingsPage implementation="com.intellij.openapi.options.colors.pages.PropertiesColorsPage"/>
+    <treeStructureProvider implementation="com.intellij.lang.properties.projectView.ResourceBundleGrouper"/>
+    <elementDescriptionProvider implementation="com.intellij.lang.properties.PropertiesDescriptionProvider"/>
+    <fileTypeFactory implementation="com.intellij.lang.properties.PropertiesFileTypeFactory"/>
+    <fileTypeFactory implementation="com.intellij.lang.properties.editor.ResourceBundleEditorProvider" />
+    <favoriteNodeProvider implementation="com.intellij.ide.favoritesTreeView.ResourcesFavoriteNodeProvider"/>
+
+    <localInspection language="Properties" shortName="UnusedProperty" bundle="messages.PropertiesBundle" key="unused.property.inspection.display.name"
+                     groupKey="properties.files.inspection.group.display.name" enabledByDefault="true" level="WARNING"
+                     implementationClass="com.intellij.codeInspection.unused.UnusedPropertyInspection"/>
+    <globalInspection shortName="DuplicatePropertyInspection" bundle="messages.InspectionsBundle" key="duplicate.property.display.name"
+                      groupKey="group.names.properties.files" enabledByDefault="false" level="WARNING"
+                      implementationClass="com.intellij.codeInspection.duplicatePropertyInspection.DuplicatePropertyInspection"/>
+    <localInspection language="Properties" shortName="TrailingSpacesInProperty" bundle="messages.PropertiesBundle"
+                     key="trail.spaces.property.inspection.display.name" groupKey="properties.files.inspection.group.display.name"
+                     enabledByDefault="true" level="WARNING"
+                     implementationClass="com.intellij.codeInspection.TrailingSpacesInPropertyInspection"/>
+
+    <idIndexer filetype="Properties" implementationClass="com.intellij.psi.impl.cache.impl.idCache.PropertiesIdIndexer"/>
+    <todoIndexer filetype="Properties" implementationClass="com.intellij.psi.impl.cache.impl.idCache.PropertiesTodoIndexer"/>
+
+    <projectService serviceImplementation="com.intellij.lang.properties.PropertiesReferenceManager"/>
+
+    <fileEditorProvider implementation="com.intellij.lang.properties.editor.ResourceBundleEditorProvider"/>
+    <spellchecker.support language="Properties" implementationClass="com.intellij.lang.properties.spellchecker.PropertiesSpellcheckingStrategy"/>
+
+    <fileBasedIndex implementation="com.intellij.lang.properties.xml.XmlPropertiesIndex"/>
+    <standardResource url="http://java.sun.com/dtd/properties.dtd" path="schemas/properties.dtd"/>
+    <iconProvider implementation="com.intellij.lang.properties.xml.XmlPropertiesIconProvider"/>
+    <psi.referenceContributor language="XML" implementation="com.intellij.lang.properties.xml.XmlPropertiesReferenceContributor"/>
+    <lang.foldingBuilder language="Properties" implementationClass="com.intellij.lang.properties.editor.PropertiesFoldingBuilder" />
+    <gotoRelatedProvider implementation="com.intellij.lang.properties.editor.GotoResourceBundleLocalizationsProvider"/>
+  </extensions>
+
+  <project-components>
+    <component>
+      <implementation-class>com.intellij.lang.properties.PropertiesFilesManager</implementation-class>
+      <skipForDefaultProject/>
+    </component>
+  </project-components>
+</idea-plugin>
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/TrailingSpacesInPropertyInspection.java b/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/TrailingSpacesInPropertyInspection.java
new file mode 100644
index 0000000..4ca736a
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/TrailingSpacesInPropertyInspection.java
@@ -0,0 +1,108 @@
+/*
+ * 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.codeInspection;
+
+import com.intellij.lang.ASTNode;
+import com.intellij.lang.properties.IProperty;
+import com.intellij.lang.properties.PropertiesBundle;
+import com.intellij.lang.properties.PropertySuppressableInspectionBase;
+import com.intellij.lang.properties.psi.PropertiesFile;
+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/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.form b/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.form
similarity index 100%
rename from plugins/properties/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.form
rename to plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.form
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.java b/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.java
new file mode 100644
index 0000000..d226349
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/duplicatePropertyInspection/DuplicatePropertyInspection.java
@@ -0,0 +1,451 @@
+/*
+ * 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.codeInspection.duplicatePropertyInspection;
+
+import com.intellij.codeInspection.*;
+import com.intellij.codeInspection.ex.GlobalInspectionContextBase;
+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.ModuleUtilCore;
+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, (GlobalInspectionContextBase)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,
+                         GlobalInspectionContextBase 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 = ModuleUtilCore.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/properties-psi-impl/src/com/intellij/codeInspection/unused/ImplicitPropertyUsageProvider.java b/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/unused/ImplicitPropertyUsageProvider.java
new file mode 100644
index 0000000..f3f8cff
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/unused/ImplicitPropertyUsageProvider.java
@@ -0,0 +1,35 @@
+/*
+ * 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.codeInspection.unused;
+
+import com.intellij.lang.properties.psi.Property;
+import com.intellij.openapi.extensions.ExtensionPointName;
+
+/**
+ * @author Max Medvedev
+ */
+public abstract class ImplicitPropertyUsageProvider {
+  public 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/properties-psi-impl/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java b/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java
new file mode 100644
index 0000000..53e241e
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java
@@ -0,0 +1,113 @@
+/*
+ * 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.codeInspection.unused;
+
+import com.intellij.codeInspection.LocalInspectionToolSession;
+import com.intellij.codeInspection.LocalQuickFix;
+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.PropertiesQuickFixFactory;
+import com.intellij.lang.properties.PropertySuppressableInspectionBase;
+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.ModuleUtilCore;
+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 = ModuleUtilCore.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");
+
+        LocalQuickFix fix = PropertiesQuickFixFactory.getInstance().createRemovePropertyLocalFix();
+        holder.registerProblem(key, description, ProblemHighlightType.LIKE_UNUSED_SYMBOL, fix);
+      }
+    };
+  }
+}
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesAnnotator.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesAnnotator.java
new file mode 100644
index 0000000..c5cdf72
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesAnnotator.java
@@ -0,0 +1,133 @@
+/*
+ * 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.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(PropertiesQuickFixFactory.getInstance().createRemovePropertyFix(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/properties-psi-impl/src/com/intellij/lang/properties/PropertiesCommenter.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesCommenter.java
new file mode 100644
index 0000000..8e63111
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesCommenter.java
@@ -0,0 +1,43 @@
+/*
+ * 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.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/properties-psi-impl/src/com/intellij/lang/properties/PropertiesQuickFixFactory.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesQuickFixFactory.java
new file mode 100644
index 0000000..cd714a4
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesQuickFixFactory.java
@@ -0,0 +1,37 @@
+/*
+ * 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.openapi.components.ServiceManager;
+import com.intellij.psi.PsiElement;
+
+import java.util.List;
+
+public abstract class PropertiesQuickFixFactory {
+  public static PropertiesQuickFixFactory getInstance() {
+    return ServiceManager.getService(PropertiesQuickFixFactory.class);
+  }
+
+  public abstract LocalQuickFix createCreatePropertyFix(PsiElement element, String key, List<PropertiesFile> files);
+
+  public abstract IntentionAction createRemovePropertyFix(Property property);
+
+  public abstract LocalQuickFix createRemovePropertyLocalFix();
+}
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesReferenceManager.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesReferenceManager.java
index f926121..785ff24 100644
--- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesReferenceManager.java
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesReferenceManager.java
@@ -26,7 +26,11 @@
 import com.intellij.psi.PsiManager;
 import com.intellij.psi.search.FileTypeIndex;
 import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.util.CachedValueProvider;
+import com.intellij.psi.util.CachedValuesManager;
+import com.intellij.psi.util.PsiModificationTracker;
 import com.intellij.util.ArrayUtil;
+import com.intellij.util.containers.ConcurrentFactoryMap;
 import com.intellij.util.indexing.FileBasedIndex;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -53,7 +57,22 @@
 
   @NotNull
   public List<PropertiesFile> findPropertiesFiles(@NotNull final Module module, final String bundleName) {
-    return findPropertiesFiles(GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module), bundleName, BundleNameEvaluator.DEFAULT);
+    ConcurrentFactoryMap<String, List<PropertiesFile>> map =
+      CachedValuesManager.getManager(module.getProject()).getCachedValue(module, new CachedValueProvider<ConcurrentFactoryMap<String, List<PropertiesFile>>>() {
+        @Nullable
+        @Override
+        public Result<ConcurrentFactoryMap<String, List<PropertiesFile>>> compute() {
+          ConcurrentFactoryMap<String, List<PropertiesFile>> factoryMap = new ConcurrentFactoryMap<String, List<PropertiesFile>>() {
+            @Nullable
+            @Override
+            protected List<PropertiesFile> create(String bundleName) {
+              return findPropertiesFiles(GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module), bundleName, BundleNameEvaluator.DEFAULT);
+            }
+          };
+          return Result.create(factoryMap, PsiModificationTracker.MODIFICATION_COUNT);
+        }
+      });
+    return map.get(bundleName);
   }
 
   @NotNull
diff --git a/plugins/properties/src/com/intellij/lang/properties/PropertiesUtilBase.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesUtilBase.java
similarity index 100%
rename from plugins/properties/src/com/intellij/lang/properties/PropertiesUtilBase.java
rename to plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertiesUtilBase.java
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertySuppressableInspectionBase.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertySuppressableInspectionBase.java
new file mode 100644
index 0000000..0c26c67
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertySuppressableInspectionBase.java
@@ -0,0 +1,164 @@
+/*
+ * 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.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/properties-psi-impl/src/com/intellij/lang/properties/PropertyValueManipulator.java
similarity index 100%
rename from plugins/properties/src/com/intellij/lang/properties/PropertyValueManipulator.java
rename to plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/PropertyValueManipulator.java
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/RemovePropertyFix.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/RemovePropertyFix.java
new file mode 100644
index 0000000..e183e7c
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/RemovePropertyFix.java
@@ -0,0 +1,63 @@
+/*
+ * 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.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
+ */
+public 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/properties-psi-impl/src/com/intellij/lang/properties/RemovePropertyLocalFix.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/RemovePropertyLocalFix.java
new file mode 100644
index 0000000..8b5a583
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/RemovePropertyLocalFix.java
@@ -0,0 +1,56 @@
+/*
+ * 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.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/properties-psi-impl/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewModel.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewModel.java
new file mode 100644
index 0000000..2faf98d
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewModel.java
@@ -0,0 +1,27 @@
+/*
+ * 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.StructureViewModel;
+
+/**
+ * @author max
+ */
+public interface PropertiesGroupingStructureViewModel extends StructureViewModel.ElementInfoProvider {
+  void setSeparator(String separator);
+
+  String getSeparator();
+}
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/PropertiesValueHighlighter.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/PropertiesValueHighlighter.java
new file mode 100644
index 0000000..8e17f6c
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/PropertiesValueHighlighter.java
@@ -0,0 +1,31 @@
+/*
+ * 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.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/properties-psi-impl/src/com/intellij/lang/properties/editor/PropertiesValueHighlightingLexer.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/PropertiesValueHighlightingLexer.java
new file mode 100644
index 0000000..6c55ffe
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/PropertiesValueHighlightingLexer.java
@@ -0,0 +1,35 @@
+/*
+ * 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.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/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleAsVirtualFile.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleAsVirtualFile.java
new file mode 100644
index 0000000..f46d207
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleAsVirtualFile.java
@@ -0,0 +1,163 @@
+/*
+ * 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.lang.properties.ResourceBundle;
+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;
+
+public class ResourceBundleAsVirtualFile extends VirtualFile {
+  private final ResourceBundle myResourceBundle;
+
+  public ResourceBundleAsVirtualFile(@NotNull ResourceBundle resourceBundle) {
+    myResourceBundle = resourceBundle;
+  }
+
+  @NotNull
+  public ResourceBundle getResourceBundle() {
+    return myResourceBundle;
+  }
+
+  @Override
+  @NotNull
+  public VirtualFileSystem getFileSystem() {
+    return myResourceBundle.getBaseDirectory().getFileSystem();
+  }
+
+  @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/ResourceBundleFileStructureViewElement.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java
similarity index 100%
rename from plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java
rename to plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java
similarity index 100%
rename from plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java
rename to plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewModel.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewModel.java
similarity index 100%
rename from plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewModel.java
rename to plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewModel.java
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleUtil.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleUtil.java
new file mode 100644
index 0000000..53a9bd4
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/editor/ResourceBundleUtil.java
@@ -0,0 +1,69 @@
+/*
+ * 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.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.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;
+  }
+}
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/findUsages/PropertiesFindUsagesProvider.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/findUsages/PropertiesFindUsagesProvider.java
new file mode 100644
index 0000000..a2d38d2
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/findUsages/PropertiesFindUsagesProvider.java
@@ -0,0 +1,58 @@
+/*
+ * 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.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/properties-psi-impl/src/com/intellij/lang/properties/findUsages/PropertySearcher.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/findUsages/PropertySearcher.java
new file mode 100644
index 0000000..4fa4830
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/findUsages/PropertySearcher.java
@@ -0,0 +1,29 @@
+/*
+ * 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.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/properties-psi-impl/src/com/intellij/lang/properties/parsing/PropertiesWordsScanner.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/parsing/PropertiesWordsScanner.java
new file mode 100644
index 0000000..cc22eb1
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/parsing/PropertiesWordsScanner.java
@@ -0,0 +1,29 @@
+/*
+ * 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.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/properties-psi-impl/src/com/intellij/lang/properties/refactoring/PropertiesRefactoringSettings.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/refactoring/PropertiesRefactoringSettings.java
new file mode 100644
index 0000000..bf84c6b
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/refactoring/PropertiesRefactoringSettings.java
@@ -0,0 +1,44 @@
+/*
+ * 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.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/properties-psi-impl/src/com/intellij/lang/properties/references/PropertiesPsiCompletionUtil.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/references/PropertiesPsiCompletionUtil.java
new file mode 100644
index 0000000..4fe5ce2
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/references/PropertiesPsiCompletionUtil.java
@@ -0,0 +1,77 @@
+/*
+ * 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.lang.properties.IProperty;
+import com.intellij.lang.properties.PropertiesFileProcessor;
+import com.intellij.lang.properties.PropertiesReferenceManager;
+import com.intellij.lang.properties.psi.PropertiesFile;
+import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.util.Comparing;
+import gnu.trove.THashSet;
+import gnu.trove.TObjectHashingStrategy;
+
+import java.util.List;
+import java.util.Set;
+
+public class PropertiesPsiCompletionUtil {
+  public static void addVariantsFromFile(PropertyReferenceBase propertyReference,
+                                         final PropertiesFile propertiesFile,
+                                         final Set<Object> variants) {
+    if (propertiesFile == null) return;
+    if (!ProjectRootManager.getInstance(propertyReference.getElement().getProject()).getFileIndex().isInContent(propertiesFile.getVirtualFile())) return;
+    List<? extends IProperty> properties = propertiesFile.getProperties();
+    for (IProperty property : properties) {
+      propertyReference.addKey(property, variants);
+    }
+  }
+
+  static Set<Object> getPropertiesKeys(final PropertyReferenceBase propertyReference) {
+    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 = propertyReference.getPropertiesFiles();
+    if (propertiesFileList == null) {
+      PropertiesReferenceManager
+        .getInstance(propertyReference.getElement().getProject()).processAllPropertiesFiles(new PropertiesFileProcessor() {
+        @Override
+        public boolean process(String baseName, PropertiesFile propertiesFile) {
+          addVariantsFromFile(propertyReference, propertiesFile, variants);
+          return true;
+        }
+      });
+    }
+    else {
+      for (PropertiesFile propFile : propertiesFileList) {
+        addVariantsFromFile(propertyReference, propFile, variants);
+      }
+    }
+    return variants;
+  }
+}
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/references/PropertyReference.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/references/PropertyReference.java
new file mode 100644
index 0000000..4c2d1e3
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/references/PropertyReference.java
@@ -0,0 +1,62 @@
+/*
+ * 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.codeInspection.LocalQuickFix;
+import com.intellij.codeInspection.LocalQuickFixProvider;
+import com.intellij.lang.properties.PropertiesQuickFixFactory;
+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());
+    LocalQuickFix fix = PropertiesQuickFixFactory.getInstance().createCreatePropertyFix(myElement, myKey, propertiesFiles);
+    return new LocalQuickFix[] {fix};
+  }
+}
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/references/PropertyReferenceBase.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/references/PropertyReferenceBase.java
new file mode 100644
index 0000000..a740d8e
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/references/PropertyReferenceBase.java
@@ -0,0 +1,186 @@
+/*
+ * 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.daemon.EmptyResolveMessageProvider;
+import com.intellij.lang.properties.IProperty;
+import com.intellij.lang.properties.PropertiesBundle;
+import com.intellij.lang.properties.PropertiesImplUtil;
+import com.intellij.lang.properties.psi.PropertiesFile;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.pom.references.PomService;
+import com.intellij.psi.*;
+import com.intellij.util.ArrayUtil;
+import com.intellij.util.IncorrectOperationException;
+import com.intellij.util.containers.ContainerUtil;
+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");
+  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 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() {
+    return ArrayUtil.EMPTY_OBJECT_ARRAY;
+  }
+}
diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java
similarity index 100%
rename from plugins/properties/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java
rename to plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java
diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java
similarity index 100%
rename from plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java
rename to plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java
diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewModel.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewModel.java
similarity index 100%
rename from plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewModel.java
rename to plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewModel.java
diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java
similarity index 100%
rename from plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java
rename to plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesSeparatorManager.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesSeparatorManager.java
new file mode 100644
index 0000000..f5e6368
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesSeparatorManager.java
@@ -0,0 +1,207 @@
+/*
+ * 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 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/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java
similarity index 100%
rename from plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java
rename to plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/xml/XmlPropertiesIconProvider.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/xml/XmlPropertiesIconProvider.java
new file mode 100644
index 0000000..c54eeb0
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/xml/XmlPropertiesIconProvider.java
@@ -0,0 +1,40 @@
+/*
+ * 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.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/properties-psi-impl/src/com/intellij/lang/properties/xml/XmlPropertiesReferenceContributor.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/xml/XmlPropertiesReferenceContributor.java
new file mode 100644
index 0000000..20fb07e
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/xml/XmlPropertiesReferenceContributor.java
@@ -0,0 +1,47 @@
+/*
+ * 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.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/properties-psi-impl/src/com/intellij/properties/EmptyPropertiesQuickFixFactory.java b/plugins/properties/properties-psi-impl/src/com/intellij/properties/EmptyPropertiesQuickFixFactory.java
new file mode 100644
index 0000000..acec252
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/properties/EmptyPropertiesQuickFixFactory.java
@@ -0,0 +1,43 @@
+/*
+ * 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.properties;
+
+import com.intellij.codeInsight.intention.IntentionAction;
+import com.intellij.codeInsight.intention.QuickFixes;
+import com.intellij.codeInspection.LocalQuickFix;
+import com.intellij.lang.properties.PropertiesQuickFixFactory;
+import com.intellij.lang.properties.psi.PropertiesFile;
+import com.intellij.lang.properties.psi.Property;
+import com.intellij.psi.PsiElement;
+
+import java.util.List;
+
+public class EmptyPropertiesQuickFixFactory extends PropertiesQuickFixFactory {
+  @Override
+  public LocalQuickFix createCreatePropertyFix(PsiElement element, String key, List<PropertiesFile> files) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public IntentionAction createRemovePropertyFix(Property property) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+
+  @Override
+  public LocalQuickFix createRemovePropertyLocalFix() {
+    return QuickFixes.EMPTY_ACTION;
+  }
+}
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/properties/PropertiesCoreEnvironment.java b/plugins/properties/properties-psi-impl/src/com/intellij/properties/PropertiesCoreEnvironment.java
index 0c88bfb..fda8022 100644
--- a/plugins/properties/properties-psi-impl/src/com/intellij/properties/PropertiesCoreEnvironment.java
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/properties/PropertiesCoreEnvironment.java
@@ -1,33 +1,92 @@
+/*
+ * 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.properties;
 
 import com.intellij.core.CoreApplicationEnvironment;
 import com.intellij.core.CoreProjectEnvironment;
+import com.intellij.ide.IconProvider;
+import com.intellij.lang.LanguageASTFactory;
+import com.intellij.lang.LanguageAnnotators;
+import com.intellij.lang.LanguageCommenters;
 import com.intellij.lang.LanguageParserDefinitions;
-import com.intellij.lang.properties.PropertiesFileType;
-import com.intellij.lang.properties.PropertiesLanguage;
+import com.intellij.lang.findUsages.LanguageFindUsages;
+import com.intellij.lang.folding.LanguageFolding;
+import com.intellij.lang.properties.*;
+import com.intellij.lang.properties.editor.PropertiesFoldingBuilder;
+import com.intellij.lang.properties.findUsages.PropertiesFindUsagesProvider;
+import com.intellij.lang.properties.parsing.PropertiesElementTypes;
 import com.intellij.lang.properties.parsing.PropertiesParserDefinition;
 import com.intellij.lang.properties.psi.PropertyKeyIndex;
+import com.intellij.lang.properties.psi.impl.PropertiesASTFactory;
+import com.intellij.lang.properties.psi.impl.PropertyImpl;
+import com.intellij.lang.properties.psi.impl.PropertyValueImpl;
+import com.intellij.lang.properties.refactoring.PropertiesRefactoringSettings;
+import com.intellij.lang.properties.structureView.PropertiesSeparatorManager;
+import com.intellij.lang.properties.xml.XmlPropertiesIconProvider;
 import com.intellij.lang.properties.xml.XmlPropertiesIndex;
 import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory;
+import com.intellij.psi.ElementManipulators;
+import com.intellij.psi.impl.cache.impl.id.IdIndexers;
+import com.intellij.psi.impl.cache.impl.idCache.PropertiesIdIndexer;
+import com.intellij.psi.impl.cache.impl.idCache.PropertiesTodoIndexer;
+import com.intellij.psi.impl.cache.impl.todo.TodoIndexers;
+import com.intellij.psi.stubs.StubElementTypeHolderEP;
 import com.intellij.psi.stubs.StubIndexExtension;
 import com.intellij.util.indexing.FileBasedIndexExtension;
 
 /**
  * @author Anna Bulenkova
  */
+@SuppressWarnings("UnusedDeclaration") // upsource
 public class PropertiesCoreEnvironment {
   public static class ApplicationEnvironment {
     public ApplicationEnvironment(CoreApplicationEnvironment appEnvironment) {
       appEnvironment.registerFileType(PropertiesFileType.INSTANCE, "properties");
-      SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(PropertiesLanguage.INSTANCE, new PropertiesSyntaxHighlighterFactory());
+      appEnvironment.addExplicitExtension(SyntaxHighlighterFactory.LANGUAGE_FACTORY, PropertiesLanguage.INSTANCE,
+                                          new PropertiesSyntaxHighlighterFactory());
       appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesParserDefinition());
       appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new XmlPropertiesIndex());
       appEnvironment.addExtension(StubIndexExtension.EP_NAME, new PropertyKeyIndex());
+
+      appEnvironment.registerApplicationService(PropertiesQuickFixFactory.class, new EmptyPropertiesQuickFixFactory());
+      appEnvironment.registerApplicationService(PropertiesRefactoringSettings.class, new PropertiesRefactoringSettings());
+      appEnvironment.registerApplicationService(PropertiesSeparatorManager.class, new PropertiesSeparatorManager());
+      appEnvironment.addExplicitExtension(LanguageAnnotators.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesAnnotator());
+      appEnvironment.addExplicitExtension(LanguageFindUsages.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesFindUsagesProvider());
+
+      appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesASTFactory());
+      appEnvironment.addExplicitExtension(LanguageFolding.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesFoldingBuilder());
+      appEnvironment.addExplicitExtension(ElementManipulators.INSTANCE, PropertyImpl.class, new PropertyManipulator());
+      appEnvironment.addExplicitExtension(ElementManipulators.INSTANCE, PropertyValueImpl.class, new PropertyValueManipulator());
+
+      final StubElementTypeHolderEP stubElementTypeHolderBean = new StubElementTypeHolderEP();
+      stubElementTypeHolderBean.holderClass = PropertiesElementTypes.class.getName();
+      appEnvironment.addExtension(StubElementTypeHolderEP.EP_NAME, stubElementTypeHolderBean);
+
+      appEnvironment.addExplicitExtension(LanguageCommenters.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesCommenter());
+      appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, PropertiesFileType.INSTANCE, new PropertiesIdIndexer());
+      appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, PropertiesFileType.INSTANCE, new PropertiesTodoIndexer());
+
+      appEnvironment.addExtension(IconProvider.EXTENSION_POINT_NAME, new XmlPropertiesIconProvider());
     }
   }
 
   public static class ProjectEnvironment {
     public ProjectEnvironment(CoreProjectEnvironment projectEnvironment) {
+      projectEnvironment.getProject().registerService(PropertiesReferenceManager.class);
     }
   }
 }
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesFilterLexer.java b/plugins/properties/properties-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesFilterLexer.java
new file mode 100644
index 0000000..07c81ea
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesFilterLexer.java
@@ -0,0 +1,49 @@
+/*
+ * 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.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/properties-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesIdIndexer.java b/plugins/properties/properties-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesIdIndexer.java
new file mode 100644
index 0000000..18887ef
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesIdIndexer.java
@@ -0,0 +1,34 @@
+/*
+ * 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.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/properties-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesTodoIndexer.java b/plugins/properties/properties-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesTodoIndexer.java
new file mode 100644
index 0000000..19fa810
--- /dev/null
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/PropertiesTodoIndexer.java
@@ -0,0 +1,30 @@
+/*
+ * 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.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);
+  }
+}
diff --git a/plugins/properties/properties.iml b/plugins/properties/properties.iml
index d5b88b8..5549251 100644
--- a/plugins/properties/properties.iml
+++ b/plugins/properties/properties.iml
@@ -3,7 +3,6 @@
   <component name="NewModuleRootManager" inherit-compiler-output="true">
     <exclude-output />
     <content url="file://$MODULE_DIR$">
-      <sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
     </content>
diff --git a/plugins/properties/src/META-INF/plugin.xml b/plugins/properties/src/META-INF/plugin.xml
index f7afc05..73f4d81 100644
--- a/plugins/properties/src/META-INF/plugin.xml
+++ b/plugins/properties/src/META-INF/plugin.xml
@@ -1,92 +1,3 @@
-<idea-plugin version="2">
-  <id>com.intellij.properties</id>
-  <name>Properties Support</name>
-  <depends>com.intellij.modules.xml</depends>
-  <description>
-    This plugin enables smart editing of properties files.
-  </description>
-  <vendor>JetBrains</vendor>
-
-  <extensionPoints>
-    <extensionPoint name="implicitPropertyUsageProvider" interface="com.intellij.codeInspection.unused.ImplicitPropertyUsageProvider"/>
-  </extensionPoints>
-
-  <extensions defaultExtensionNs="com.intellij">
-    <errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
-    <applicationService serviceInterface="com.intellij.lang.properties.LastSelectedPropertiesFileStore"
-                        serviceImplementation="com.intellij.lang.properties.LastSelectedPropertiesFileStore"/>
-    <applicationService serviceInterface="com.intellij.lang.properties.refactoring.PropertiesRefactoringSettings"
-                        serviceImplementation="com.intellij.lang.properties.refactoring.PropertiesRefactoringSettings"/>
-    <annotator language="Properties" implementationClass="com.intellij.lang.properties.PropertiesAnnotator"/>
-    <completion.contributor language="Properties" implementationClass="com.intellij.lang.properties.PropertiesCompletionContributor"
-                            id="propertiesCompletion" order="before javaClassReference"/>
-    <lang.refactoringSupport language="Properties" implementationClass="com.intellij.lang.properties.refactoring.PropertiesRefactoringSupportProvider"/>
-    <lang.documentationProvider language="Properties" implementationClass="com.intellij.lang.properties.PropertiesDocumentationProvider"/>
-    <lang.findUsagesProvider language="Properties"
-                                 implementationClass="com.intellij.lang.properties.findUsages.PropertiesFindUsagesProvider"/>
-    <lang.elementManipulator forClass="com.intellij.lang.properties.psi.impl.PropertyValueImpl"
-                             implementationClass="com.intellij.lang.properties.PropertyValueManipulator"/>
-    <lang.elementManipulator forClass="com.intellij.lang.properties.psi.impl.PropertyImpl"
-                             implementationClass="com.intellij.lang.properties.PropertyManipulator"/>
-    <applicationService serviceInterface="com.intellij.lang.properties.structureView.PropertiesSeparatorManager"
-                            serviceImplementation="com.intellij.lang.properties.structureView.PropertiesSeparatorManager"/>
-    <codeInsight.wordCompletionFilter language="Properties"
-                                      implementationClass="com.intellij.lang.properties.PropertiesWordCompletionFilter"/>
-    <lang.psiStructureViewFactory language="Properties"
-                                  implementationClass="com.intellij.lang.properties.structureView.PropertiesStructureViewBuilderFactory"/>
-    <lang.ast.factory language="Properties" implementationClass="com.intellij.lang.properties.psi.impl.PropertiesASTFactory"/>
-    <joinLinesHandler implementation="com.intellij.lang.properties.PropertiesJoinLinesHandler"/>
-    
-    <enterHandlerDelegate implementation="com.intellij.codeInsight.editorActions.enter.EnterInPropertiesFileHandler"/>
-
-    <lang.parserDefinition language="Properties" implementationClass="com.intellij.lang.properties.parsing.PropertiesParserDefinition"/>
-    <renameHandler implementation="com.intellij.lang.properties.refactoring.ResourceBundleRenameHandler"/>
-    <renameHandler implementation="com.intellij.lang.properties.refactoring.ResourceBundleKeyRenameHandler"/>
-    <renameHandler implementation="com.intellij.lang.properties.refactoring.PropertyRenameHandler"/>
-    <stubElementTypeHolder class="com.intellij.lang.properties.parsing.PropertiesElementTypes"/>
-    <renamePsiElementProcessor implementation="com.intellij.lang.properties.refactoring.RenamePropertyProcessor"/>
-    <lang.commenter language="Properties" implementationClass="com.intellij.lang.properties.PropertiesCommenter"/>
-    <stubIndex implementation="com.intellij.lang.properties.psi.PropertyKeyIndex"/>
-    <lang.namesValidator language="Properties" implementationClass="com.intellij.lang.properties.PropertiesNamesValidator"/>
-    <refactoring.safeDeleteProcessor implementation="com.intellij.lang.properties.refactoring.PropertiesSafeDeleteProcessor"/>
-    <refactoring.moveHandler implementation="com.intellij.lang.properties.projectView.ResourceBundleMoveProvider"/>
-    <colorSettingsPage implementation="com.intellij.openapi.options.colors.pages.PropertiesColorsPage"/>
-    <treeStructureProvider implementation="com.intellij.lang.properties.projectView.ResourceBundleGrouper"/>
-    <elementDescriptionProvider implementation="com.intellij.lang.properties.PropertiesDescriptionProvider"/>
-    <fileTypeFactory implementation="com.intellij.lang.properties.PropertiesFileTypeFactory"/>
-    <fileTypeFactory implementation="com.intellij.lang.properties.editor.ResourceBundleEditorProvider" />
-    <favoriteNodeProvider implementation="com.intellij.ide.favoritesTreeView.ResourcesFavoriteNodeProvider"/>
-
-    <localInspection language="Properties" shortName="UnusedProperty" bundle="messages.PropertiesBundle" key="unused.property.inspection.display.name"
-                     groupKey="properties.files.inspection.group.display.name" enabledByDefault="true" level="WARNING"
-                     implementationClass="com.intellij.codeInspection.unused.UnusedPropertyInspection"/>
-    <globalInspection shortName="DuplicatePropertyInspection" bundle="messages.InspectionsBundle" key="duplicate.property.display.name"
-                      groupKey="group.names.properties.files" enabledByDefault="false" level="WARNING"
-                      implementationClass="com.intellij.codeInspection.duplicatePropertyInspection.DuplicatePropertyInspection"/>
-    <localInspection language="Properties" shortName="TrailingSpacesInProperty" bundle="messages.PropertiesBundle"
-                     key="trail.spaces.property.inspection.display.name" groupKey="properties.files.inspection.group.display.name"
-                     enabledByDefault="true" level="WARNING"
-                     implementationClass="com.intellij.lang.properties.TrailingSpacesInPropertyInspection"/>
-
-    <idIndexer filetype="Properties" implementationClass="com.intellij.psi.impl.cache.impl.idCache.PropertiesIdIndexer"/>
-    <todoIndexer filetype="Properties" implementationClass="com.intellij.psi.impl.cache.impl.idCache.PropertiesTodoIndexer"/>
-
-    <projectService serviceInterface="com.intellij.lang.properties.PropertiesReferenceManager" serviceImplementation="com.intellij.lang.properties.PropertiesReferenceManager"/>
-
-    <fileEditorProvider implementation="com.intellij.lang.properties.editor.ResourceBundleEditorProvider"/>
-    <spellchecker.support language="Properties" implementationClass="com.intellij.lang.properties.spellchecker.PropertiesSpellcheckingStrategy"/>
-
-    <fileBasedIndex implementation="com.intellij.lang.properties.xml.XmlPropertiesIndex"/>
-    <standardResource url="http://java.sun.com/dtd/properties.dtd" path="schemas/properties.dtd"/>
-    <iconProvider implementation="com.intellij.lang.properties.xml.XmlPropertiesIconProvider"/>
-    <psi.referenceContributor language="XML" implementation="com.intellij.lang.properties.xml.XmlPropertiesReferenceContributor"/>
-    <lang.foldingBuilder language="Properties" implementationClass="com.intellij.lang.properties.editor.PropertiesFoldingBuilder" />
-  </extensions>
-
-  <project-components>
-    <component>
-      <implementation-class>com.intellij.lang.properties.PropertiesFilesManager</implementation-class>
-      <skipForDefaultProject/>
-    </component>
-  </project-components>
+<idea-plugin version="2" xmlns:xi="http://www.w3.org/2001/XInclude">
+  <xi:include href="/META-INF/PropertiesPlugin.xml" xpointer="xpointer(/idea-plugin/*)"/>
 </idea-plugin>
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 192f455..0000000
--- 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 ee0b9f5..0000000
--- 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 2f8370d..0000000
--- 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 37eb79e..6fd19b2 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 @@
 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 @@
     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 316a0f8..0000000
--- 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 a80c90f..0000000
--- 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 370b6b6..0000000
--- 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 789cfc6..60d3376 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 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 0000000..8b2d3e3
--- /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/PropertySuppressableInspectionBase.java b/plugins/properties/src/com/intellij/lang/properties/PropertySuppressableInspectionBase.java
deleted file mode 100644
index 7aff268..0000000
--- 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/RemovePropertyFix.java b/plugins/properties/src/com/intellij/lang/properties/RemovePropertyFix.java
deleted file mode 100644
index a5fd365..0000000
--- 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 5c8c581..0000000
--- 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 9ff99a9..0000000
--- 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 0000000..a092ad1
--- /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 f9dcf03..0000000
--- 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 0a937f0..0000000
--- 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 a4e105a..0000000
--- 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 2f79936..0000000
--- 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 89e6baf..5abeb70 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.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.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 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 @@
   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 @@
                                                                        : 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 @@
       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 @@
     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 @@
     });
   }
 
-  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 @@
     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 @@
   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 @@
 
   @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 @@
     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 0000000..9c02983
--- /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/ResourceBundleFileType.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileType.java
index 9defcbc..17a80f5 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.openapi.fileTypes.ex.FakeFileType;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.lang.properties.PropertiesBundle;
+import com.intellij.openapi.fileTypes.ex.FakeFileType;
+import com.intellij.openapi.vfs.VirtualFile;
 import org.jetbrains.annotations.NotNull;
 
 /**
@@ -40,7 +38,4 @@
     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/ResourceBundleUtil.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleUtil.java
deleted file mode 100644
index ab2035c..0000000
--- 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 99e7338..0000000
--- 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 0239356..0000000
--- 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 c4d54d6..0000000
--- 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 eb32811..0000000
--- 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 650f2ac..0000000
--- 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 303ed3c..7d7dbc1 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.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 @@
 
   @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 @@
 
   @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 31c821c..fe555a7 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.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 @@
 
     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 edcb2e9..335cacb 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 @@
     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 0000000..e356771
--- /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 ff5fcfd..0000000
--- 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 bcc1e84..0000000
--- 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/PropertiesSeparatorManager.java b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesSeparatorManager.java
deleted file mode 100644
index 91c7d88..0000000
--- 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/xml/XmlPropertiesIconProvider.java b/plugins/properties/src/com/intellij/lang/properties/xml/XmlPropertiesIconProvider.java
deleted file mode 100644
index a6757d0..0000000
--- 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 bb66ee5..0000000
--- 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 10e2134..0000000
--- 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 4224983..0000000
--- 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 b810a43..0000000
--- 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);
-  }
-}
diff --git a/plugins/properties/testSrc/com/intellij/lang/properties/TrailingSpacesInPropertyInspectionTest.java b/plugins/properties/testSrc/com/intellij/lang/properties/TrailingSpacesInPropertyInspectionTest.java
index 19dc891..54064ee 100644
--- a/plugins/properties/testSrc/com/intellij/lang/properties/TrailingSpacesInPropertyInspectionTest.java
+++ b/plugins/properties/testSrc/com/intellij/lang/properties/TrailingSpacesInPropertyInspectionTest.java
@@ -1,5 +1,21 @@
+/*
+ * 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.codeInspection.TrailingSpacesInPropertyInspection;
 import com.intellij.openapi.application.PluginPathManager;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.testFramework.PlatformTestCase;
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/NativeLogReader.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/NativeLogReader.java
index 3a2068f..d32e980 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/NativeLogReader.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/NativeLogReader.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.
@@ -31,6 +31,7 @@
   private static final Logger LOG = Logger.getInstance("#org.jetbrains.idea.svn.NativeLogReader");
 
   private final static MultiMap<Thread, CallInfo> ourCallLog = new MultiMap<Thread, CallInfo>() {
+    @NotNull
     @Override
     protected Collection<CallInfo> createCollection() {
       return new ArrayList<CallInfo>(2);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileSystemListener.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileSystemListener.java
index 77e0a8f..5c5419d 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileSystemListener.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnFileSystemListener.java
@@ -583,7 +583,7 @@
       }
     }
     final File tmpFile = FileUtil.findSequentNonexistentFile(myStorageForUndo, "tmp", "");
-    myUndoStorageContents.add(0, Couple.newOne(new File(file.getPath()), tmpFile));
+    myUndoStorageContents.add(0, Couple.of(new File(file.getPath()), tmpFile));
     new File(file.getPath()).renameTo(tmpFile);
   }
 
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnNativeCallsTranslator.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnNativeCallsTranslator.java
index a8d6399..873cea9 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnNativeCallsTranslator.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnNativeCallsTranslator.java
@@ -122,26 +122,26 @@
 
     static {
       gnomeMessages.put(ISVNGnomeKeyringLibrary.GNOME_KEYRING_RESULT_OK,
-                        Couple.newOne("GNOME_KEYRING_RESULT_OK", "The operation completed successfully."));
+                        Couple.of("GNOME_KEYRING_RESULT_OK", "The operation completed successfully."));
       gnomeMessages.put(ISVNGnomeKeyringLibrary.GNOME_KEYRING_RESULT_DENIED,
-                        Couple.newOne("GNOME_KEYRING_RESULT_DENIED", "Either the user or daemon denied access."));
+                        Couple.of("GNOME_KEYRING_RESULT_DENIED", "Either the user or daemon denied access."));
       gnomeMessages.put(ISVNGnomeKeyringLibrary.GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON,
-                        Couple.newOne("GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON", "Keyring daemon is not available."));
+                        Couple.of("GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON", "Keyring daemon is not available."));
       gnomeMessages.put(ISVNGnomeKeyringLibrary.GNOME_KEYRING_RESULT_ALREADY_UNLOCKED,
-                        Couple.newOne("GNOME_KEYRING_RESULT_ALREADY_UNLOCKED", "Keyring was already unlocked."));
+                        Couple.of("GNOME_KEYRING_RESULT_ALREADY_UNLOCKED", "Keyring was already unlocked."));
       gnomeMessages.put(ISVNGnomeKeyringLibrary.GNOME_KEYRING_RESULT_NO_SUCH_KEYRING,
-                        Couple.newOne("GNOME_KEYRING_RESULT_NO_SUCH_KEYRING", "No such keyring exists."));
+                        Couple.of("GNOME_KEYRING_RESULT_NO_SUCH_KEYRING", "No such keyring exists."));
 
       gnomeMessages.put(ISVNGnomeKeyringLibrary.GNOME_KEYRING_RESULT_BAD_ARGUMENTS,
-                        Couple.newOne("GNOME_KEYRING_RESULT_BAD_ARGUMENTS", "Bad arguments to function."));
+                        Couple.of("GNOME_KEYRING_RESULT_BAD_ARGUMENTS", "Bad arguments to function."));
       gnomeMessages.put(ISVNGnomeKeyringLibrary.GNOME_KEYRING_RESULT_IO_ERROR,
-                        Couple.newOne("GNOME_KEYRING_RESULT_IO_ERROR", "Problem communicating with daemon."));
+                        Couple.of("GNOME_KEYRING_RESULT_IO_ERROR", "Problem communicating with daemon."));
       gnomeMessages.put(ISVNGnomeKeyringLibrary.GNOME_KEYRING_RESULT_CANCELLED,
-                        Couple.newOne("GNOME_KEYRING_RESULT_CANCELLED", "Operation was cancelled."));
+                        Couple.of("GNOME_KEYRING_RESULT_CANCELLED", "Operation was cancelled."));
       gnomeMessages.put(ISVNGnomeKeyringLibrary.GNOME_KEYRING_RESULT_KEYRING_ALREADY_EXISTS,
-                        Couple.newOne("GNOME_KEYRING_RESULT_KEYRING_ALREADY_EXISTS", "The keyring already exists."));
+                        Couple.of("GNOME_KEYRING_RESULT_KEYRING_ALREADY_EXISTS", "The keyring already exists."));
       gnomeMessages.put(ISVNGnomeKeyringLibrary.GNOME_KEYRING_RESULT_NO_MATCH,
-                        Couple.newOne("GNOME_KEYRING_RESULT_NO_MATCH", "No such match found."));
+                        Couple.of("GNOME_KEYRING_RESULT_NO_MATCH", "No such match found."));
     }
   }
 
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java
index 988d35c..5fe1996 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java
@@ -348,10 +348,9 @@
       boolean isDirectory = node.getUserObject() instanceof SVNURL ||
                             (node.getSVNDirEntry() != null && node.getSVNDirEntry().getKind() == SVNNodeKind.DIR);
       String url = node.getURL().toDecodedString();
-      final SvnRepositoryLocation repositoryLocation = new SvnRepositoryLocation(node.getURL().toString());
 
       AbstractVcsHelper.getInstance(myProject)
-        .showFileHistory(myVCS.getVcsHistoryProvider(), VcsUtil.getFilePathOnNonLocal(url, isDirectory), myVCS, repositoryLocation);
+        .showFileHistory(myVCS.getVcsHistoryProvider(), VcsUtil.getFilePathOnNonLocal(url, isDirectory), myVCS, url);
       node.reload(false);
     }
   }
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/RootsAndBranches.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/RootsAndBranches.java
index 371b5d5..00d3d6a 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/RootsAndBranches.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/RootsAndBranches.java
@@ -148,14 +148,14 @@
     for (Map.Entry<String, SvnMergeInfoRootPanelManual> entry : myMergePanels.entrySet()) {
       final String localPath = entry.getKey();
       final WCInfoWithBranches wcInfo = entry.getValue().getWcInfo();
-      states.put(Couple.newOne(localPath, wcInfo.getUrl().toString()), entry.getValue().getInfo());
+      states.put(Couple.of(localPath, wcInfo.getUrl().toString()), entry.getValue().getInfo());
     }
     createPanels(myLocation, new Runnable() {
       public void run() {
         for (Map.Entry<String, SvnMergeInfoRootPanelManual> entry : myMergePanels.entrySet()) {
           final String localPath = entry.getKey();
           final WCInfoWithBranches wcInfo = entry.getValue().getWcInfo();
-          final Couple<String> key = Couple.newOne(localPath, wcInfo.getUrl().toString());
+          final Couple<String> key = Couple.of(localPath, wcInfo.getUrl().toString());
           final SvnMergeInfoRootPanelManual.InfoHolder infoHolder = states.get(key);
           if (infoHolder !=  null) {
             entry.getValue().initSelection(infoHolder);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/MergeInfoHolder.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/MergeInfoHolder.java
index f84019c..9276abd 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/MergeInfoHolder.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/mergeinfo/MergeInfoHolder.java
@@ -86,7 +86,7 @@
   }
 
   private static Couple<String> createKey(final WCPaths root, final WCInfoWithBranches.Branch branch) {
-    return Couple.newOne(root.getPath(), branch.getUrl());
+    return Couple.of(root.getPath(), branch.getUrl());
   }
 
   public void refresh(final boolean ignoreEnabled) {
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/SvnRollbackEnvironment.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/SvnRollbackEnvironment.java
index 7c5ec8e..01c86eb 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/SvnRollbackEnvironment.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/rollback/SvnRollbackEnvironment.java
@@ -355,7 +355,7 @@
     }
 
     private void markRename(@NotNull final File beforeFile, @NotNull final File afterFile) {
-      myToBeDeleted.add(Couple.newOne(beforeFile, afterFile));
+      myToBeDeleted.add(Couple.of(beforeFile, afterFile));
     }
 
     public ThroughRenameInfo findToFile(@NotNull final FilePath file, @Nullable final File firstTo) {
diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnHistoryTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnHistoryTest.java
index ae867ab..3250921 100644
--- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnHistoryTest.java
+++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnHistoryTest.java
@@ -25,7 +25,6 @@
 import com.intellij.openapi.vcs.history.VcsHistoryProvider;
 import com.intellij.util.concurrency.Semaphore;
 import junit.framework.Assert;
-import org.jetbrains.annotations.Nullable;
 import org.junit.Test;
 
 /**
@@ -78,12 +77,6 @@
       public void beforeRefresh() {
       }
 
-      @Nullable
-      @Override
-      public RepositoryLocation getRepositoryLocation() {
-        return null;
-      }
-
       @Override
       public void forceRefresh() {
       }
@@ -134,12 +127,6 @@
       public void beforeRefresh() {
       }
 
-      @Nullable
-      @Override
-      public RepositoryLocation getRepositoryLocation() {
-        return null;
-      }
-
       @Override
       public void forceRefresh() {
       }
@@ -189,12 +176,6 @@
       public void beforeRefresh() {
       }
 
-      @Nullable
-      @Override
-      public RepositoryLocation getRepositoryLocation() {
-        return null;
-      }
-
       @Override
       public void forceRefresh() {
       }
@@ -248,12 +229,6 @@
       public void beforeRefresh() {
       }
 
-      @Nullable
-      @Override
-      public RepositoryLocation getRepositoryLocation() {
-        return null;
-      }
-
       @Override
       public void forceRefresh() {
       }
@@ -308,12 +283,6 @@
       public void beforeRefresh() {
       }
 
-      @Nullable
-      @Override
-      public RepositoryLocation getRepositoryLocation() {
-        return null;
-      }
-
       @Override
       public void forceRefresh() {
       }
@@ -348,12 +317,6 @@
       public void beforeRefresh() {
       }
 
-      @Nullable
-      @Override
-      public RepositoryLocation getRepositoryLocation() {
-        return null;
-      }
-
       @Override
       public void forceRefresh() {
       }
@@ -387,12 +350,6 @@
       public void beforeRefresh() {
       }
 
-      @Nullable
-      @Override
-      public RepositoryLocation getRepositoryLocation() {
-        return null;
-      }
-
       @Override
       public void forceRefresh() {
       }
diff --git a/plugins/tasks/tasks-core/src/META-INF/plugin.xml b/plugins/tasks/tasks-core/src/META-INF/plugin.xml
index 621cb8f..2eb5ff1 100644
--- a/plugins/tasks/tasks-core/src/META-INF/plugin.xml
+++ b/plugins/tasks/tasks-core/src/META-INF/plugin.xml
@@ -121,6 +121,7 @@
     <tasks.contextProvider implementation="com.intellij.tasks.context.ProjectViewContextProvider"/>
     <tasks.contextProvider implementation="com.intellij.tasks.context.RunConfigurationsContextProvider"/>
     <tasks.contextProvider implementation="com.intellij.tasks.context.XDebuggerBreakpointsContextProvider"/>
+    <tasks.contextProvider implementation="com.intellij.tasks.context.XDebuggerWatchesProvider"/>
 
     <tasks.repositoryType implementation="com.intellij.tasks.jira.JiraRepositoryType"/>
     <tasks.repositoryType implementation="com.intellij.tasks.youtrack.YouTrackRepositoryType"/>
diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/context/OpenEditorsContextProvider.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/context/OpenEditorsContextProvider.java
index f3f0395..8902689 100644
--- a/plugins/tasks/tasks-core/src/com/intellij/tasks/context/OpenEditorsContextProvider.java
+++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/context/OpenEditorsContextProvider.java
@@ -17,7 +17,11 @@
 package com.intellij.tasks.context;
 
 import com.intellij.openapi.fileEditor.FileEditorManager;
+import com.intellij.openapi.fileEditor.impl.DockableEditorTabbedContainer;
 import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl;
+import com.intellij.ui.docking.DockContainer;
+import com.intellij.ui.docking.DockManager;
+import com.intellij.ui.docking.impl.DockManagerImpl;
 import org.jdom.Element;
 import org.jetbrains.annotations.NotNull;
 
@@ -27,8 +31,10 @@
 public class OpenEditorsContextProvider extends WorkingContextProvider {
 
   private final FileEditorManagerImpl myFileEditorManager;
+  private final DockManagerImpl myDockManager;
 
-  public OpenEditorsContextProvider(FileEditorManager fileEditorManager) {
+  public OpenEditorsContextProvider(FileEditorManager fileEditorManager, DockManager dockManager) {
+    myDockManager = (DockManagerImpl)dockManager;
     myFileEditorManager = fileEditorManager instanceof FileEditorManagerImpl ? (FileEditorManagerImpl)fileEditorManager : null;
   }
 
@@ -48,6 +54,8 @@
     if (myFileEditorManager != null) {
       myFileEditorManager.writeExternal(element);
     }
+    Element state = myDockManager.getState();
+    element.addContent(state);
   }
 
   public void loadContext(Element element) {
@@ -55,6 +63,11 @@
       myFileEditorManager.readExternal(element);
       myFileEditorManager.getMainSplitters().openFiles();
     }
+    Element dockState = element.getChild("DockManager");
+    if (dockState != null) {
+      myDockManager.loadState(dockState);
+      myDockManager.readState();
+    }
   }
 
   public void clearContext() {
@@ -62,5 +75,10 @@
       myFileEditorManager.closeAllFiles();
       myFileEditorManager.getMainSplitters().clear();
     }
+    for (DockContainer container : myDockManager.getContainers()) {
+      if (container instanceof DockableEditorTabbedContainer) {
+        container.closeAll();
+      }
+    }
   }
 }
diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/context/WorkingContextManager.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/context/WorkingContextManager.java
index 2fc0573..9aff123 100644
--- a/plugins/tasks/tasks-core/src/com/intellij/tasks/context/WorkingContextManager.java
+++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/context/WorkingContextManager.java
@@ -75,7 +75,7 @@
     myProject = project;
   }
 
-  private void loadContext(Element fromElement) {
+  public void loadContext(Element fromElement) {
     for (WorkingContextProvider provider : Extensions.getExtensions(WorkingContextProvider.EP_NAME, myProject)) {
       try {
         Element child = fromElement.getChild(provider.getId());
diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/context/XDebuggerWatchesProvider.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/context/XDebuggerWatchesProvider.java
new file mode 100644
index 0000000..62b2699
--- /dev/null
+++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/context/XDebuggerWatchesProvider.java
@@ -0,0 +1,76 @@
+/*
+ * 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.tasks.context;
+
+import com.intellij.openapi.util.InvalidDataException;
+import com.intellij.openapi.util.WriteExternalException;
+import com.intellij.util.xmlb.Accessor;
+import com.intellij.util.xmlb.SerializationFilter;
+import com.intellij.util.xmlb.XmlSerializer;
+import com.intellij.xdebugger.XDebuggerManager;
+import com.intellij.xdebugger.impl.XDebuggerManagerImpl;
+import com.intellij.xdebugger.impl.XDebuggerWatchesManager;
+import org.jdom.Element;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Dmitry Avdeev
+ */
+public class XDebuggerWatchesProvider extends WorkingContextProvider {
+
+  private final XDebuggerWatchesManager myWatchesManager;
+
+  public XDebuggerWatchesProvider(XDebuggerManager xDebuggerManager) {
+    myWatchesManager = ((XDebuggerManagerImpl)xDebuggerManager).getWatchesManager();
+  }
+
+  @NotNull
+  @Override
+  public String getId() {
+    return "watches";
+  }
+
+  @NotNull
+  @Override
+  public String getDescription() {
+    return "Debugger watches";
+  }
+
+  @Override
+  public void saveContext(Element toElement) throws WriteExternalException {
+    XDebuggerWatchesManager.WatchesManagerState state = myWatchesManager.getState();
+    Element serialize = XmlSerializer.serialize(state, new SerializationFilter() {
+      @Override
+      public boolean accepts(Accessor accessor, Object bean) {
+        return accessor.read(bean) != null;
+      }
+    });
+    toElement.addContent(serialize.removeContent());
+  }
+
+  @Override
+  public void loadContext(Element fromElement) throws InvalidDataException {
+    XDebuggerWatchesManager.WatchesManagerState state =
+      XmlSerializer.deserialize(fromElement, XDebuggerWatchesManager.WatchesManagerState.class);
+    myWatchesManager.loadState(state);
+
+  }
+
+  @Override
+  public void clearContext() {
+    myWatchesManager.loadState(null);
+  }
+}
diff --git a/plugins/tasks/tasks-tests/tasks-tests.iml b/plugins/tasks/tasks-tests/tasks-tests.iml
index 71f4017..d09122f 100644
--- a/plugins/tasks/tasks-tests/tasks-tests.iml
+++ b/plugins/tasks/tasks-tests/tasks-tests.iml
@@ -20,6 +20,7 @@
     <orderEntry type="module" module-name="git4idea" scope="TEST" />
     <orderEntry type="library" name="gson" level="project" />
     <orderEntry type="module" module-name="jira" scope="TEST" />
+    <orderEntry type="module" module-name="testFramework" scope="TEST" />
   </component>
 </module>
 
diff --git a/plugins/tasks/tasks-tests/test/com/intellij/tasks/context/EditorsContextTest.java b/plugins/tasks/tasks-tests/test/com/intellij/tasks/context/EditorsContextTest.java
new file mode 100644
index 0000000..ec2cf84
--- /dev/null
+++ b/plugins/tasks/tasks-tests/test/com/intellij/tasks/context/EditorsContextTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.tasks.context;
+
+import com.intellij.openapi.editor.EditorFactory;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.testFramework.FileEditorManagerTestCase;
+import com.intellij.ui.docking.DockManager;
+import org.jdom.Element;
+
+/**
+ * @author Dmitry Avdeev
+ */
+public class EditorsContextTest extends FileEditorManagerTestCase {
+
+  public void testDockableContainer() throws Exception {
+
+    VirtualFile file = getFile("/foo.txt");
+    myManager.openFile(file, false);
+    DockManager dockManager = DockManager.getInstance(getProject());
+    assertEquals(1, dockManager.getContainers().size());
+    myManager.initDockableContentFactory();
+
+    myManager.openFileInNewWindow(file);
+    assertEquals(2, dockManager.getContainers().size());
+
+    Element context = new Element("context");
+    WorkingContextManager contextManager = WorkingContextManager.getInstance(getProject());
+    contextManager.saveContext(context);
+    assertEquals(2, context.getChild("editors").getChildren().size());
+    assertEquals(2, EditorFactory.getInstance().getAllEditors().length);
+
+    contextManager.clearContext();
+    assertEquals(1, dockManager.getContainers().size());
+    assertEquals(0, EditorFactory.getInstance().getAllEditors().length);
+
+    //contextManager.loadContext(context);
+    //assertEquals(2, dockManager.getContainers().size());
+    //Editor[] editors = EditorFactory.getInstance().getAllEditors();
+    //assertEquals(2, editors.length);
+    //
+    //contextManager.clearContext();
+  }
+
+  protected String getBasePath() {
+    return "/plugins/tasks/tasks-tests/testData/context";
+  }
+
+  @Override
+  protected boolean isCommunity() {
+    return true;
+  }
+
+}
diff --git a/plugins/tasks/tasks-tests/testData/context/foo.txt b/plugins/tasks/tasks-tests/testData/context/foo.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/plugins/tasks/tasks-tests/testData/context/foo.txt
@@ -0,0 +1 @@
+
diff --git a/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGPatternConfigurationProducer.java b/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGPatternConfigurationProducer.java
index 9869e9c..67f3eb1 100644
--- a/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGPatternConfigurationProducer.java
+++ b/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGPatternConfigurationProducer.java
@@ -27,6 +27,7 @@
 import com.intellij.execution.junit.JUnitUtil;
 import com.intellij.execution.junit2.info.MethodLocation;
 import com.intellij.execution.testframework.AbstractTestProxy;
+import com.intellij.execution.testframework.TestsUIUtil;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.actionSystem.LangDataKeys;
@@ -86,7 +87,7 @@
   }
 
   public static boolean isMultipleElementsSelected(ConfigurationContext context) {
-    if (AbstractTestProxy.DATA_KEY.getData(context.getDataContext()) != null) return false;
+    if (TestsUIUtil.isMultipleSelectionImpossible(context.getDataContext())) return false;
     final LinkedHashSet<String> classes = new LinkedHashSet<String>();
     final PsiElement[] elements = collectPatternElements(context, classes);
     if (elements != null && collectTestMembers(elements).size() > 1) {
diff --git a/plugins/testng/src/com/theoryinpractice/testng/ui/actions/RerunFailedTestsAction.java b/plugins/testng/src/com/theoryinpractice/testng/ui/actions/RerunFailedTestsAction.java
index 293299a..a353805 100644
--- a/plugins/testng/src/com/theoryinpractice/testng/ui/actions/RerunFailedTestsAction.java
+++ b/plugins/testng/src/com/theoryinpractice/testng/ui/actions/RerunFailedTestsAction.java
@@ -9,10 +9,13 @@
 import com.intellij.execution.runners.ExecutionEnvironment;
 import com.intellij.execution.testframework.AbstractTestProxy;
 import com.intellij.openapi.module.Module;
+import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.ComponentContainer;
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiModifier;
+import com.intellij.psi.search.GlobalSearchScope;
 import com.theoryinpractice.testng.configuration.SearchingForTestsTask;
 import com.theoryinpractice.testng.configuration.TestNGConfiguration;
 import com.theoryinpractice.testng.configuration.TestNGRunnableState;
@@ -50,13 +53,22 @@
             return new SearchingForTestsTask(serverSocket, config, tempFile, client) {
               @Override
               protected void fillTestObjects(final Map<PsiClass, Collection<PsiMethod>> classes) throws CantRunException {
+                final GlobalSearchScope scope = config.getConfigurationModule().getSearchScope();
+                final Project project = config.getProject();
                 for (AbstractTestProxy proxy : failedTests) {
-                  final Location location = proxy.getLocation(config.getProject(), config.getConfigurationModule().getSearchScope());
+                  final Location location = proxy.getLocation(project, scope);
                   if (location != null) {
                     final PsiElement element = location.getPsiElement();
                     if (element instanceof PsiMethod && element.isValid()) {
                       final PsiMethod psiMethod = (PsiMethod)element;
-                      final PsiClass psiClass = psiMethod.getContainingClass();
+                      PsiClass psiClass = psiMethod.getContainingClass();
+                      if (psiClass != null && psiClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
+                        final AbstractTestProxy parent = proxy.getParent();
+                        final PsiElement elt = parent != null ? parent.getLocation(project, scope).getPsiElement() : null;
+                        if (elt instanceof PsiClass) {
+                          psiClass = (PsiClass)elt;
+                        }
+                      }
                       Collection<PsiMethod> psiMethods = classes.get(psiClass);
                       if (psiMethods == null) {
                         psiMethods = new ArrayList<PsiMethod>();
diff --git a/plugins/testng/src/inspectionDescriptions/AssertEqualsBetweenInconvertibleTypesTestNG.html b/plugins/testng/src/inspectionDescriptions/AssertEqualsBetweenInconvertibleTypesTestNG.html
index bd61526..da93b41 100644
--- a/plugins/testng/src/inspectionDescriptions/AssertEqualsBetweenInconvertibleTypesTestNG.html
+++ b/plugins/testng/src/inspectionDescriptions/AssertEqualsBetweenInconvertibleTypesTestNG.html
@@ -4,5 +4,4 @@
 types. While such a call might theoretically be useful, most likely it represents a bug.
 <!-- tooltip end -->
 <p>
-<small>New in 12, Powered by TestNG-J</small>
 </body></html>
\ No newline at end of file
diff --git a/plugins/testng/src/inspectionDescriptions/AssertsWithoutMessagesTestNG.html b/plugins/testng/src/inspectionDescriptions/AssertsWithoutMessagesTestNG.html
index 75337ee..d13c628 100644
--- a/plugins/testng/src/inspectionDescriptions/AssertsWithoutMessagesTestNG.html
+++ b/plugins/testng/src/inspectionDescriptions/AssertsWithoutMessagesTestNG.html
@@ -4,6 +4,5 @@
 An error message on assertion failure may help clarify the test case's intent.
 <!-- tooltip end -->
 <p>
-<small>New in 12, Powered by TestNG-J</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/testng/src/inspectionDescriptions/ExpectedExceptionNeverThrownTestNG.html b/plugins/testng/src/inspectionDescriptions/ExpectedExceptionNeverThrownTestNG.html
index 106478a..a50cb14 100644
--- a/plugins/testng/src/inspectionDescriptions/ExpectedExceptionNeverThrownTestNG.html
+++ b/plugins/testng/src/inspectionDescriptions/ExpectedExceptionNeverThrownTestNG.html
@@ -3,7 +3,5 @@
 This inspection reports checked exceptions expected by a TestNG test method,
 which are never thrown inside the method body.
 <!-- tooltip end -->
-<p>
-  <small>New in 12, Powered by TestNG-J</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/testng/src/inspectionDescriptions/MisorderedAssertEqualsArgumentsTestNG.html b/plugins/testng/src/inspectionDescriptions/MisorderedAssertEqualsArgumentsTestNG.html
index 484099e..06a3fe6 100644
--- a/plugins/testng/src/inspectionDescriptions/MisorderedAssertEqualsArgumentsTestNG.html
+++ b/plugins/testng/src/inspectionDescriptions/MisorderedAssertEqualsArgumentsTestNG.html
@@ -5,7 +5,5 @@
 will behave fine for assertions which pass, but may give confusing error reports if their expected and actual
 arguments differ.
 <!-- tooltip end -->
-<p>
-  <small>New in 12, Powered by TestNG-J</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/plugins/ui-designer-core/src/com/intellij/designer/DesignerEditor.java b/plugins/ui-designer-core/src/com/intellij/designer/DesignerEditor.java
index 7c73ebe..d44274d 100644
--- a/plugins/ui-designer-core/src/com/intellij/designer/DesignerEditor.java
+++ b/plugins/ui-designer-core/src/com/intellij/designer/DesignerEditor.java
@@ -22,13 +22,11 @@
 import com.intellij.openapi.fileEditor.FileEditorState;
 import com.intellij.openapi.fileEditor.FileEditorStateLevel;
 import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleUtilCore;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.UserDataHolderBase;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.testFramework.LightVirtualFile;
 import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
 import java.beans.PropertyChangeListener;
@@ -43,17 +41,10 @@
     if (file instanceof LightVirtualFile) {
       file = ((LightVirtualFile)file).getOriginalFile();
     }
-    Module module = findModule(project, file);
-    if (module == null) {
-      throw new IllegalArgumentException("No module for file " + file + " in project " + project);
-    }
-    myDesignerPanel = createDesignerPanel(project, module, file);
+    myDesignerPanel = createDesignerPanel(project, findModule(project, file), file);
   }
 
-  @Nullable
-  protected Module findModule(Project project, VirtualFile file) {
-    return ModuleUtilCore.findModuleForFile(file, project);
-  }
+  protected abstract Module findModule(Project project, VirtualFile file);
 
   @NotNull
   protected abstract DesignerEditorPanel createDesignerPanel(Project project, Module module, VirtualFile file);
diff --git a/plugins/ui-designer-core/src/com/intellij/designer/DesignerToolWindow.java b/plugins/ui-designer-core/src/com/intellij/designer/DesignerToolWindow.java
index cffd41b..0246e43 100644
--- a/plugins/ui-designer-core/src/com/intellij/designer/DesignerToolWindow.java
+++ b/plugins/ui-designer-core/src/com/intellij/designer/DesignerToolWindow.java
@@ -135,7 +135,7 @@
       @Override
       public void actionPerformed(AnActionEvent e) {
         if (myTreeBuilder != null) {
-          myTreeBuilder.expandAll(null);
+          TreeUtil.expandAll(myComponentTree);
         }
       }
     };
diff --git a/plugins/ui-designer-core/src/com/intellij/designer/designSurface/DesignerEditorPanel.java b/plugins/ui-designer-core/src/com/intellij/designer/designSurface/DesignerEditorPanel.java
index ef39d68..0679245 100644
--- a/plugins/ui-designer-core/src/com/intellij/designer/designSurface/DesignerEditorPanel.java
+++ b/plugins/ui-designer-core/src/com/intellij/designer/designSurface/DesignerEditorPanel.java
@@ -143,7 +143,7 @@
 
   protected String myLastExecuteCommand;
 
-  public DesignerEditorPanel(@NotNull DesignerEditor editor, @NotNull Project project, @NotNull Module module, @NotNull VirtualFile file) {
+  public DesignerEditorPanel(@NotNull DesignerEditor editor, @NotNull Project project, Module module, @NotNull VirtualFile file) {
     myEditor = editor;
     myProject = project;
     myModule = module;
diff --git a/plugins/ui-designer/src/META-INF/plugin.xml b/plugins/ui-designer/src/META-INF/plugin.xml
index 49e29d9..6724c40 100644
--- a/plugins/ui-designer/src/META-INF/plugin.xml
+++ b/plugins/ui-designer/src/META-INF/plugin.xml
@@ -125,7 +125,6 @@
 
     <fileBasedIndex implementation="com.intellij.uiDesigner.binding.FormClassIndex"/>
 
-    <compiler implementation="com.intellij.uiDesigner.make.Form2ByteCodeCompiler"/>
     <compiler implementation="com.intellij.uiDesigner.make.Form2SourceCompiler"/>
     <compileServer.plugin classpath="jps/ui-designer-jps-plugin.jar"/>
 
diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/GridBuildUtil.java b/plugins/ui-designer/src/com/intellij/uiDesigner/GridBuildUtil.java
index a24b063..a653056 100644
--- a/plugins/ui-designer/src/com/intellij/uiDesigner/GridBuildUtil.java
+++ b/plugins/ui-designer/src/com/intellij/uiDesigner/GridBuildUtil.java
@@ -320,7 +320,7 @@
     }
 
 
-    return Couple.newOne(
+    return Couple.of(
       new Integer(Util.eliminate(y, rowSpans, null)),
       new Integer(Util.eliminate(x, colSpans, null))
     );
diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/actions/PreviewFormAction.java b/plugins/ui-designer/src/com/intellij/uiDesigner/actions/PreviewFormAction.java
index b859b27..ce26a9b 100644
--- a/plugins/ui-designer/src/com/intellij/uiDesigner/actions/PreviewFormAction.java
+++ b/plugins/ui-designer/src/com/intellij/uiDesigner/actions/PreviewFormAction.java
@@ -54,7 +54,6 @@
 import com.intellij.uiDesigner.compiler.Utils;
 import com.intellij.uiDesigner.designSurface.GuiEditor;
 import com.intellij.uiDesigner.lw.*;
-import com.intellij.uiDesigner.make.Form2ByteCodeCompiler;
 import com.intellij.uiDesigner.make.PreviewNestedFormLoader;
 import com.intellij.util.PathsList;
 import com.intellij.util.containers.HashSet;
@@ -66,8 +65,11 @@
 import javax.swing.*;
 import java.io.File;
 import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
+import java.util.StringTokenizer;
 
 /**
  * @author Anton Katilin
@@ -84,6 +86,21 @@
   @NonNls private static final String RUNTIME_BUNDLE_PREFIX = "RuntimeBundle";
   @NonNls public static final String PREVIEW_BINDING_FIELD = "myComponent";
 
+  @NotNull
+  public static InstrumentationClassFinder createClassFinder(@NotNull final String classPath){
+    final ArrayList<URL> urls = new ArrayList<URL>();
+    for (StringTokenizer tokenizer = new StringTokenizer(classPath, File.pathSeparator); tokenizer.hasMoreTokens();) {
+      final String s = tokenizer.nextToken();
+      try {
+        urls.add(new File(s).toURI().toURL());
+      }
+      catch (Exception exc) {
+        throw new RuntimeException(exc);
+      }
+    }
+    return new InstrumentationClassFinder(urls.toArray(new URL[urls.size()]));
+  }
+
   public void actionPerformed(final AnActionEvent e) {
     final GuiEditor editor = FormEditingUtil.getActiveEditor(e.getDataContext());
     if (editor != null) {
@@ -128,7 +145,7 @@
     final String classPath = OrderEnumerator.orderEntries(module).recursively().getPathsList().getPathsString() + File.pathSeparator +
       sources.getPathsString() + File.pathSeparator + /* resources bundles */
       tempPath;
-    final InstrumentationClassFinder finder = Form2ByteCodeCompiler.createClassFinder(classPath);
+    final InstrumentationClassFinder finder = createClassFinder(classPath);
 
     try {
       final Document doc = FileDocumentManager.getInstance().getDocument(formFile);
diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormRelatedFilesProvider.java b/plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormRelatedFilesProvider.java
index 7918ace..dbe2838 100644
--- a/plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormRelatedFilesProvider.java
+++ b/plugins/ui-designer/src/com/intellij/uiDesigner/binding/FormRelatedFilesProvider.java
@@ -51,7 +51,7 @@
     }
     else {
       PsiFile file = context.getContainingFile();
-      if (file.getFileType() == GuiFormFileType.INSTANCE) {
+      if (file != null && file.getFileType() == GuiFormFileType.INSTANCE) {
         try {
           String className = Utils.getBoundClassName(file.getText());
           if (className != null) {
diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/make/Form2ByteCodeCompiler.java b/plugins/ui-designer/src/com/intellij/uiDesigner/make/Form2ByteCodeCompiler.java
deleted file mode 100644
index dd60ce6..0000000
--- a/plugins/ui-designer/src/com/intellij/uiDesigner/make/Form2ByteCodeCompiler.java
+++ /dev/null
@@ -1,444 +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.uiDesigner.make;
-
-import com.intellij.compiler.PsiClassWriter;
-import com.intellij.compiler.impl.CompilerUtil;
-import com.intellij.compiler.instrumentation.InstrumentationClassFinder;
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.compiler.*;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleUtil;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.OrderEnumerator;
-import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.vfs.VfsUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.JavaPsiFacade;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.uiDesigner.FormEditingUtil;
-import com.intellij.uiDesigner.GuiDesignerConfiguration;
-import com.intellij.uiDesigner.UIDesignerBundle;
-import com.intellij.uiDesigner.compiler.AlienFormFileException;
-import com.intellij.uiDesigner.compiler.AsmCodeGenerator;
-import com.intellij.uiDesigner.compiler.FormErrorInfo;
-import com.intellij.uiDesigner.compiler.Utils;
-import com.intellij.uiDesigner.lw.CompiledClassPropertiesProvider;
-import com.intellij.uiDesigner.lw.LwRootContainer;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jps.incremental.java.CopyResourcesUtil;
-
-import java.io.DataInput;
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.StringTokenizer;
-
-public final class Form2ByteCodeCompiler implements ClassInstrumentingCompiler {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.uiDesigner.make.Form2ByteCodeCompiler");
-
-  @Override
-  @NotNull
-  public String getDescription() {
-    return UIDesignerBundle.message("component.gui.designer.form.to.bytecode.compiler");
-  }
-
-  @Override
-  public boolean validateConfiguration(CompileScope scope) {
-    return true;
-  }
-
-  @NotNull
-  public static InstrumentationClassFinder createClassFinder(@NotNull final String classPath){
-    final ArrayList<URL> urls = new ArrayList<URL>();
-    for (StringTokenizer tokenizer = new StringTokenizer(classPath, File.pathSeparator); tokenizer.hasMoreTokens();) {
-      final String s = tokenizer.nextToken();
-      try {
-        urls.add(new File(s).toURI().toURL());
-      }
-      catch (Exception exc) {
-        throw new RuntimeException(exc);
-      }
-    }
-    return new InstrumentationClassFinder(urls.toArray(new URL[urls.size()]));
-  }
-
-  @Override
-  @NotNull
-  public ProcessingItem[] getProcessingItems(final CompileContext context) {
-    final Project project = context.getProject();
-    if (!GuiDesignerConfiguration.getInstance(project).INSTRUMENT_CLASSES) {
-      return ProcessingItem.EMPTY_ARRAY;
-    }
-
-    final ArrayList<ProcessingItem> items = new ArrayList<ProcessingItem>();
-
-    ApplicationManager.getApplication().runReadAction(new Runnable() {
-      @Override
-      public void run() {
-        final CompileScope scope = context.getCompileScope();
-        final CompileScope projectScope = context.getProjectCompileScope();
-
-        final VirtualFile[] formFiles = projectScope.getFiles(StdFileTypes.GUI_DESIGNER_FORM, true);
-        if (formFiles.length==0) return;
-        final CompilerManager compilerManager = CompilerManager.getInstance(project);
-        final BindingsCache bindingsCache = new BindingsCache(project);
-
-        final HashMap<Module, ArrayList<VirtualFile>> module2formFiles = sortByModules(project, formFiles);
-
-        try {
-          for (final Module module : module2formFiles.keySet()) {
-            final HashMap<String, VirtualFile> class2form = new HashMap<String, VirtualFile>();
-
-            final ArrayList<VirtualFile> list = module2formFiles.get(module);
-            for (final VirtualFile formFile : list) {
-              if (compilerManager.isExcludedFromCompilation(formFile)) {
-                continue;
-              }
-
-              final String classToBind;
-              try {
-                classToBind = bindingsCache.getBoundClassName(formFile);
-              }
-              catch (AlienFormFileException e) {
-                // ignore non-IDEA forms
-                continue;
-              }
-              catch (Exception e) {
-                addMessage(context, UIDesignerBundle.message("error.cannot.process.form.file", e), formFile, CompilerMessageCategory.ERROR);
-                continue;
-              }
-
-              if (classToBind == null) {
-                continue;
-              }
-
-              final VirtualFile classFile = findFile(context, classToBind, module);
-              if (classFile == null) {
-                if (scope.belongs(formFile.getUrl())) {
-                  addMessage(context, UIDesignerBundle.message("error.class.to.bind.does.not.exist", classToBind), formFile,
-                             CompilerMessageCategory.ERROR);
-                }
-                continue;
-              }
-
-              final VirtualFile alreadyProcessedForm = class2form.get(classToBind);
-              if (alreadyProcessedForm != null) {
-                if (belongsToCompileScope(context, formFile, classToBind)) {
-                  addMessage(
-                    context,
-                    UIDesignerBundle.message("error.duplicate.bind",
-                                             classToBind, alreadyProcessedForm.getPresentableUrl()),
-                    formFile, CompilerMessageCategory.ERROR);
-                }
-                continue;
-              }
-              class2form.put(classToBind, formFile);
-
-              final ProcessingItem item = new MyInstrumentationItem(classFile, formFile, classToBind);
-              items.add(item);
-            }
-          }
-        }
-        finally {
-          bindingsCache.close();
-        }
-      }
-    });
-
-    return items.toArray(new ProcessingItem[items.size()]);
-  }
-
-  private static boolean belongsToCompileScope(final CompileContext context, final VirtualFile formFile, final String classToBind) {
-    final CompileScope compileScope = context.getCompileScope();
-    if (compileScope.belongs(formFile.getUrl())) {
-      return true;
-    }
-    final VirtualFile sourceFile = findSourceFile(context, formFile, classToBind);
-    return sourceFile != null && compileScope.belongs(sourceFile.getUrl());
-  }
-
-  private static HashMap<Module, ArrayList<VirtualFile>> sortByModules(final Project project, final VirtualFile[] formFiles) {
-    final HashMap<Module, ArrayList<VirtualFile>> module2formFiles = new HashMap<Module,ArrayList<VirtualFile>>();
-    for (final VirtualFile formFile : formFiles) {
-      final Module module = ModuleUtil.findModuleForFile(formFile, project);
-      if (module != null) {
-        ArrayList<VirtualFile> list = module2formFiles.get(module);
-        if (list == null) {
-          list = new ArrayList<VirtualFile>();
-          module2formFiles.put(module, list);
-        }
-        list.add(formFile);
-      }
-      else {
-        // todo[anton] handle somehow
-      }
-    }
-    return module2formFiles;
-  }
-
-  private static HashMap<Module, ArrayList<MyInstrumentationItem>> sortByModules(final Project project, final ProcessingItem[] items) {
-    final HashMap<Module, ArrayList<MyInstrumentationItem>> module2formFiles = new HashMap<Module,ArrayList<MyInstrumentationItem>>();
-    for (ProcessingItem item1 : items) {
-      final MyInstrumentationItem item = (MyInstrumentationItem)item1;
-      final VirtualFile formFile = item.getFormFile();
-
-      final Module module = ModuleUtil.findModuleForFile(formFile, project);
-      if (module != null) {
-        ArrayList<MyInstrumentationItem> list = module2formFiles.get(module);
-        if (list == null) {
-          list = new ArrayList<MyInstrumentationItem>();
-          module2formFiles.put(module, list);
-        }
-        list.add(item);
-      }
-      else {
-        // todo[anton] handle somehow
-      }
-    }
-    return module2formFiles;
-  }
-
-  @Nullable
-  private static VirtualFile findFile(final CompileContext context, final String className, final Module module) {
-    /*for most cases (top-level classes) this will work*/
-    VirtualFile file = findFileByRelativePath(context, module, className.replace('.', '/') + ".class"); 
-    if (file == null) {
-      // getClassFileName() is much longer than simply conversion from dots into slashes, but works for inner classes
-      file = findFileByRelativePath(context, module, getClassFileName(className.replace('$', '.'), module) + ".class");
-    }
-    return file;
-  }
-
-  private static VirtualFile findFileByRelativePath(final CompileContext context, final Module module, final String relativepath) {
-    final VirtualFile output = context.getModuleOutputDirectory(module);
-    VirtualFile file = output != null? output.findFileByRelativePath(relativepath) : null;
-    if (file == null) {
-      final VirtualFile testsOutput = context.getModuleOutputDirectoryForTests(module);
-      if (testsOutput != null && !testsOutput.equals(output)) {
-        file = testsOutput.findFileByRelativePath(relativepath);
-      }
-    }
-    return file;
-  }
-
-  private static String getClassFileName(final String _className, final Module module) {
-    final PsiClass aClass = JavaPsiFacade.getInstance(module.getProject()).findClass(_className, GlobalSearchScope.moduleScope(module));
-    if (aClass == null) {
-      return _className.replace('.', '/');
-    }
-
-    PsiClass outerClass = aClass;
-    while (outerClass.getParent() instanceof PsiClass) {
-      outerClass = (PsiClass)outerClass.getParent();
-    }
-
-    final String outerQualifiedName = outerClass.getQualifiedName();
-
-    assert outerQualifiedName != null;
-    return outerQualifiedName.replace('.','/') + _className.substring(outerQualifiedName.length()).replace('.','$');
-  }
-
-  @Override
-  public ProcessingItem[] process(final CompileContext context, final ProcessingItem[] items) {
-    final ArrayList<ProcessingItem> compiledItems = new ArrayList<ProcessingItem>();
-
-    context.getProgressIndicator().pushState();
-    context.getProgressIndicator().setText(UIDesignerBundle.message("progress.compiling.ui.forms"));
-
-    final Project project = context.getProject();
-    final HashMap<Module, ArrayList<MyInstrumentationItem>> module2itemsList = sortByModules(project, items);
-
-    List<File> filesToRefresh = new ArrayList<File>();
-    for (final Module module : module2itemsList.keySet()) {
-      final String classPath = OrderEnumerator.orderEntries(module).recursively().getPathsList().getPathsString();
-      final InstrumentationClassFinder finder = createClassFinder(classPath);
-
-      try {
-        if (GuiDesignerConfiguration.getInstance(project).COPY_FORMS_RUNTIME_TO_OUTPUT) {
-          final String moduleOutputPath = CompilerPaths.getModuleOutputPath(module, false);
-          try {
-            if (moduleOutputPath != null) {
-              filesToRefresh.addAll(CopyResourcesUtil.copyFormsRuntime(moduleOutputPath, false));
-            }
-            final String testsOutputPath = CompilerPaths.getModuleOutputPath(module, true);
-            if (testsOutputPath != null && !testsOutputPath.equals(moduleOutputPath)) {
-              filesToRefresh.addAll(CopyResourcesUtil.copyFormsRuntime(testsOutputPath, false));
-            }
-          }
-          catch (IOException e) {
-            addMessage(
-              context,
-              UIDesignerBundle.message("error.cannot.copy.gui.designer.form.runtime", module.getName(), e.toString()),
-              null, CompilerMessageCategory.ERROR);
-          }
-        }
-
-        final ArrayList<MyInstrumentationItem> list = module2itemsList.get(module);
-
-        for (final MyInstrumentationItem item : list) {
-          //context.getProgressIndicator().setFraction((double)++formsProcessed / (double)items.length);
-
-          final VirtualFile formFile = item.getFormFile();
-          context.getProgressIndicator().setText2(formFile.getPresentableUrl());
-
-          final String text = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
-            @Override
-            public String compute() {
-              if (!belongsToCompileScope(context, formFile, item.getClassToBindFQname())) {
-                return null;
-              }
-              Document document = FileDocumentManager.getInstance().getDocument(formFile);
-              return document == null ? null : document.getText();
-            }
-          });
-          if (text == null) {
-            continue; // does not belong to current scope
-          }
-
-          final LwRootContainer rootContainer;
-          try {
-            rootContainer = Utils.getRootContainer(text, new CompiledClassPropertiesProvider(finder.getLoader()));
-          }
-          catch (Exception e) {
-            addMessage(context, UIDesignerBundle.message("error.cannot.process.form.file", e), formFile, CompilerMessageCategory.ERROR);
-            continue;
-          }
-
-          final File classFile = VfsUtil.virtualToIoFile(item.getFile());
-          LOG.assertTrue(classFile.exists(), classFile.getPath());
-
-          final AsmCodeGenerator codeGenerator = new AsmCodeGenerator(
-            rootContainer, finder, new PsiNestedFormLoader(module), false, new PsiClassWriter(module)
-          );
-          ApplicationManager.getApplication().runReadAction(new Runnable() {
-            @Override
-            public void run() {
-              codeGenerator.patchFile(classFile);
-            }
-          });
-          final FormErrorInfo[] errors = codeGenerator.getErrors();
-          final FormErrorInfo[] warnings = codeGenerator.getWarnings();
-          for (FormErrorInfo warning : warnings) {
-            addMessage(context, warning, formFile, CompilerMessageCategory.WARNING);
-          }
-          for (FormErrorInfo error : errors) {
-            addMessage(context, error, formFile, CompilerMessageCategory.ERROR);
-          }
-          if (errors.length == 0) {
-            compiledItems.add(item);
-          }
-        }
-      }
-      finally {
-        finder.releaseResources();
-      }
-    }
-    CompilerUtil.refreshIOFiles(filesToRefresh);
-    context.getProgressIndicator().popState();
-
-    return compiledItems.toArray(new ProcessingItem[compiledItems.size()]);
-  }
-
-  private static void addMessage(final CompileContext context,
-                          final String s,
-                          final VirtualFile formFile,
-                          final CompilerMessageCategory severity) {
-    addMessage(context, new FormErrorInfo(null, s), formFile, severity);
-  }
-
-  private static void addMessage(final CompileContext context,
-                          final FormErrorInfo e,
-                          final VirtualFile formFile,
-                          final CompilerMessageCategory severity) {
-    if (formFile != null) {
-      FormElementNavigatable navigatable = new FormElementNavigatable(context.getProject(), formFile, e.getComponentId());
-      context.addMessage(severity,
-                         formFile.getPresentableUrl() + ": " + e.getErrorMessage(),
-                         formFile.getUrl(), -1, -1, navigatable);
-    }
-    else {
-      context.addMessage(severity, e.getErrorMessage(), null, -1, -1);
-    }
-  }
-
-  @Override
-  public ValidityState createValidityState(final DataInput in) throws IOException {
-    return TimestampValidityState.load(in);
-  }
-
-  public static VirtualFile findSourceFile(final CompileContext context, final VirtualFile formFile, final String className) {
-    final Module module = context.getModuleByFile(formFile);
-    if (module == null) {
-      return null;
-    }
-    final PsiClass aClass = FormEditingUtil.findClassToBind(module, className);
-    if (aClass == null) {
-      return null;
-    }
-
-    final PsiFile containingFile = aClass.getContainingFile();
-    if (containingFile == null){
-      return null;
-    }
-
-    return containingFile.getVirtualFile();
-  }
-
-  private static final class MyInstrumentationItem implements ProcessingItem {
-    private final VirtualFile myClassFile;
-    private final VirtualFile myFormFile;
-    private final String myClassToBindFQname;
-    private final TimestampValidityState myState;
-
-    private MyInstrumentationItem(final VirtualFile classFile, final VirtualFile formFile, final String classToBindFQname) {
-      myClassFile = classFile;
-      myFormFile = formFile;
-      myClassToBindFQname = classToBindFQname;
-      myState = new TimestampValidityState(formFile.getTimeStamp());
-    }
-
-    @Override
-    @NotNull
-    public VirtualFile getFile() {
-      return myClassFile;
-    }
-
-    public VirtualFile getFormFile() {
-      return myFormFile;
-    }
-
-    public String getClassToBindFQname() {
-      return myClassToBindFQname;
-    }
-
-    @Override
-    public ValidityState getValidityState() {
-      return myState;
-    }
-  }
-
-}
diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/make/Form2SourceCompiler.java b/plugins/ui-designer/src/com/intellij/uiDesigner/make/Form2SourceCompiler.java
index 05ba514..946bf5e 100644
--- a/plugins/ui-designer/src/com/intellij/uiDesigner/make/Form2SourceCompiler.java
+++ b/plugins/ui-designer/src/com/intellij/uiDesigner/make/Form2SourceCompiler.java
@@ -26,7 +26,10 @@
 import com.intellij.openapi.module.ModuleUtilCore;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiDocumentManager;
+import com.intellij.psi.PsiFile;
+import com.intellij.uiDesigner.FormEditingUtil;
 import com.intellij.uiDesigner.GuiDesignerConfiguration;
 import com.intellij.uiDesigner.UIDesignerBundle;
 import com.intellij.uiDesigner.compiler.AlienFormFileException;
@@ -44,6 +47,24 @@
 
 public final class Form2SourceCompiler implements SourceInstrumentingCompiler{
 
+  private static VirtualFile findSourceFile(final CompileContext context, final VirtualFile formFile, final String className) {
+    final Module module = context.getModuleByFile(formFile);
+    if (module == null) {
+      return null;
+    }
+    final PsiClass aClass = FormEditingUtil.findClassToBind(module, className);
+    if (aClass == null) {
+      return null;
+    }
+
+    final PsiFile containingFile = aClass.getContainingFile();
+    if (containingFile == null){
+      return null;
+    }
+
+    return containingFile.getVirtualFile();
+  }
+
   @NotNull
   public String getDescription() {
     return UIDesignerBundle.message("component.gui.designer.form.to.source.compiler");
@@ -96,7 +117,7 @@
               continue;
             }
 
-            final VirtualFile sourceFile = Form2ByteCodeCompiler.findSourceFile(context, formFile, classToBind);
+            final VirtualFile sourceFile = findSourceFile(context, formFile, classToBind);
             if (sourceFile == null) {
               if (scope.belongs(formFile.getUrl())) {
                 addError(context, new FormErrorInfo(null, UIDesignerBundle.message("error.class.to.bind.does.not.exist", classToBind)), formFile);
diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/editors/string/KeyChooserDialog.java b/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/editors/string/KeyChooserDialog.java
index bd655bc..52dd53a 100644
--- a/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/editors/string/KeyChooserDialog.java
+++ b/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/editors/string/KeyChooserDialog.java
@@ -153,7 +153,7 @@
       final String key = property.getUnescapedKey();
       final String value = property.getValue();
       if (key != null) {
-        myPairs.add(Couple.newOne(key, value != null ? value : NULL));
+        myPairs.add(Couple.of(key, value != null ? value : NULL));
       }
     }
     Collections.sort(myPairs, new MyPairComparator());
diff --git a/plugins/ui-designer/testSrc/com/intellij/uiDesigner/make/UiDesignerExternalBuildTest.java b/plugins/ui-designer/testSrc/com/intellij/uiDesigner/make/UiDesignerExternalBuildTest.java
index 091ed0b..4837b0e 100644
--- a/plugins/ui-designer/testSrc/com/intellij/uiDesigner/make/UiDesignerExternalBuildTest.java
+++ b/plugins/ui-designer/testSrc/com/intellij/uiDesigner/make/UiDesignerExternalBuildTest.java
@@ -31,10 +31,6 @@
  * @author nik
  */
 public class UiDesignerExternalBuildTest extends ArtifactCompilerTestCase {
-  @Override
-  protected boolean useExternalCompiler() {
-    return true;
-  }
 
   //IDEA-94779
   public void testCopyFormsRuntimeToArtifact() throws IOException {
diff --git a/python/helpers/pycharm/pycharm_load_entry_point.py b/python/helpers/pycharm/pycharm_load_entry_point.py
index f03286c..ecf4f90 100644
--- a/python/helpers/pycharm/pycharm_load_entry_point.py
+++ b/python/helpers/pycharm/pycharm_load_entry_point.py
@@ -1,9 +1,9 @@
-import sys
+import os, sys
 from pkg_resources import load_entry_point
 
 if __name__ == '__main__':
-  name = sys.argv.pop()
-  dist = sys.argv.pop()
+  dist = os.environ.get("PYCHARM_EP_DIST")
+  name = os.environ.get("PYCHARM_EP_NAME")
   sys.exit(
     load_entry_point(dist, "console_scripts", name)()
   )
diff --git a/python/helpers/pydev/pydevconsole.py b/python/helpers/pydev/pydevconsole.py
index 7edf089..6c0640f 100644
--- a/python/helpers/pydev/pydevconsole.py
+++ b/python/helpers/pydev/pydevconsole.py
@@ -368,6 +368,45 @@
                 self.skip = 1
             sys.stderr.write(data)
 
+    def showsyntaxerror(self, filename=None):
+        """Display the syntax error that just occurred."""
+        #Override for avoid using sys.excepthook PY-12600
+        type, value, tb = sys.exc_info()
+        sys.last_type = type
+        sys.last_value = value
+        sys.last_traceback = tb
+        if filename and type is SyntaxError:
+            # Work hard to stuff the correct filename in the exception
+            try:
+                msg, (dummy_filename, lineno, offset, line) = value.args
+            except ValueError:
+                # Not the format we expect; leave it alone
+                pass
+            else:
+                # Stuff in the right filename
+                value = SyntaxError(msg, (filename, lineno, offset, line))
+                sys.last_value = value
+        list = traceback.format_exception_only(type, value)
+        sys.stderr.write(''.join(list))
+
+    def showtraceback(self):
+        """Display the exception that just occurred."""
+        #Override for avoid using sys.excepthook PY-12600
+        try:
+            type, value, tb = sys.exc_info()
+            sys.last_type = type
+            sys.last_value = value
+            sys.last_traceback = tb
+            tblist = traceback.extract_tb(tb)
+            del tblist[:1]
+            lines = traceback.format_list(tblist)
+            if lines:
+                lines.insert(0, "Traceback (most recent call last):\n")
+            lines.extend(traceback.format_exception_only(type, value))
+        finally:
+            tblist = tb = None
+        sys.stderr.write(''.join(lines))
+
 def consoleExec(thread_id, frame_id, expression):
     """returns 'False' in case expression is partialy correct
     """
diff --git a/python/main_pycharm_ce.iml b/python/main_pycharm_ce.iml
index 67303ad..8a72b6d 100644
--- a/python/main_pycharm_ce.iml
+++ b/python/main_pycharm_ce.iml
@@ -18,6 +18,7 @@
     <orderEntry type="module" module-name="python-ide-community" />
     <orderEntry type="module" module-name="platform-main" />
     <orderEntry type="module" module-name="jira" />
+    <orderEntry type="module" module-name="ShortcutPromoter" />
   </component>
 </module>
 
diff --git a/python/openapi/src/com/jetbrains/python/packaging/PyExternalProcessException.java b/python/openapi/src/com/jetbrains/python/packaging/PyExternalProcessException.java
index 40d1f31..06e2337 100644
--- a/python/openapi/src/com/jetbrains/python/packaging/PyExternalProcessException.java
+++ b/python/openapi/src/com/jetbrains/python/packaging/PyExternalProcessException.java
@@ -16,6 +16,7 @@
 package com.jetbrains.python.packaging;
 
 import com.intellij.execution.ExecutionException;
+import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.text.StringUtil;
 import org.jetbrains.annotations.NotNull;
 
@@ -34,6 +35,8 @@
   @NotNull private List<String> myArgs;
   @NotNull private String myMessage;
 
+  private Pair<String, Runnable> myHandler = null;
+
   public PyExternalProcessException(int retcode, @NotNull String name, @NotNull List<String> args, @NotNull String message) {
     super(String.format("External process error '%s %s':\n%s", name, StringUtil.join(args, " "), message));
     myRetcode = retcode;
@@ -92,4 +95,18 @@
     }
     return StringUtil.join(result, "");
   }
+
+  public PyExternalProcessException withHandler(@NotNull String name, @NotNull Runnable handler) {
+    myHandler = Pair.create(name, handler);
+    return this;
+  }
+
+
+  public boolean hasHandler() {
+    return myHandler != null;
+  }
+
+  public Pair<String, Runnable> getHandler() {
+    return myHandler;
+  }
 }
diff --git a/python/pluginTestSrc/com/jetbrains/jython/PyJythonHighlightingTest.java b/python/pluginTestSrc/com/jetbrains/jython/PyJythonHighlightingTest.java
index 40330be..4ddef37 100644
--- a/python/pluginTestSrc/com/jetbrains/jython/PyJythonHighlightingTest.java
+++ b/python/pluginTestSrc/com/jetbrains/jython/PyJythonHighlightingTest.java
@@ -18,7 +18,7 @@
 import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
 import com.jetbrains.python.PythonTestUtil;
 import com.jetbrains.python.inspections.PyCallingNonCallableInspection;
-import com.jetbrains.python.inspections.PyUnresolvedReferencesInspection;
+import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection;
 
 /**
  * @author yole
diff --git a/python/psi-api/src/com/jetbrains/python/PythonFQDNNames.java b/python/psi-api/src/com/jetbrains/python/PythonFQDNNames.java
new file mode 100644
index 0000000..364a6ad
--- /dev/null
+++ b/python/psi-api/src/com/jetbrains/python/PythonFQDNNames.java
@@ -0,0 +1,36 @@
+package com.jetbrains.python;
+
+import com.jetbrains.python.nameResolver.FQNamesProvider;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Python (not django) names
+ * @author Ilya.Kazakevich
+ */
+public class PythonFQDNNames implements FQNamesProvider {
+
+  /**
+   * dict()
+   */
+  public static final PythonFQDNNames DICT_CLASS = new PythonFQDNNames(true, "dict"); // TODO: Add other dict-like types
+
+  private final boolean myIsClass;
+  @NotNull
+  private final String[] myNames;
+
+  private PythonFQDNNames(final boolean isClass, @NotNull final String... names) {
+    myIsClass = isClass;
+    myNames = names;
+  }
+
+  @NotNull
+  @Override
+  public String[] getNames() {
+    return myNames.clone();
+  }
+
+  @Override
+  public boolean isClass() {
+    return myIsClass;
+  }
+}
diff --git a/python/psi-api/src/com/jetbrains/python/nameResolver/NameResolverTools.java b/python/psi-api/src/com/jetbrains/python/nameResolver/NameResolverTools.java
index e8d8f51..7fad933 100644
--- a/python/psi-api/src/com/jetbrains/python/nameResolver/NameResolverTools.java
+++ b/python/psi-api/src/com/jetbrains/python/nameResolver/NameResolverTools.java
@@ -1,14 +1,16 @@
 package com.jetbrains.python.nameResolver;
 
+import com.intellij.openapi.util.Condition;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiReference;
-import com.jetbrains.python.psi.PyClass;
-import com.jetbrains.python.psi.PyElement;
-import com.jetbrains.python.psi.PyFunction;
-import com.jetbrains.python.psi.PyQualifiedNameOwner;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.jetbrains.python.psi.*;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
 
 /**
  * @author Ilya.Kazakevich
@@ -75,4 +77,38 @@
     return false;
   }
 
+  /**
+   * Looks for parent call of certain function
+   * @param anchor element to look parent for
+   * @param functionName function to find
+   * @return parent call or null if not found
+   */
+  @Nullable
+  public static PyCallExpression findCallExpParent(@NotNull final PsiElement anchor, @NotNull final FQNamesProvider functionName) {
+    final PsiElement parent = PsiTreeUtil.findFirstParent(anchor, new MyFunctionCondition(functionName));
+    if (parent instanceof PyCallExpression) {
+      return (PyCallExpression)parent;
+    }
+    return null;
+  }
+
+  /**
+   * Looks for call of some function
+   */
+  private static class MyFunctionCondition implements Condition<PsiElement> {
+    @NotNull
+    private final FQNamesProvider myNameToSearch;
+
+    MyFunctionCondition(@NotNull final FQNamesProvider name) {
+      myNameToSearch = name;
+    }
+
+    @Override
+    public boolean value(final PsiElement element) {
+      if (element instanceof PyCallExpression) {
+        return ((PyCallExpression)element).isCallee(myNameToSearch);
+      }
+      return false;
+    }
+  }
 }
diff --git a/python/psi-api/src/com/jetbrains/python/psi/PyImportedNameDefiner.java b/python/psi-api/src/com/jetbrains/python/psi/PyImportedNameDefiner.java
index 6d5626a..8758b85 100644
--- a/python/psi-api/src/com/jetbrains/python/psi/PyImportedNameDefiner.java
+++ b/python/psi-api/src/com/jetbrains/python/psi/PyImportedNameDefiner.java
@@ -20,5 +20,5 @@
  *
  * @author vlan
  */
-public interface PyImportedNameDefiner extends NameDefiner {
+public interface PyImportedNameDefiner extends NameDefiner, PyElement {
 }
diff --git a/python/psi-api/src/com/jetbrains/python/psi/PyStarImportElement.java b/python/psi-api/src/com/jetbrains/python/psi/PyStarImportElement.java
index 0fda47c..fc69a0f 100644
--- a/python/psi-api/src/com/jetbrains/python/psi/PyStarImportElement.java
+++ b/python/psi-api/src/com/jetbrains/python/psi/PyStarImportElement.java
@@ -20,5 +20,5 @@
  * User: dcheryasov
  * Date: Jul 28, 2008
  */
-public interface PyStarImportElement extends PyElement, PyImportedNameDefiner {
+public interface PyStarImportElement extends PyImportedNameDefiner {
 }
diff --git a/python/python-rest/src/com/jetbrains/rest/sphinx/SphinxBaseCommand.java b/python/python-rest/src/com/jetbrains/rest/sphinx/SphinxBaseCommand.java
index ee0d0e5..21b9e44 100644
--- a/python/python-rest/src/com/jetbrains/rest/sphinx/SphinxBaseCommand.java
+++ b/python/python-rest/src/com/jetbrains/rest/sphinx/SphinxBaseCommand.java
@@ -165,11 +165,12 @@
         script_params.addParameter(p);
       }
     }
-    cmd.addParameters("Sphinx", "sphinx-quickstart");
 
     cmd.setPassParentEnvironment(true);
     setPythonIOEncoding(cmd.getEnvironment(), "utf-8");
     setPythonUnbuffered(cmd.getEnvironment());
+    cmd.getEnvironment().put("PYCHARM_EP_DIST", "Sphinx");
+    cmd.getEnvironment().put("PYCHARM_EP_NAME", "sphinx-quickstart");
 
     List<String> pathList = Lists.newArrayList(PythonCommandLineState.getAddedPaths(sdk));
     pathList.addAll(PythonCommandLineState.collectPythonPath(module));
diff --git a/python/resources/liveTemplates/Python.xml b/python/resources/liveTemplates/Python.xml
index 96689b1..47928f8 100644
--- a/python/resources/liveTemplates/Python.xml
+++ b/python/resources/liveTemplates/Python.xml
@@ -4,8 +4,21 @@
     <variable name="method" expression="pyFunctionName()" defaultValue="" alwaysStopAt="false" />
     <variable name="end" expression="" defaultValue="" alwaysStopAt="true" />
     <context>
+      <option name="HTML_TEXT" value="false" />
+      <option name="HTML" value="false" />
+      <option name="XSL_TEXT" value="false" />
+      <option name="XML" value="false" />
+      <option name="Python" value="true" />
+      <option name="Django" value="false" />
+      <option name="CSS_PROPERTY_VALUE" value="false" />
+      <option name="CSS_DECLARATION_BLOCK" value="false" />
+      <option name="CSS_RULESET_LIST" value="false" />
+      <option name="CSS" value="false" />
+      <option name="JAVA_SCRIPT" value="false" />
       <option name="TypeScript" value="false" />
+      <option name="SQL" value="false" />
       <option name="CoffeeScript" value="false" />
+      <option name="OTHER" value="false" />
     </context>
   </template>
   <template name="main" value="if __name__ == '__main__':&#10;    $END$" description="if __name__ == '__main__'" toReformat="false" toShortenFQNames="true">
diff --git a/python/resources/tips/Interpreter.html b/python/resources/tips/Interpreter.html
index 3bc9c18..4f4c58f 100644
--- a/python/resources/tips/Interpreter.html
+++ b/python/resources/tips/Interpreter.html
@@ -6,7 +6,7 @@
     <p>PyCharm allows configuring Python interpreters on the various stages of development: </p>
 <ul>
 <li>When a project is only being created (<span class="control">File | New Project</span>, or <span class="control">Create New Project</span> on the Welcome screen).</li>
-<li>In an already existing project (<span class="control">File | Settings - Python Interpreters</span>).</li>
+<li>In an already existing project (<span class="control">File | Settings - Project Interpreter</span>).</li>
 </ul>
 </body>
 </html>
diff --git a/python/resources/tips/LiveTemplatesRestore.html b/python/resources/tips/LiveTemplatesRestore.html
new file mode 100755
index 0000000..dd09059
--- /dev/null
+++ b/python/resources/tips/LiveTemplatesRestore.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+    <link rel="stylesheet" type="text/css" href="css/tips.css">
+</head>
+<body>
+
+<p>If you've changed a live template, it becomes blue. If you want to return to the 
+original text, right-click such a blue template, and choose 
+<span class="control">Restore defaults</span> on the context menu.
+</p>
+</body>
+</html>
diff --git a/python/resources/tips/Multicursor.html b/python/resources/tips/Multicursor.html
new file mode 100755
index 0000000..251d849
--- /dev/null
+++ b/python/resources/tips/Multicursor.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+    <link rel="stylesheet" type="text/css" href="css/tips.css">
+</head>
+<body>
+
+
+    <p>In <span class="product">&productName;</span>, you can have multiple cursors. 
+Having pressed <span class="shortcut">Alt</span>, click the left mouse button 
+at the desired position to set additional cursors in the editor.</p>
+<p>Press <span class="shortcut">&shortcut:EditorEscape;</span> to remove all the additional cursors  
+but one that resides at the line at caret.</p>
+<p class="image"><img src="images/multicursor.png"></p>
+
+
+</body>
+</html>
diff --git a/python/resources/tips/Multicursor1.html b/python/resources/tips/Multicursor1.html
new file mode 100755
index 0000000..21bf62f
--- /dev/null
+++ b/python/resources/tips/Multicursor1.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+    <link rel="stylesheet" type="text/css" href="css/tips.css">
+</head>
+<body>
+
+
+    <p>Clone the cursor strictly upwards or downwards. To do that, 
+press <span class="shortcut">&shortcut:GotoAction;</span> twice, type 
+<span class="control">Clone caret</span>, and then choose the desired action.</p>
+<p class="image"><img src="images/multicursor1.png"></p>
+</body>
+</html>
diff --git a/python/resources/tips/QuickDocInSuggestionList.html b/python/resources/tips/QuickDocInSuggestionList.html
new file mode 100755
index 0000000..94d0e5a
--- /dev/null
+++ b/python/resources/tips/QuickDocInSuggestionList.html
@@ -0,0 +1,14 @@
+<html>
+<head>
+    <link rel="stylesheet" type="text/css" href="css/tips.css">
+</head>
+<body>
+
+
+    <p>When choosing a live template from a suggestion list, press 
+<span class="shortcut">&shortcut:QuickJavaDoc;</span> to view quick documentation - 
+to be sure you make a right choice:</p>
+<p class="image"><img src="images/qdoc_live_template.png"></p>
+
+</body>
+</html>
diff --git a/python/resources/tips/QuickDocOnMouseMove.html b/python/resources/tips/QuickDocOnMouseMove.html
new file mode 100755
index 0000000..9499aea
--- /dev/null
+++ b/python/resources/tips/QuickDocOnMouseMove.html
@@ -0,0 +1,15 @@
+<html>
+<head>
+    <link rel="stylesheet" type="text/css" href="css/tips.css">
+</head>
+<body>
+
+<p>You don't need to invoke quick documentation explicitly 
+(<span class="shortcut">&shortcut:QuickJavaDoc;</span>) - if you just move your mouse 
+pointer over the desired symbol, the quick documentation pop-up window will show
+automatically.</p>
+<p>To enable this feature, select the check box <span class="control">Show quick doc on mouse move</span> 
+in the editor settings.
+</p>
+</body>
+</html>
diff --git a/python/resources/tips/RemoteInterpreter.html b/python/resources/tips/RemoteInterpreter.html
index 83cdbe2..9373493 100644
--- a/python/resources/tips/RemoteInterpreter.html
+++ b/python/resources/tips/RemoteInterpreter.html
@@ -5,16 +5,9 @@
 <body>
     <p>Found yourself in a situation, when you want to use an interpreter located remotely? With 
 PyCharm it is quite easy.</p>
-
-    <p>To configure a remote interpreter, press <span class="shortcut">&shortcut:ShowSettings;</span>, and
-      under the <span class="control">Project Settings</span>. open the page <span class="control">Python Interpreters</span>.</p>
-<p>Then press <span class="shortcut">&shortcut:NewElement;</span>, and choose the option <span class="control">Remote</span>:</p>
-<p class="image"><img src="images/add_remote_interpreter.png" alt="add_remote_interpreter"/></p>
-
+<p>To configure a remote interpreter, press <span class="shortcut">&shortcut:ShowSettings;</span>, and
+under the <span class="control">Project Settings</span>. open the page <span class="control">Project Interpreter</span>.</p>
+<p>Then click the geat button, and choose the option <span class="control">Add Remote</span>:</p>
 <p>You can use this remote interpreter for your project, or just leave it as one of the available interpreters.</p>
 </body>
 </html>
-<html>
-<head></head>
-<body></body>
-</html>
\ No newline at end of file
diff --git a/python/resources/tips/TerminalOpen.html b/python/resources/tips/TerminalOpen.html
new file mode 100755
index 0000000..bb96cee
--- /dev/null
+++ b/python/resources/tips/TerminalOpen.html
@@ -0,0 +1,14 @@
+<html>
+<head>
+    <link rel="stylesheet" type="text/css" href="css/tips.css">
+</head>
+<body>
+
+
+    <p><span class="product">&productName;</span> makes it possible to 
+launch the embedded local terminal using keyboard only. Press 
+<span class="shortcut">&shortcut:ActivateTerminalToolWindow;</span>, 
+and see the terminal running.
+</p>
+</body>
+</html>
diff --git a/python/resources/tips/images/multicursor1@2x.png b/python/resources/tips/images/multicursor1@2x.png
new file mode 100755
index 0000000..2920846
--- /dev/null
+++ b/python/resources/tips/images/multicursor1@2x.png
Binary files differ
diff --git a/python/resources/tips/images/multicursor1@2x_dark.png b/python/resources/tips/images/multicursor1@2x_dark.png
new file mode 100755
index 0000000..04dbef3
--- /dev/null
+++ b/python/resources/tips/images/multicursor1@2x_dark.png
Binary files differ
diff --git a/python/resources/tips/images/multicursor@2x.png b/python/resources/tips/images/multicursor@2x.png
new file mode 100755
index 0000000..d771d0a
--- /dev/null
+++ b/python/resources/tips/images/multicursor@2x.png
Binary files differ
diff --git a/python/resources/tips/images/multicursor@2x_dark.png b/python/resources/tips/images/multicursor@2x_dark.png
new file mode 100755
index 0000000..dd93320
--- /dev/null
+++ b/python/resources/tips/images/multicursor@2x_dark.png
Binary files differ
diff --git a/python/resources/tips/images/qdoc_live_template@2x-3.png b/python/resources/tips/images/qdoc_live_template@2x-3.png
new file mode 100755
index 0000000..ae79e7e
--- /dev/null
+++ b/python/resources/tips/images/qdoc_live_template@2x-3.png
Binary files differ
diff --git a/python/resources/tips/images/qdoc_live_template@2x_dark-3.png b/python/resources/tips/images/qdoc_live_template@2x_dark-3.png
new file mode 100755
index 0000000..6b077c6
--- /dev/null
+++ b/python/resources/tips/images/qdoc_live_template@2x_dark-3.png
Binary files differ
diff --git a/python/src/META-INF/IdeTipsAndTricks.xml b/python/src/META-INF/IdeTipsAndTricks.xml
index 7237331..e920175 100644
--- a/python/src/META-INF/IdeTipsAndTricks.xml
+++ b/python/src/META-INF/IdeTipsAndTricks.xml
@@ -108,5 +108,11 @@
     <tipAndTrick file="CheckRegExp.html"/>
     <tipAndTrick file="CtrlDotInLookups.html"/>
     <tipAndTrick file="HorizontalScrolling.html"/>
+    <tipAndTrick file="LiveTemplatesRestore.html"/>
+    <tipAndTrick file="Multicursor.html"/>
+    <tipAndTrick file="Multicursor1.html"/>
+    <tipAndTrick file="QuickDocInSuggestionList.html"/>
+    <tipAndTrick file="QuickDocOnMouseMove.html"/>
+    <tipAndTrick file="TerminalOpen.html"/>
   </extensions>
 </idea-plugin>
\ No newline at end of file
diff --git a/python/src/META-INF/python-core.xml b/python/src/META-INF/python-core.xml
index dd93341..411fa6c 100644
--- a/python/src/META-INF/python-core.xml
+++ b/python/src/META-INF/python-core.xml
@@ -270,7 +270,7 @@
 
     <localInspection language="Python" shortName="PyArgumentListInspection" bundle="com.jetbrains.python.PyBundle" key="INSP.NAME.incorrect.call.arguments" groupKey="INSP.GROUP.python" enabledByDefault="true"  level="WARNING" implementationClass="com.jetbrains.python.inspections.PyArgumentListInspection"/>
     <localInspection language="Python" shortName="PyRedeclarationInspection" bundle="com.jetbrains.python.PyBundle" key="INSP.NAME.redeclaration" groupKey="INSP.GROUP.python" enabledByDefault="true"  level="WARNING" implementationClass="com.jetbrains.python.inspections.PyRedeclarationInspection"/>
-    <localInspection language="Python" shortName="PyUnresolvedReferencesInspection" bundle="com.jetbrains.python.PyBundle" key="INSP.NAME.unresolved.refs" groupKey="INSP.GROUP.python" enabledByDefault="true"  level="WARNING" implementationClass="com.jetbrains.python.inspections.PyUnresolvedReferencesInspection"/>
+    <localInspection language="Python" shortName="PyUnresolvedReferencesInspection" bundle="com.jetbrains.python.PyBundle" key="INSP.NAME.unresolved.refs" groupKey="INSP.GROUP.python" enabledByDefault="true"  level="WARNING" implementationClass="com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection"/>
     <localInspection language="Python" shortName="PyInterpreterInspection" bundle="com.jetbrains.python.PyBundle" key="INSP.NAME.invalid.interpreter" groupKey="INSP.GROUP.python" enabledByDefault="true"  level="WARNING" implementationClass="com.jetbrains.python.inspections.PyInterpreterInspection"/>
     <localInspection language="Python" shortName="PyMethodParametersInspection" bundle="com.jetbrains.python.PyBundle" key="INSP.NAME.problematic.first.parameter" groupKey="INSP.GROUP.python" enabledByDefault="true"  level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PyMethodParametersInspection"/>
     <localInspection language="Python" shortName="PyUnreachableCodeInspection" bundle="com.jetbrains.python.PyBundle" key="INSP.NAME.unreachable.code" groupKey="INSP.GROUP.python" enabledByDefault="true"  level="WARNING" implementationClass="com.jetbrains.python.inspections.PyUnreachableCodeInspection"/>
@@ -532,6 +532,7 @@
   <extensionPoints>    
     <extensionPoint qualifiedName="Pythonid.importResolver" interface="com.jetbrains.python.psi.impl.PyImportResolver"/>
     <extensionPoint qualifiedName="Pythonid.magicLiteral" interface="com.jetbrains.python.magicLiteral.PyMagicLiteralExtensionPoint"/>
+    <extensionPoint qualifiedName="Pythonid.unresolvedReferenceSkipper" interface="com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferenceSkipperExtPoint"/>
     <extensionPoint qualifiedName="Pythonid.resolveResultRater" interface="com.jetbrains.python.psi.impl.PyResolveResultRater"/>
     <extensionPoint qualifiedName="Pythonid.typeProvider" interface="com.jetbrains.python.psi.impl.PyTypeProvider"/>
     <extensionPoint qualifiedName="Pythonid.pySuperMethodsSearch" interface="com.intellij.util.QueryExecutor"/>
diff --git a/python/src/com/jetbrains/python/codeInsight/imports/PyImportOptimizer.java b/python/src/com/jetbrains/python/codeInsight/imports/PyImportOptimizer.java
index 0ebcaca..5d24e3b 100644
--- a/python/src/com/jetbrains/python/codeInsight/imports/PyImportOptimizer.java
+++ b/python/src/com/jetbrains/python/codeInsight/imports/PyImportOptimizer.java
@@ -21,7 +21,7 @@
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiFileSystemItem;
 import com.jetbrains.python.formatter.PyBlock;
-import com.jetbrains.python.inspections.PyUnresolvedReferencesInspection;
+import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection;
 import com.jetbrains.python.psi.*;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
diff --git a/python/src/com/jetbrains/python/codeInsight/liveTemplates/PythonTemplateContextType.java b/python/src/com/jetbrains/python/codeInsight/liveTemplates/PythonTemplateContextType.java
index 4ae7abe..1032cbd 100644
--- a/python/src/com/jetbrains/python/codeInsight/liveTemplates/PythonTemplateContextType.java
+++ b/python/src/com/jetbrains/python/codeInsight/liveTemplates/PythonTemplateContextType.java
@@ -17,11 +17,15 @@
 
 import com.intellij.codeInsight.template.FileTypeBasedContextType;
 import com.intellij.patterns.PsiElementPattern;
+import com.intellij.psi.PsiComment;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiFile;
+import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.util.ProcessingContext;
 import com.jetbrains.python.PyTokenTypes;
 import com.jetbrains.python.PythonFileType;
+import com.jetbrains.python.psi.PyParameterList;
+import com.jetbrains.python.psi.PyStringLiteralExpression;
 import org.jetbrains.annotations.NotNull;
 
 import static com.intellij.patterns.PlatformPatterns.psiElement;
@@ -39,16 +43,20 @@
     if (super.isInContext(file, offset)) {
       final PsiElement element = file.findElementAt(offset);
       if (element != null) {
-        return !isAfterDot(element);
+        return !(isAfterDot(element) || element instanceof PsiComment || element instanceof PyStringLiteralExpression ||
+                 isInsideParameterList(element));
       }
     }
     return false;
   }
 
+  private static boolean isInsideParameterList(@NotNull PsiElement element) {
+    return PsiTreeUtil.getParentOfType(element, PyParameterList.class) != null;
+  }
+
   private static boolean isAfterDot(@NotNull PsiElement element) {
-    ProcessingContext context = new ProcessingContext();
     final PsiElementPattern.Capture<PsiElement> capture = psiElement().afterLeafSkipping(psiElement().whitespace(),
                                                                                          psiElement().withElementType(PyTokenTypes.DOT));
-    return capture.accepts(element, context);
+    return capture.accepts(element, new ProcessingContext());
   }
 }
diff --git a/python/src/com/jetbrains/python/documentation/PyTypeModelBuilder.java b/python/src/com/jetbrains/python/documentation/PyTypeModelBuilder.java
index 6934a37..5df0a37 100644
--- a/python/src/com/jetbrains/python/documentation/PyTypeModelBuilder.java
+++ b/python/src/com/jetbrains/python/documentation/PyTypeModelBuilder.java
@@ -195,7 +195,7 @@
     }
     else if (type instanceof PyUnionType && allowUnions) {
       if (type instanceof PyDynamicallyEvaluatedType || PyTypeChecker.isUnknown(type)) {
-        result = new UnknownType(build(((PyUnionType)type).excludeNull(), true));
+        result = new UnknownType(build(((PyUnionType)type).excludeNull(myContext), true));
       }
       else {
         result = new OneOf(
diff --git a/python/src/com/jetbrains/python/documentation/doctest/PyDocstringVisitorFilter.java b/python/src/com/jetbrains/python/documentation/doctest/PyDocstringVisitorFilter.java
index 4ea4f88..e79d52c 100644
--- a/python/src/com/jetbrains/python/documentation/doctest/PyDocstringVisitorFilter.java
+++ b/python/src/com/jetbrains/python/documentation/doctest/PyDocstringVisitorFilter.java
@@ -18,6 +18,7 @@
 import com.intellij.lang.injection.InjectedLanguageManager;
 import com.intellij.psi.PsiFile;
 import com.jetbrains.python.inspections.*;
+import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection;
 import com.jetbrains.python.psi.PyFile;
 import com.jetbrains.python.validation.DocStringAnnotator;
 import com.jetbrains.python.validation.HighlightingAnnotator;
diff --git a/python/src/com/jetbrains/python/formatter/PyPreFormatProcessor.java b/python/src/com/jetbrains/python/formatter/PyPreFormatProcessor.java
index ee56016..af07fe8 100644
--- a/python/src/com/jetbrains/python/formatter/PyPreFormatProcessor.java
+++ b/python/src/com/jetbrains/python/formatter/PyPreFormatProcessor.java
@@ -84,6 +84,9 @@
       String text = element.getText();
       int commentStart = text.indexOf('#');
       if (commentStart != -1 && (commentStart + 1) < text.length()) {
+        if (text.charAt(commentStart+1) == '!') {
+          return; //shebang
+        }
         String commentText = StringUtil.trimLeading(text.substring(commentStart + 1));
 
         String newText = "# " + commentText;
diff --git a/python/src/com/jetbrains/python/inspections/PyUnresolvedReferencesInspection.java b/python/src/com/jetbrains/python/inspections/PyUnresolvedReferencesInspection.java
deleted file mode 100644
index d416f1b..0000000
--- a/python/src/com/jetbrains/python/inspections/PyUnresolvedReferencesInspection.java
+++ /dev/null
@@ -1,1037 +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.jetbrains.python.inspections;
-
-import com.google.common.collect.ImmutableSet;
-import com.intellij.codeInspection.*;
-import com.intellij.codeInspection.ui.ListEditForm;
-import com.intellij.lang.ASTNode;
-import com.intellij.lang.annotation.HighlightSeverity;
-import com.intellij.lang.injection.InjectedLanguageManager;
-import com.intellij.openapi.extensions.Extensions;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleUtilCore;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.util.*;
-import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
-import com.intellij.psi.*;
-import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.psi.util.QualifiedName;
-import com.intellij.util.Consumer;
-import com.intellij.util.PlatformUtils;
-import com.jetbrains.python.PyBundle;
-import com.jetbrains.python.PyNames;
-import com.jetbrains.python.codeInsight.PyCodeInsightSettings;
-import com.jetbrains.python.codeInsight.PyDynamicMember;
-import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
-import com.jetbrains.python.codeInsight.dataflow.scope.ScopeUtil;
-import com.jetbrains.python.codeInsight.imports.AutoImportHintAction;
-import com.jetbrains.python.codeInsight.imports.AutoImportQuickFix;
-import com.jetbrains.python.codeInsight.imports.OptimizeImportsQuickFix;
-import com.jetbrains.python.codeInsight.imports.PythonReferenceImporter;
-import com.jetbrains.python.console.PydevConsoleRunner;
-import com.jetbrains.python.documentation.DocStringParameterReference;
-import com.jetbrains.python.documentation.DocStringTypeReference;
-import com.jetbrains.python.inspections.quickfix.*;
-import com.jetbrains.python.packaging.PyPIPackageUtil;
-import com.jetbrains.python.packaging.PyPackageManager;
-import com.jetbrains.python.packaging.PyRequirement;
-import com.jetbrains.python.psi.*;
-import com.jetbrains.python.psi.impl.PyBuiltinCache;
-import com.jetbrains.python.psi.impl.PyImportStatementNavigator;
-import com.jetbrains.python.psi.impl.PyImportedModule;
-import com.jetbrains.python.psi.impl.references.PyImportReference;
-import com.jetbrains.python.psi.impl.references.PyOperatorReference;
-import com.jetbrains.python.psi.resolve.ImportedResolveResult;
-import com.jetbrains.python.psi.resolve.PyResolveContext;
-import com.jetbrains.python.psi.resolve.QualifiedNameFinder;
-import com.jetbrains.python.psi.resolve.RatedResolveResult;
-import com.jetbrains.python.psi.types.*;
-import com.jetbrains.python.sdk.PythonSdkType;
-import com.jetbrains.python.sdk.skeletons.PySkeletonRefresher;
-import org.jetbrains.annotations.Nls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.*;
-import java.util.*;
-
-import static com.jetbrains.python.inspections.quickfix.AddIgnoredIdentifierQuickFix.END_WILDCARD;
-
-/**
- * Marks references that fail to resolve. Also tracks unused imports and provides "optimize imports" support.
- * User: dcheryasov
- * Date: Nov 15, 2008
- */
-public class PyUnresolvedReferencesInspection extends PyInspection {
-  private static Key<Visitor> KEY = Key.create("PyUnresolvedReferencesInspection.Visitor");
-  public static final Key<PyUnresolvedReferencesInspection> SHORT_NAME_KEY = Key.create(PyUnresolvedReferencesInspection.class.getSimpleName());
-
-  public JDOMExternalizableStringList ignoredIdentifiers = new JDOMExternalizableStringList();
-
-  public static PyUnresolvedReferencesInspection getInstance(PsiElement element) {
-    final InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(element.getProject()).getInspectionProfile();
-    return (PyUnresolvedReferencesInspection)inspectionProfile.getUnwrappedTool(SHORT_NAME_KEY.toString(), element);
-  }
-
-  @Nls
-  @NotNull
-  public String getDisplayName() {
-    return PyBundle.message("INSP.NAME.unresolved.refs");
-  }
-
-  @NotNull
-  @Override
-  public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder,
-                                        final boolean isOnTheFly,
-                                        @NotNull final LocalInspectionToolSession session) {
-    final Visitor visitor = new Visitor(holder, session, ignoredIdentifiers);
-    // buildVisitor() will be called on injected files in the same session - don't overwrite if we already have one
-    final Visitor existingVisitor = session.getUserData(KEY);
-    if (existingVisitor == null) {
-      session.putUserData(KEY, visitor);
-    }
-    return visitor;
-  }
-
-  @Override
-  public void inspectionFinished(@NotNull LocalInspectionToolSession session, @NotNull ProblemsHolder holder) {
-    final Visitor visitor = session.getUserData(KEY);
-    assert visitor != null;
-    if (PyCodeInsightSettings.getInstance().HIGHLIGHT_UNUSED_IMPORTS) {
-      visitor.highlightUnusedImports();
-    }
-    session.putUserData(KEY, null);
-  }
-
-  @Override
-  public JComponent createOptionsPanel() {
-    ListEditForm form = new ListEditForm("Ignore references", ignoredIdentifiers);
-    return form.getContentPanel();
-  }
-
-  public static class Visitor extends PyInspectionVisitor {
-    private Set<PsiElement> myUsedImports = Collections.synchronizedSet(new HashSet<PsiElement>());
-    private Set<NameDefiner> myAllImports = Collections.synchronizedSet(new HashSet<NameDefiner>());
-    private final ImmutableSet<String> myIgnoredIdentifiers;
-    private volatile Boolean myIsEnabled = null;
-
-    public Visitor(@Nullable ProblemsHolder holder, @NotNull LocalInspectionToolSession session, List<String> ignoredIdentifiers) {
-      super(holder, session);
-      myIgnoredIdentifiers = ImmutableSet.copyOf(ignoredIdentifiers);
-    }
-
-    public boolean isEnabled(@NotNull PsiElement anchor) {
-      if (myIsEnabled == null) {
-        final boolean isPyCharm = PlatformUtils.isPyCharm();
-        myIsEnabled = (isPyCharm && PythonSdkType.getSdk(anchor) != null || !isPyCharm) &&
-                      !PySkeletonRefresher.isGeneratingSkeletons();
-      }
-      return myIsEnabled;
-    }
-
-    @Override
-    public void visitPyTargetExpression(PyTargetExpression node) {
-      checkSlots(node);
-    }
-
-    private void checkSlots(PyQualifiedExpression node) {
-      final PyExpression qualifier = node.getQualifier();
-      if (qualifier != null) {
-        final PyType type = myTypeEvalContext.getType(qualifier);
-        if (type instanceof PyClassType) {
-          final PyClass pyClass = ((PyClassType)type).getPyClass();
-          if (pyClass.isNewStyleClass()) {
-            if (pyClass.getOwnSlots() == null) {
-              return;
-            }
-            final List<String> slots = pyClass.getSlots();
-            final String attrName = node.getReferencedName();
-            if (slots != null && !slots.contains(attrName) && !slots.contains(PyNames.DICT)) {
-              for (PyClass ancestor : pyClass.getAncestorClasses(myTypeEvalContext)) {
-                if (ancestor == null) {
-                  return;
-                }
-                if (PyNames.OBJECT.equals(ancestor.getName())) {
-                  break;
-                }
-                final List<String> ancestorSlots = ancestor.getSlots();
-                if (ancestorSlots == null || ancestorSlots.contains(attrName) || ancestorSlots.contains(PyNames.DICT)) {
-                  return;
-                }
-              }
-              final ASTNode nameNode = node.getNameElement();
-              final PsiElement e = nameNode != null ? nameNode.getPsi() : node;
-              registerProblem(e, "'" + pyClass.getName() + "' object has no attribute '" + attrName + "'");
-            }
-          }
-        }
-      }
-    }
-
-    @Override
-    public void visitPyImportElement(PyImportElement node) {
-      super.visitPyImportElement(node);
-      final PyFromImportStatement fromImport = PsiTreeUtil.getParentOfType(node, PyFromImportStatement.class);
-      if (isEnabled(node) && (fromImport == null || !fromImport.isFromFuture())) {
-        myAllImports.add(node);
-      }
-    }
-
-    @Override
-    public void visitPyStarImportElement(PyStarImportElement node) {
-      super.visitPyStarImportElement(node);
-      if (isEnabled(node)) {
-        myAllImports.add(node);
-      }
-    }
-
-    @Nullable
-    private static PyExceptPart getImportErrorGuard(PyElement node) {
-      final PyImportStatementBase importStatement = PsiTreeUtil.getParentOfType(node, PyImportStatementBase.class);
-      if (importStatement != null) {
-        final PyTryPart tryPart = PsiTreeUtil.getParentOfType(node, PyTryPart.class);
-        if (tryPart != null) {
-          final PyTryExceptStatement tryExceptStatement = PsiTreeUtil.getParentOfType(tryPart, PyTryExceptStatement.class);
-          if (tryExceptStatement != null) {
-            for (PyExceptPart exceptPart : tryExceptStatement.getExceptParts()) {
-              final PyExpression expr = exceptPart.getExceptClass();
-              if (expr != null && "ImportError".equals(expr.getName())) {
-                return exceptPart;
-              }
-            }
-          }
-        }
-      }
-      return null;
-    }
-
-    private static boolean isGuardedByHasattr(@NotNull final PyElement node, @NotNull final String name) {
-      final String nodeName = node.getName();
-      if (nodeName != null) {
-        final ScopeOwner owner = ScopeUtil.getDeclarationScopeOwner(node, nodeName);
-        PyElement e = PsiTreeUtil.getParentOfType(node, PyConditionalStatementPart.class, PyConditionalExpression.class);
-        while (e != null && PsiTreeUtil.isAncestor(owner, e, true)) {
-          final ArrayList<PyCallExpression> calls = new ArrayList<PyCallExpression>();
-          PyExpression cond = null;
-          if (e instanceof PyConditionalStatementPart) {
-            cond = ((PyConditionalStatementPart)e).getCondition();
-          }
-          else if (e instanceof PyConditionalExpression && PsiTreeUtil.isAncestor(((PyConditionalExpression)e).getTruePart(), node, true)) {
-            cond = ((PyConditionalExpression)e).getCondition();
-          }
-          if (cond instanceof PyCallExpression) {
-            calls.add((PyCallExpression)cond);
-          }
-          if (cond != null) {
-            final PyCallExpression[] callExpressions = PsiTreeUtil.getChildrenOfType(cond, PyCallExpression.class);
-            if (callExpressions != null) {
-              calls.addAll(Arrays.asList(callExpressions));
-            }
-            for (PyCallExpression call : calls) {
-              final PyExpression callee = call.getCallee();
-              final PyExpression[] args = call.getArguments();
-              // TODO: Search for `node` aliases using aliases analysis
-              if (callee != null && "hasattr".equals(callee.getName()) && args.length == 2 &&
-                  nodeName.equals(args[0].getName()) && args[1] instanceof PyStringLiteralExpression &&
-                  ((PyStringLiteralExpression)args[1]).getStringValue().equals(name)) {
-                return true;
-              }
-            }
-          }
-          e = PsiTreeUtil.getParentOfType(e, PyConditionalStatementPart.class);
-        }
-      }
-      return false;
-    }
-
-    @Override
-    public void visitPyElement(final PyElement node) {
-      super.visitPyElement(node);
-      final PsiFile file = node.getContainingFile();
-      final InjectedLanguageManager injectedLanguageManager =
-        InjectedLanguageManager.getInstance(node.getProject());
-      if (injectedLanguageManager.isInjectedFragment(file)) {
-        final PsiLanguageInjectionHost host =
-          injectedLanguageManager.getInjectionHost(node);
-        processInjection(host);
-      }
-      if (node instanceof PyReferenceOwner) {
-        final PyResolveContext resolveContext = PyResolveContext.noImplicits().withTypeEvalContext(myTypeEvalContext);
-        processReference(node, ((PyReferenceOwner)node).getReference(resolveContext));
-      }
-      else {
-        if (node instanceof PsiLanguageInjectionHost) {
-          processInjection((PsiLanguageInjectionHost)node);
-        }
-        for (final PsiReference reference : node.getReferences()) {
-          processReference(node, reference);
-        }
-      }
-    }
-
-    private void processInjection(@Nullable PsiLanguageInjectionHost node) {
-      if (node == null) return;
-      final List<Pair<PsiElement,TextRange>>
-        files = InjectedLanguageManager.getInstance(node.getProject()).getInjectedPsiFiles(node);
-      if (files != null) {
-        for (Pair<PsiElement,TextRange> pair : files) {
-          new PyRecursiveElementVisitor() {
-            @Override
-            public void visitPyElement(PyElement element) {
-              super.visitPyElement(element);
-              if (element instanceof PyReferenceOwner) {
-                final PyResolveContext resolveContext = PyResolveContext.noImplicits().withTypeEvalContext(myTypeEvalContext);
-                final PsiPolyVariantReference reference = ((PyReferenceOwner)element).getReference(resolveContext);
-                if (reference != null) {
-                  final ResolveResult[] resolveResults = reference.multiResolve(false);
-                  for (ResolveResult resolveResult : resolveResults) {
-                    if (resolveResult instanceof ImportedResolveResult) {
-                      myUsedImports.addAll(((ImportedResolveResult)resolveResult).getNameDefiners());
-                    }
-                  }
-                }
-              }
-            }
-          }.visitElement(pair.getFirst());
-        }
-      }
-    }
-
-    private void processReference(PyElement node, @Nullable PsiReference reference) {
-      if (!isEnabled(node) || reference == null || reference.isSoft()) {
-        return;
-      }
-      HighlightSeverity severity = HighlightSeverity.ERROR;
-      if (reference instanceof PsiReferenceEx) {
-        severity = ((PsiReferenceEx)reference).getUnresolvedHighlightSeverity(myTypeEvalContext);
-        if (severity == null) return;
-      }
-      PyExceptPart guard = getImportErrorGuard(node);
-      if (guard != null) {
-        processReferenceInImportGuard(node, guard);
-        return;
-      }
-      if (node instanceof PyQualifiedExpression) {
-        final PyQualifiedExpression qExpr = (PyQualifiedExpression)node;
-        final PyExpression qualifier = qExpr.getQualifier();
-        final String name = node.getName();
-        if (qualifier != null && name != null && isGuardedByHasattr(qualifier, name)) {
-          return;
-        }
-      }
-      PsiElement target = null;
-      boolean unresolved;
-      if (reference instanceof PsiPolyVariantReference) {
-        final PsiPolyVariantReference poly = (PsiPolyVariantReference)reference;
-        final ResolveResult[] resolveResults = poly.multiResolve(false);
-        unresolved = (resolveResults.length == 0);
-        for (ResolveResult resolveResult : resolveResults) {
-          if (target == null && resolveResult.isValidResult()) {
-            target = resolveResult.getElement();
-          }
-          if (resolveResult instanceof ImportedResolveResult) {
-            myUsedImports.addAll(((ImportedResolveResult)resolveResult).getNameDefiners());
-          }
-        }
-      }
-      else {
-        target = reference.resolve();
-        unresolved = (target == null);
-      }
-      if (unresolved) {
-        boolean ignoreUnresolved = false;
-        for (PyInspectionExtension extension : Extensions.getExtensions(PyInspectionExtension.EP_NAME)) {
-          if (extension.ignoreUnresolvedReference(node, reference)) {
-            ignoreUnresolved = true;
-            break;
-          }
-        }
-        if (!ignoreUnresolved) {
-          registerUnresolvedReferenceProblem(node, reference, severity);
-        }
-        // don't highlight unresolved imports as unused
-        if (node.getParent() instanceof PyImportElement) {
-          myAllImports.remove(node.getParent());
-        }
-      }
-      else if (reference instanceof PyImportReference &&
-               target == reference.getElement().getContainingFile() &&
-               !isContainingFileImportAllowed(node, (PsiFile)target)) {
-        registerProblem(node, "Import resolves to its containing file");
-      }
-    }
-
-    private static boolean isContainingFileImportAllowed(PyElement node, PsiFile target) {
-      // import resolving to containing file is allowed when we're importing from the current package and the containing file
-      // is __init__.py (PY-5265)
-      final boolean insideFromImport = PsiTreeUtil.getParentOfType(node, PyFromImportStatement.class) != null;
-      if (!insideFromImport) {
-        return false;
-      }
-      if (PyImportStatementNavigator.getImportStatementByElement(node) != null) {
-        return false;
-      }
-      return target.getName().equals(PyNames.INIT_DOT_PY);
-    }
-
-    private void processReferenceInImportGuard(PyElement node, PyExceptPart guard) {
-      final PyImportElement importElement = PsiTreeUtil.getParentOfType(node, PyImportElement.class);
-      if (importElement != null) {
-        final String visibleName = importElement.getVisibleName();
-        final ScopeOwner owner = ScopeUtil.getScopeOwner(importElement);
-        if (visibleName != null && owner != null) {
-          final Collection<PsiElement> allWrites = ScopeUtil.getReadWriteElements(visibleName, owner, false, true);
-          final Collection<PsiElement> writesInsideGuard = new ArrayList<PsiElement>();
-          for (PsiElement write : allWrites) {
-            if (PsiTreeUtil.isAncestor(guard, write, false)) {
-              writesInsideGuard.add(write);
-            }
-          }
-          if (writesInsideGuard.isEmpty()) {
-            final PyTargetExpression asElement = importElement.getAsNameElement();
-            final PyElement toHighlight = asElement != null ? asElement : node;
-            registerProblem(toHighlight,
-                            PyBundle.message("INSP.try.except.import.error",
-                                             visibleName),
-                            ProblemHighlightType.LIKE_UNKNOWN_SYMBOL);
-          }
-        }
-      }
-    }
-
-    private void registerUnresolvedReferenceProblem(@NotNull PyElement node, @NotNull final PsiReference reference,
-                                                    @NotNull HighlightSeverity severity) {
-      if (reference instanceof DocStringTypeReference) {
-        return;
-      }
-      String description = null;
-      PsiElement element = reference.getElement();
-      final String text = element.getText();
-      TextRange rangeInElement = reference.getRangeInElement();
-      String refText = text;  // text of the part we're working with
-      if (rangeInElement.getStartOffset() > 0 && rangeInElement.getEndOffset() > 0) {
-        refText = rangeInElement.substring(text);
-      }
-
-      final List<LocalQuickFix> actions = new ArrayList<LocalQuickFix>(2);
-      final String refName = (element instanceof PyQualifiedExpression) ? ((PyQualifiedExpression)element).getReferencedName() : refText;
-      // Empty text, nothing to highlight
-      if (refName == null || refName.length() <= 0) {
-        return;
-      }
-
-      final QualifiedName canonicalQName = getCanonicalName(reference, myTypeEvalContext);
-      final String canonicalName = canonicalQName != null ? canonicalQName.toString() : null;
-      if (canonicalName != null) {
-        for (String ignored : myIgnoredIdentifiers) {
-          if (ignored.endsWith(END_WILDCARD)) {
-            final String prefix = ignored.substring(0, ignored.length() - END_WILDCARD.length());
-            if (canonicalName.startsWith(prefix)) {
-              return;
-            }
-          }
-          else if (canonicalName.equals(ignored)) {
-            return;
-          }
-        }
-      }
-      // Legacy non-qualified ignore patterns
-      if (myIgnoredIdentifiers.contains(refName)) {
-        return;
-      }
-
-      if (element instanceof PyReferenceExpression) {
-        PyReferenceExpression expr = (PyReferenceExpression)element;
-        if (PyNames.COMPARISON_OPERATORS.contains(refName)) {
-          return;
-        }
-        if (expr.isQualified()) {
-          final PyClassTypeImpl object_type = (PyClassTypeImpl)PyBuiltinCache.getInstance(node).getObjectType();
-          if ((object_type != null) && object_type.getPossibleInstanceMembers().contains(refName)) return;
-        }
-        else {
-          if (PyUnreachableCodeInspection.hasAnyInterruptedControlFlowPaths(expr)) {
-            return;
-          }
-          if (LanguageLevel.forElement(node).isOlderThan(LanguageLevel.PYTHON26)) {
-            if ("with".equals(refName)) {
-              actions.add(new UnresolvedRefAddFutureImportQuickFix());
-            }
-          }
-          if (refText.equals("true") || refText.equals("false")) {
-            actions.add(new UnresolvedRefTrueFalseQuickFix(element));
-          }
-          addAddSelfFix(node, expr, actions);
-          PyCallExpression callExpression = PsiTreeUtil.getParentOfType(element, PyCallExpression.class);
-          if (callExpression != null && (!(callExpression.getCallee() instanceof PyQualifiedExpression) ||
-              ((PyQualifiedExpression)callExpression.getCallee()).getQualifier() == null)) {
-            actions.add(new UnresolvedRefCreateFunctionQuickFix(callExpression, expr));
-          }
-          PyFunction parentFunction = PsiTreeUtil.getParentOfType(element, PyFunction.class);
-          PyDecorator decorator = PsiTreeUtil.getParentOfType(element, PyDecorator.class);
-          PyImportStatement importStatement = PsiTreeUtil.getParentOfType(element, PyImportStatement.class);
-          if (parentFunction != null && decorator == null && importStatement == null) {
-            actions.add(new UnresolvedReferenceAddParameterQuickFix(refName));
-          }
-          actions.add(new PyRenameUnresolvedRefQuickFix());
-        }
-        // unqualified:
-        // may be module's
-        if (PyModuleType.getPossibleInstanceMembers().contains(refName)) return;
-        // may be a "try: import ..."; not an error not to resolve
-        if ((
-          PsiTreeUtil.getParentOfType(
-            PsiTreeUtil.getParentOfType(node, PyImportElement.class), PyTryExceptStatement.class, PyIfStatement.class
-          ) != null
-        )) {
-          severity = HighlightSeverity.WEAK_WARNING;
-          description = PyBundle.message("INSP.module.$0.not.found", refText);
-          // TODO: mark the node so that future references pointing to it won't result in a error, but in a warning
-        }
-      }
-      if (reference instanceof PsiReferenceEx && description == null) {
-        description = ((PsiReferenceEx)reference).getUnresolvedDescription();
-      }
-      if (description == null) {
-        boolean markedQualified = false;
-        if (element instanceof PyQualifiedExpression) {
-          // TODO: Add __qualname__ for Python 3.3 to the skeleton of <class 'object'>, introduce a pseudo-class skeleton for
-          // <class 'function'>
-          if ("__qualname__".equals(refText) && LanguageLevel.forElement(element).isAtLeast(LanguageLevel.PYTHON33)) {
-            return;
-          }
-          final PyQualifiedExpression expr = (PyQualifiedExpression)element;
-          if (PyNames.COMPARISON_OPERATORS.contains(expr.getReferencedName())) {
-            return;
-          }
-          final PyExpression qualifier = expr.getQualifier();
-          if (qualifier != null) {
-            PyType type = myTypeEvalContext.getType(qualifier);
-            if (type != null) {
-              if (ignoreUnresolvedMemberForType(type, reference, refName)) {
-                return;
-              }
-              addCreateMemberFromUsageFixes(type, reference, refText, actions);
-              if (type instanceof PyClassTypeImpl) {
-                if (reference instanceof PyOperatorReference) {
-                  description = PyBundle.message("INSP.unresolved.operator.ref",
-                                                 type.getName(), refName,
-                                                 ((PyOperatorReference)reference).getReadableOperatorName());
-                }
-                else {
-                  description = PyBundle.message("INSP.unresolved.ref.$0.for.class.$1", refText, type.getName());
-                }
-                markedQualified = true;
-              }
-              else {
-                description = PyBundle.message("INSP.cannot.find.$0.in.$1", refText, type.getName());
-                markedQualified = true;
-              }
-            }
-          }
-        }
-        if (!markedQualified) {
-          description = PyBundle.message("INSP.unresolved.ref.$0", refText);
-
-          // look in other imported modules for this whole name
-          if (PythonReferenceImporter.isImportable(element)) {
-            addAutoImportFix(node, reference, actions);
-          }
-
-          addCreateClassFix(refText, element, actions);
-        }
-      }
-      ProblemHighlightType hl_type;
-      if (severity == HighlightSeverity.WARNING) {
-        hl_type = ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
-      }
-      else if (severity == HighlightSeverity.ERROR) {
-        hl_type = ProblemHighlightType.GENERIC_ERROR;
-      }
-      else {
-        hl_type = ProblemHighlightType.LIKE_UNKNOWN_SYMBOL;
-      }
-
-      if (element != null) {
-        PyImportStatementBase importStatementBase = PsiTreeUtil.getParentOfType(element, PyImportStatementBase.class);
-        if ((importStatementBase != null) && GenerateBinaryStubsFix.isApplicable(importStatementBase)) {
-          actions.addAll(GenerateBinaryStubsFix.generateFixes(importStatementBase));
-        }
-      }
-      if (canonicalQName != null) {
-        actions.add(new AddIgnoredIdentifierQuickFix(canonicalQName, false));
-        if (canonicalQName.getComponentCount() > 1) {
-          actions.add(new AddIgnoredIdentifierQuickFix(canonicalQName.removeLastComponent(), true));
-        }
-      }
-      addPluginQuickFixes(reference, actions);
-
-      if (reference instanceof PyImportReference) {
-        // TODO: Ignore references in the second part of the 'from ... import ...' expression
-        final QualifiedName qname = QualifiedName.fromDottedString(refName);
-        final List<String> components = qname.getComponents();
-        if (!components.isEmpty()) {
-          final String packageName = components.get(0);
-          final Module module = ModuleUtilCore.findModuleForPsiElement(node);
-          final Sdk sdk = PythonSdkType.findPythonSdk(module);
-          if (module != null && sdk != null) {
-            if (PyPIPackageUtil.INSTANCE.isInPyPI(packageName)) {
-              final List<PyRequirement> requirements = Collections.singletonList(new PyRequirement(packageName));
-              final String name = "Install package " + packageName;
-              if (PyPackageManager.getInstance(sdk).hasPip()) {
-                actions.add(new PyPackageRequirementsInspection.PyInstallRequirementsFix(name, module, sdk, requirements));
-              }
-            }
-          }
-        }
-      }
-      registerProblem(node, description, hl_type, null, rangeInElement, actions.toArray(new LocalQuickFix[actions.size()]));
-    }
-
-    /**
-     * Return the canonical qualified name for a reference (even for an unresolved one).
-     */
-    @Nullable
-    private static QualifiedName getCanonicalName(@NotNull PsiReference reference, @NotNull TypeEvalContext context) {
-      final PsiElement element = reference.getElement();
-      if (reference instanceof PyOperatorReference && element instanceof PyQualifiedExpression) {
-        final PyExpression receiver = ((PyOperatorReference)reference).getReceiver();
-        if (receiver != null) {
-          final PyType type = context.getType(receiver);
-          if (type instanceof PyClassType) {
-            final String name = ((PyClassType)type).getClassQName();
-            if (name != null) {
-              return QualifiedName.fromDottedString(name).append(((PyQualifiedExpression)element).getReferencedName());
-            }
-          }
-        }
-      }
-      else if (element instanceof PyReferenceExpression) {
-        final PyReferenceExpression expr = (PyReferenceExpression)element;
-        final PyExpression qualifier = expr.getQualifier();
-        final String exprName = expr.getName();
-        if (exprName != null) {
-          if (qualifier != null) {
-            final PyType type = context.getType(qualifier);
-            if (type instanceof PyClassType) {
-              final String name = ((PyClassType)type).getClassQName();
-              if (name != null) {
-                return QualifiedName.fromDottedString(name).append(exprName);
-              }
-            }
-            else if (type instanceof PyModuleType) {
-              final PyFile file = ((PyModuleType)type).getModule();
-              final QualifiedName name = QualifiedNameFinder.findCanonicalImportPath(file, element);
-              if (name != null) {
-                return name.append(exprName);
-              }
-            }
-          }
-          else {
-            final PsiElement parent = element.getParent();
-            if (parent instanceof PyImportElement) {
-              final PyImportStatementBase importStmt = PsiTreeUtil.getParentOfType(parent, PyImportStatementBase.class);
-              if (importStmt instanceof PyImportStatement) {
-                return QualifiedName.fromComponents(exprName);
-              }
-              else if (importStmt instanceof PyFromImportStatement) {
-                final PsiElement resolved = ((PyFromImportStatement)importStmt).resolveImportSource();
-                if (resolved != null) {
-                  final QualifiedName path = QualifiedNameFinder.findCanonicalImportPath(resolved, element);
-                  if (path != null) {
-                    return path.append(exprName);
-                  }
-                }
-              }
-            }
-            else {
-              final QualifiedName path = QualifiedNameFinder.findCanonicalImportPath(element, element);
-              if (path != null) {
-                return path.append(exprName);
-              }
-            }
-          }
-        }
-      }
-      else if (reference instanceof DocStringParameterReference) {
-        return QualifiedName.fromDottedString(reference.getCanonicalText());
-      }
-      return null;
-    }
-
-    private boolean ignoreUnresolvedMemberForType(@NotNull PyType type, PsiReference reference, String name) {
-      if (type instanceof PyNoneType || PyTypeChecker.isUnknown(type)) {
-        // this almost always means that we don't know the type, so don't show an error in this case
-        return true;
-      }
-      if (type instanceof PyImportedModuleType) {
-        PyImportedModule module = ((PyImportedModuleType)type).getImportedModule();
-        if (module.resolve() == null) {
-          return true;
-        }
-      }
-      if (type instanceof PyClassTypeImpl) {
-        PyClass cls = ((PyClassType)type).getPyClass();
-        if (overridesGetAttr(cls, myTypeEvalContext)) {
-          return true;
-        }
-        if (cls.findProperty(name, true) != null) {
-          return true;
-        }
-        if (PyUtil.hasUnresolvedAncestors(cls, myTypeEvalContext)) {
-          return true;
-        }
-        if (isDecoratedAsDynamic(cls, true)) {
-          return true;
-        }
-        if (hasUnresolvedDynamicMember((PyClassType)type, reference, name)) return true;
-      }
-      if (type instanceof PyFunctionType) {
-        final Callable callable = ((PyFunctionType)type).getCallable();
-        if (callable instanceof PyFunction && ((PyFunction)callable).getDecoratorList() != null) {
-          return true;
-        }
-      }
-      for (PyInspectionExtension extension : Extensions.getExtensions(PyInspectionExtension.EP_NAME)) {
-        if (extension.ignoreUnresolvedMember(type, name)) {
-          return true;
-        }
-      }
-      return false;
-    }
-
-    private static boolean hasUnresolvedDynamicMember(@NotNull final PyClassType type,
-                                                      PsiReference reference,
-                                                      @NotNull final String name) {
-      for (PyClassMembersProvider provider : Extensions.getExtensions(PyClassMembersProvider.EP_NAME)) {
-        final Collection<PyDynamicMember> resolveResult = provider.getMembers(type, reference.getElement());
-        for (PyDynamicMember member : resolveResult) {
-          if (member.getName().equals(name)) return true;
-        }
-      }
-      return false;
-    }
-
-    private boolean isDecoratedAsDynamic(@NotNull PyClass cls, boolean inherited) {
-      if (inherited) {
-        if (isDecoratedAsDynamic(cls, false)) {
-          return true;
-        }
-        for (PyClass base : cls.getAncestorClasses(myTypeEvalContext)) {
-          if (base != null && isDecoratedAsDynamic(base, false)) {
-            return true;
-          }
-        }
-      }
-      else {
-        if (cls.getDecoratorList() != null) {
-          return true;
-        }
-        final String docString = cls.getDocStringValue();
-        if (docString != null && docString.contains("@DynamicAttrs")) {
-          return true;
-        }
-      }
-      return false;
-    }
-
-    private static void addCreateMemberFromUsageFixes(PyType type, PsiReference reference, String refText, List<LocalQuickFix> actions) {
-      PsiElement element = reference.getElement();
-      if (type instanceof PyClassTypeImpl) {
-        PyClass cls = ((PyClassType)type).getPyClass();
-        if (!PyBuiltinCache.getInstance(element).isBuiltin(cls)) {
-          if (element.getParent() instanceof PyCallExpression) {
-            actions.add(new AddMethodQuickFix(refText, cls.getName(), true));
-          }
-          else if (!(reference instanceof PyOperatorReference)) {
-            actions.add(new AddFieldQuickFix(refText, "None", type.getName(), true));
-          }
-        }
-      }
-      else if (type instanceof PyModuleType) {
-        PyFile file = ((PyModuleType)type).getModule();
-        actions.add(new AddFunctionQuickFix(refText, file.getName()));
-      }
-    }
-
-    private void addAddSelfFix(PyElement node, PyReferenceExpression expr, List<LocalQuickFix> actions) {
-      final PyClass containedClass = PsiTreeUtil.getParentOfType(node, PyClass.class);
-      final PyFunction function = PsiTreeUtil.getParentOfType(node, PyFunction.class);
-      if (containedClass != null && function != null) {
-        final PyParameter[] parameters = function.getParameterList().getParameters();
-        if (parameters.length == 0) return;
-        final String qualifier = parameters[0].getText();
-        final PyDecoratorList decoratorList = function.getDecoratorList();
-        boolean isClassMethod = false;
-        if (decoratorList != null) {
-          for (PyDecorator decorator : decoratorList.getDecorators()) {
-            final PyExpression callee = decorator.getCallee();
-            if (callee != null && PyNames.CLASSMETHOD.equals(callee.getText()))
-              isClassMethod = true;
-          }
-        }
-        for (PyTargetExpression target : containedClass.getInstanceAttributes()) {
-          if (!isClassMethod && Comparing.strEqual(node.getName(), target.getName())) {
-            actions.add(new UnresolvedReferenceAddSelfQuickFix(expr, qualifier));
-          }
-        }
-        for (PyStatement statement : containedClass.getStatementList().getStatements()) {
-          if (statement instanceof PyAssignmentStatement) {
-            PyExpression lhsExpression = ((PyAssignmentStatement)statement).getLeftHandSideExpression();
-            if (lhsExpression != null && lhsExpression.getText().equals(expr.getText())) {
-              PyExpression assignedValue = ((PyAssignmentStatement)statement).getAssignedValue();
-              if (assignedValue instanceof PyCallExpression) {
-                PyType type = myTypeEvalContext.getType(assignedValue);
-                if (type != null && type instanceof PyClassTypeImpl) {
-                  if (((PyCallExpression)assignedValue).isCalleeText(PyNames.PROPERTY)) {
-                    actions.add(new UnresolvedReferenceAddSelfQuickFix(expr, qualifier));
-                  }
-                }
-              }
-            }
-          }
-        }
-        for (PyFunction method : containedClass.getMethods()) {
-          if (expr.getText().equals(method.getName())) {
-            actions.add(new UnresolvedReferenceAddSelfQuickFix(expr, qualifier));
-          }
-        }
-      }
-    }
-
-    private static void addAutoImportFix(PyElement node, PsiReference reference, List<LocalQuickFix> actions) {
-      final PsiFile file = InjectedLanguageManager.getInstance(node.getProject()).getTopLevelFile(node);
-      if (!(file instanceof PyFile)) return;
-      AutoImportQuickFix importFix = PythonReferenceImporter.proposeImportFix(node, reference);
-      if (importFix != null) {
-        if (!suppressHintForAutoImport(node, importFix) && PyCodeInsightSettings.getInstance().SHOW_IMPORT_POPUP) {
-          final AutoImportHintAction autoImportHintAction = new AutoImportHintAction(importFix);
-          actions.add(autoImportHintAction);
-        }
-        else {
-          actions.add(importFix);
-        }
-      }
-    }
-
-    private static boolean suppressHintForAutoImport(PyElement node, AutoImportQuickFix importFix) {
-      // if the context doesn't look like a function call and we only found imports of functions, suggest auto-import
-      // as a quickfix but no popup balloon (PY-2312)
-      if (!isCall(node) && importFix.hasOnlyFunctions()) {
-        return true;
-      }
-      // if we're in a class context and the class defines a variable with the same name, offer auto-import only as quickfix,
-      // not as popup
-      PyClass containingClass = PsiTreeUtil.getParentOfType(node, PyClass.class);
-      if (containingClass != null && (containingClass.findMethodByName(importFix.getNameToImport(), true) != null ||
-                                      containingClass.findInstanceAttribute(importFix.getNameToImport(), true) != null)) {
-        return true;
-      }
-      return false;
-    }
-
-    private void addCreateClassFix(String refText, PsiElement element, List<LocalQuickFix> actions) {
-      if (refText.length() > 2 && Character.isUpperCase(refText.charAt(0)) && !refText.toUpperCase().equals(refText) &&
-          PsiTreeUtil.getParentOfType(element, PyImportStatementBase.class) == null) {
-        PsiElement anchor = element;
-        if (element instanceof PyQualifiedExpression) {
-          final PyExpression expr = ((PyQualifiedExpression)element).getQualifier();
-          if (expr != null) {
-            final PyType type = myTypeEvalContext.getType(expr);
-            if (type instanceof PyModuleType) {
-              anchor = ((PyModuleType)type).getModule();
-            }
-            else {
-              anchor = null;
-            }
-          }
-          if (anchor != null) {
-            actions.add(new CreateClassQuickFix(refText, anchor));
-          }
-        }
-      }
-    }
-
-    private static boolean isCall(PyElement node) {
-      final PyCallExpression callExpression = PsiTreeUtil.getParentOfType(node, PyCallExpression.class);
-      return callExpression != null && node == callExpression.getCallee();
-    }
-
-    @Nullable
-    private static PsiElement resolveClassMember(@NotNull PyClass cls, @NotNull String name, @NotNull TypeEvalContext context) {
-      final PyType type = context.getType(cls);
-      if (type != null) {
-        final PyResolveContext resolveContext = PyResolveContext.noImplicits().withTypeEvalContext(context);
-        final List<? extends RatedResolveResult> results = type.resolveMember(name, null, AccessDirection.READ, resolveContext);
-        if (results != null && !results.isEmpty()) {
-          return results.get(0).getElement();
-        }
-      }
-      return null;
-    }
-
-    private static boolean overridesGetAttr(@NotNull PyClass cls, @NotNull TypeEvalContext context) {
-      PsiElement method = resolveClassMember(cls, PyNames.GETATTR, context);
-      if (method != null) {
-        return true;
-      }
-      method = resolveClassMember(cls, PyNames.GETATTRIBUTE, context);
-      if (method != null && !PyBuiltinCache.getInstance(cls).isBuiltin(method)) {
-        return true;
-      }
-      return false;
-    }
-
-    private static void addPluginQuickFixes(PsiReference reference, final List<LocalQuickFix> actions) {
-      for (PyUnresolvedReferenceQuickFixProvider provider : Extensions.getExtensions(PyUnresolvedReferenceQuickFixProvider.EP_NAME)) {
-        provider.registerQuickFixes(reference, new Consumer<LocalQuickFix>() {
-          public void consume(LocalQuickFix localQuickFix) {
-            actions.add(localQuickFix);
-          }
-        });
-      }
-    }
-
-    public void highlightUnusedImports() {
-      final List<PsiElement> unused = collectUnusedImportElements();
-      for (PsiElement element : unused) {
-        if (element.getTextLength() > 0) {
-          registerProblem(element, "Unused import statement", ProblemHighlightType.LIKE_UNUSED_SYMBOL, null, new OptimizeImportsQuickFix());
-        }
-      }
-    }
-
-    private List<PsiElement> collectUnusedImportElements() {
-      if (myAllImports.isEmpty()) {
-        return Collections.emptyList();
-      }
-      // PY-1315 Unused imports inspection shouldn't work in python REPL console
-      final NameDefiner first = myAllImports.iterator().next();
-      if (first.getContainingFile() instanceof PyExpressionCodeFragment || PydevConsoleRunner.isInPydevConsole(first)) {
-        return Collections.emptyList();
-      }
-      List<PsiElement> result = new ArrayList<PsiElement>();
-
-      Set<NameDefiner> unusedImports = new HashSet<NameDefiner>(myAllImports);
-      unusedImports.removeAll(myUsedImports);
-      Set<String> usedImportNames = new HashSet<String>();
-      for (PsiElement usedImport : myUsedImports) {
-        if (usedImport instanceof NameDefiner) {
-          for (PyElement e : ((NameDefiner)usedImport).iterateNames()) {
-            usedImportNames.add(e.getName());
-          }
-        }
-      }
-
-      Set<PyImportStatementBase> unusedStatements = new HashSet<PyImportStatementBase>();
-      final PyUnresolvedReferencesInspection suppressableInspection = new PyUnresolvedReferencesInspection();
-      QualifiedName packageQName = null;
-      List<String> dunderAll = null;
-
-          for (NameDefiner unusedImport : unusedImports) {
-        if (packageQName == null) {
-          final PsiFile file = unusedImport.getContainingFile();
-          if (file instanceof PyFile) {
-            dunderAll = ((PyFile)file).getDunderAll();
-          }
-          if (file != null && PyUtil.isPackage(file)) {
-            packageQName = QualifiedNameFinder.findShortestImportableQName(file);
-          }
-        }
-        PyImportStatementBase importStatement = PsiTreeUtil.getParentOfType(unusedImport, PyImportStatementBase.class);
-        if (importStatement != null && !unusedStatements.contains(importStatement) && !myUsedImports.contains(importStatement)) {
-          if (suppressableInspection.isSuppressedFor(importStatement)) {
-            continue;
-          }
-          // don't remove as unused imports in try/except statements
-          if (PsiTreeUtil.getParentOfType(importStatement, PyTryExceptStatement.class) != null) {
-            continue;
-          }
-          // Don't report conditional imports as unused
-          if (PsiTreeUtil.getParentOfType(unusedImport, PyIfStatement.class) != null) {
-            boolean isUsed = false;
-            for (PyElement e : unusedImport.iterateNames()) {
-              if (usedImportNames.contains(e.getName())) {
-                isUsed = true;
-              }
-            }
-            if (isUsed) {
-              continue;
-            }
-          }
-          PsiElement importedElement;
-          if (unusedImport instanceof PyImportElement) {
-            final PyImportElement importElement = (PyImportElement)unusedImport;
-            final PsiElement element = importElement.resolve();
-            if (element == null) {
-              if (importElement.getImportedQName() != null) {
-                //Mark import as unused even if it can't be resolved
-                result.add(importElement.getParent());
-              }
-              continue;
-            }
-            if (dunderAll != null && dunderAll.contains(importElement.getVisibleName())) {
-              continue;
-            }
-            importedElement = element.getContainingFile();
-          }
-          else {
-            assert importStatement instanceof PyFromImportStatement;
-            importedElement = ((PyFromImportStatement)importStatement).resolveImportSource();
-            if (importedElement == null) {
-              continue;
-            }
-          }
-          if (packageQName != null && importedElement instanceof PsiFileSystemItem) {
-            final QualifiedName importedQName = QualifiedNameFinder.findShortestImportableQName((PsiFileSystemItem)importedElement);
-            if (importedQName != null && importedQName.matchesPrefix(packageQName)) {
-              continue;
-            }
-          }
-          if (unusedImport instanceof PyStarImportElement || areAllImportsUnused(importStatement, unusedImports)) {
-            unusedStatements.add(importStatement);
-            result.add(importStatement);
-          }
-          else {
-            result.add(unusedImport);
-          }
-        }
-      }
-      return result;
-    }
-
-    private static boolean areAllImportsUnused(PyImportStatementBase importStatement, Set<NameDefiner> unusedImports) {
-      final PyImportElement[] elements = importStatement.getImportElements();
-      for (PyImportElement element : elements) {
-        if (!unusedImports.contains(element)) {
-          return false;
-        }
-      }
-      return true;
-    }
-
-    public void optimizeImports() {
-      final List<PsiElement> elementsToDelete = collectUnusedImportElements();
-      for (PsiElement element : elementsToDelete) {
-        if (element.isValid()) {
-          element.delete();
-        }
-      }
-    }
-  }
-
-}
diff --git a/python/src/com/jetbrains/python/inspections/quickfix/AddIgnoredIdentifierQuickFix.java b/python/src/com/jetbrains/python/inspections/quickfix/AddIgnoredIdentifierQuickFix.java
index 23e0b2e..22c1a26 100644
--- a/python/src/com/jetbrains/python/inspections/quickfix/AddIgnoredIdentifierQuickFix.java
+++ b/python/src/com/jetbrains/python/inspections/quickfix/AddIgnoredIdentifierQuickFix.java
@@ -21,7 +21,7 @@
 import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
 import com.intellij.psi.PsiElement;
 import com.intellij.util.Consumer;
-import com.jetbrains.python.inspections.PyUnresolvedReferencesInspection;
+import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection;
 import com.intellij.psi.util.QualifiedName;
 import org.jetbrains.annotations.NotNull;
 
diff --git a/python/src/com/jetbrains/python/inspections/quickfix/PyMakeFunctionFromMethodQuickFix.java b/python/src/com/jetbrains/python/inspections/quickfix/PyMakeFunctionFromMethodQuickFix.java
index e578bdd..4c5a714 100644
--- a/python/src/com/jetbrains/python/inspections/quickfix/PyMakeFunctionFromMethodQuickFix.java
+++ b/python/src/com/jetbrains/python/inspections/quickfix/PyMakeFunctionFromMethodQuickFix.java
@@ -28,7 +28,7 @@
 import com.jetbrains.python.PyBundle;
 import com.jetbrains.python.PyNames;
 import com.jetbrains.python.codeInsight.imports.AddImportHelper;
-import com.jetbrains.python.inspections.PyUnresolvedReferencesInspection;
+import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection;
 import com.jetbrains.python.psi.*;
 import com.jetbrains.python.refactoring.PyRefactoringUtil;
 import org.jetbrains.annotations.NonNls;
diff --git a/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferenceSkipperExtPoint.java b/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferenceSkipperExtPoint.java
new file mode 100644
index 0000000..d64d9a9
--- /dev/null
+++ b/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferenceSkipperExtPoint.java
@@ -0,0 +1,25 @@
+package com.jetbrains.python.inspections.unresolvedReference;
+
+import com.intellij.openapi.extensions.ExtensionPointName;
+import com.jetbrains.python.psi.PyImportedNameDefiner;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Inject this point to ask "unused reference" inspection to skip some unused references.
+ * For example in Django you may import "I18N" to your "settings.py". It is not used in "settings.py", but used by Django
+ * and should not be marked as "unused".
+ *
+ * @author Ilya.Kazakevich
+ */
+public interface PyUnresolvedReferenceSkipperExtPoint {
+  @NotNull
+  ExtensionPointName<PyUnresolvedReferenceSkipperExtPoint> EP_NAME = ExtensionPointName.create("Pythonid.unresolvedReferenceSkipper");
+
+  /**
+   * Checks if some unused import should be skipped
+   *
+   * @param importNameDefiner unused import
+   * @return true if should be skipped
+   */
+  boolean unusedImportShouldBeSkipped(@NotNull PyImportedNameDefiner importNameDefiner);
+}
diff --git a/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferencesInspection.java b/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferencesInspection.java
new file mode 100644
index 0000000..fbe2680
--- /dev/null
+++ b/python/src/com/jetbrains/python/inspections/unresolvedReference/PyUnresolvedReferencesInspection.java
@@ -0,0 +1,1067 @@
+/*
+ * 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.jetbrains.python.inspections.unresolvedReference;
+
+import com.google.common.collect.ImmutableSet;
+import com.intellij.codeInspection.*;
+import com.intellij.codeInspection.ui.ListEditForm;
+import com.intellij.lang.ASTNode;
+import com.intellij.lang.annotation.HighlightSeverity;
+import com.intellij.lang.injection.InjectedLanguageManager;
+import com.intellij.openapi.extensions.Extensions;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleUtilCore;
+import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.openapi.util.*;
+import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
+import com.intellij.psi.*;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.QualifiedName;
+import com.intellij.util.Consumer;
+import com.intellij.util.PlatformUtils;
+import com.jetbrains.python.PyBundle;
+import com.jetbrains.python.PyNames;
+import com.jetbrains.python.codeInsight.PyCodeInsightSettings;
+import com.jetbrains.python.codeInsight.PyDynamicMember;
+import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
+import com.jetbrains.python.codeInsight.dataflow.scope.ScopeUtil;
+import com.jetbrains.python.codeInsight.imports.AutoImportHintAction;
+import com.jetbrains.python.codeInsight.imports.AutoImportQuickFix;
+import com.jetbrains.python.codeInsight.imports.OptimizeImportsQuickFix;
+import com.jetbrains.python.codeInsight.imports.PythonReferenceImporter;
+import com.jetbrains.python.console.PydevConsoleRunner;
+import com.jetbrains.python.documentation.DocStringParameterReference;
+import com.jetbrains.python.documentation.DocStringTypeReference;
+import com.jetbrains.python.inspections.*;
+import com.jetbrains.python.inspections.quickfix.*;
+import com.jetbrains.python.packaging.PyPIPackageUtil;
+import com.jetbrains.python.packaging.PyPackageManager;
+import com.jetbrains.python.packaging.PyRequirement;
+import com.jetbrains.python.psi.*;
+import com.jetbrains.python.psi.impl.PyBuiltinCache;
+import com.jetbrains.python.psi.impl.PyImportStatementNavigator;
+import com.jetbrains.python.psi.impl.PyImportedModule;
+import com.jetbrains.python.psi.impl.references.PyImportReference;
+import com.jetbrains.python.psi.impl.references.PyOperatorReference;
+import com.jetbrains.python.psi.resolve.ImportedResolveResult;
+import com.jetbrains.python.psi.resolve.PyResolveContext;
+import com.jetbrains.python.psi.resolve.QualifiedNameFinder;
+import com.jetbrains.python.psi.resolve.RatedResolveResult;
+import com.jetbrains.python.psi.types.*;
+import com.jetbrains.python.sdk.PythonSdkType;
+import com.jetbrains.python.sdk.skeletons.PySkeletonRefresher;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import java.util.*;
+import java.util.HashSet;
+
+import static com.jetbrains.python.inspections.quickfix.AddIgnoredIdentifierQuickFix.END_WILDCARD;
+
+/**
+ * Marks references that fail to resolve. Also tracks unused imports and provides "optimize imports" support.
+ * User: dcheryasov
+ * Date: Nov 15, 2008
+ */
+public class PyUnresolvedReferencesInspection extends PyInspection {
+  private static Key<Visitor> KEY = Key.create("PyUnresolvedReferencesInspection.Visitor");
+  public static final Key<PyUnresolvedReferencesInspection> SHORT_NAME_KEY =
+    Key.create(PyUnresolvedReferencesInspection.class.getSimpleName());
+
+  public JDOMExternalizableStringList ignoredIdentifiers = new JDOMExternalizableStringList();
+
+  public static PyUnresolvedReferencesInspection getInstance(PsiElement element) {
+    final InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(element.getProject()).getInspectionProfile();
+    return (PyUnresolvedReferencesInspection)inspectionProfile.getUnwrappedTool(SHORT_NAME_KEY.toString(), element);
+  }
+
+  @Nls
+  @NotNull
+  public String getDisplayName() {
+    return PyBundle.message("INSP.NAME.unresolved.refs");
+  }
+
+  @NotNull
+  @Override
+  public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder,
+                                        final boolean isOnTheFly,
+                                        @NotNull final LocalInspectionToolSession session) {
+    final Visitor visitor = new Visitor(holder, session, ignoredIdentifiers);
+    // buildVisitor() will be called on injected files in the same session - don't overwrite if we already have one
+    final Visitor existingVisitor = session.getUserData(KEY);
+    if (existingVisitor == null) {
+      session.putUserData(KEY, visitor);
+    }
+    return visitor;
+  }
+
+  @Override
+  public void inspectionFinished(@NotNull LocalInspectionToolSession session, @NotNull ProblemsHolder holder) {
+    final Visitor visitor = session.getUserData(KEY);
+    assert visitor != null;
+    if (PyCodeInsightSettings.getInstance().HIGHLIGHT_UNUSED_IMPORTS) {
+      visitor.highlightUnusedImports();
+    }
+    session.putUserData(KEY, null);
+  }
+
+  @Override
+  public JComponent createOptionsPanel() {
+    ListEditForm form = new ListEditForm("Ignore references", ignoredIdentifiers);
+    return form.getContentPanel();
+  }
+
+  public static class Visitor extends PyInspectionVisitor {
+    private Set<PsiElement> myUsedImports = Collections.synchronizedSet(new HashSet<PsiElement>());
+    private Set<PyImportedNameDefiner> myAllImports = Collections.synchronizedSet(new HashSet<PyImportedNameDefiner>());
+    private final ImmutableSet<String> myIgnoredIdentifiers;
+    private volatile Boolean myIsEnabled = null;
+
+    public Visitor(@Nullable ProblemsHolder holder, @NotNull LocalInspectionToolSession session, List<String> ignoredIdentifiers) {
+      super(holder, session);
+      myIgnoredIdentifiers = ImmutableSet.copyOf(ignoredIdentifiers);
+    }
+
+    public boolean isEnabled(@NotNull PsiElement anchor) {
+      if (myIsEnabled == null) {
+        final boolean isPyCharm = PlatformUtils.isPyCharm();
+        myIsEnabled = (isPyCharm && PythonSdkType.getSdk(anchor) != null || !isPyCharm) &&
+                      !PySkeletonRefresher.isGeneratingSkeletons();
+      }
+      return myIsEnabled;
+    }
+
+    @Override
+    public void visitPyTargetExpression(PyTargetExpression node) {
+      checkSlots(node);
+    }
+
+    private void checkSlots(PyQualifiedExpression node) {
+      final PyExpression qualifier = node.getQualifier();
+      if (qualifier != null) {
+        final PyType type = myTypeEvalContext.getType(qualifier);
+        if (type instanceof PyClassType) {
+          final PyClass pyClass = ((PyClassType)type).getPyClass();
+          if (pyClass.isNewStyleClass()) {
+            if (pyClass.getOwnSlots() == null) {
+              return;
+            }
+            final List<String> slots = pyClass.getSlots();
+            final String attrName = node.getReferencedName();
+            if (slots != null && !slots.contains(attrName) && !slots.contains(PyNames.DICT)) {
+              for (PyClass ancestor : pyClass.getAncestorClasses(myTypeEvalContext)) {
+                if (ancestor == null) {
+                  return;
+                }
+                if (PyNames.OBJECT.equals(ancestor.getName())) {
+                  break;
+                }
+                final List<String> ancestorSlots = ancestor.getSlots();
+                if (ancestorSlots == null || ancestorSlots.contains(attrName) || ancestorSlots.contains(PyNames.DICT)) {
+                  return;
+                }
+              }
+              final ASTNode nameNode = node.getNameElement();
+              final PsiElement e = nameNode != null ? nameNode.getPsi() : node;
+              registerProblem(e, "'" + pyClass.getName() + "' object has no attribute '" + attrName + "'");
+            }
+          }
+        }
+      }
+    }
+
+    @Override
+    public void visitPyImportElement(PyImportElement node) {
+      super.visitPyImportElement(node);
+      final PyFromImportStatement fromImport = PsiTreeUtil.getParentOfType(node, PyFromImportStatement.class);
+      if (isEnabled(node) && (fromImport == null || !fromImport.isFromFuture())) {
+        myAllImports.add(node);
+      }
+    }
+
+    @Override
+    public void visitPyStarImportElement(PyStarImportElement node) {
+      super.visitPyStarImportElement(node);
+      if (isEnabled(node)) {
+        myAllImports.add(node);
+      }
+    }
+
+    @Nullable
+    private static PyExceptPart getImportErrorGuard(PyElement node) {
+      final PyImportStatementBase importStatement = PsiTreeUtil.getParentOfType(node, PyImportStatementBase.class);
+      if (importStatement != null) {
+        final PyTryPart tryPart = PsiTreeUtil.getParentOfType(node, PyTryPart.class);
+        if (tryPart != null) {
+          final PyTryExceptStatement tryExceptStatement = PsiTreeUtil.getParentOfType(tryPart, PyTryExceptStatement.class);
+          if (tryExceptStatement != null) {
+            for (PyExceptPart exceptPart : tryExceptStatement.getExceptParts()) {
+              final PyExpression expr = exceptPart.getExceptClass();
+              if (expr != null && "ImportError".equals(expr.getName())) {
+                return exceptPart;
+              }
+            }
+          }
+        }
+      }
+      return null;
+    }
+
+    private static boolean isGuardedByHasattr(@NotNull final PyElement node, @NotNull final String name) {
+      final String nodeName = node.getName();
+      if (nodeName != null) {
+        final ScopeOwner owner = ScopeUtil.getDeclarationScopeOwner(node, nodeName);
+        PyElement e = PsiTreeUtil.getParentOfType(node, PyConditionalStatementPart.class, PyConditionalExpression.class);
+        while (e != null && PsiTreeUtil.isAncestor(owner, e, true)) {
+          final ArrayList<PyCallExpression> calls = new ArrayList<PyCallExpression>();
+          PyExpression cond = null;
+          if (e instanceof PyConditionalStatementPart) {
+            cond = ((PyConditionalStatementPart)e).getCondition();
+          }
+          else if (e instanceof PyConditionalExpression && PsiTreeUtil.isAncestor(((PyConditionalExpression)e).getTruePart(), node, true)) {
+            cond = ((PyConditionalExpression)e).getCondition();
+          }
+          if (cond instanceof PyCallExpression) {
+            calls.add((PyCallExpression)cond);
+          }
+          if (cond != null) {
+            final PyCallExpression[] callExpressions = PsiTreeUtil.getChildrenOfType(cond, PyCallExpression.class);
+            if (callExpressions != null) {
+              calls.addAll(Arrays.asList(callExpressions));
+            }
+            for (PyCallExpression call : calls) {
+              final PyExpression callee = call.getCallee();
+              final PyExpression[] args = call.getArguments();
+              // TODO: Search for `node` aliases using aliases analysis
+              if (callee != null && "hasattr".equals(callee.getName()) && args.length == 2 &&
+                  nodeName.equals(args[0].getName()) && args[1] instanceof PyStringLiteralExpression &&
+                  ((PyStringLiteralExpression)args[1]).getStringValue().equals(name)) {
+                return true;
+              }
+            }
+          }
+          e = PsiTreeUtil.getParentOfType(e, PyConditionalStatementPart.class);
+        }
+      }
+      return false;
+    }
+
+    @Override
+    public void visitPyElement(final PyElement node) {
+      super.visitPyElement(node);
+      final PsiFile file = node.getContainingFile();
+      final InjectedLanguageManager injectedLanguageManager =
+        InjectedLanguageManager.getInstance(node.getProject());
+      if (injectedLanguageManager.isInjectedFragment(file)) {
+        final PsiLanguageInjectionHost host =
+          injectedLanguageManager.getInjectionHost(node);
+        processInjection(host);
+      }
+      if (node instanceof PyReferenceOwner) {
+        final PyResolveContext resolveContext = PyResolveContext.noImplicits().withTypeEvalContext(myTypeEvalContext);
+        processReference(node, ((PyReferenceOwner)node).getReference(resolveContext));
+      }
+      else {
+        if (node instanceof PsiLanguageInjectionHost) {
+          processInjection((PsiLanguageInjectionHost)node);
+        }
+        for (final PsiReference reference : node.getReferences()) {
+          processReference(node, reference);
+        }
+      }
+    }
+
+    private void processInjection(@Nullable PsiLanguageInjectionHost node) {
+      if (node == null) return;
+      final List<Pair<PsiElement, TextRange>>
+        files = InjectedLanguageManager.getInstance(node.getProject()).getInjectedPsiFiles(node);
+      if (files != null) {
+        for (Pair<PsiElement, TextRange> pair : files) {
+          new PyRecursiveElementVisitor() {
+            @Override
+            public void visitPyElement(PyElement element) {
+              super.visitPyElement(element);
+              if (element instanceof PyReferenceOwner) {
+                final PyResolveContext resolveContext = PyResolveContext.noImplicits().withTypeEvalContext(myTypeEvalContext);
+                final PsiPolyVariantReference reference = ((PyReferenceOwner)element).getReference(resolveContext);
+                if (reference != null) {
+                  final ResolveResult[] resolveResults = reference.multiResolve(false);
+                  for (ResolveResult resolveResult : resolveResults) {
+                    if (resolveResult instanceof ImportedResolveResult) {
+                      myUsedImports.addAll(((ImportedResolveResult)resolveResult).getNameDefiners());
+                    }
+                  }
+                }
+              }
+            }
+          }.visitElement(pair.getFirst());
+        }
+      }
+    }
+
+    private void processReference(PyElement node, @Nullable PsiReference reference) {
+      if (!isEnabled(node) || reference == null || reference.isSoft()) {
+        return;
+      }
+      HighlightSeverity severity = HighlightSeverity.ERROR;
+      if (reference instanceof PsiReferenceEx) {
+        severity = ((PsiReferenceEx)reference).getUnresolvedHighlightSeverity(myTypeEvalContext);
+        if (severity == null) return;
+      }
+      PyExceptPart guard = getImportErrorGuard(node);
+      if (guard != null) {
+        processReferenceInImportGuard(node, guard);
+        return;
+      }
+      if (node instanceof PyQualifiedExpression) {
+        final PyQualifiedExpression qExpr = (PyQualifiedExpression)node;
+        final PyExpression qualifier = qExpr.getQualifier();
+        final String name = node.getName();
+        if (qualifier != null && name != null && isGuardedByHasattr(qualifier, name)) {
+          return;
+        }
+      }
+      PsiElement target = null;
+      boolean unresolved;
+      if (reference instanceof PsiPolyVariantReference) {
+        final PsiPolyVariantReference poly = (PsiPolyVariantReference)reference;
+        final ResolveResult[] resolveResults = poly.multiResolve(false);
+        unresolved = (resolveResults.length == 0);
+        for (ResolveResult resolveResult : resolveResults) {
+          if (target == null && resolveResult.isValidResult()) {
+            target = resolveResult.getElement();
+          }
+          if (resolveResult instanceof ImportedResolveResult) {
+            myUsedImports.addAll(((ImportedResolveResult)resolveResult).getNameDefiners());
+          }
+        }
+      }
+      else {
+        target = reference.resolve();
+        unresolved = (target == null);
+      }
+      if (unresolved) {
+        boolean ignoreUnresolved = false;
+        for (PyInspectionExtension extension : Extensions.getExtensions(PyInspectionExtension.EP_NAME)) {
+          if (extension.ignoreUnresolvedReference(node, reference)) {
+            ignoreUnresolved = true;
+            break;
+          }
+        }
+        if (!ignoreUnresolved) {
+          registerUnresolvedReferenceProblem(node, reference, severity);
+        }
+        // don't highlight unresolved imports as unused
+        if (node.getParent() instanceof PyImportElement) {
+          myAllImports.remove(node.getParent());
+        }
+      }
+      else if (reference instanceof PyImportReference &&
+               target == reference.getElement().getContainingFile() &&
+               !isContainingFileImportAllowed(node, (PsiFile)target)) {
+        registerProblem(node, "Import resolves to its containing file");
+      }
+    }
+
+    private static boolean isContainingFileImportAllowed(PyElement node, PsiFile target) {
+      // import resolving to containing file is allowed when we're importing from the current package and the containing file
+      // is __init__.py (PY-5265)
+      final boolean insideFromImport = PsiTreeUtil.getParentOfType(node, PyFromImportStatement.class) != null;
+      if (!insideFromImport) {
+        return false;
+      }
+      if (PyImportStatementNavigator.getImportStatementByElement(node) != null) {
+        return false;
+      }
+      return target.getName().equals(PyNames.INIT_DOT_PY);
+    }
+
+    private void processReferenceInImportGuard(PyElement node, PyExceptPart guard) {
+      final PyImportElement importElement = PsiTreeUtil.getParentOfType(node, PyImportElement.class);
+      if (importElement != null) {
+        final String visibleName = importElement.getVisibleName();
+        final ScopeOwner owner = ScopeUtil.getScopeOwner(importElement);
+        if (visibleName != null && owner != null) {
+          final Collection<PsiElement> allWrites = ScopeUtil.getReadWriteElements(visibleName, owner, false, true);
+          final Collection<PsiElement> writesInsideGuard = new ArrayList<PsiElement>();
+          for (PsiElement write : allWrites) {
+            if (PsiTreeUtil.isAncestor(guard, write, false)) {
+              writesInsideGuard.add(write);
+            }
+          }
+          if (writesInsideGuard.isEmpty()) {
+            final PyTargetExpression asElement = importElement.getAsNameElement();
+            final PyElement toHighlight = asElement != null ? asElement : node;
+            registerProblem(toHighlight,
+                            PyBundle.message("INSP.try.except.import.error",
+                                             visibleName),
+                            ProblemHighlightType.LIKE_UNKNOWN_SYMBOL);
+          }
+        }
+      }
+    }
+
+    private void registerUnresolvedReferenceProblem(@NotNull PyElement node, @NotNull final PsiReference reference,
+                                                    @NotNull HighlightSeverity severity) {
+      if (reference instanceof DocStringTypeReference) {
+        return;
+      }
+      String description = null;
+      PsiElement element = reference.getElement();
+      final String text = element.getText();
+      TextRange rangeInElement = reference.getRangeInElement();
+      String refText = text;  // text of the part we're working with
+      if (rangeInElement.getStartOffset() > 0 && rangeInElement.getEndOffset() > 0) {
+        refText = rangeInElement.substring(text);
+      }
+
+      final List<LocalQuickFix> actions = new ArrayList<LocalQuickFix>(2);
+      final String refName = (element instanceof PyQualifiedExpression) ? ((PyQualifiedExpression)element).getReferencedName() : refText;
+      // Empty text, nothing to highlight
+      if (refName == null || refName.length() <= 0) {
+        return;
+      }
+
+      final QualifiedName canonicalQName = getCanonicalName(reference, myTypeEvalContext);
+      final String canonicalName = canonicalQName != null ? canonicalQName.toString() : null;
+      if (canonicalName != null) {
+        for (String ignored : myIgnoredIdentifiers) {
+          if (ignored.endsWith(END_WILDCARD)) {
+            final String prefix = ignored.substring(0, ignored.length() - END_WILDCARD.length());
+            if (canonicalName.startsWith(prefix)) {
+              return;
+            }
+          }
+          else if (canonicalName.equals(ignored)) {
+            return;
+          }
+        }
+      }
+      // Legacy non-qualified ignore patterns
+      if (myIgnoredIdentifiers.contains(refName)) {
+        return;
+      }
+
+      if (element instanceof PyReferenceExpression) {
+        PyReferenceExpression expr = (PyReferenceExpression)element;
+        if (PyNames.COMPARISON_OPERATORS.contains(refName)) {
+          return;
+        }
+        if (expr.isQualified()) {
+          final PyClassTypeImpl object_type = (PyClassTypeImpl)PyBuiltinCache.getInstance(node).getObjectType();
+          if ((object_type != null) && object_type.getPossibleInstanceMembers().contains(refName)) return;
+        }
+        else {
+          if (PyUnreachableCodeInspection.hasAnyInterruptedControlFlowPaths(expr)) {
+            return;
+          }
+          if (LanguageLevel.forElement(node).isOlderThan(LanguageLevel.PYTHON26)) {
+            if ("with".equals(refName)) {
+              actions.add(new UnresolvedRefAddFutureImportQuickFix());
+            }
+          }
+          if (refText.equals("true") || refText.equals("false")) {
+            actions.add(new UnresolvedRefTrueFalseQuickFix(element));
+          }
+          addAddSelfFix(node, expr, actions);
+          PyCallExpression callExpression = PsiTreeUtil.getParentOfType(element, PyCallExpression.class);
+          if (callExpression != null && (!(callExpression.getCallee() instanceof PyQualifiedExpression) ||
+                                         ((PyQualifiedExpression)callExpression.getCallee()).getQualifier() == null)) {
+            actions.add(new UnresolvedRefCreateFunctionQuickFix(callExpression, expr));
+          }
+          PyFunction parentFunction = PsiTreeUtil.getParentOfType(element, PyFunction.class);
+          PyDecorator decorator = PsiTreeUtil.getParentOfType(element, PyDecorator.class);
+          PyImportStatement importStatement = PsiTreeUtil.getParentOfType(element, PyImportStatement.class);
+          if (parentFunction != null && decorator == null && importStatement == null) {
+            actions.add(new UnresolvedReferenceAddParameterQuickFix(refName));
+          }
+          actions.add(new PyRenameUnresolvedRefQuickFix());
+        }
+        // unqualified:
+        // may be module's
+        if (PyModuleType.getPossibleInstanceMembers().contains(refName)) return;
+        // may be a "try: import ..."; not an error not to resolve
+        if ((
+          PsiTreeUtil.getParentOfType(
+            PsiTreeUtil.getParentOfType(node, PyImportElement.class), PyTryExceptStatement.class, PyIfStatement.class
+          ) != null
+        )) {
+          severity = HighlightSeverity.WEAK_WARNING;
+          description = PyBundle.message("INSP.module.$0.not.found", refText);
+          // TODO: mark the node so that future references pointing to it won't result in a error, but in a warning
+        }
+      }
+      if (reference instanceof PsiReferenceEx && description == null) {
+        description = ((PsiReferenceEx)reference).getUnresolvedDescription();
+      }
+      if (description == null) {
+        boolean markedQualified = false;
+        if (element instanceof PyQualifiedExpression) {
+          // TODO: Add __qualname__ for Python 3.3 to the skeleton of <class 'object'>, introduce a pseudo-class skeleton for
+          // <class 'function'>
+          if ("__qualname__".equals(refText) && LanguageLevel.forElement(element).isAtLeast(LanguageLevel.PYTHON33)) {
+            return;
+          }
+          final PyQualifiedExpression expr = (PyQualifiedExpression)element;
+          if (PyNames.COMPARISON_OPERATORS.contains(expr.getReferencedName())) {
+            return;
+          }
+          final PyExpression qualifier = expr.getQualifier();
+          if (qualifier != null) {
+            PyType type = myTypeEvalContext.getType(qualifier);
+            if (type != null) {
+              if (ignoreUnresolvedMemberForType(type, reference, refName)) {
+                return;
+              }
+              addCreateMemberFromUsageFixes(type, reference, refText, actions);
+              if (type instanceof PyClassTypeImpl) {
+                if (reference instanceof PyOperatorReference) {
+                  description = PyBundle.message("INSP.unresolved.operator.ref",
+                                                 type.getName(), refName,
+                                                 ((PyOperatorReference)reference).getReadableOperatorName());
+                }
+                else {
+                  description = PyBundle.message("INSP.unresolved.ref.$0.for.class.$1", refText, type.getName());
+                }
+                markedQualified = true;
+              }
+              else {
+                description = PyBundle.message("INSP.cannot.find.$0.in.$1", refText, type.getName());
+                markedQualified = true;
+              }
+            }
+          }
+        }
+        if (!markedQualified) {
+          description = PyBundle.message("INSP.unresolved.ref.$0", refText);
+
+          // look in other imported modules for this whole name
+          if (PythonReferenceImporter.isImportable(element)) {
+            addAutoImportFix(node, reference, actions);
+          }
+
+          addCreateClassFix(refText, element, actions);
+        }
+      }
+      ProblemHighlightType hl_type;
+      if (severity == HighlightSeverity.WARNING) {
+        hl_type = ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
+      }
+      else if (severity == HighlightSeverity.ERROR) {
+        hl_type = ProblemHighlightType.GENERIC_ERROR;
+      }
+      else {
+        hl_type = ProblemHighlightType.LIKE_UNKNOWN_SYMBOL;
+      }
+
+      if (element != null) {
+        PyImportStatementBase importStatementBase = PsiTreeUtil.getParentOfType(element, PyImportStatementBase.class);
+        if ((importStatementBase != null) && GenerateBinaryStubsFix.isApplicable(importStatementBase)) {
+          actions.addAll(GenerateBinaryStubsFix.generateFixes(importStatementBase));
+        }
+      }
+      if (canonicalQName != null) {
+        actions.add(new AddIgnoredIdentifierQuickFix(canonicalQName, false));
+        if (canonicalQName.getComponentCount() > 1) {
+          actions.add(new AddIgnoredIdentifierQuickFix(canonicalQName.removeLastComponent(), true));
+        }
+      }
+      addPluginQuickFixes(reference, actions);
+
+      if (reference instanceof PyImportReference) {
+        // TODO: Ignore references in the second part of the 'from ... import ...' expression
+        final QualifiedName qname = QualifiedName.fromDottedString(refName);
+        final List<String> components = qname.getComponents();
+        if (!components.isEmpty()) {
+          final String packageName = components.get(0);
+          final Module module = ModuleUtilCore.findModuleForPsiElement(node);
+          final Sdk sdk = PythonSdkType.findPythonSdk(module);
+          if (module != null && sdk != null) {
+            if (PyPIPackageUtil.INSTANCE.isInPyPI(packageName)) {
+              final List<PyRequirement> requirements = Collections.singletonList(new PyRequirement(packageName));
+              final String name = "Install package " + packageName;
+              if (PyPackageManager.getInstance(sdk).hasPip()) {
+                actions.add(new PyPackageRequirementsInspection.PyInstallRequirementsFix(name, module, sdk, requirements));
+              }
+            }
+          }
+        }
+      }
+      registerProblem(node, description, hl_type, null, rangeInElement, actions.toArray(new LocalQuickFix[actions.size()]));
+    }
+
+    /**
+     * Return the canonical qualified name for a reference (even for an unresolved one).
+     */
+    @Nullable
+    private static QualifiedName getCanonicalName(@NotNull PsiReference reference, @NotNull TypeEvalContext context) {
+      final PsiElement element = reference.getElement();
+      if (reference instanceof PyOperatorReference && element instanceof PyQualifiedExpression) {
+        final PyExpression receiver = ((PyOperatorReference)reference).getReceiver();
+        if (receiver != null) {
+          final PyType type = context.getType(receiver);
+          if (type instanceof PyClassType) {
+            final String name = ((PyClassType)type).getClassQName();
+            if (name != null) {
+              return QualifiedName.fromDottedString(name).append(((PyQualifiedExpression)element).getReferencedName());
+            }
+          }
+        }
+      }
+      else if (element instanceof PyReferenceExpression) {
+        final PyReferenceExpression expr = (PyReferenceExpression)element;
+        final PyExpression qualifier = expr.getQualifier();
+        final String exprName = expr.getName();
+        if (exprName != null) {
+          if (qualifier != null) {
+            final PyType type = context.getType(qualifier);
+            if (type instanceof PyClassType) {
+              final String name = ((PyClassType)type).getClassQName();
+              if (name != null) {
+                return QualifiedName.fromDottedString(name).append(exprName);
+              }
+            }
+            else if (type instanceof PyModuleType) {
+              final PyFile file = ((PyModuleType)type).getModule();
+              final QualifiedName name = QualifiedNameFinder.findCanonicalImportPath(file, element);
+              if (name != null) {
+                return name.append(exprName);
+              }
+            }
+          }
+          else {
+            final PsiElement parent = element.getParent();
+            if (parent instanceof PyImportElement) {
+              final PyImportStatementBase importStmt = PsiTreeUtil.getParentOfType(parent, PyImportStatementBase.class);
+              if (importStmt instanceof PyImportStatement) {
+                return QualifiedName.fromComponents(exprName);
+              }
+              else if (importStmt instanceof PyFromImportStatement) {
+                final PsiElement resolved = ((PyFromImportStatement)importStmt).resolveImportSource();
+                if (resolved != null) {
+                  final QualifiedName path = QualifiedNameFinder.findCanonicalImportPath(resolved, element);
+                  if (path != null) {
+                    return path.append(exprName);
+                  }
+                }
+              }
+            }
+            else {
+              final QualifiedName path = QualifiedNameFinder.findCanonicalImportPath(element, element);
+              if (path != null) {
+                return path.append(exprName);
+              }
+            }
+          }
+        }
+      }
+      else if (reference instanceof DocStringParameterReference) {
+        return QualifiedName.fromDottedString(reference.getCanonicalText());
+      }
+      return null;
+    }
+
+    private boolean ignoreUnresolvedMemberForType(@NotNull PyType type, PsiReference reference, String name) {
+      if (type instanceof PyNoneType || PyTypeChecker.isUnknown(type)) {
+        // this almost always means that we don't know the type, so don't show an error in this case
+        return true;
+      }
+      if (type instanceof PyImportedModuleType) {
+        PyImportedModule module = ((PyImportedModuleType)type).getImportedModule();
+        if (module.resolve() == null) {
+          return true;
+        }
+      }
+      if (type instanceof PyClassTypeImpl) {
+        PyClass cls = ((PyClassType)type).getPyClass();
+        if (overridesGetAttr(cls, myTypeEvalContext)) {
+          return true;
+        }
+        if (cls.findProperty(name, true) != null) {
+          return true;
+        }
+        if (PyUtil.hasUnresolvedAncestors(cls, myTypeEvalContext)) {
+          return true;
+        }
+        if (isDecoratedAsDynamic(cls, true)) {
+          return true;
+        }
+        if (hasUnresolvedDynamicMember((PyClassType)type, reference, name)) return true;
+      }
+      if (type instanceof PyFunctionType) {
+        final Callable callable = ((PyFunctionType)type).getCallable();
+        if (callable instanceof PyFunction && ((PyFunction)callable).getDecoratorList() != null) {
+          return true;
+        }
+      }
+      for (PyInspectionExtension extension : Extensions.getExtensions(PyInspectionExtension.EP_NAME)) {
+        if (extension.ignoreUnresolvedMember(type, name)) {
+          return true;
+        }
+      }
+      return false;
+    }
+
+    private static boolean hasUnresolvedDynamicMember(@NotNull final PyClassType type,
+                                                      PsiReference reference,
+                                                      @NotNull final String name) {
+      for (PyClassMembersProvider provider : Extensions.getExtensions(PyClassMembersProvider.EP_NAME)) {
+        final Collection<PyDynamicMember> resolveResult = provider.getMembers(type, reference.getElement());
+        for (PyDynamicMember member : resolveResult) {
+          if (member.getName().equals(name)) return true;
+        }
+      }
+      return false;
+    }
+
+    private boolean isDecoratedAsDynamic(@NotNull PyClass cls, boolean inherited) {
+      if (inherited) {
+        if (isDecoratedAsDynamic(cls, false)) {
+          return true;
+        }
+        for (PyClass base : cls.getAncestorClasses(myTypeEvalContext)) {
+          if (base != null && isDecoratedAsDynamic(base, false)) {
+            return true;
+          }
+        }
+      }
+      else {
+        if (cls.getDecoratorList() != null) {
+          return true;
+        }
+        final String docString = cls.getDocStringValue();
+        if (docString != null && docString.contains("@DynamicAttrs")) {
+          return true;
+        }
+      }
+      return false;
+    }
+
+    private static void addCreateMemberFromUsageFixes(PyType type, PsiReference reference, String refText, List<LocalQuickFix> actions) {
+      PsiElement element = reference.getElement();
+      if (type instanceof PyClassTypeImpl) {
+        PyClass cls = ((PyClassType)type).getPyClass();
+        if (!PyBuiltinCache.getInstance(element).isBuiltin(cls)) {
+          if (element.getParent() instanceof PyCallExpression) {
+            actions.add(new AddMethodQuickFix(refText, cls.getName(), true));
+          }
+          else if (!(reference instanceof PyOperatorReference)) {
+            actions.add(new AddFieldQuickFix(refText, "None", type.getName(), true));
+          }
+        }
+      }
+      else if (type instanceof PyModuleType) {
+        PyFile file = ((PyModuleType)type).getModule();
+        actions.add(new AddFunctionQuickFix(refText, file.getName()));
+      }
+    }
+
+    private void addAddSelfFix(PyElement node, PyReferenceExpression expr, List<LocalQuickFix> actions) {
+      final PyClass containedClass = PsiTreeUtil.getParentOfType(node, PyClass.class);
+      final PyFunction function = PsiTreeUtil.getParentOfType(node, PyFunction.class);
+      if (containedClass != null && function != null) {
+        final PyParameter[] parameters = function.getParameterList().getParameters();
+        if (parameters.length == 0) return;
+        final String qualifier = parameters[0].getText();
+        final PyDecoratorList decoratorList = function.getDecoratorList();
+        boolean isClassMethod = false;
+        if (decoratorList != null) {
+          for (PyDecorator decorator : decoratorList.getDecorators()) {
+            final PyExpression callee = decorator.getCallee();
+            if (callee != null && PyNames.CLASSMETHOD.equals(callee.getText())) {
+              isClassMethod = true;
+            }
+          }
+        }
+        for (PyTargetExpression target : containedClass.getInstanceAttributes()) {
+          if (!isClassMethod && Comparing.strEqual(node.getName(), target.getName())) {
+            actions.add(new UnresolvedReferenceAddSelfQuickFix(expr, qualifier));
+          }
+        }
+        for (PyStatement statement : containedClass.getStatementList().getStatements()) {
+          if (statement instanceof PyAssignmentStatement) {
+            PyExpression lhsExpression = ((PyAssignmentStatement)statement).getLeftHandSideExpression();
+            if (lhsExpression != null && lhsExpression.getText().equals(expr.getText())) {
+              PyExpression assignedValue = ((PyAssignmentStatement)statement).getAssignedValue();
+              if (assignedValue instanceof PyCallExpression) {
+                PyType type = myTypeEvalContext.getType(assignedValue);
+                if (type != null && type instanceof PyClassTypeImpl) {
+                  if (((PyCallExpression)assignedValue).isCalleeText(PyNames.PROPERTY)) {
+                    actions.add(new UnresolvedReferenceAddSelfQuickFix(expr, qualifier));
+                  }
+                }
+              }
+            }
+          }
+        }
+        for (PyFunction method : containedClass.getMethods()) {
+          if (expr.getText().equals(method.getName())) {
+            actions.add(new UnresolvedReferenceAddSelfQuickFix(expr, qualifier));
+          }
+        }
+      }
+    }
+
+    private static void addAutoImportFix(PyElement node, PsiReference reference, List<LocalQuickFix> actions) {
+      final PsiFile file = InjectedLanguageManager.getInstance(node.getProject()).getTopLevelFile(node);
+      if (!(file instanceof PyFile)) return;
+      AutoImportQuickFix importFix = PythonReferenceImporter.proposeImportFix(node, reference);
+      if (importFix != null) {
+        if (!suppressHintForAutoImport(node, importFix) && PyCodeInsightSettings.getInstance().SHOW_IMPORT_POPUP) {
+          final AutoImportHintAction autoImportHintAction = new AutoImportHintAction(importFix);
+          actions.add(autoImportHintAction);
+        }
+        else {
+          actions.add(importFix);
+        }
+      }
+    }
+
+    private static boolean suppressHintForAutoImport(PyElement node, AutoImportQuickFix importFix) {
+      // if the context doesn't look like a function call and we only found imports of functions, suggest auto-import
+      // as a quickfix but no popup balloon (PY-2312)
+      if (!isCall(node) && importFix.hasOnlyFunctions()) {
+        return true;
+      }
+      // if we're in a class context and the class defines a variable with the same name, offer auto-import only as quickfix,
+      // not as popup
+      PyClass containingClass = PsiTreeUtil.getParentOfType(node, PyClass.class);
+      if (containingClass != null && (containingClass.findMethodByName(importFix.getNameToImport(), true) != null ||
+                                      containingClass.findInstanceAttribute(importFix.getNameToImport(), true) != null)) {
+        return true;
+      }
+      return false;
+    }
+
+    private void addCreateClassFix(String refText, PsiElement element, List<LocalQuickFix> actions) {
+      if (refText.length() > 2 && Character.isUpperCase(refText.charAt(0)) && !refText.toUpperCase().equals(refText) &&
+          PsiTreeUtil.getParentOfType(element, PyImportStatementBase.class) == null) {
+        PsiElement anchor = element;
+        if (element instanceof PyQualifiedExpression) {
+          final PyExpression expr = ((PyQualifiedExpression)element).getQualifier();
+          if (expr != null) {
+            final PyType type = myTypeEvalContext.getType(expr);
+            if (type instanceof PyModuleType) {
+              anchor = ((PyModuleType)type).getModule();
+            }
+            else {
+              anchor = null;
+            }
+          }
+          if (anchor != null) {
+            actions.add(new CreateClassQuickFix(refText, anchor));
+          }
+        }
+      }
+    }
+
+    private static boolean isCall(PyElement node) {
+      final PyCallExpression callExpression = PsiTreeUtil.getParentOfType(node, PyCallExpression.class);
+      return callExpression != null && node == callExpression.getCallee();
+    }
+
+    @Nullable
+    private static PsiElement resolveClassMember(@NotNull PyClass cls, @NotNull String name, @NotNull TypeEvalContext context) {
+      final PyType type = context.getType(cls);
+      if (type != null) {
+        final PyResolveContext resolveContext = PyResolveContext.noImplicits().withTypeEvalContext(context);
+        final List<? extends RatedResolveResult> results = type.resolveMember(name, null, AccessDirection.READ, resolveContext);
+        if (results != null && !results.isEmpty()) {
+          return results.get(0).getElement();
+        }
+      }
+      return null;
+    }
+
+    private static boolean overridesGetAttr(@NotNull PyClass cls, @NotNull TypeEvalContext context) {
+      PsiElement method = resolveClassMember(cls, PyNames.GETATTR, context);
+      if (method != null) {
+        return true;
+      }
+      method = resolveClassMember(cls, PyNames.GETATTRIBUTE, context);
+      if (method != null && !PyBuiltinCache.getInstance(cls).isBuiltin(method)) {
+        return true;
+      }
+      return false;
+    }
+
+    private static void addPluginQuickFixes(PsiReference reference, final List<LocalQuickFix> actions) {
+      for (PyUnresolvedReferenceQuickFixProvider provider : Extensions.getExtensions(PyUnresolvedReferenceQuickFixProvider.EP_NAME)) {
+        provider.registerQuickFixes(reference, new Consumer<LocalQuickFix>() {
+          public void consume(LocalQuickFix localQuickFix) {
+            actions.add(localQuickFix);
+          }
+        });
+      }
+    }
+
+    public void highlightUnusedImports() {
+      final List<PsiElement> unused = collectUnusedImportElements();
+      for (PsiElement element : unused) {
+        if (element.getTextLength() > 0) {
+          registerProblem(element, "Unused import statement", ProblemHighlightType.LIKE_UNUSED_SYMBOL, null, new OptimizeImportsQuickFix());
+        }
+      }
+    }
+
+    private List<PsiElement> collectUnusedImportElements() {
+      if (myAllImports.isEmpty()) {
+        return Collections.emptyList();
+      }
+      // PY-1315 Unused imports inspection shouldn't work in python REPL console
+      final NameDefiner first = myAllImports.iterator().next();
+      if (first.getContainingFile() instanceof PyExpressionCodeFragment || PydevConsoleRunner.isInPydevConsole(first)) {
+        return Collections.emptyList();
+      }
+      List<PsiElement> result = new ArrayList<PsiElement>();
+
+      Set<PyImportedNameDefiner> unusedImports = new HashSet<PyImportedNameDefiner>(myAllImports);
+      unusedImports.removeAll(myUsedImports);
+
+      // Remove those unsed, that are reported to be skipped by extension points
+      final Set<PyImportedNameDefiner> unusedImportToSkip = new HashSet<PyImportedNameDefiner>();
+      for (final PyImportedNameDefiner unusedImport : unusedImports) {
+        if (importShouldBeSkippedByExtPoint(unusedImport)) { // Pass to extension points
+          unusedImportToSkip.add(unusedImport);
+        }
+      }
+
+      unusedImports.removeAll(unusedImportToSkip);
+
+
+      Set<String> usedImportNames = new HashSet<String>();
+      for (PsiElement usedImport : myUsedImports) {
+        if (usedImport instanceof NameDefiner) {
+          for (PyElement e : ((NameDefiner)usedImport).iterateNames()) {
+            usedImportNames.add(e.getName());
+          }
+        }
+      }
+
+      Set<PyImportStatementBase> unusedStatements = new HashSet<PyImportStatementBase>();
+      final PyUnresolvedReferencesInspection suppressableInspection = new PyUnresolvedReferencesInspection();
+      QualifiedName packageQName = null;
+      List<String> dunderAll = null;
+
+      // TODO: Use strategies instead of pack of "continue"
+      for (PyImportedNameDefiner unusedImport : unusedImports) {
+        if (packageQName == null) {
+          final PsiFile file = unusedImport.getContainingFile();
+          if (file instanceof PyFile) {
+            dunderAll = ((PyFile)file).getDunderAll();
+          }
+          if (file != null && PyUtil.isPackage(file)) {
+            packageQName = QualifiedNameFinder.findShortestImportableQName(file);
+          }
+        }
+        PyImportStatementBase importStatement = PsiTreeUtil.getParentOfType(unusedImport, PyImportStatementBase.class);
+        if (importStatement != null && !unusedStatements.contains(importStatement) && !myUsedImports.contains(importStatement)) {
+          if (suppressableInspection.isSuppressedFor(importStatement)) {
+            continue;
+          }
+          // don't remove as unused imports in try/except statements
+          if (PsiTreeUtil.getParentOfType(importStatement, PyTryExceptStatement.class) != null) {
+            continue;
+          }
+          // Don't report conditional imports as unused
+          if (PsiTreeUtil.getParentOfType(unusedImport, PyIfStatement.class) != null) {
+            boolean isUsed = false;
+            for (PyElement e : unusedImport.iterateNames()) {
+              if (usedImportNames.contains(e.getName())) {
+                isUsed = true;
+              }
+            }
+            if (isUsed) {
+              continue;
+            }
+          }
+          PsiElement importedElement;
+          if (unusedImport instanceof PyImportElement) {
+            final PyImportElement importElement = (PyImportElement)unusedImport;
+            final PsiElement element = importElement.resolve();
+            if (element == null) {
+              if (importElement.getImportedQName() != null) {
+                //Mark import as unused even if it can't be resolved
+                result.add(importElement.getParent());
+              }
+              continue;
+            }
+            if (dunderAll != null && dunderAll.contains(importElement.getVisibleName())) {
+              continue;
+            }
+            importedElement = element.getContainingFile();
+          }
+          else {
+            assert importStatement instanceof PyFromImportStatement;
+            importedElement = ((PyFromImportStatement)importStatement).resolveImportSource();
+            if (importedElement == null) {
+              continue;
+            }
+          }
+          if (packageQName != null && importedElement instanceof PsiFileSystemItem) {
+            final QualifiedName importedQName = QualifiedNameFinder.findShortestImportableQName((PsiFileSystemItem)importedElement);
+            if (importedQName != null && importedQName.matchesPrefix(packageQName)) {
+              continue;
+            }
+          }
+          if (unusedImport instanceof PyStarImportElement || areAllImportsUnused(importStatement, unusedImports)) {
+            unusedStatements.add(importStatement);
+            result.add(importStatement);
+          }
+          else {
+            result.add(unusedImport);
+          }
+        }
+      }
+      return result;
+    }
+
+    private static boolean areAllImportsUnused(PyImportStatementBase importStatement, Set<PyImportedNameDefiner> unusedImports) {
+      final PyImportElement[] elements = importStatement.getImportElements();
+      for (PyImportElement element : elements) {
+        if (!unusedImports.contains(element)) {
+          return false;
+        }
+      }
+      return true;
+    }
+
+    public void optimizeImports() {
+      final List<PsiElement> elementsToDelete = collectUnusedImportElements();
+      for (PsiElement element : elementsToDelete) {
+        if (element.isValid()) {
+          element.delete();
+        }
+      }
+    }
+  }
+
+  /**
+   * Checks if one or more extension points ask unused import to be skipped
+   * @param importNameDefiner unused import
+   * @return true of one or more asks
+   */
+  private static boolean importShouldBeSkippedByExtPoint(@NotNull final PyImportedNameDefiner importNameDefiner) {
+    for (final PyUnresolvedReferenceSkipperExtPoint skipper : PyUnresolvedReferenceSkipperExtPoint.EP_NAME.getExtensions()) {
+      if (skipper.unusedImportShouldBeSkipped(importNameDefiner)) {
+        return true;
+      }
+    }
+    return false;
+  }
+}
diff --git a/python/src/com/jetbrains/python/inspections/unresolvedReference/package-info.java b/python/src/com/jetbrains/python/inspections/unresolvedReference/package-info.java
new file mode 100644
index 0000000..512a8ca
--- /dev/null
+++ b/python/src/com/jetbrains/python/inspections/unresolvedReference/package-info.java
@@ -0,0 +1,7 @@
+/**
+ *
+ * Inspection that reports unresolved and unused references.
+ * You can inject logic to mark some unused imports as used. See extension points in this package.
+ * @author Ilya.Kazakevich
+ */
+package com.jetbrains.python.inspections.unresolvedReference;
\ No newline at end of file
diff --git a/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java b/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java
index 0b65e70..4a4f016 100644
--- a/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java
+++ b/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java
@@ -52,6 +52,7 @@
 import com.intellij.remote.RemoteFile;
 import com.intellij.remote.RemoteSdkAdditionalData;
 import com.intellij.remote.RemoteSdkCredentials;
+import com.intellij.remote.VagrantNotStartedException;
 import com.intellij.util.ArrayUtil;
 import com.intellij.util.Function;
 import com.intellij.util.PathMappingSettings;
@@ -98,6 +99,9 @@
   public static final int ERROR_EXECUTION = -6;
   public static final int ERROR_INTERRUPTED = -7;
 
+  public static final int ERROR_VAGRANT_NOT_LAUNCHED = 101;
+  public static final int ERROR_REMOTE_ACCESS = 102;
+
   public static final String PACKAGE_PIP = "pip";
   public static final String PACKAGE_DISTRIBUTE = "distribute";
   public static final String PACKAGE_SETUPTOOLS = "setuptools";
@@ -121,6 +125,7 @@
 
   public static final String SETUPTOOLS = PACKAGE_SETUPTOOLS + "-" + SETUPTOOLS_VERSION;
   public static final String PIP = PACKAGE_PIP + "-" + PIP_VERSION;
+  private static final String LAUNCH_VAGRANT = "launchVagrant";
 
   private List<PyPackage> myPackagesCache = null;
   private Map<String, Set<PyPackage>> myDependenciesCache = null;
@@ -790,12 +795,37 @@
     if (sdkData instanceof PyRemoteSdkAdditionalDataBase) { //remote interpreter
       RemoteSdkCredentials remoteSdkCredentials;
       try {
-        remoteSdkCredentials = ((RemoteSdkAdditionalData)sdkData).getRemoteSdkCredentials();
+        remoteSdkCredentials = ((RemoteSdkAdditionalData)sdkData).getRemoteSdkCredentials(false);
       }
       catch (InterruptedException e) {
         LOG.error(e);
         remoteSdkCredentials = null;
       }
+      catch (final ExecutionException e) {
+        if (e.getCause() instanceof VagrantNotStartedException) {
+          throw new PyExternalProcessException(ERROR_VAGRANT_NOT_LAUNCHED, helperPath, args, "Vagrant instance is down. <a href=\"" +
+                                                                      LAUNCH_VAGRANT +
+                                                                      "\">Launch vagrant</a>").withHandler(LAUNCH_VAGRANT, new Runnable() {
+            @Override
+            public void run() {
+              final PythonRemoteInterpreterManager manager = PythonRemoteInterpreterManager.getInstance();
+              if (manager != null) {
+
+                try {
+                  manager.runVagrant(((VagrantNotStartedException)e.getCause()).getVagrantFolder());
+                  clearCaches();
+
+                }
+                catch (ExecutionException e1) {
+                  throw new RuntimeException(e1);
+                }
+              }
+            }
+          });
+        } else {
+          throw new PyExternalProcessException(ERROR_REMOTE_ACCESS, helperPath, args, e.getMessage());
+        }
+      }
       final PythonRemoteInterpreterManager manager = PythonRemoteInterpreterManager.getInstance();
       if (manager != null && remoteSdkCredentials != null) {
         final List<String> cmdline = new ArrayList<String>();
diff --git a/python/src/com/jetbrains/python/packaging/ui/PyInstalledPackagesPanel.java b/python/src/com/jetbrains/python/packaging/ui/PyInstalledPackagesPanel.java
index 0fdbc53..e0c0e30 100644
--- a/python/src/com/jetbrains/python/packaging/ui/PyInstalledPackagesPanel.java
+++ b/python/src/com/jetbrains/python/packaging/ui/PyInstalledPackagesPanel.java
@@ -125,7 +125,22 @@
                   }
                   final boolean hasPackagingTools = myHasPip && myHasSetuptools;
                   allowCreateVirtualEnv &= !hasPackagingTools;
+
+                  if (externalProcessException.hasHandler()) {
+                    final String key = externalProcessException.getHandler().first;
+                    myNotificationArea.addLinkHandler(key,
+                                                      new Runnable() {
+                                                        @Override
+                                                        public void run() {
+                                                          externalProcessException.getHandler().second.run();
+                                                          myNotificationArea.removeLinkHandler(key);
+                                                          updateNotifications(selectedSdk);
+                                                        }
+                                                      }
+                    );
+                  }
                 }
+
                 if (text == null) {
                   if (!myHasSetuptools) {
                     text = "Python package management tools not found. <a href=\"" + INSTALL_SETUPTOOLS + "\">Install 'setuptools'</a>";
@@ -186,7 +201,7 @@
   protected boolean canUninstallPackage(InstalledPackage pkg) {
     if (!myHasPip) return false;
     if (PythonSdkType.isVirtualEnv(getSelectedSdk()) && pkg instanceof PyPackage) {
-      final String location = ((PyPackage) pkg).getLocation();
+      final String location = ((PyPackage)pkg).getLocation();
       if (location != null && location.startsWith(PyPackageManagerImpl.getUserSite())) {
         return false;
       }
diff --git a/python/src/com/jetbrains/python/psi/PyUtil.java b/python/src/com/jetbrains/python/psi/PyUtil.java
index 1700a49..877da8d 100644
--- a/python/src/com/jetbrains/python/psi/PyUtil.java
+++ b/python/src/com/jetbrains/python/psi/PyUtil.java
@@ -67,6 +67,7 @@
 import com.jetbrains.python.magicLiteral.PyMagicLiteralTools;
 import com.jetbrains.python.psi.impl.PyBuiltinCache;
 import com.jetbrains.python.psi.impl.PyPsiUtils;
+import com.jetbrains.python.psi.impl.PythonLanguageLevelPusher;
 import com.jetbrains.python.psi.types.*;
 import com.jetbrains.python.refactoring.classes.PyDependenciesComparator;
 import com.jetbrains.python.refactoring.classes.extractSuperclass.PyExtractSuperclassHelper;
@@ -775,7 +776,8 @@
     // Most of the cases should be handled by this one, PyLanguageLevelPusher pushes folders only
     final VirtualFile folder = virtualFile.getParent();
     if (folder != null) {
-      final LanguageLevel level = folder.getUserData(LanguageLevel.KEY);
+      LanguageLevel level = folder.getUserData(LanguageLevel.KEY);
+      if (level == null) level = PythonLanguageLevelPusher.getFileLanguageLevel(project, virtualFile);
       if (level != null) return level;
     }
     else {
@@ -1521,7 +1523,7 @@
   public static List<PyParameter> getParameters(@NotNull Callable callable, @NotNull TypeEvalContext context) {
     PyType type = context.getType(callable);
     if (type instanceof PyUnionType) {
-      type = ((PyUnionType)type).excludeNull();
+      type = ((PyUnionType)type).excludeNull(context);
     }
     if (type instanceof PyCallableType) {
       final PyCallableType callableType = (PyCallableType)type;
diff --git a/python/src/com/jetbrains/python/psi/impl/PyBlockEvaluator.java b/python/src/com/jetbrains/python/psi/impl/PyBlockEvaluator.java
index f23ed3a..36e67a1 100644
--- a/python/src/com/jetbrains/python/psi/impl/PyBlockEvaluator.java
+++ b/python/src/com/jetbrains/python/psi/impl/PyBlockEvaluator.java
@@ -17,6 +17,7 @@
 
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.PsiElement;
+import com.intellij.psi.util.QualifiedName;
 import com.jetbrains.python.PyNames;
 import com.jetbrains.python.psi.*;
 import org.jetbrains.annotations.NotNull;
@@ -148,19 +149,21 @@
             myDeclarations.putAll(importEvaluator.myDeclarations);
           }
           else {
-            for (PyImportElement element : node.getImportElements()) {
-              Object value = importEvaluator.myNamespace.get(element.getName());
-              String name = element.getAsName();
-              if (name == null) {
-                name = element.getName();
+            for (final PyImportElement element : node.getImportElements()) {
+              final String nameOfVarInOurModule = element.getVisibleName();
+              final QualifiedName nameOfVarInExternalModule = element.getImportedQName();
+              if ((nameOfVarInOurModule == null) || (nameOfVarInExternalModule == null)) {
+                continue;
               }
-              myNamespace.put(name, value);
-              List<PyExpression> declarations = importEvaluator.getDeclarations(name);
-              if (myDeclarations.containsKey(name)) {
-                myDeclarations.get(name).addAll(declarations);
+
+              final Object value = importEvaluator.myNamespace.get(nameOfVarInExternalModule.toString());
+              myNamespace.put(nameOfVarInOurModule, value);
+              final List<PyExpression> declarations = importEvaluator.getDeclarations(nameOfVarInOurModule);
+              if (myDeclarations.containsKey(nameOfVarInOurModule)) {
+                myDeclarations.get(nameOfVarInOurModule).addAll(declarations);
               }
               else {
-                myDeclarations.put(name, declarations);
+                myDeclarations.put(nameOfVarInOurModule, declarations);
               }
             }
           }
diff --git a/python/src/com/jetbrains/python/psi/impl/PyEvaluator.java b/python/src/com/jetbrains/python/psi/impl/PyEvaluator.java
index d4300be..dea9296 100644
--- a/python/src/com/jetbrains/python/psi/impl/PyEvaluator.java
+++ b/python/src/com/jetbrains/python/psi/impl/PyEvaluator.java
@@ -16,21 +16,27 @@
 package com.jetbrains.python.psi.impl;
 
 import com.intellij.psi.PsiElement;
+import com.intellij.psi.util.PsiTreeUtil;
 import com.jetbrains.python.PyNames;
 import com.jetbrains.python.PyTokenTypes;
+import com.jetbrains.python.PythonFQDNNames;
 import com.jetbrains.python.psi.*;
 import com.jetbrains.python.psi.resolve.PyResolveContext;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import java.util.*;
 
 /**
  * TODO: Merge PythonDataflowUtil, {@link com.jetbrains.python.psi.impl.PyConstantExpressionEvaluator}  and {@link com.jetbrains.python.psi.impl.PyEvaluator} and all its inheritors and improve Abstract Interpretation
+ *
  * @author yole
  */
 public class PyEvaluator {
   private Set<PyExpression> myVisited = new HashSet<PyExpression>();
   private Map<String, Object> myNamespace;
   private boolean myEvaluateCollectionItems = true;
+  private boolean myEvaluateKeys = true;
 
   public void setNamespace(Map<String, Object> namespace) {
     myNamespace = namespace;
@@ -40,7 +46,15 @@
     myEvaluateCollectionItems = evaluateCollectionItems;
   }
 
-  public Object evaluate(PyExpression expr) {
+  /**
+   * @param evaluateKeys evaluate keys for dicts or not (i.e. you wanna see string or StringLiteralExpressions as keys)
+   */
+  public void setEvaluateKeys(final boolean evaluateKeys) {
+    myEvaluateKeys = evaluateKeys;
+  }
+
+  @Nullable
+  public Object evaluate(@Nullable PyExpression expr) {
     if (expr == null || myVisited.contains(expr)) {
       return null;
     }
@@ -76,6 +90,7 @@
 
   /**
    * Evaluates some sequence (tuple, list)
+   *
    * @param expr seq expression
    * @return evaluated seq
    */
@@ -83,12 +98,8 @@
     PyExpression[] elements = expr.getElements();
     if (expr instanceof PyDictLiteralExpression) {
       Map<Object, Object> result = new HashMap<Object, Object>();
-      for (PyKeyValueExpression keyValueExpression : ((PyDictLiteralExpression)expr).getElements()) {
-        Object dictKey = evaluate(keyValueExpression.getKey());
-        if (dictKey != null) {
-          PyExpression value = keyValueExpression.getValue();
-          result.put(dictKey, myEvaluateCollectionItems ? evaluate(value) : value);
-        }
+      for (final PyKeyValueExpression keyValueExpression : ((PyDictLiteralExpression)expr).getElements()) {
+        addRecordFromDict(result, keyValueExpression.getKey(), keyValueExpression.getValue());
       }
       return result;
     }
@@ -130,6 +141,7 @@
     return null;
   }
 
+  @Nullable
   protected Object evaluateCall(PyCallExpression call) {
     final PyExpression[] args = call.getArguments();
     if (call.isCalleeText(PyNames.REPLACE) && args.length == 2) {
@@ -145,6 +157,54 @@
         }
       }
     }
+
+    // Support dict([("k": "v")]) syntax
+    if (call.isCallee(PythonFQDNNames.DICT_CLASS)) {
+      final Collection<PyTupleExpression> tuples = PsiTreeUtil.findChildrenOfType(call, PyTupleExpression.class);
+      if (!tuples.isEmpty()) {
+        final Map<Object, Object> result = new HashMap<Object, Object>();
+        for (final PyTupleExpression tuple : tuples) {
+          final PsiElement[] tupleElements = tuple.getChildren();
+          if (tupleElements.length != 2) {
+            return null;
+          }
+          final PyExpression key = PyUtil.as(tupleElements[0], PyExpression.class);
+          final PyExpression value = PyUtil.as(tupleElements[1], PyExpression.class);
+          if ((key != null)) {
+            addRecordFromDict(result, key, value);
+          }
+        }
+        return result;
+      }
+    }
+
+
     return null;
   }
+
+  /**
+   * Adds record for map when working with dict
+   *
+   * @param result map to return to user
+   * @param key    dict key
+   * @param value  dict value
+   */
+  private void addRecordFromDict(@NotNull final Map<Object, Object> result,
+                                 @NotNull final PyExpression key,
+                                 @Nullable final PyExpression value) {
+    result.put(myEvaluateKeys ? evaluate(key) : key, myEvaluateCollectionItems ? evaluate(value) : value);
+  }
+
+  /**
+   * Shortcut that evaluates expression with default params and casts it to particular type (if possible)
+   *
+   * @param expression exp to evaluate
+   * @param resultType expected type
+   * @param <T>        expected type
+   * @return value if expression is evaluated to this type, null otherwise
+   */
+  @Nullable
+  public static <T> T evaluate(@Nullable final PyExpression expression, @NotNull final Class<T> resultType) {
+    return PyUtil.as(new PyEvaluator().evaluate(expression), resultType);
+  }
 }
diff --git a/python/src/com/jetbrains/python/psi/impl/PyImportElementImpl.java b/python/src/com/jetbrains/python/psi/impl/PyImportElementImpl.java
index 70e3ecf..de8b517 100644
--- a/python/src/com/jetbrains/python/psi/impl/PyImportElementImpl.java
+++ b/python/src/com/jetbrains/python/psi/impl/PyImportElementImpl.java
@@ -83,6 +83,7 @@
     return element != null ? element.getName() : null;
   }
 
+  @Override
   @Nullable
   public String getVisibleName() {
     final PyImportElementStub stub = getStub();
diff --git a/python/src/com/jetbrains/python/psi/impl/PyNamedParameterImpl.java b/python/src/com/jetbrains/python/psi/impl/PyNamedParameterImpl.java
index f38937d..bf792fe 100644
--- a/python/src/com/jetbrains/python/psi/impl/PyNamedParameterImpl.java
+++ b/python/src/com/jetbrains/python/psi/impl/PyNamedParameterImpl.java
@@ -239,7 +239,7 @@
             final PyType type = context.getType(defaultValue);
             if (type != null && !(type instanceof PyNoneType)) {
               if (type instanceof PyTupleType) {
-                return PyTypeParser.getTypeByName(this, "collections.Iterable");
+                return PyUnionType.createWeakType(type);
               }
               return type;
             }
diff --git a/python/src/com/jetbrains/python/psi/impl/PyTargetExpressionImpl.java b/python/src/com/jetbrains/python/psi/impl/PyTargetExpressionImpl.java
index 060c39c..545e8e8 100644
--- a/python/src/com/jetbrains/python/psi/impl/PyTargetExpressionImpl.java
+++ b/python/src/com/jetbrains/python/psi/impl/PyTargetExpressionImpl.java
@@ -208,7 +208,7 @@
           final PyAssignmentStatement assignment = (PyAssignmentStatement)nextParent;
           final PyExpression value = assignment.getAssignedValue();
           if (value != null) {
-            final PyType assignedType = context.getType(value);
+            final PyType assignedType = PyTypeChecker.toNonWeakType(context.getType(value), context);
             if (assignedType instanceof PyTupleType) {
               final PyType t = getTypeFromTupleAssignment((PyTupleExpression)parent, (PyTupleType)assignedType);
               if (t != null) {
@@ -386,6 +386,14 @@
         }
       }
     }
+    else if (iterableType instanceof PyTupleType) {
+      final PyTupleType tupleType = (PyTupleType)iterableType;
+      final List<PyType> memberTypes = new ArrayList<PyType>();
+      for (int i = 0; i < tupleType.getElementCount(); i++) {
+        memberTypes.add(tupleType.getElementType(i));
+      }
+      return PyUnionType.union(memberTypes);
+    }
     else if (iterableType instanceof PyUnionType) {
       final Collection<PyType> members = ((PyUnionType)iterableType).getMembers();
       final List<PyType> iterationTypes = new ArrayList<PyType>();
diff --git a/python/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java b/python/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java
index 132e657..c3fd23b 100644
--- a/python/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java
+++ b/python/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java
@@ -20,7 +20,7 @@
 import com.intellij.openapi.fileTypes.FileTypeManager;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.module.ModuleUtil;
+import com.intellij.openapi.module.ModuleUtilCore;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.roots.*;
@@ -85,14 +85,19 @@
   }
 
   public LanguageLevel getImmediateValue(@NotNull Project project, @Nullable VirtualFile file) {
+    return getFileLanguageLevel(project, file);
+  }
+
+  public static LanguageLevel getFileLanguageLevel(Project project, VirtualFile file) {
     if (ApplicationManager.getApplication().isUnitTestMode() && LanguageLevel.FORCE_LANGUAGE_LEVEL != null) {
       return LanguageLevel.FORCE_LANGUAGE_LEVEL;
     }
     if (file == null) return null;
 
-    final Module module = ModuleUtil.findModuleForFile(file, project);
+    final Module module = ModuleUtilCore.findModuleForFile(file, project);
     if (module != null) {
-      return getImmediateValue(module);
+      final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
+      return PythonSdkType.getLanguageLevelForSdk(sdk);
     }
     final Sdk sdk = findSdk(project, file);
     if (sdk != null) {
diff --git a/python/src/com/jetbrains/python/psi/types/PyDynamicallyEvaluatedType.java b/python/src/com/jetbrains/python/psi/types/PyDynamicallyEvaluatedType.java
index 1743947..85624b1 100644
--- a/python/src/com/jetbrains/python/psi/types/PyDynamicallyEvaluatedType.java
+++ b/python/src/com/jetbrains/python/psi/types/PyDynamicallyEvaluatedType.java
@@ -49,7 +49,7 @@
 
   @Override
   public String getName() {
-    PyType res = excludeNull();
+    PyType res = excludeNull(TypeEvalContext.codeInsightFallback());
     return res != null ? res.getName() : PyNames.UNKNOWN_TYPE;
   }
 }
diff --git a/python/src/com/jetbrains/python/psi/types/PyTypeChecker.java b/python/src/com/jetbrains/python/psi/types/PyTypeChecker.java
index cbdeb16..f4a5236 100644
--- a/python/src/com/jetbrains/python/psi/types/PyTypeChecker.java
+++ b/python/src/com/jetbrains/python/psi/types/PyTypeChecker.java
@@ -215,6 +215,17 @@
     return false;
   }
 
+  @Nullable
+  public static PyType toNonWeakType(@Nullable PyType type, @NotNull TypeEvalContext context) {
+    if (type instanceof PyUnionType) {
+      final PyUnionType unionType = (PyUnionType)type;
+      if (unionType.isWeak()) {
+        return unionType.excludeNull(context);
+      }
+    }
+    return type;
+  }
+
   public static boolean hasGenerics(@Nullable PyType type, @NotNull TypeEvalContext context) {
     final Set<PyGenericType> collected = new HashSet<PyGenericType>();
     collectGenerics(type, context, collected, new HashSet<PyType>());
diff --git a/python/src/com/jetbrains/python/psi/types/PyUnionType.java b/python/src/com/jetbrains/python/psi/types/PyUnionType.java
index 8572b72..d94eb75 100644
--- a/python/src/com/jetbrains/python/psi/types/PyUnionType.java
+++ b/python/src/com/jetbrains/python/psi/types/PyUnionType.java
@@ -184,7 +184,7 @@
    * @return union with excluded types
    */
   @Nullable
-  public PyType exclude(PyType type, TypeEvalContext context) {
+  public PyType exclude(@Nullable PyType type, @NotNull TypeEvalContext context) {
     final List<PyType> members = new ArrayList<PyType>();
     for (PyType m : getMembers()) {
       if (type == null) {
@@ -202,8 +202,8 @@
   }
 
   @Nullable
-  public PyType excludeNull() {
-    return exclude(null, null);
+  public PyType excludeNull(@NotNull TypeEvalContext context) {
+    return exclude(null, context);
   }
 
   private static PyType unit(@Nullable PyType type) {
diff --git a/python/src/com/jetbrains/python/refactoring/introduce/IntroduceHandler.java b/python/src/com/jetbrains/python/refactoring/introduce/IntroduceHandler.java
index 618cf00..29fc441 100644
--- a/python/src/com/jetbrains/python/refactoring/introduce/IntroduceHandler.java
+++ b/python/src/com/jetbrains/python/refactoring/introduce/IntroduceHandler.java
@@ -283,7 +283,8 @@
     }
 
     element1 = PyRefactoringUtil.getSelectedExpression(project, file, element1, element2);
-    if (element1 == null) {
+    final PyComprehensionElement comprehension = PsiTreeUtil.getParentOfType(element1, PyComprehensionElement.class, true);
+    if (element1 == null || comprehension != null) {
       showCannotPerformError(project, editor);
       return;
     }
@@ -401,10 +402,6 @@
     if (decorator != null && PsiTreeUtil.isAncestor(decorator.getCallee(), element, false)) {
       return false;
     }
-    final PyComprehensionElement comprehension = PsiTreeUtil.getParentOfType(element, PyComprehensionElement.class, true);
-    if (comprehension != null) {
-      return false;
-    }
     return PsiTreeUtil.getParentOfType(element, PyParameterList.class) == null;
   }
 
@@ -413,6 +410,10 @@
     if (call != null && PsiTreeUtil.isAncestor(call.getCallee(), element, false)) {
       return false;
     }
+    final PyComprehensionElement comprehension = PsiTreeUtil.getParentOfType(element, PyComprehensionElement.class, true);
+    if (comprehension != null) {
+      return false;
+    }
     return true;
   }
 
diff --git a/python/src/com/jetbrains/python/remote/PythonRemoteInterpreterManager.java b/python/src/com/jetbrains/python/remote/PythonRemoteInterpreterManager.java
index a7a96a0..b904b55 100644
--- a/python/src/com/jetbrains/python/remote/PythonRemoteInterpreterManager.java
+++ b/python/src/com/jetbrains/python/remote/PythonRemoteInterpreterManager.java
@@ -91,7 +91,7 @@
   public abstract PySkeletonGenerator createRemoteSkeletonGenerator(@Nullable Project project,
                                                                     @Nullable Component ownerComponent,
                                                                     @NotNull Sdk sdk,
-                                                                    String path);
+                                                                    String path) throws ExecutionException;
 
   public abstract boolean ensureCanWrite(@Nullable Object projectOrComponent, RemoteSdkCredentials data, String path);
 
@@ -170,6 +170,10 @@
   @Nullable
   public abstract RemoteCredentials getVagrantRemoteCredentials(VagrantBasedCredentialsHolder data) throws IOException;
 
+  public abstract boolean checkVagrantStatus(String vagrantFolder, boolean runIfDown);
+
+  public abstract void runVagrant(String vagrantFolder) throws ExecutionException;
+
   public abstract void checkVagrantStatus(VagrantBasedCredentialsHolder data);
 
   public abstract RemoteCredentials getCredentialsBySftpServerId(String id);
diff --git a/python/src/com/jetbrains/python/sdk/PythonSdkType.java b/python/src/com/jetbrains/python/sdk/PythonSdkType.java
index d3301da..a51d8e2 100644
--- a/python/src/com/jetbrains/python/sdk/PythonSdkType.java
+++ b/python/src/com/jetbrains/python/sdk/PythonSdkType.java
@@ -15,12 +15,17 @@
  */
 package com.jetbrains.python.sdk;
 
+import com.intellij.execution.ExecutionException;
 import com.intellij.execution.configurations.GeneralCommandLine;
 import com.intellij.execution.process.ProcessOutput;
 import com.intellij.facet.Facet;
 import com.intellij.facet.FacetConfiguration;
 import com.intellij.facet.FacetManager;
 import com.intellij.ide.DataManager;
+import com.intellij.notification.Notification;
+import com.intellij.notification.NotificationListener;
+import com.intellij.notification.NotificationType;
+import com.intellij.notification.Notifications;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.application.Application;
 import com.intellij.openapi.application.ApplicationManager;
@@ -53,6 +58,7 @@
 import com.intellij.reference.SoftReference;
 import com.intellij.remote.RemoteSdkCredentials;
 import com.intellij.remote.RemoteSdkCredentialsHolder;
+import com.intellij.remote.VagrantNotStartedException;
 import com.intellij.util.ArrayUtil;
 import com.intellij.util.Consumer;
 import com.intellij.util.NullableConsumer;
@@ -76,6 +82,7 @@
 import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
+import javax.swing.event.HyperlinkEvent;
 import java.awt.*;
 import java.io.File;
 import java.io.FilenameFilter;
@@ -551,7 +558,15 @@
               }
               catch (InvalidSdkException e) {
                 // If the SDK is invalid, the user should worry about the SDK itself, not about skeletons generation errors
-                if (!isInvalid(sdk)) {
+                if (isRemote(sdk)) {
+                  notifyRemoteSdkSkeletonsFail(e, new Runnable() {
+                    @Override
+                    public void run() {
+                      setupSdkPaths(project, ownerComponent, sdk, sdkModificator);
+                    }
+                  });
+                }
+                else if (!isInvalid(sdk)) {
                   LOG.error(e);
                 }
               }
@@ -563,6 +578,42 @@
     return sdkPathsUpdated;
   }
 
+  public static void notifyRemoteSdkSkeletonsFail(final InvalidSdkException e, @Nullable final Runnable restartAction) {
+    NotificationListener notificationListener;
+
+    if (e.getCause() instanceof VagrantNotStartedException) {
+      notificationListener =
+        new NotificationListener() {
+          @Override
+          public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
+            final PythonRemoteInterpreterManager manager = PythonRemoteInterpreterManager.getInstance();
+            if (manager != null) {
+              try {
+                manager.runVagrant(((VagrantNotStartedException)e.getCause()).getVagrantFolder());
+              }
+              catch (ExecutionException e1) {
+                throw new RuntimeException(e1);
+              }
+            }
+            if (restartAction != null) {
+              restartAction.run();
+            }
+          }
+        };
+    }
+    else {
+      notificationListener = null;
+    }
+
+    Notifications.Bus.notify(
+      new Notification(
+        SKELETONS_TOPIC, "Couldn't refresh skeletons for remote interpreter", e.getMessage() + "\n<a href=\"#\">Launch vagrant and refresh skeletons</a>",
+        NotificationType.WARNING,
+        notificationListener
+      )
+    );
+  }
+
   /**
    * In which root type built-in skeletons are put.
    */
@@ -595,7 +646,8 @@
           addSdkRoot(sdkModificator, path);
         }
       }
-    } else {
+    }
+    else {
       addRemoteLibrariesRoot(sdkModificator, sdkHome);
     }
 
diff --git a/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java b/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java
index a964fa9..f583ebb 100644
--- a/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java
+++ b/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java
@@ -113,7 +113,15 @@
                       updateSdk(project, sdk);
                     }
                     catch (InvalidSdkException e) {
-                      if (!PythonSdkType.isInvalid(sdk)) {
+                      if (PythonSdkType.isRemote(sdk)) {
+                        PythonSdkType.notifyRemoteSdkSkeletonsFail(e, new Runnable() {
+                          @Override
+                          public void run() {
+                            updateActiveSdks(project, delay);
+                          }
+                        });
+                      }
+                      else if (!PythonSdkType.isInvalid(sdk)) {
                         LOG.error(e);
                       }
                     }
diff --git a/python/src/com/jetbrains/python/sdk/flavors/PythonSdkFlavor.java b/python/src/com/jetbrains/python/sdk/flavors/PythonSdkFlavor.java
index 07c8e1c..ec255b5 100644
--- a/python/src/com/jetbrains/python/sdk/flavors/PythonSdkFlavor.java
+++ b/python/src/com/jetbrains/python/sdk/flavors/PythonSdkFlavor.java
@@ -181,11 +181,11 @@
   }
 
   @Nullable
-  protected static String getVersionFromOutput(String sdkHome, String version_opt, String version_regexp) {
-    String run_dir = new File(sdkHome).getParent();
-    final ProcessOutput process_output = PySdkUtil.getProcessOutput(run_dir, new String[]{sdkHome, version_opt});
+  protected static String getVersionFromOutput(String sdkHome, String versionOpt, String versionRegexp) {
+    String runDirectory = new File(sdkHome).getParent();
+    final ProcessOutput processOutput = PySdkUtil.getProcessOutput(runDirectory, new String[]{sdkHome, versionOpt}, 10000);
 
-    return getVersionFromOutput(version_regexp, process_output);
+    return getVersionFromOutput(versionRegexp, processOutput);
   }
 
   @Nullable
diff --git a/python/src/com/jetbrains/python/sdk/skeletons/PySkeletonRefresher.java b/python/src/com/jetbrains/python/sdk/skeletons/PySkeletonRefresher.java
index 28d8e51..13202d7 100644
--- a/python/src/com/jetbrains/python/sdk/skeletons/PySkeletonRefresher.java
+++ b/python/src/com/jetbrains/python/sdk/skeletons/PySkeletonRefresher.java
@@ -18,6 +18,7 @@
 import com.google.common.base.Joiner;
 import com.google.common.collect.Lists;
 import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
+import com.intellij.execution.ExecutionException;
 import com.intellij.notification.Notification;
 import com.intellij.notification.NotificationListener;
 import com.intellij.notification.NotificationType;
@@ -198,7 +199,12 @@
     mySkeletonsPath = skeletonsPath;
     final PythonRemoteInterpreterManager remoteInterpreterManager = PythonRemoteInterpreterManager.getInstance();
     if (PySdkUtil.isRemote(sdk) && remoteInterpreterManager != null) {
-      mySkeletonsGenerator = remoteInterpreterManager.createRemoteSkeletonGenerator(myProject, ownerComponent, sdk, getSkeletonsPath());
+      try {
+        mySkeletonsGenerator = remoteInterpreterManager.createRemoteSkeletonGenerator(myProject, ownerComponent, sdk, getSkeletonsPath());
+      }
+      catch (ExecutionException e) {
+        throw new InvalidSdkException(e.getMessage(), e.getCause());
+      }
     }
     else {
       mySkeletonsGenerator = new PySkeletonGenerator(getSkeletonsPath(), mySdk, folder);
diff --git a/python/testData/blockEvaluator/external_module.py b/python/testData/blockEvaluator/external_module.py
new file mode 100644
index 0000000..9371c18
--- /dev/null
+++ b/python/testData/blockEvaluator/external_module.py
@@ -0,0 +1,4 @@
+SOME_VARIABLE = "42"
+SOME_LIST = ['a', 'b']
+
+
diff --git a/python/testData/blockEvaluator/my_module.py b/python/testData/blockEvaluator/my_module.py
new file mode 100644
index 0000000..b726b47
--- /dev/null
+++ b/python/testData/blockEvaluator/my_module.py
@@ -0,0 +1,9 @@
+__author__ = 'Ilya.Kazakevich'
+from external_module import SOME_VARIABLE, SOME_LIST
+from some_package import VARIABLE_IN_PACKAGE
+from some_package.module_in_package import *
+from some_package.another_module_in_package import VARIABLE_IN_PACKAGE_MODULE_2 as MY_RENAMED_VAR
+
+
+SOME_LIST += ['c', 'd']
+
diff --git a/python/testData/blockEvaluator/some_package/__init__.py b/python/testData/blockEvaluator/some_package/__init__.py
new file mode 100644
index 0000000..7acfca7
--- /dev/null
+++ b/python/testData/blockEvaluator/some_package/__init__.py
@@ -0,0 +1,2 @@
+__author__ = 'Ilya.Kazakevich'
+VARIABLE_IN_PACKAGE = "foo"
\ No newline at end of file
diff --git a/python/testData/blockEvaluator/some_package/another_module_in_package.py b/python/testData/blockEvaluator/some_package/another_module_in_package.py
new file mode 100644
index 0000000..a8ef7c9
--- /dev/null
+++ b/python/testData/blockEvaluator/some_package/another_module_in_package.py
@@ -0,0 +1,2 @@
+__author__ = 'Ilya.Kazakevich'
+VARIABLE_IN_PACKAGE_MODULE_2 = "foo"
diff --git a/python/testData/blockEvaluator/some_package/module_in_package.py b/python/testData/blockEvaluator/some_package/module_in_package.py
new file mode 100644
index 0000000..1ed3bcb
--- /dev/null
+++ b/python/testData/blockEvaluator/some_package/module_in_package.py
@@ -0,0 +1,2 @@
+__author__ = 'Ilya.Kazakevich'
+VARIABLE_IN_PACKAGE_MODULE = "foo"
diff --git a/python/testData/formatter/shebang.py b/python/testData/formatter/shebang.py
new file mode 100644
index 0000000..44f7725
--- /dev/null
+++ b/python/testData/formatter/shebang.py
@@ -0,0 +1 @@
+#!/usr/bin/python3
\ No newline at end of file
diff --git a/python/testData/formatter/shebang_after.py b/python/testData/formatter/shebang_after.py
new file mode 100644
index 0000000..44f7725
--- /dev/null
+++ b/python/testData/formatter/shebang_after.py
@@ -0,0 +1 @@
+#!/usr/bin/python3
\ No newline at end of file
diff --git a/python/testSrc/com/jetbrains/python/PyBlockEvaluatorTest.java b/python/testSrc/com/jetbrains/python/PyBlockEvaluatorTest.java
index 3fd0a0a..368c055 100644
--- a/python/testSrc/com/jetbrains/python/PyBlockEvaluatorTest.java
+++ b/python/testSrc/com/jetbrains/python/PyBlockEvaluatorTest.java
@@ -20,7 +20,9 @@
 import com.jetbrains.python.psi.PyFile;
 import com.jetbrains.python.psi.PyFunction;
 import com.jetbrains.python.psi.PyStringLiteralExpression;
+import com.jetbrains.python.psi.PyUtil;
 import com.jetbrains.python.psi.impl.PyBlockEvaluator;
+import org.junit.Assert;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -64,42 +66,60 @@
 
   public void testDict() {
     PyBlockEvaluator eval = doEvaluate("a={'b': 'c'}");
-    Map map = (Map) eval.getValue("a");
+    Map map = (Map)eval.getValue("a");
     assertEquals(1, map.size());
     assertEquals("c", map.get("b"));
   }
 
   public void testDictNoEvaluate() {
     PyBlockEvaluator eval = doEvaluate("a={'b': 'c'}", true);
-    Map map = (Map) eval.getValue("a");
+    Map map = (Map)eval.getValue("a");
     assertEquals(1, map.size());
     assertTrue(map.get("b") instanceof PyStringLiteralExpression);
   }
 
   public void testDictAssign() {
     PyBlockEvaluator eval = doEvaluate("a={}\na['b']='c'");
-    Map map = (Map) eval.getValue("a");
+    Map map = (Map)eval.getValue("a");
     assertEquals(1, map.size());
     assertEquals("c", map.get("b"));
   }
 
   public void testDictAssignNoEvaluate() {
     PyBlockEvaluator eval = doEvaluate("a={}\na['b']='c'", true);
-    Map map = (Map) eval.getValue("a");
+    Map map = (Map)eval.getValue("a");
     assertEquals(1, map.size());
     assertTrue(map.get("b") instanceof PyStringLiteralExpression);
   }
 
   public void testDictUpdate() {
     PyBlockEvaluator eval = doEvaluate("a={}\na.update({'b': 'c'})");
-    Map map = (Map) eval.getValue("a");
+    Map map = (Map)eval.getValue("a");
     assertEquals(1, map.size());
     assertEquals("c", map.get("b"));
   }
 
+  /**
+   * Ensures module has any vars imported from external modules
+   */
+  public void testImport() {
+    myFixture.copyDirectoryToProject("blockEvaluator", "");
+    final PyFile file = PyUtil.as(myFixture.configureByFile("my_module.py"), PyFile.class);
+    assert file != null : "Failed to read file";
+    final PyBlockEvaluator sut = new PyBlockEvaluator();
+    sut.evaluate(file);
+
+    Assert.assertEquals("Failed to read var from package module", "foo", sut.getValueAsString("VARIABLE_IN_PACKAGE_MODULE"));
+    Assert.assertEquals("Failed to read var from package", "foo", sut.getValueAsString("VARIABLE_IN_PACKAGE"));
+    Assert.assertEquals("Failed to read list from another module", Arrays.asList("a", "b", "c", "d"), sut.getValueAsList("SOME_LIST"));
+    Assert.assertEquals("Failed to read var from another module", "42", sut.getValueAsString("SOME_VARIABLE"));
+    Assert.assertEquals("Failed to read var from another module with alias", "foo", sut.getValueAsString("MY_RENAMED_VAR"));
+  }
+
   public void testFunction() {
     PyBlockEvaluator eval = new PyBlockEvaluator();
-    PyFile file = (PyFile)PsiFileFactory.getInstance(myFixture.getProject()).createFileFromText("a.py", PythonFileType.INSTANCE, "def foo(): return 'a'");
+    PyFile file = (PyFile)PsiFileFactory.getInstance(myFixture.getProject())
+      .createFileFromText("a.py", PythonFileType.INSTANCE, "def foo(): return 'a'");
     PyFunction foo = file.findTopLevelFunction("foo");
     eval.evaluate(foo);
     assertEquals("a", eval.getReturnValue());
diff --git a/python/testSrc/com/jetbrains/python/PyFormatterTest.java b/python/testSrc/com/jetbrains/python/PyFormatterTest.java
index 3983689..3680544 100644
--- a/python/testSrc/com/jetbrains/python/PyFormatterTest.java
+++ b/python/testSrc/com/jetbrains/python/PyFormatterTest.java
@@ -398,6 +398,10 @@
     doTest();
   }
 
+  public void testShebang() { //PY-12775
+    doTest();
+  }
+
   private void doTest() {
     doTest(false);
   }
diff --git a/python/testSrc/com/jetbrains/python/PyQuickFixTest.java b/python/testSrc/com/jetbrains/python/PyQuickFixTest.java
index fde0c2e..c36372d 100644
--- a/python/testSrc/com/jetbrains/python/PyQuickFixTest.java
+++ b/python/testSrc/com/jetbrains/python/PyQuickFixTest.java
@@ -23,6 +23,7 @@
 import com.jetbrains.python.documentation.PyDocumentationSettings;
 import com.jetbrains.python.fixtures.PyTestCase;
 import com.jetbrains.python.inspections.*;
+import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection;
 import com.jetbrains.python.psi.LanguageLevel;
 import org.jetbrains.annotations.NonNls;
 
diff --git a/python/testSrc/com/jetbrains/python/PySuppressInspectionsTest.java b/python/testSrc/com/jetbrains/python/PySuppressInspectionsTest.java
index 9c238be..1eab5f2 100644
--- a/python/testSrc/com/jetbrains/python/PySuppressInspectionsTest.java
+++ b/python/testSrc/com/jetbrains/python/PySuppressInspectionsTest.java
@@ -18,7 +18,7 @@
 import com.intellij.codeInsight.intention.IntentionAction;
 import com.jetbrains.python.fixtures.PyTestCase;
 import com.jetbrains.python.inspections.PyInspection;
-import com.jetbrains.python.inspections.PyUnresolvedReferencesInspection;
+import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection;
 import com.jetbrains.python.inspections.PyUnusedLocalInspection;
 
 import java.util.List;
diff --git a/python/testSrc/com/jetbrains/python/PyTypeTest.java b/python/testSrc/com/jetbrains/python/PyTypeTest.java
index cfa2966..81b4aa4 100644
--- a/python/testSrc/com/jetbrains/python/PyTypeTest.java
+++ b/python/testSrc/com/jetbrains/python/PyTypeTest.java
@@ -805,6 +805,20 @@
            "expr = iter(xs).next()\n");
   }
 
+  // PY-10967
+  public void testDefaultTupleParameterMember() {
+    doTest("int",
+           "def foo(xs=(1, 2)):\n" +
+           "  expr, foo = xs\n");
+  }
+
+  public void testTupleIterationType() {
+    doTest("int | str",
+           "xs = (1, 'a')\n" +
+           "for expr in xs:\n" +
+           "    pass\n");
+  }
+
   private static TypeEvalContext getTypeEvalContext(@NotNull PyExpression element) {
     return TypeEvalContext.userInitiated(element.getContainingFile()).withTracing();
   }
diff --git a/python/testSrc/com/jetbrains/python/inspections/Py3UnresolvedReferencesInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/Py3UnresolvedReferencesInspectionTest.java
index ee37eab..fe019c6 100644
--- a/python/testSrc/com/jetbrains/python/inspections/Py3UnresolvedReferencesInspectionTest.java
+++ b/python/testSrc/com/jetbrains/python/inspections/Py3UnresolvedReferencesInspectionTest.java
@@ -20,6 +20,7 @@
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.testFramework.LightProjectDescriptor;
 import com.jetbrains.python.fixtures.PyTestCase;
+import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection;
 import com.jetbrains.python.psi.LanguageLevel;
 import com.jetbrains.python.psi.PyClass;
 import com.jetbrains.python.psi.PyFile;
diff --git a/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java
index 546795e..2141736 100644
--- a/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java
+++ b/python/testSrc/com/jetbrains/python/inspections/PyUnresolvedReferencesInspectionTest.java
@@ -16,6 +16,7 @@
 package com.jetbrains.python.inspections;
 
 import com.jetbrains.python.fixtures.PyInspectionTestCase;
+import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection;
 import com.jetbrains.python.psi.LanguageLevel;
 import org.jetbrains.annotations.NotNull;
 
diff --git a/python/testSrc/com/jetbrains/python/inspections/PyUnusedImportTest.java b/python/testSrc/com/jetbrains/python/inspections/PyUnusedImportTest.java
index e02afa1..018d75e 100644
--- a/python/testSrc/com/jetbrains/python/inspections/PyUnusedImportTest.java
+++ b/python/testSrc/com/jetbrains/python/inspections/PyUnusedImportTest.java
@@ -16,6 +16,7 @@
 package com.jetbrains.python.inspections;
 
 import com.jetbrains.python.fixtures.PyTestCase;
+import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection;
 import org.jetbrains.annotations.NotNull;
 
 /**
diff --git a/python/testSrc/com/jetbrains/python/quickFixes/AddFieldQuickFixTest.java b/python/testSrc/com/jetbrains/python/quickFixes/AddFieldQuickFixTest.java
index c93553d..21ada79 100644
--- a/python/testSrc/com/jetbrains/python/quickFixes/AddFieldQuickFixTest.java
+++ b/python/testSrc/com/jetbrains/python/quickFixes/AddFieldQuickFixTest.java
@@ -18,7 +18,7 @@
 import com.intellij.testFramework.TestDataPath;
 import com.jetbrains.python.PyBundle;
 import com.jetbrains.python.PyQuickFixTestCase;
-import com.jetbrains.python.inspections.PyUnresolvedReferencesInspection;
+import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection;
 import com.jetbrains.python.inspections.PyUnusedLocalInspection;
 
 /**
diff --git a/python/testSrc/com/jetbrains/python/quickFixes/AddMethodQuickFixTest.java b/python/testSrc/com/jetbrains/python/quickFixes/AddMethodQuickFixTest.java
index bde22a9..6bc3571 100644
--- a/python/testSrc/com/jetbrains/python/quickFixes/AddMethodQuickFixTest.java
+++ b/python/testSrc/com/jetbrains/python/quickFixes/AddMethodQuickFixTest.java
@@ -18,7 +18,7 @@
 import com.jetbrains.python.PyBundle;
 import com.jetbrains.python.PyQuickFixTestCase;
 import com.jetbrains.python.inspections.PyClassHasNoInitInspection;
-import com.jetbrains.python.inspections.PyUnresolvedReferencesInspection;
+import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection;
 
 /**
  * User: ktisha
diff --git a/resources-en/src/inspectionDescriptions/BlockMarkerComments.html b/resources-en/src/inspectionDescriptions/BlockMarkerComments.html
new file mode 100644
index 0000000..a101cf2
--- /dev/null
+++ b/resources-en/src/inspectionDescriptions/BlockMarkerComments.html
@@ -0,0 +1,20 @@
+<!--
+  ~ 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.
+  -->
+<html>
+<body>
+This inspection reports comments which are code block markers
+</body>
+</html>
diff --git a/resources-en/src/inspectionDescriptions/Contract.html b/resources-en/src/inspectionDescriptions/Contract.html
new file mode 100644
index 0000000..099c159
--- /dev/null
+++ b/resources-en/src/inspectionDescriptions/Contract.html
@@ -0,0 +1,9 @@
+<html>
+<body>
+This inspection reports various method contract (@Contract annotation) well-formedness issues:
+<!-- tooltip end -->
+<li>Errors in contract syntax</li>
+<li>Contracts not conforming to the method signature (wrong parameter count)</li>
+<li>Method implementations that contradict the contract (e.g. returning "true" when the contract says "false")</li>
+</body>
+</html>
\ No newline at end of file
diff --git a/resources-en/src/inspectionDescriptions/FieldAccessNotGuarded.html b/resources-en/src/inspectionDescriptions/FieldAccessNotGuarded.html
index 8e24462..cd726d5 100644
--- a/resources-en/src/inspectionDescriptions/FieldAccessNotGuarded.html
+++ b/resources-en/src/inspectionDescriptions/FieldAccessNotGuarded.html
@@ -2,6 +2,5 @@
 <body>
                This inspection reports any accesses of fields declared as @net.jcip.annotations.GuardedBy
                 which are are not guarded by an appropriate synchronization structure.
-           <br><small>New in 9</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/resources-en/src/inspectionDescriptions/InconsistentLanguageLevel.html b/resources-en/src/inspectionDescriptions/InconsistentLanguageLevel.html
index 74f8a76..e5775ea 100644
--- a/resources-en/src/inspectionDescriptions/InconsistentLanguageLevel.html
+++ b/resources-en/src/inspectionDescriptions/InconsistentLanguageLevel.html
@@ -2,6 +2,5 @@
 <body>
 <font face="verdana" size="-1">This inspection lists modules which depend on other modules with higher language level. Such dependencies should be broken off.
 </font>
-<br><small>New in 9</small>
 </body>
 </html>
diff --git a/resources-en/src/inspectionDescriptions/InstanceGuardedByStatic.html b/resources-en/src/inspectionDescriptions/InstanceGuardedByStatic.html
index 6e430dd..565f32d 100644
--- a/resources-en/src/inspectionDescriptions/InstanceGuardedByStatic.html
+++ b/resources-en/src/inspectionDescriptions/InstanceGuardedByStatic.html
@@ -6,6 +6,5 @@
                 as access to each locked field in any object instance will prevent simultaneous access to that field in
                 every object
                 instance.
-           <br><small>New in 9</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/resources-en/src/inspectionDescriptions/NonFinalFieldInImmutable.html b/resources-en/src/inspectionDescriptions/NonFinalFieldInImmutable.html
index 3606a6a..a0b877f 100644
--- a/resources-en/src/inspectionDescriptions/NonFinalFieldInImmutable.html
+++ b/resources-en/src/inspectionDescriptions/NonFinalFieldInImmutable.html
@@ -3,6 +3,5 @@
                 This inspection reports any non-final field in a class with annotation
                 @net.jcip.annotations.Immutable. This violates the contract of the @Immutable
                 annotation.
-           <br><small>New in 9</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/resources-en/src/inspectionDescriptions/NonFinalGuard.html b/resources-en/src/inspectionDescriptions/NonFinalGuard.html
index db32641..aa0e3e7 100644
--- a/resources-en/src/inspectionDescriptions/NonFinalGuard.html
+++ b/resources-en/src/inspectionDescriptions/NonFinalGuard.html
@@ -3,6 +3,5 @@
                This inspection reports any @net.jcip.annotations.GuardedBy annotations where the guarding field
                 is not final. Gaurding on a non-final field may result in unexpected race conditions, as locks will
                 be held on the value of the field (which may change), rather than the field itself.
-           <br><small>New in 9</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/resources-en/src/inspectionDescriptions/StaticGuardedByInstance.html b/resources-en/src/inspectionDescriptions/StaticGuardedByInstance.html
index 18a9cac..d2efdbc 100644
--- a/resources-en/src/inspectionDescriptions/StaticGuardedByInstance.html
+++ b/resources-en/src/inspectionDescriptions/StaticGuardedByInstance.html
@@ -7,6 +7,5 @@
                 concurrency, multiple threads may be able to access the guarded field simultaneously, by locking in
                 different
                 object contexts.
-           <br><small>New in 9</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/resources-en/src/inspectionDescriptions/UnknownGuard.html b/resources-en/src/inspectionDescriptions/UnknownGuard.html
index 3044276..fa76c83 100644
--- a/resources-en/src/inspectionDescriptions/UnknownGuard.html
+++ b/resources-en/src/inspectionDescriptions/UnknownGuard.html
@@ -2,6 +2,5 @@
 <body>
                 This inspection reports any @net.jcip.annotations.GuardedBy annotations where the guarding field
                 is unknown.
-           <br><small>New in 9</small>
 </body>
 </html>
\ No newline at end of file
diff --git a/resources-en/src/intentionDescriptions/AddJavadocIntention/after.java.template b/resources-en/src/intentionDescriptions/AddJavadocIntention/after.java.template
new file mode 100644
index 0000000..d8ef261
--- /dev/null
+++ b/resources-en/src/intentionDescriptions/AddJavadocIntention/after.java.template
@@ -0,0 +1,8 @@
+public class X {
+  /**
+   * @param j
+   */
+  public void m(int j) {
+
+  }
+}
diff --git a/resources-en/src/intentionDescriptions/AddJavadocIntention/before.java.template b/resources-en/src/intentionDescriptions/AddJavadocIntention/before.java.template
new file mode 100644
index 0000000..81f77ff
--- /dev/null
+++ b/resources-en/src/intentionDescriptions/AddJavadocIntention/before.java.template
@@ -0,0 +1,5 @@
+public class X {
+  public void <spot>m</spot>(int j) {
+
+  }
+}
diff --git a/resources-en/src/intentionDescriptions/AddJavadocIntention/description.html b/resources-en/src/intentionDescriptions/AddJavadocIntention/description.html
new file mode 100644
index 0000000..12558ab
--- /dev/null
+++ b/resources-en/src/intentionDescriptions/AddJavadocIntention/description.html
@@ -0,0 +1,20 @@
+<!--
+  ~ 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.
+  -->
+<html>
+<body>
+Creates documentation comment for class, method or field if it's not created yet.
+</body>
+</html>
diff --git a/resources-en/src/intentionDescriptions/CreateSwitchIntention/after.java.template b/resources-en/src/intentionDescriptions/CreateSwitchIntention/after.java.template
new file mode 100644
index 0000000..f5d18e0
--- /dev/null
+++ b/resources-en/src/intentionDescriptions/CreateSwitchIntention/after.java.template
@@ -0,0 +1,5 @@
+void m(int var) {
+  switch(var) {
+
+  }
+}
\ No newline at end of file
diff --git a/resources-en/src/intentionDescriptions/CreateSwitchIntention/before.java.template b/resources-en/src/intentionDescriptions/CreateSwitchIntention/before.java.template
new file mode 100644
index 0000000..76cda38
--- /dev/null
+++ b/resources-en/src/intentionDescriptions/CreateSwitchIntention/before.java.template
@@ -0,0 +1,3 @@
+void m(int var) {
+  <spot>var<spot>
+}
\ No newline at end of file
diff --git a/resources-en/src/intentionDescriptions/CreateSwitchIntention/description.html b/resources-en/src/intentionDescriptions/CreateSwitchIntention/description.html
new file mode 100644
index 0000000..f83b1d0
--- /dev/null
+++ b/resources-en/src/intentionDescriptions/CreateSwitchIntention/description.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+Creates switch statement for selected variable
+</body>
+</html>
diff --git a/resources-en/src/intentionDescriptions/GenerateMissedTestsAction/after.java.template b/resources-en/src/intentionDescriptions/GenerateMissedTestsAction/after.java.template
new file mode 100644
index 0000000..5d0e5b4
--- /dev/null
+++ b/resources-en/src/intentionDescriptions/GenerateMissedTestsAction/after.java.template
@@ -0,0 +1,16 @@
+public class Foo {
+  public void doSomething() {
+  }
+
+  public void doSomethingElse(){
+  }
+}
+public class FooTest extends TestCase {
+  public void testDoSomething() {
+
+  }
+  <spot>
+  public void testDoSomethingElse() {
+  }
+  </spot>
+}
diff --git a/resources-en/src/intentionDescriptions/GenerateMissedTestsAction/before.java.template b/resources-en/src/intentionDescriptions/GenerateMissedTestsAction/before.java.template
new file mode 100644
index 0000000..7bcdfe8
--- /dev/null
+++ b/resources-en/src/intentionDescriptions/GenerateMissedTestsAction/before.java.template
@@ -0,0 +1,10 @@
+<spot>public class Foo</spot> {
+  public void doSomething() {
+  }
+
+  public void doSomethingElse(){
+  }
+}
+public class FooTest extends TestCase {
+  public void testDoSomething() {}
+}
diff --git a/resources-en/src/intentionDescriptions/GenerateMissedTestsAction/description.html b/resources-en/src/intentionDescriptions/GenerateMissedTestsAction/description.html
new file mode 100644
index 0000000..8989294
--- /dev/null
+++ b/resources-en/src/intentionDescriptions/GenerateMissedTestsAction/description.html
@@ -0,0 +1,6 @@
+<html>
+<body>
+This intention generates missed tests for the selected class. <br>
+Generated skeleton test methods for the chosen public methods would be appended to the existing test class.
+</body>
+</html>
diff --git a/resources-en/src/messages/CompilerBundle.properties b/resources-en/src/messages/CompilerBundle.properties
index 27a33a6..be73675 100644
--- a/resources-en/src/messages/CompilerBundle.properties
+++ b/resources-en/src/messages/CompilerBundle.properties
@@ -51,18 +51,11 @@
 generated.ant.build.building.concrete.module.section.title=Module {0}
 compiler.error.exception=Error: {0}
 error.compiler.caches.corrupted=Compiler caches are corrupted. Starting rebuild...
-error.caches.old.format=Compiler caches on disk have old format. Project rebuild is required.
-error.previous.compilation.failed=Previous compilation did not terminate properly. Caches may have been corrupted. Starting rebuild...
 error.dependency.info.on.disk.corrupted=Compiler dependency information on disk is corrupted. Rebuild required.
-error.vfs.was.rebuilt=File system caches were invalidated. Rebuild required.
 status.compilation.aborted=Compilation aborted
 status.all.up.to.date=All files are up-to-date
-progress.saving.caches=Saving caches...
-progress.clearing.output=Clearing output directories...
 compiler.error.failed.to.delete=Failed to delete {0}
-progress.synchronizing.output.directory=Synchronizing output directory...
 progress.updating.caches=Updating caches...
-progress.processing.outdated.files=Processing outdated files...
 compiler.content.name.compile=Compile
 compiler.content.name.make=Make
 status.compilation.completed.successfully.with.warnings=Compilation completed successfully with {0} {0,choice, 0#warnings|1#warning|2#warnings}
@@ -73,25 +66,19 @@
 error.failed.to.create.directory=Failed to create directory {0}
 error.chunk.modules.must.have.same.jdk=The following modules must have the same JDK assigned because of cyclic dependencies between them:\n{0}\nPlease update modules configuration
 error.chunk.modules.must.have.same.language.level=The following modules must have the same language level assigned because of cyclic dependencies between them:\n{0}\nPlease update modules configuration
-error.annotation.processing.not.supported.for.module.cycles=Annotation processors running is not supported for module cycles. The following modules form a cycle:\n{0}\nPlease either update modules configuration or exclude these modules from annotation processing
 warning.sources.under.output.paths=Compiler option \"Clear output directory on rebuild\" is currently on.\nHowever, source files may exist in the following output paths:\n{0}\nCompilation will proceed without clearing output directories.
 action.compiler.properties.text=Compiler Properties
 actions.exclude.from.compile.text=Exclude from Compile
-progress.deleting.temp.files=Deleting temp files...
 progress.checking.dependencies=Checking dependencies...
 progress.found.dependent.files=Found {0} dependent files
 error.compiler.internal.error=Compiler internal error. Process terminated with exit code {0}
 error.bad.class.file.format=Bad class file format:\n{0}
 java.compiler.description=Java Compiler
-annotation.processing.compiler.description=Java Annotation Processing Compiler
 resource.compiler.description=Resource Compiler
-progress.copying.resources=Copying resources...
-progress.generating.rmi.stubs=Generating RMI stubs...
 rmi.compiler.description=RMI Compiler
 error.jdk.not.specified=Cannot start compiler: the SDK is not specified for {0,choice, 1#module|2#modules\n} {1}.\nSpecify the SDK at Project Structure dialog.
 error.output.not.specified=Cannot start compilation: the output path is not specified for {0,choice, 1#module|2#modules\n} {1}.\nSpecify the output path in Configure Project.
 error.project.output.not.specified=Cannot start compilation: some compilers require that project path is defined.\nSpecify project output path in Configure Project.
-statistics.files.classes.module=Files: {0} - Classes: {1} - Module: {2}
 statistics.files.classes=Files: {0} - Classes: {1}
 compiler.javac.name=Javac
 javac.error.jdk.home.missing=Cannot find home directory ''{1}'' for JDK ''{0}''.\nUpdate JDK configuration.
@@ -99,16 +86,8 @@
 javac.error.tools.jar.missing=Cannot obtain path javac classes for JDK {0}.\nUpdate JDK configuration.
 javac.error.unknown.jdk.version=Cannot determine version for JDK {0}.\nUpdate JDK configuration.
 javac.error.1_0_compilation.not.supported=Compilation is not supported for JDK 1.0
-compiler.jikes.name=Jikes
-jikes.error.path.to.compiler.unspecified=Cannot start Jikes compiler.\nThe path to compiler executable is not configured
-jikes.error.path.to.compiler.missing=Cannot start Jikes compiler.\nThe file {0} not found.
 compiler.configurable.display.name=Compiler
-label.option.honor.dependencies=Honor &dependencies on "Compile" command
 label.option.compile.in.background=C&ompile in background
-label.option.deploy.ask=Ask
-label.option.deploy.never=Never
-label.option.deploy.always=Always
-label.option.deploy.text=Deploy web applications to server after compilation:
 label.option.clear.output.directory.on.rebuild=C&lear output directory on rebuild
 label.option.resource.patterns.text=Resource patterns\:
 error.compiler.configurable.malformed.patterns=The following resource patterns are malformed:\n{0}
@@ -121,8 +100,6 @@
 java.compiler.option.generate.debugging.info=Generate debugging info
 java.compiler.option.report.deprecated=Report use of deprecated features
 javac.option.max.heap.size=Maximum heap size (MB):
-jikes.option.path.to.executable=Path to Jikes executable:
-jikes.options.group.title=Jikes Options
 javac.options.group.title=Javac Options
 rmic.option.generate.iiop.stubs=Generate IIOP stubs
 rmic.option.enable.rmi.stubs=Enable RMI stubs generation
@@ -139,7 +116,6 @@
 error.compiler.process.not.started=Compiler not started: {0}
 add.notnull.assertions=Add @NotNull &assertions
 
-eclipse.compiler.error.jar.not.found=Cannot start Eclipse compiler.\nThe file {0} not found.
 compiler.eclipse.name=Eclipse
 eclipse.options.group.title=Eclipse Options
 eclipse.compiler.parsing=Parsing {0}
diff --git a/resources-en/src/messages/DebuggerBundle.properties b/resources-en/src/messages/DebuggerBundle.properties
index 09907f7..ff3238c 100644
--- a/resources-en/src/messages/DebuggerBundle.properties
+++ b/resources-en/src/messages/DebuggerBundle.properties
@@ -329,8 +329,8 @@
 error.evaluating.breakpoint.condition.or.action=Problem processing VM event:\nBreakpoint: ''{0}''\nError: {1}\nWould you like to stop at the breakpoint?
 error.unable.to.evaluate.expression=unable to evaluate the expression
 breakpoint.properties.panel.option.pass.count=&Pass count:
-breakpoint.properties.panel.option.class.filters=C&lass filters
-breakpoint.properties.panel.option.instance.filters=&Instance filters
+breakpoint.properties.panel.option.class.filters=C&lass filters:
+breakpoint.properties.panel.option.instance.filters=&Instance filters:
 breakpoint.properties.panel.option.condition=Co&ndition:
 breakpoint.properties.panel.option.suspend.all=All
 breakpoint.properties.panel.option.suspend.none=None
@@ -431,7 +431,6 @@
 action.show.watches.description=Shows or hides 'watches' pane
 action.show.watches.text.hide=Hide Watches
 action.show.watches.text.show=Show Watches
-action.unmute.on.stop.text=Unmute breakpoints on session finish
 action.watch.method.return.value.description=Enables watching last executed method return value
 action.watches.method.return.value.enable=Watch method return values
 action.watches.method.return.value.disable=Stop watching method return values
diff --git a/resources-en/src/messages/QuickFixBundle.properties b/resources-en/src/messages/QuickFixBundle.properties
index 93a969d..9e94379 100644
--- a/resources-en/src/messages/QuickFixBundle.properties
+++ b/resources-en/src/messages/QuickFixBundle.properties
@@ -274,4 +274,11 @@
 replace.with.list.access.text=Replace with list access
 
 add.qualifier=Add qualifier
-add.qualifier.original.class.chooser.title=Original class
\ No newline at end of file
+add.qualifier.original.class.chooser.title=Original class
+
+wrap.array.to.arrays.as.list.parameter.text=Wrap {0, choice, 1#1st|2#2nd|3#3rd|4#{0,number}th} parameter using ''Arrays.asList''
+wrap.array.to.arrays.as.list.single.parameter.text=Wrap using ''Arrays.asList''
+
+annotations.fix=Annotations
+add.missing.annotation.parameters.fix=Add missing annotation parameters - {0}
+add.missing.annotation.single.parameter.fix=Add missing annotation parameter ''{0}''
\ No newline at end of file
diff --git a/resources/src/META-INF/IdeaPlugin.xml b/resources/src/META-INF/IdeaPlugin.xml
index f9d4d4c..93cee99 100644
--- a/resources/src/META-INF/IdeaPlugin.xml
+++ b/resources/src/META-INF/IdeaPlugin.xml
@@ -518,6 +518,9 @@
     <localInspection language="JAVA" shortName="ConstantConditions" bundle="messages.InspectionsBundle" key="inspection.data.flow.display.name"
                      groupName="Probable bugs" enabledByDefault="true" level="WARNING"
                      implementationClass="com.intellij.codeInspection.dataFlow.DataFlowInspection"/>
+    <localInspection language="JAVA" shortName="Contract" bundle="messages.InspectionsBundle" key="inspection.contract.display.name"
+                     groupName="Probable bugs" enabledByDefault="true" level="WARNING"
+                     implementationClass="com.intellij.codeInspection.dataFlow.ContractInspection"/>
     <localInspection language="JAVA" shortName="UnusedAssignment" displayName="Unused assignment" groupName="Probable bugs" enabledByDefault="true"
                      level="WARNING" implementationClass="com.intellij.codeInspection.defUse.DefUseInspection"/>
     <localInspection language="JAVA" shortName="NumericOverflow" displayName="Numeric overflow" groupName="Numeric issues" enabledByDefault="true"
@@ -658,6 +661,11 @@
                      groupKey="group.names.inheritance.issues" enabledByDefault="false" level="WARNING"
                      implementationClass="com.intellij.codeInspection.inheritance.SuperClassHasFrequentlyUsedInheritorsInspection"
                      displayName="Class may extend a commonly used base class instead of implementing interface"/>
+    <localInspection language="JAVA" shortName="BlockMarkerComments"
+                     groupBundle="messages.InspectionsBundle"
+                     groupName="Code style issues" enabledByDefault="false" level="WARNING"
+                     implementationClass="com.intellij.codeInspection.BlockMarkerCommentsInspection"
+                     displayName="Block marker comment"/>
 
     <intentionAction>
       <className>com.intellij.codeInsight.daemon.quickFix.RedundantLambdaParameterTypeIntention</className>
@@ -707,6 +715,10 @@
       <className>com.intellij.codeInsight.intention.impl.DeannotateIntentionAction</className>
       <category>Control Flow</category>
     </intentionAction>
+    <intentionAction>
+      <className>com.intellij.codeInsight.intention.impl.CreateSwitchIntention</className>
+      <category>Control Flow</category>
+    </intentionAction>
 
     <intentionAction>
       <className>com.intellij.codeInsight.intention.impl.CreateFieldFromParameterAction</className>
@@ -733,6 +745,10 @@
       <category>Declaration</category>
     </intentionAction>
     <intentionAction>
+      <className>com.intellij.testIntegration.createTest.GenerateMissedTestsAction</className>
+      <category>Declaration</category>
+    </intentionAction>
+    <intentionAction>
       <className>com.intellij.codeInsight.intention.impl.CreateSubclassAction</className>
       <category>Declaration</category>
     </intentionAction>
@@ -847,6 +863,11 @@
     </intentionAction>
 
     <intentionAction>
+      <className>com.intellij.codeInsight.intention.impl.AddJavadocIntention</className>
+      <category>Declaration</category>
+    </intentionAction>
+
+    <intentionAction>
       <className>com.intellij.codeInsight.intention.impl.ConvertAbsolutePathToRelativeIntentionAction</className>
       <category>Other</category>
     </intentionAction>
@@ -867,8 +888,6 @@
     </intentionAction>
 
 
-
-
     <intentionAction>
       <className>com.intellij.codeInspection.concurrencyAnnotations.JCiPOrderEntryFix</className>
     </intentionAction>
diff --git a/resources/src/idea/JavaActions.xml b/resources/src/idea/JavaActions.xml
index d90a1de..81721a9 100644
--- a/resources/src/idea/JavaActions.xml
+++ b/resources/src/idea/JavaActions.xml
@@ -160,8 +160,7 @@
         <add-to-group group-id="XDebugger.Watches.Tree.Popup" anchor="last"/>
       </action>
       <action id="Debugger.ViewText" class="com.intellij.debugger.actions.ViewTextAction">
-        <add-to-group group-id="XDebugger.Variables.Tree.Popup" anchor="before" relative-to-action="Debugger.ViewAsGroup"/>
-        <add-to-group group-id="XDebugger.Watches.Tree.Popup" anchor="before" relative-to-action="Debugger.CustomizeContextView"/>
+        <add-to-group group-id="XDebugger.ValueGroup" anchor="last"/>
       </action>
       <action id="Debugger.CopyValue" class="com.intellij.debugger.actions.CopyValueAction"/>
       <action id="Debugger.CompareValueWithClipboard" class="com.intellij.debugger.actions.CompareValueWithClipboardAction"/>
@@ -177,7 +176,7 @@
       <action id="Debugger.RemoveAllWatches" class="com.intellij.debugger.actions.RemoveAllWatchesAction"/>
       <action id="Debugger.RemoveWatch" class="com.intellij.debugger.actions.RemoveWatchAction" icon="AllIcons.Actions.Delete"/>
       <action id="Debugger.ViewAsGroup" class="com.intellij.debugger.actions.ViewAsGroup">
-        <add-to-group group-id="XDebugger.Variables.Tree.Popup" anchor="before" relative-to-action="Debugger.CustomizeContextView"/>
+        <add-to-group group-id="XDebugger.ValueGroup" anchor="last"/>
       </action>
       <!--<action id="Debugger.SetValue" class="com.intellij.debugger.actions.SetValueAction"/>-->
       <!--<action id="Debugger.ShowAsHex" class="com.intellij.debugger.actions.ShowAsHexAction" text="Show as Hex"/>-->
diff --git a/resources/src/idea/RichPlatformActions.xml b/resources/src/idea/RichPlatformActions.xml
index 0822f3c..e54eddd 100644
--- a/resources/src/idea/RichPlatformActions.xml
+++ b/resources/src/idea/RichPlatformActions.xml
@@ -98,7 +98,6 @@
       <action id="CompileDirty" class="com.intellij.compiler.actions.CompileDirtyAction" icon="AllIcons.Actions.Compile"/>
       <action id="MakeModule" class="com.intellij.compiler.actions.MakeModuleAction"/>
       <action id="Compile" class="com.intellij.compiler.actions.CompileAction"/>
-      <action id="RunAPT" class="com.intellij.compiler.actions.ProcessAnnotationsAction"/>
       <separator/>
       <action id="CompileProject" class="com.intellij.compiler.actions.CompileProjectAction"/>
       <separator/>
@@ -149,9 +148,6 @@
 
       <separator/>
 
-      <action internal="true" id="CompilerTest" class="com.intellij.compiler.impl.javaCompiler.api.CompilerPerfTestAction"
-              text="Test Rebuild Performance"/>
-
       <add-to-group group-id="Internal" anchor="last"/>
     </group>
 
@@ -177,13 +173,9 @@
       <add-to-group group-id="EditorPopupMenu.Run" anchor="first"/>
     </reference>
 
-    <reference ref="RunAPT">
-      <add-to-group group-id="EditorPopupMenu.Run" anchor="first"/>
-    </reference>
 
     <group id="EditorTabCompileGroup">
       <reference ref="Compile"/>
-      <reference ref="RunAPT"/>
       <add-to-group group-id="EditorTabPopupMenuEx" anchor="before" relative-to-action="RunContextPopupGroup"/>
     </group>
 
@@ -209,7 +201,6 @@
     <group id="ProjectViewCompileGroup">
       <reference ref="MakeModule"/>
       <reference ref="Compile"/>
-      <reference ref="RunAPT"/>
 
       <add-to-group group-id="ProjectViewPopupMenuRunGroup" anchor="first"/>
     </group>
@@ -232,7 +223,6 @@
     <group id="StructureViewCompileGroup">
       <separator/>
       <reference ref="Compile"/>
-      <reference ref="RunAPT"/>
 
       <add-to-group group-id="StructureViewPopupMenu" anchor="after" relative-to-action="RunContextPopupGroup"/>
     </group>
@@ -256,7 +246,6 @@
       <reference ref="$Delete"/>
       <separator/>
       <reference ref="Compile"/>
-      <reference ref="RunAPT"/>
       <reference ref="VersionControlsGroup"/>
 
       <separator/>
@@ -297,7 +286,6 @@
       <reference ref="AddToFavorites"/>
       <separator/>
       <reference ref="Compile"/>
-      <reference ref="RunAPT"/>
       <reference ref="RunContextPopupGroup"/>
       <separator/>
 
@@ -337,7 +325,6 @@
       <reference ref="$Delete"/>
       <separator/>
       <reference ref="Compile"/>
-      <reference ref="RunAPT"/>
       <reference ref="RunContextPopupGroup"/>
       <separator/>
       <reference ref="VersionControlsGroup"/>
diff --git a/resources/src/idea/RichPlatformPlugin.xml b/resources/src/idea/RichPlatformPlugin.xml
index 7b38db5..ae9befc 100644
--- a/resources/src/idea/RichPlatformPlugin.xml
+++ b/resources/src/idea/RichPlatformPlugin.xml
@@ -35,21 +35,12 @@
     <extensionPoint name="compiler.buildParticipantProvider"
                     interface="com.intellij.openapi.compiler.make.BuildParticipantProvider"/>
 
-    <extensionPoint name="compiler.additionalCompileScopeProvider"
-                    interface="com.intellij.compiler.impl.AdditionalCompileScopeProvider"/>
-
     <extensionPoint name="compiler.buildTargetScopeProvider"
                     interface="com.intellij.compiler.impl.BuildTargetScopeProvider"/>
 
-    <extensionPoint name="compiler.makeDependencyProcessor"
-                    interface="com.intellij.compiler.DependencyProcessor"/>
-
     <extensionPoint name="compiler.optionsManager"
                     interface="com.intellij.compiler.options.CompilerOptionsFilter"/>
 
-    <extensionPoint name="compiler.resourceCompilerExtension"
-                    interface="com.intellij.compiler.impl.resourceCompiler.ResourceCompilerExtension"/>
-
     <extensionPoint name="java.programPatcher"
                     interface="com.intellij.execution.runners.JavaProgramPatcher"/>
 
@@ -217,16 +208,10 @@
 
     <projectService serviceInterface="com.intellij.compiler.impl.javaCompiler.javac.JavacConfiguration"
                     serviceImplementation="com.intellij.compiler.impl.javaCompiler.javac.JavacConfiguration"/>
-    <projectService serviceInterface="com.intellij.compiler.impl.javaCompiler.api.CompilerAPIConfiguration"
-                    serviceImplementation="com.intellij.compiler.impl.javaCompiler.api.CompilerAPIConfiguration"/>
     <projectService serviceInterface="com.intellij.compiler.impl.javaCompiler.eclipse.EclipseCompilerConfiguration"
                     serviceImplementation="com.intellij.compiler.impl.javaCompiler.eclipse.EclipseCompilerConfiguration"/>
-    <projectService serviceInterface="com.intellij.compiler.impl.javaCompiler.eclipse.EclipseEmbeddedCompilerConfiguration"
-                    serviceImplementation="com.intellij.compiler.impl.javaCompiler.eclipse.EclipseEmbeddedCompilerConfiguration"/>
     <projectService serviceInterface="com.intellij.compiler.impl.rmiCompiler.RmicConfiguration"
                     serviceImplementation="com.intellij.compiler.impl.rmiCompiler.RmicConfiguration"/>
-    <projectService serviceInterface="com.intellij.compiler.impl.javaCompiler.jikes.JikesConfiguration"
-                    serviceImplementation="com.intellij.compiler.impl.javaCompiler.jikes.JikesConfiguration"/>
     <pathMacroFilter implementation="com.intellij.compiler.impl.javaCompiler.javac.JavacConfigurationMacroFilter"/>
 
     <applicationService serviceInterface="com.intellij.openapi.wm.impl.FrameTitleBuilder"
diff --git a/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconBuilder.java b/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconBuilder.java
index 350fe41..098a3e7 100644
--- a/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconBuilder.java
+++ b/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconBuilder.java
@@ -57,6 +57,7 @@
 public class NavigationGutterIconBuilder<T> {
   @NonNls private static final String PATTERN = "&nbsp;&nbsp;&nbsp;&nbsp;{0}";
   private static final NotNullFunction<PsiElement,Collection<? extends PsiElement>> DEFAULT_PSI_CONVERTOR = new NotNullFunction<PsiElement, Collection<? extends PsiElement>>() {
+    @Override
     @NotNull
     public Collection<? extends PsiElement> fun(final PsiElement element) {
       return ContainerUtil.createMaybeSingletonList(element);
@@ -77,6 +78,7 @@
   private NullableFunction<T,String> myNamer = ElementPresentationManager.namer();
   private final NotNullFunction<T, Collection<? extends GotoRelatedItem>> myGotoRelatedItemProvider;
   public static final NotNullFunction<DomElement,Collection<? extends PsiElement>> DEFAULT_DOM_CONVERTOR = new NotNullFunction<DomElement, Collection<? extends PsiElement>>() {
+    @Override
     @NotNull
     public Collection<? extends PsiElement> fun(final DomElement o) {
       return ContainerUtil.createMaybeSingletonList(o.getXmlElement());
@@ -295,6 +297,7 @@
     }
 
     return new NotNullLazyValue<List<SmartPsiElementPointer>>() {
+      @Override
       @NotNull
       public List<SmartPsiElementPointer> compute() {
         return calcPsiTargets(project, targets.create(), converter);
@@ -359,16 +362,19 @@
       return !myEmpty;
     }
 
+    @Override
     @NotNull
     public Icon getIcon() {
       return myIcon;
     }
 
+    @Override
     @Nullable
     public String getTooltipText() {
       return myTooltipText;
     }
 
+    @Override
     public Alignment getAlignment() {
       return myAlignment;
     }
diff --git a/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconRenderer.java b/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconRenderer.java
index 84c47f2..e465115 100644
--- a/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconRenderer.java
+++ b/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconRenderer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -58,12 +58,14 @@
     myPointers = pointers;
   }
 
+  @Override
   public boolean isNavigateAction() {
     return true;
   }
 
   public List<PsiElement> getTargetElements() {
     return ContainerUtil.mapNotNull(myPointers.getValue(), new NullableFunction<SmartPsiElementPointer, PsiElement>() {
+      @Override
       public PsiElement fun(final SmartPsiElementPointer smartPsiElementPointer) {
         return smartPsiElementPointer.getElement();
       }
@@ -91,15 +93,18 @@
     return result;
   }
 
+  @Override
   @Nullable
   public AnAction getClickAction() {
     return new AnAction() {
+      @Override
       public void actionPerformed(AnActionEvent e) {
         navigate(e == null ? null : (MouseEvent)e.getInputEvent(), null);
       }
     };
   }
 
+  @Override
   public void navigate(@Nullable final MouseEvent event, @Nullable final PsiElement elt) {
     final List<PsiElement> list = getTargetElements();
     if (list.isEmpty()) {
diff --git a/xml/dom-impl/src/com/intellij/util/xml/AbstractDomDeclarationSearcher.java b/xml/dom-impl/src/com/intellij/util/xml/AbstractDomDeclarationSearcher.java
index f11d5ad..4f3a7cb 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/AbstractDomDeclarationSearcher.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/AbstractDomDeclarationSearcher.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.
@@ -32,6 +32,7 @@
  */
 public abstract class AbstractDomDeclarationSearcher extends PomDeclarationSearcher {
 
+  @Override
   public void findDeclarationsAt(@NotNull PsiElement psiElement, int offsetInElement, Consumer<PomTarget> consumer) {
     if (!(psiElement instanceof XmlToken)) return;
 
diff --git a/xml/dom-impl/src/com/intellij/util/xml/DomDocumentationProvider.java b/xml/dom-impl/src/com/intellij/util/xml/DomDocumentationProvider.java
index 0daaf2d..086141f 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/DomDocumentationProvider.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/DomDocumentationProvider.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.
@@ -29,14 +29,17 @@
  */
 public class DomDocumentationProvider implements DocumentationProvider {
 
+  @Override
   public String getQuickNavigateInfo(final PsiElement element, PsiElement originalElement) {
     return null;
   }
 
+  @Override
   public List<String> getUrlFor(final PsiElement element, final PsiElement originalElement) {
     return null;
   }
 
+  @Override
   public String generateDoc(PsiElement element, final PsiElement originalElement) {
     if (element instanceof PomTargetPsiElement) {
       PomTarget target = ((PomTargetPsiElement)element).getTarget();
@@ -56,10 +59,12 @@
     return ElementPresentationManager.getDocumentationForElement(domElement);
   }
 
+  @Override
   public PsiElement getDocumentationElementForLookupItem(final PsiManager psiManager, final Object object, final PsiElement element) {
     return null;
   }
 
+  @Override
   public PsiElement getDocumentationElementForLink(final PsiManager psiManager, final String link, final PsiElement context) {
     return null;
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/DomNameSuggestionProvider.java b/xml/dom-impl/src/com/intellij/util/xml/DomNameSuggestionProvider.java
index b322d8f..31ac8c2 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/DomNameSuggestionProvider.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/DomNameSuggestionProvider.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.
@@ -29,6 +29,7 @@
  * @author Gregory.Shrago
  */
 public class DomNameSuggestionProvider implements NameSuggestionProvider {
+  @Override
   public SuggestedNameInfo getSuggestedNames(final PsiElement element, final PsiElement nameSuggestionContext, final Set<String> result) {
     if (element instanceof PsiMetaOwner) {
       final PsiMetaData psiMetaData = ((PsiMetaOwner)element).getMetaData();
diff --git a/xml/dom-impl/src/com/intellij/util/xml/DomUsageTypeProvider.java b/xml/dom-impl/src/com/intellij/util/xml/DomUsageTypeProvider.java
index 17b61ba..27a85c8 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/DomUsageTypeProvider.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/DomUsageTypeProvider.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.
@@ -28,6 +28,7 @@
  * @author Gregory.Shrago
  */
 public class DomUsageTypeProvider implements UsageTypeProvider {
+  @Override
   @Nullable
   public UsageType getUsageType(PsiElement element) {
     final PsiFile psiFile = element.getContainingFile();
diff --git a/xml/dom-impl/src/com/intellij/util/xml/ElementPresentationManagerImpl.java b/xml/dom-impl/src/com/intellij/util/xml/ElementPresentationManagerImpl.java
index d1d370d..28cb6c0 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/ElementPresentationManagerImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/ElementPresentationManagerImpl.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.
@@ -30,6 +30,7 @@
  */
 public class ElementPresentationManagerImpl extends ElementPresentationManager {
 
+  @Override
   @NotNull
   public <T> Object[] createVariants(Collection<T> elements, Function<T, String> namer, int iconFlags) {
     List<Object> result = new ArrayList<Object>(elements.size());
@@ -43,6 +44,7 @@
     return result.toArray();
   }
 
+  @Override
   public Object createVariant(final Object variant, final String name, final PsiElement psiElement) {
     final LookupElementBuilder builder;
     if (psiElement != null) {
diff --git a/xml/dom-impl/src/com/intellij/util/xml/EnumConverter.java b/xml/dom-impl/src/com/intellij/util/xml/EnumConverter.java
index edb8521..8f65646 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/EnumConverter.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/EnumConverter.java
@@ -34,6 +34,7 @@
  */
 public class EnumConverter<T extends Enum> extends ResolvingConverter<T>{
   private static final ConcurrentFactoryMap<Class,EnumConverter> ourCache = new ConcurrentFactoryMap<Class, EnumConverter>() {
+    @Override
     @NotNull
     protected EnumConverter create(final Class key) {
       return new EnumConverter(key);
@@ -53,18 +54,22 @@
     return NamedEnumUtil.getEnumValueByElement(anEnum);
   }
 
+  @Override
   public final T fromString(final String s, final ConvertContext context) {
     return s==null?null:(T)NamedEnumUtil.getEnumElementByValue((Class)myType, s);
   }
 
+  @Override
   public final String toString(final T t, final ConvertContext context) {
     return t == null? null:getStringValue(t);
   }
 
+  @Override
   public String getErrorMessage(@Nullable final String s, final ConvertContext context) {
     return CodeInsightBundle.message("error.unknown.enum.value.message", s);
   }
 
+  @Override
   @NotNull
   public Collection<? extends T> getVariants(final ConvertContext context) {
     final XmlElement element = context.getXmlElement();
diff --git a/xml/dom-impl/src/com/intellij/util/xml/ModelMergerImpl.java b/xml/dom-impl/src/com/intellij/util/xml/ModelMergerImpl.java
index 6d6e95c..7a26980 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/ModelMergerImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/ModelMergerImpl.java
@@ -45,6 +45,7 @@
   private static final Class<MergedObject> MERGED_OBJECT_CLASS = MergedObject.class;
 
   private final ConcurrentFactoryMap<Method,List<Pair<InvocationStrategy,Class>>> myAcceptsCache = new ConcurrentFactoryMap<Method,List<Pair<InvocationStrategy,Class>>>() {
+    @Override
     protected List<Pair<InvocationStrategy,Class>> create(final Method method) {
       List<Pair<InvocationStrategy,Class>> result = new ArrayList<Pair<InvocationStrategy,Class>>();
       for (int i = myInvocationStrategies.size() - 1; i >= 0; i--) {
@@ -59,10 +60,12 @@
 
   public ModelMergerImpl() {
     addInvocationStrategy(Object.class, new InvocationStrategy<Object>() {
+      @Override
       public boolean accepts(final Method method) {
         return true;
       }
 
+      @Override
       public Object invokeMethod(final JavaMethod javaMethod, final Object proxy, final Object[] args, final List<Object> implementations)
         throws IllegalAccessException, InvocationTargetException {
         final Method method = javaMethod.getMethod();
@@ -72,10 +75,12 @@
     });
 
     addInvocationStrategy(Object.class, new InvocationStrategy<Object>() {
+      @Override
       public boolean accepts(final Method method) {
         return Collection.class.isAssignableFrom(method.getReturnType());
       }
 
+      @Override
       public Object invokeMethod(final JavaMethod method, final Object proxy, final Object[] args, final List<Object> implementations)
         throws IllegalAccessException, InvocationTargetException {
 
@@ -87,10 +92,12 @@
 
 
     addInvocationStrategy(Object.class, new InvocationStrategy<Object>() {
+      @Override
       public boolean accepts(final Method method) {
         return Object.class.equals(method.getDeclaringClass());
       }
 
+      @Override
       public Object invokeMethod(final JavaMethod method, final Object proxy, final Object[] args, final List<Object> implementations) {
         @NonNls String methodName = method.getName();
         if ("toString".equals(methodName)) {
@@ -114,10 +121,12 @@
     });
 
     addInvocationStrategy(Object.class, new InvocationStrategy<Object>() {
+      @Override
       public boolean accepts(final Method method) {
         return "isValid".equals(method.getName());
       }
 
+      @Override
       public Object invokeMethod(final JavaMethod method, final Object proxy, final Object[] args, final List<Object> implementations)
         throws IllegalAccessException, InvocationTargetException {
         for (final Object implementation : implementations) {
@@ -130,10 +139,12 @@
     });
 
     addInvocationStrategy(Object.class, new InvocationStrategy<Object>() {
+      @Override
       public boolean accepts(final Method method) {
         return void.class.equals(method.getReturnType());
       }
 
+      @Override
       public Object invokeMethod(final JavaMethod method, final Object proxy, final Object[] args, final List<Object> implementations)
         throws IllegalAccessException, InvocationTargetException {
         for (final Object t : implementations) {
@@ -144,10 +155,12 @@
     });
 
     addInvocationStrategy(Object.class, new InvocationStrategy<Object>() {
+      @Override
       public boolean accepts(final Method method) {
         return MERGED_OBJECT_CLASS.equals(method.getDeclaringClass());
       }
 
+      @Override
       public Object invokeMethod(final JavaMethod method, final Object proxy, final Object[] args, final List<Object> implementations)
         throws IllegalAccessException, InvocationTargetException {
         assert "getImplementations".equals(method.getName());
@@ -156,10 +169,12 @@
     });
 
     addInvocationStrategy(DomElement.class, new InvocationStrategy<DomElement>() {
+      @Override
       public boolean accepts(final Method method) {
         return DomInvocationHandler.ACCEPT_METHOD.equals(method);
       }
 
+      @Override
       public Object invokeMethod(final JavaMethod method, final DomElement proxy, final Object[] args, final List<DomElement> implementations)
         throws IllegalAccessException, InvocationTargetException {
         final DomElementVisitor visitor = (DomElementVisitor)args[0];
@@ -169,10 +184,12 @@
     });
 
     addInvocationStrategy(DomElement.class, new InvocationStrategy<DomElement>() {
+      @Override
       public boolean accepts(final Method method) {
         return DomInvocationHandler.ACCEPT_CHILDREN_METHOD.equals(method);
       }
 
+      @Override
       public Object invokeMethod(final JavaMethod method, final DomElement proxy, final Object[] args, final List<DomElement> implementations)
         throws IllegalAccessException, InvocationTargetException {
         final DomElementVisitor visitor = (DomElementVisitor)args[0];
@@ -191,21 +208,25 @@
     return javaMethod.getMethod().getAnnotation(Intersect.class) != null;
   }
 
+  @Override
   public final <T> void addInvocationStrategy(Class<T> aClass, InvocationStrategy<T> strategy) {
     myInvocationStrategies.add(Pair.<InvocationStrategy,Class>create(strategy, aClass));
   }
 
+  @Override
   public final <T> void addMergingStrategy(Class<T> aClass, MergingStrategy<T> strategy) {
     myMergingStrategies.add(strategy);
     myMergingStrategyClasses.add(aClass);
   }
 
+  @Override
   public <T> T mergeModels(final Class<T> aClass, final T... implementations) {
     if (implementations.length == 1) return implementations[0];
     final MergingInvocationHandler<T> handler = new MergingInvocationHandler<T>(aClass, Arrays.asList(implementations));
     return _mergeModels(aClass, handler, implementations);
   }
 
+  @Override
   public <T> T mergeModels(final Class<T> aClass, final Collection<? extends T> implementations) {
     return (T)mergeModels((Class)aClass, implementations.toArray());
   }
@@ -232,7 +253,7 @@
   }
 
 
-  private static final Map<Class<? extends Object>, Method> ourPrimaryKeyMethods = new HashMap<Class<? extends Object>, Method>();
+  private static final Map<Class<?>, Method> ourPrimaryKeyMethods = new HashMap<Class<?>, Method>();
 
   public class MergingInvocationHandler<T> implements InvocationHandler {
     private final Class<? super T> myClass;
@@ -262,6 +283,7 @@
       throw new AssertionError("impossible");
     }
 
+    @Override
     public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable {
       try {
         return findStrategy(proxy, method).invokeMethod(getJavaMethod(method), proxy, args, myImplementations);
@@ -300,7 +322,7 @@
   }
 
   @Nullable
-  private static Method getPrimaryKeyMethod(final Class<? extends Object> aClass) {
+  private static Method getPrimaryKeyMethod(final Class<?> aClass) {
     Method method = ourPrimaryKeyMethods.get(aClass);
     if (method == null) {
       if (ourPrimaryKeyMethods.containsKey(aClass)) return null;
@@ -332,6 +354,7 @@
     if (returnType.isInterface()) {
       final List<Object> orderedPrimaryKeys = new SmartList<Object>();
       final FactoryMap<Object, List<Set<Object>>> map = new FactoryMap<Object, List<Set<Object>>>() {
+        @Override
         @NotNull
         protected List<Set<Object>> create(final Object key) {
           orderedPrimaryKeys.add(key);
@@ -339,6 +362,7 @@
         }
       };
       final FactoryMap<Object, int[]> counts = new FactoryMap<Object, int[]>() {
+        @Override
         @NotNull
         protected int[] create(final Object key) {
           return new int[implementations.size()];
@@ -402,7 +426,7 @@
                             final int index,
                             final List<Object> results,
                             final boolean singleValuedInvocation,
-                            final boolean intersect) throws IllegalAccessException, InvocationTargetException {
+                            final boolean intersect) {
     final Object primaryKey = getPrimaryKey(o, singleValuedInvocation);
     if (primaryKey != null || singleValuedInvocation) {
       final List<Set<Object>> list = map.get(primaryKey);
diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomCollectionProblemDescriptorImpl.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomCollectionProblemDescriptorImpl.java
index e6ea34f..9cdfb7f 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomCollectionProblemDescriptorImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomCollectionProblemDescriptorImpl.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.
@@ -47,6 +47,7 @@
     return super.toString() + "; " + myChildDescription;
   }
 
+  @Override
   public DomCollectionChildDescription getChildDescription() {
     return myChildDescription;
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementAnnotationHolderImpl.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementAnnotationHolderImpl.java
index 55b140a..4673dfc 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementAnnotationHolderImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementAnnotationHolderImpl.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.
@@ -49,11 +49,13 @@
     return myOnTheFly;
   }
 
+  @Override
   @NotNull
   public DomElementProblemDescriptor createProblem(@NotNull DomElement domElement, @Nullable String message, LocalQuickFix... fixes) {
     return createProblem(domElement, HighlightSeverity.ERROR, message, fixes);
   }
 
+  @Override
   @NotNull
   public DomElementProblemDescriptor createProblem(@NotNull DomElement domElement,
                                                    DomCollectionChildDescription childDescription,
@@ -61,11 +63,13 @@
     return addProblem(new DomCollectionProblemDescriptorImpl(domElement, message, HighlightSeverity.ERROR, childDescription));
   }
 
+  @Override
   @NotNull
   public final DomElementProblemDescriptor createProblem(@NotNull DomElement domElement, HighlightSeverity highlightType, String message) {
     return createProblem(domElement, highlightType, message, LocalQuickFix.EMPTY_ARRAY);
   }
 
+  @Override
   public DomElementProblemDescriptor createProblem(@NotNull final DomElement domElement,
                                                    final HighlightSeverity highlightType,
                                                    final String message,
@@ -73,6 +77,7 @@
     return createProblem(domElement, highlightType, message, null, fixes);
   }
 
+  @Override
   public DomElementProblemDescriptor createProblem(@NotNull final DomElement domElement,
                                                    final HighlightSeverity highlightType,
                                                    final String message,
@@ -81,6 +86,7 @@
     return addProblem(new DomElementProblemDescriptorImpl(domElement, message, highlightType, textRange, null, fixes));
   }
 
+  @Override
   public DomElementProblemDescriptor createProblem(@NotNull DomElement domElement,
                                                    ProblemHighlightType highlightType,
                                                    String message,
@@ -89,11 +95,13 @@
     return addProblem(new DomElementProblemDescriptorImpl(domElement, message, HighlightSeverity.ERROR, textRange, highlightType, fixes));
   }
 
+  @Override
   @NotNull
   public DomElementResolveProblemDescriptor createResolveProblem(@NotNull GenericDomValue element, @NotNull PsiReference reference) {
     return addProblem(new DomElementResolveProblemDescriptorImpl(element, reference, getQuickFixes(element, reference)));
   }
 
+  @Override
   @NotNull
   public Annotation createAnnotation(@NotNull DomElement element, HighlightSeverity severity, @Nullable String message) {
     final XmlElement xmlElement = element.getXmlElement();
@@ -110,6 +118,7 @@
     return myAnnotations;
   }
 
+  @Override
   public int getSize() {
     return size();
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementProblemDescriptorImpl.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementProblemDescriptorImpl.java
index 9cc9ec9..37c52ee 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementProblemDescriptorImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementProblemDescriptorImpl.java
@@ -92,26 +92,31 @@
     myHighlightType = highlightType;
   }
 
+  @Override
   @NotNull
   public DomElement getDomElement() {
     return myDomElement;
   }
 
+  @Override
   @NotNull
   public HighlightSeverity getHighlightSeverity() {
     return mySeverity;
   }
 
+  @Override
   @NotNull
   public String getDescriptionTemplate() {
     return myMessage == null ? "" : myMessage;
   }
 
+  @Override
   @NotNull
   public LocalQuickFix[] getFixes() {
     return myFixes;
   }
 
+  @Override
   @NotNull
   public final List<Annotation> getAnnotations() {
     if (myAnnotations == null) {
@@ -120,6 +125,7 @@
     return myAnnotations;
   }
 
+  @Override
   public void highlightWholeElement() {
     final PsiElement psiElement = getPsiElement();
     if (psiElement instanceof XmlAttributeValue) {
@@ -230,6 +236,7 @@
     return null;
   }
 
+  @Override
   @Nullable
   public ProblemHighlightType getHighlightType() {
     return myHighlightType;
diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptorImpl.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptorImpl.java
index cf61ef3..e9b436e 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptorImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptorImpl.java
@@ -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.
@@ -40,16 +40,19 @@
      myReference = reference;
   }
 
+  @Override
   @NotNull
   public PsiReference getPsiReference() {
     return myReference;
   }
 
+  @Override
   @NotNull
   public GenericDomValue getDomElement() {
     return (GenericDomValue)super.getDomElement();
   }
 
+  @Override
   @NotNull
   protected Pair<TextRange, PsiElement> computeProblemRange() {
     final PsiReference reference = myReference;
diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsErrorPanel.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsErrorPanel.java
index 9a40ed5..b4a3502 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsErrorPanel.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsErrorPanel.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.
@@ -68,12 +68,14 @@
 
     addUpdateRequest();
     domManager.addDomEventListener(new DomChangeAdapter() {
+      @Override
       protected void elementChanged(DomElement element) {
         addUpdateRequest();
       }
     }, this);
   }
 
+  @Override
   public void updateHighlighting() {
     updatePanel();
   }
@@ -105,8 +107,10 @@
   private void addUpdateRequest() {
     ApplicationManager.getApplication().invokeLater(new Runnable() {
 
+      @Override
       public void run() {
         myAlarm.addRequest(new Runnable() {
+          @Override
           public void run() {
             if (myProject.isOpen() && !myProject.isDisposed()) {
               updatePanel();
@@ -117,23 +121,28 @@
     });
   }
 
+  @Override
   protected void paintComponent(Graphics g) {
     super.paintComponent(g);
 
     myErrorStripeRenderer.paint(this, g, new Rectangle(0, 0, getWidth(), getHeight()));
   }
 
+  @Override
   public void dispose() {
     myAlarm.cancelAllRequests();
   }
 
+  @Override
   public JComponent getComponent() {
     return this;
   }
 
+  @Override
   public void commit() {
   }
 
+  @Override
   public void reset() {
     updatePanel();
   }
@@ -149,6 +158,7 @@
             PsiDocumentManager.getInstance(xmlFile.getProject()).getDocument(xmlFile), xmlFile);
     }
 
+    @Override
     protected DaemonCodeAnalyzerStatus getDaemonCodeAnalyzerStatus(boolean fillErrorsCount, SeverityRegistrar severityRegistrar) {
       final DaemonCodeAnalyzerStatus status = super.getDaemonCodeAnalyzerStatus(fillErrorsCount, severityRegistrar);
       if (status != null && isInspectionCompleted()) {
@@ -179,6 +189,7 @@
 
     protected boolean isInspectionCompleted() {
       return ContainerUtil.and(myDomElements, new Condition<DomElement>() {
+        @Override
         public boolean value(final DomElement element) {
           return myAnnotationsManager.getHighlightStatus(element) == DomHighlightStatus.INSPECTIONS_FINISHED;
         }
@@ -187,6 +198,7 @@
 
     protected boolean isErrorAnalyzingFinished() {
       return ContainerUtil.and(myDomElements, new Condition<DomElement>() {
+        @Override
         public boolean value(final DomElement element) {
           return myAnnotationsManager.getHighlightStatus(element).compareTo(DomHighlightStatus.ANNOTATORS_FINISHED) >= 0;
         }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsHighlightingUtil.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsHighlightingUtil.java
index 06cfcd3..6fb09e1 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsHighlightingUtil.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsHighlightingUtil.java
@@ -43,6 +43,7 @@
   public static ProblemDescriptor createProblemDescriptors(final InspectionManager manager, final DomElementProblemDescriptor problemDescriptor) {
     final ProblemHighlightType type = getProblemHighlightType(problemDescriptor);
     return createProblemDescriptors(problemDescriptor, new Function<Pair<TextRange, PsiElement>, ProblemDescriptor>() {
+      @Override
       public ProblemDescriptor fun(final Pair<TextRange, PsiElement> s) {
         return manager
           .createProblemDescriptor(s.second, s.first, problemDescriptor.getDescriptionTemplate(), type, true, problemDescriptor.getFixes());
@@ -68,6 +69,7 @@
   public static Annotation createAnnotation(final DomElementProblemDescriptor problemDescriptor) {
 
     return createProblemDescriptors(problemDescriptor, new Function<Pair<TextRange, PsiElement>, Annotation>() {
+      @Override
       public Annotation fun(final Pair<TextRange, PsiElement> s) {
         String text = problemDescriptor.getDescriptionTemplate();
         if (StringUtil.isEmpty(text)) text = null;
diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsProblemsHolderImpl.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsProblemsHolderImpl.java
index a9f70bc..02d494e 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsProblemsHolderImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsProblemsHolderImpl.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.
@@ -45,6 +45,7 @@
 
   private final Function<DomElement, List<DomElementProblemDescriptor>> myDomProblemsGetter =
     new Function<DomElement, List<DomElementProblemDescriptor>>() {
+      @Override
       public List<DomElementProblemDescriptor> fun(final DomElement s) {
         final Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> map = myCachedErrors.get(s);
         return map != null ? ContainerUtil.concat(map.values()) : Collections.<DomElementProblemDescriptor>emptyList();
@@ -54,11 +55,13 @@
   private final DomFileElement myElement;
 
   private static final Factory<Map<Class<? extends DomElementsInspection>,List<DomElementProblemDescriptor>>> CONCURRENT_HASH_MAP_FACTORY = new Factory<Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>>>() {
+    @Override
     public Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> create() {
       return new ConcurrentHashMap<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>>();
     }
   };
   private static final Factory<List<DomElementProblemDescriptor>> SMART_LIST_FACTORY = new Factory<List<DomElementProblemDescriptor>>() {
+    @Override
     public List<DomElementProblemDescriptor> create() {
       return new SmartList<DomElementProblemDescriptor>();
     }
@@ -79,6 +82,7 @@
     myPassedInspections.add(inspectionClass);
   }
 
+  @Override
   public final boolean isInspectionCompleted(@NotNull final DomElementsInspection inspection) {
     return isInspectionCompleted(inspection.getClass());
   }
@@ -99,16 +103,19 @@
     myCachedChildrenErrors.clear();
   }
 
+  @Override
   @NotNull
   public synchronized List<DomElementProblemDescriptor> getProblems(DomElement domElement) {
     if (domElement == null || !domElement.isValid()) return Collections.emptyList();
     return myDomProblemsGetter.fun(domElement);
   }
 
+  @Override
   public List<DomElementProblemDescriptor> getProblems(final DomElement domElement, boolean includeXmlProblems) {
     return getProblems(domElement);
   }
 
+  @Override
   public List<DomElementProblemDescriptor> getProblems(final DomElement domElement,
                                                        final boolean includeXmlProblems,
                                                        final boolean withChildren) {
@@ -119,6 +126,7 @@
     return ContainerUtil.concat(getProblemsMap(domElement).values());
   }
 
+  @Override
   public List<DomElementProblemDescriptor> getProblems(DomElement domElement,
                                                        final boolean includeXmlProblems,
                                                        final boolean withChildren,
@@ -126,8 +134,10 @@
     return getProblems(domElement, withChildren, minSeverity);
   }
 
+  @Override
   public List<DomElementProblemDescriptor> getProblems(final DomElement domElement, final boolean withChildren, final HighlightSeverity minSeverity) {
     return ContainerUtil.findAll(getProblems(domElement, true, withChildren), new Condition<DomElementProblemDescriptor>() {
+      @Override
       public boolean value(final DomElementProblemDescriptor object) {
         return SeverityRegistrar.getSeverityRegistrar(domElement.getManager().getProject()).compare(object.getHighlightSeverity(), minSeverity) >= 0;
       }
@@ -151,6 +161,7 @@
       mergeMaps(problems, myCachedErrors.get(domElement));
       if (DomUtil.hasXml(domElement)) {
         domElement.acceptChildren(new DomElementVisitor() {
+          @Override
           public void visitDomElement(DomElement element) {
             mergeMaps(problems, getProblemsMap(element));
           }
@@ -169,10 +180,12 @@
     }
   }
 
+  @Override
   public List<DomElementProblemDescriptor> getAllProblems() {
     return getProblems(myElement, false, true);
   }
 
+  @Override
   public List<DomElementProblemDescriptor> getAllProblems(@NotNull DomElementsInspection inspection) {
     if (!myElement.isValid()) {
       return Collections.emptyList();
diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomHighlightingHelperImpl.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomHighlightingHelperImpl.java
index 3330f90..b9f49b2 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomHighlightingHelperImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomHighlightingHelperImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -56,6 +56,7 @@
   private final GenericValueReferenceProvider myProvider = new GenericValueReferenceProvider();
   private final DomApplicationComponent myDomApplicationComponent = DomApplicationComponent.getInstance();
 
+  @Override
   public void runAnnotators(DomElement element, DomElementAnnotationHolder holder, Class<? extends DomElement> rootClass) {
     final DomElementsAnnotator annotator = myDomApplicationComponent.getAnnotator(rootClass);
     if (annotator != null) {
@@ -63,6 +64,7 @@
     }
   }
 
+  @Override
   @NotNull
   public List<DomElementProblemDescriptor> checkRequired(final DomElement element, final DomElementAnnotationHolder holder) {
     final Required required = element.getAnnotation(Required.class);
@@ -105,6 +107,7 @@
     return Collections.emptyList();
   }
 
+  @Override
   @NotNull
   public List<DomElementProblemDescriptor> checkResolveProblems(GenericDomValue element, final DomElementAnnotationHolder holder) {
     if (StringUtil.isEmpty(element.getStringValue())) {
@@ -156,6 +159,7 @@
            converter instanceof ResolvingConverter && ((ResolvingConverter)converter).getAdditionalVariants(domReference.getConvertContext()).contains(element.getStringValue());
   }
 
+  @Override
   @NotNull
   public List<DomElementProblemDescriptor> checkNameIdentity(DomElement element, final DomElementAnnotationHolder holder) {
     final String elementName = ElementPresentationManager.getElementName(element);
@@ -243,33 +247,40 @@
       parentTag = _parentTag;
     }
 
+    @Override
     @NotNull
     public String getName() {
       return XmlBundle.message("insert.required.tag.fix", tagName);
     }
 
+    @Override
     @NotNull
     public String getText() {
       return getName();
     }
 
+    @Override
     @NotNull
     public String getFamilyName() {
       return getName();
     }
 
+    @Override
     public boolean isAvailable(@NotNull final Project project, final Editor editor, final PsiFile file) {
       return true;
     }
 
+    @Override
     public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
       doFix();
     }
 
+    @Override
     public boolean startInWriteAction() {
       return true;
     }
 
+    @Override
     public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
       doFix();
     }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/MockAnnotatingDomInspection.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/MockAnnotatingDomInspection.java
index 0f98632..32d42f2 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/MockAnnotatingDomInspection.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/MockAnnotatingDomInspection.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.
@@ -29,24 +29,28 @@
     super(domClass);
   }
 
+  @Override
   protected void checkDomElement(DomElement element, DomElementAnnotationHolder holder, DomHighlightingHelper helper) {
     for (final Class aClass : getDomClasses()) {
       helper.runAnnotators(element, holder, aClass);
     }
   }
 
+  @Override
   @Nls
   @NotNull
   public String getGroupDisplayName() {
     throw new UnsupportedOperationException("Method getGroupDisplayName is not yet implemented in " + getClass().getName());
   }
 
+  @Override
   @Nls
   @NotNull
   public String getDisplayName() {
     throw new UnsupportedOperationException("Method getDisplayName is not yet implemented in " + getClass().getName());
   }
 
+  @Override
   @NonNls
   @NotNull
   public String getShortName() {
diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/MockDomInspection.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/MockDomInspection.java
index 8546092..3bd26c4 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/MockDomInspection.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/MockDomInspection.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.
@@ -29,18 +29,21 @@
     super(domClass);
   }
 
+  @Override
   @Nls
   @NotNull
   public String getGroupDisplayName() {
     throw new UnsupportedOperationException("Method getGroupDisplayName is not yet implemented in " + getClass().getName());
   }
 
+  @Override
   @Nls
   @NotNull
   public String getDisplayName() {
     throw new UnsupportedOperationException("Method getDisplayName is not yet implemented in " + getClass().getName());
   }
 
+  @Override
   @NonNls
   @NotNull
   public String getShortName() {
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/AbstractDomChildDescriptionImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/AbstractDomChildDescriptionImpl.java
index 20a9702..9a9dc53 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/AbstractDomChildDescriptionImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/AbstractDomChildDescriptionImpl.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,7 +24,6 @@
 import com.intellij.pom.references.PomService;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.SmartPsiElementPointer;
-import com.intellij.util.xml.Stubbed;
 import com.intellij.util.ReflectionUtil;
 import com.intellij.util.xml.*;
 import com.intellij.util.xml.reflect.AbstractDomChildrenDescription;
@@ -100,15 +99,18 @@
     myUserMap = userMap;
   }
 
+  @Override
   @Nullable
   public <T extends Annotation> T getAnnotation(final Class<T> annotationClass) {
     return myCustomAnnotations == null ? null : (T)myCustomAnnotations.get(annotationClass);
   }
 
+  @Override
   public <T> T getUserData(final Key<T> key) {
     return myUserMap == null ? null : (T)myUserMap.get(key);
   }
 
+  @Override
   @NotNull
   public final List<? extends DomElement> getStableValues(@NotNull final DomElement parent) {
     final List<? extends DomElement> list = getValues(parent);
@@ -117,6 +119,7 @@
     for (int i = 0; i < list.size(); i++) {
       final int i1 = i;
       result.add(domManager.createStableValue(new Factory<DomElement>() {
+        @Override
         @Nullable
         public DomElement create() {
           if (!parent.isValid()) return null;
@@ -130,11 +133,13 @@
   }
 
 
+  @Override
   @NotNull
   public final Type getType() {
     return myType;
   }
 
+  @Override
   @NotNull
   public DomNameStrategy getDomNameStrategy(@NotNull DomElement parent) {
     final DomNameStrategy strategy = DomImplUtil.getDomNameStrategy(ReflectionUtil.getRawType(getType()), false);
@@ -166,6 +171,7 @@
     return myPresentationTemplate.getValue();
   }
 
+  @Override
   @Nullable
   public PsiElement getDeclaration(final Project project) {
     DomElement domDeclaration = getDomDeclaration();
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/AddChildInvocation.java b/xml/dom-impl/src/com/intellij/util/xml/impl/AddChildInvocation.java
index 2bca8dd..c7cbd2c 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/AddChildInvocation.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/AddChildInvocation.java
@@ -38,6 +38,7 @@
     myType = type;
   }
 
+  @Override
   public Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
     return handler.addCollectionChild(myDescription, myClassGetter.fun(args), myIndexGetter.fun(args));
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/AddToCompositeCollectionInvocation.java b/xml/dom-impl/src/com/intellij/util/xml/impl/AddToCompositeCollectionInvocation.java
index da04e8e..0f8af9b 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/AddToCompositeCollectionInvocation.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/AddToCompositeCollectionInvocation.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.
@@ -36,6 +36,7 @@
     myType = type;
   }
 
+  @Override
   public Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
     Set<XmlTag> set = ContainerUtil.newTroveSet();
     for (final CollectionChildDescriptionImpl qname : myQnames) {
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/AttributeChildDescriptionImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/AttributeChildDescriptionImpl.java
index 076ab28..945af22 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/AttributeChildDescriptionImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/AttributeChildDescriptionImpl.java
@@ -43,6 +43,7 @@
     myGetterMethod = null;
   }
 
+  @Override
   @NotNull
   public DomNameStrategy getDomNameStrategy(@NotNull DomElement parent) {
     final DomNameStrategy strategy = DomImplUtil.getDomNameStrategy(ReflectionUtil.getRawType(getType()), true);
@@ -50,6 +51,7 @@
   }
 
 
+  @Override
   public final JavaMethod getGetterMethod() {
     return myGetterMethod;
   }
@@ -59,22 +61,26 @@
     return "Attribute:" + getXmlName();
   }
 
+  @Override
   @Nullable
   public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
     final JavaMethod method = getGetterMethod();
     return method == null ? super.getAnnotation(annotationClass) : method.getAnnotation(annotationClass);
   }
 
+  @Override
   @NotNull
   public List<? extends DomElement> getValues(@NotNull DomElement parent) {
     return Arrays.asList(getDomAttributeValue(parent));
   }
 
+  @Override
   @NotNull
   public String getCommonPresentableName(@NotNull DomNameStrategy strategy) {
     throw new UnsupportedOperationException("Method getCommonPresentableName is not yet implemented in " + getClass().getName());
   }
 
+  @Override
   public GenericAttributeValue getDomAttributeValue(DomElement parent) {
     final DomInvocationHandler handler = DomManagerImpl.getDomInvocationHandler(parent);
     if (handler != null) {
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/AttributeChildInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/AttributeChildInvocationHandler.java
index 4209949..c98e931 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/AttributeChildInvocationHandler.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/AttributeChildInvocationHandler.java
@@ -48,17 +48,21 @@
     super(description.getType(), strategy, attributeName, description, manager, false, stub);
   }
 
+  @Override
   public void acceptChildren(DomElementVisitor visitor) {
   }
 
+  @Override
   protected final XmlTag setEmptyXmlTag() {
     return ensureTagExists();
   }
 
+  @Override
   protected boolean isAttribute() {
     return true;
   }
 
+  @Override
   protected XmlElement recomputeXmlElement(@NotNull final DomInvocationHandler parent) {
     if (!parent.isValid()) return null;
 
@@ -80,6 +84,7 @@
     return tag.getNamespace().equals(ns) ? null : ns;
   }
 
+  @Override
   public final XmlAttribute ensureXmlElementExists() {
     XmlAttribute attribute = (XmlAttribute)getXmlElement();
     if (attribute != null) return attribute;
@@ -103,19 +108,23 @@
     }
   }
 
+  @Override
   public <T extends DomElement> T createStableCopy() {
     final DomElement parentCopy = getParent().createStableCopy();
     return getManager().createStableValue(new Factory<T>() {
+      @Override
       public T create() {
         return parentCopy.isValid() ? (T) getChildDescription().getValues(parentCopy).get(0) : null;
       }
     });
   }
 
+  @Override
   public final void undefineInternal() {
     final XmlTag tag = getXmlTag();
     if (tag != null) {
       getManager().runChange(new Runnable() {
+        @Override
         public void run() {
           try {
             setXmlElement(null);
@@ -130,18 +139,21 @@
     }
   }
 
+  @Override
   @Nullable
   public final XmlTag getXmlTag() {
     final DomInvocationHandler handler = getParentHandler();
     return handler == null ? null : handler.getXmlTag();
   }
 
+  @Override
   public final XmlTag ensureTagExists() {
     final DomInvocationHandler parent = getParentHandler();
     assert parent != null : "write operations should be performed on the DOM having a parent, your DOM may be not very fresh";
     return parent.ensureTagExists();
   }
 
+  @Override
   @Nullable
   protected String getValue() {
     if (myStub != null) {
@@ -157,10 +169,12 @@
     return null;
   }
 
+  @Override
   public void copyFrom(final DomElement other) {
     setValue(((GenericAttributeValue) other).getStringValue());
   }
 
+  @Override
   protected void setValue(@Nullable final String value) {
     final XmlTag tag = ensureTagExists();
     final String attributeName = getXmlElementName();
@@ -170,6 +184,7 @@
     if (Comparing.equal(oldValue, newValue, true)) return;
 
     getManager().runChange(new Runnable() {
+      @Override
       public void run() {
         try {
           XmlAttribute attribute = tag.setAttribute(attributeName, namespace, newValue);
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/CollectionChildDescriptionImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/CollectionChildDescriptionImpl.java
index 98d3e67..b9f9871 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/CollectionChildDescriptionImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/CollectionChildDescriptionImpl.java
@@ -41,6 +41,7 @@
 public class CollectionChildDescriptionImpl extends DomChildDescriptionImpl implements DomCollectionChildDescription, AbstractCollectionChildDescription {
   private final Collection<JavaMethod> myGetterMethods;
   private final NotNullFunction<DomInvocationHandler, List<XmlTag>> myTagsGetter = new NotNullFunction<DomInvocationHandler, List<XmlTag>>() {
+    @Override
     @NotNull
     public List<XmlTag> fun(final DomInvocationHandler handler) {
       XmlTag tag = handler.getXmlTag();
@@ -65,6 +66,7 @@
     return myTagsGetter;
   }
 
+  @Override
   public DomElement addValue(@NotNull DomElement element) {
     assert element.getGenericInfo().getCollectionChildrenDescriptions().contains(this);
     return addChild(element, getType(), Integer.MAX_VALUE);
@@ -81,24 +83,29 @@
     }
   }
 
+  @Override
   public DomElement addValue(@NotNull DomElement element, int index) {
     return addChild(element, getType(), index);
   }
 
+  @Override
   public DomElement addValue(@NotNull DomElement parent, Type type) {
     return addValue(parent, type, Integer.MAX_VALUE);
   }
 
+  @Override
   public final DomElement addValue(@NotNull DomElement parent, Type type, int index) {
     return addChild(parent, type, index);
   }
 
+  @Override
   @Nullable
   public final JavaMethod getGetterMethod() {
     final Collection<JavaMethod> methods = myGetterMethods;
     return methods.isEmpty() ? null : methods.iterator().next();
   }
 
+  @Override
   @NotNull
   public List<? extends DomElement> getValues(@NotNull final DomElement element) {
     final DomInvocationHandler handler = DomManagerImpl.getDomInvocationHandler(element);
@@ -109,6 +116,7 @@
     if (getterMethod == null) {
       final Collection<DomElement> collection = ModelMergerUtil.getFilteredImplementations(element);
       return ContainerUtil.concat(collection, new Function<DomElement, Collection<? extends DomElement>>() {
+        @Override
         public Collection<? extends DomElement> fun(final DomElement domElement) {
           final DomInvocationHandler handler = DomManagerImpl.getDomInvocationHandler(domElement);
           assert handler != null : domElement;
@@ -119,12 +127,14 @@
     return (List<? extends DomElement>)getterMethod.invoke(element, ArrayUtil.EMPTY_OBJECT_ARRAY);
   }
 
+  @Override
   @NotNull
   public String getCommonPresentableName(@NotNull DomNameStrategy strategy) {
     String words = strategy.splitIntoWords(getXmlElementName());
     return StringUtil.capitalizeWords(words.endsWith("es") ? words: StringUtil.pluralize(words), true);
   }
 
+  @Override
   @Nullable
   public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
     final JavaMethod method = getGetterMethod();
@@ -137,10 +147,12 @@
     return elemType instanceof AnnotatedElement ? ((AnnotatedElement)elemType).getAnnotation(annotationClass) : super.getAnnotation(annotationClass);
   }
 
+  @Override
   public List<XmlTag> getSubTags(final DomInvocationHandler handler, final XmlTag[] subTags, final XmlFile file) {
     return DomImplUtil.findSubTags(subTags, handler.createEvaluatedXmlName(getXmlName()), file);
   }
 
+  @Override
   public EvaluatedXmlName createEvaluatedXmlName(final DomInvocationHandler parent, final XmlTag childTag) {
     return parent.createEvaluatedXmlName(getXmlName());
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/CollectionElementInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/CollectionElementInvocationHandler.java
index 7e294bd..e30246e 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/CollectionElementInvocationHandler.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/CollectionElementInvocationHandler.java
@@ -50,10 +50,12 @@
 
   }
 
+  @Override
   protected Type narrowType(@NotNull final Type nominalType) {
     return getStub() == null ? getManager().getTypeChooserManager().getTypeChooser(nominalType).chooseType(getXmlTag()) : nominalType;
   }
 
+  @Override
   protected final XmlTag setEmptyXmlTag() {
     throw new UnsupportedOperationException("CollectionElementInvocationHandler.setXmlTag() shouldn't be called;" +
                                             "\nparent=" + getParent() + ";\n" +
@@ -74,6 +76,7 @@
     return null;
   }
 
+  @Override
   public final void undefineInternal() {
     final DomElement parent = getParent();
     final XmlTag tag = getXmlTag();
@@ -85,6 +88,7 @@
     getManager().fireEvent(new DomEvent(parent, false));
   }
 
+  @Override
   public DomElement createPathStableCopy() {
     final AbstractDomChildDescriptionImpl description = getChildDescription();
     final DomElement parent = getParent();
@@ -92,6 +96,7 @@
     final DomElement parentCopy = parent.createStableCopy();
     final int index = description.getValues(parent).indexOf(getProxy());
     return getManager().createStableValue(new Factory<DomElement>() {
+      @Override
       @Nullable
       public DomElement create() {
         if (parentCopy.isValid()) {
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertAnnotationImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertAnnotationImpl.java
index 2fcb9eb..cd53662 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertAnnotationImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertAnnotationImpl.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.
@@ -32,6 +32,7 @@
     mySoft = soft;
   }
 
+  @Override
   public Class<? extends Annotation> annotationType() {
     return Convert.class;
   }
@@ -40,10 +41,12 @@
     return myConverter;
   }
 
+  @Override
   public Class<? extends Converter> value() {
     return myConverter.getClass();
   }
 
+  @Override
   public boolean soft() {
     return mySoft;
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertContextFactory.java b/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertContextFactory.java
index 00035b8..07d8a03 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertContextFactory.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertContextFactory.java
@@ -21,6 +21,7 @@
 public class ConvertContextFactory {
    public static ConvertContext createConvertContext(final DomElement element) {
       return new ConvertContextImpl(DomManagerImpl.getDomInvocationHandler(element)) {
+        @Override
         public DomElement getInvocationElement() {
            return element;
         }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertContextImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertContextImpl.java
index 6478ba4..8c21795 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertContextImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertContextImpl.java
@@ -35,15 +35,18 @@
     this(DomManagerImpl.getDomInvocationHandler(element));
   }
 
+  @Override
   @NotNull
   public DomElement getInvocationElement() {
     return myHandler.getProxy();
   }
 
+  @Override
   public PsiManager getPsiManager() {
     return myHandler.getFile().getManager();
   }
 
+  @Override
   public Module getModule() {
     final DomElement domElement = getInvocationElement();
     if (domElement.getManager().isMockElement(domElement)) {
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/ConverterManagerImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/ConverterManagerImpl.java
index 199ec26..ef2bfc4 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/ConverterManagerImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/ConverterManagerImpl.java
@@ -52,10 +52,12 @@
     mySimpleConverters.put(PathReference.class, PathReferenceConverter.INSTANCE);
   }
 
+  @Override
   public void addConverter(Class clazz, Converter converter) {
     mySimpleConverters.put(clazz, converter);
   }
 
+  @Override
   @NotNull
   public final Converter getConverterInstance(final Class<? extends Converter> converterClass) {
     Converter converter = getInstance(converterClass);
@@ -67,6 +69,7 @@
     return (T)myConverterInstances.get(clazz);
   }
 
+  @Override
   @Nullable
   public final Converter getConverterByClass(final Class<?> convertingClass) {
     final Converter converter = mySimpleConverters.get(convertingClass);
@@ -83,6 +86,7 @@
     return null;
   }
 
+  @Override
   public <T extends Converter> void registerConverterImplementation(Class<T> converterInterface, T converterImpl) {
     myConverterInstances.put(converterInterface, converterImpl);
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/CustomDomChildrenDescriptionImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/CustomDomChildrenDescriptionImpl.java
index b99eda0..b0e5d8a 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/CustomDomChildrenDescriptionImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/CustomDomChildrenDescriptionImpl.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.
@@ -35,6 +35,7 @@
 public class CustomDomChildrenDescriptionImpl extends AbstractDomChildDescriptionImpl implements CustomDomChildrenDescription, AbstractCollectionChildDescription {
   @Nullable private final JavaMethod myGetter;
   public static final NotNullFunction<DomInvocationHandler,List<XmlTag>> CUSTOM_TAGS_GETTER = new NotNullFunction<DomInvocationHandler, List<XmlTag>>() {
+    @Override
     @NotNull
     public List<XmlTag> fun(final DomInvocationHandler handler) {
       return DomImplUtil.getCustomSubTags(handler, handler.getXmlTag().getSubTags(), handler.getFile());
@@ -75,6 +76,7 @@
     return parent.getCollectionChildren(this, CUSTOM_TAGS_GETTER);
   }
 
+  @Override
   @NotNull
   public List<? extends DomElement> getValues(@NotNull final DomElement parent) {
     final DomInvocationHandler handler = DomManagerImpl.getDomInvocationHandler(parent);
@@ -84,14 +86,17 @@
     return (List<? extends DomElement>)myGetter.invoke(parent, ArrayUtil.EMPTY_OBJECT_ARRAY);
   }
 
+  @Override
   public int compareTo(final AbstractDomChildDescriptionImpl o) {
     return equals(o) ? 0 : -1;
   }
 
+  @Override
   public List<XmlTag> getSubTags(final DomInvocationHandler handler, final XmlTag[] subTags, final XmlFile file) {
     return DomImplUtil.getCustomSubTags(handler, subTags, file);
   }
 
+  @Override
   public EvaluatedXmlName createEvaluatedXmlName(final DomInvocationHandler parent, final XmlTag childTag) {
     return new DummyEvaluatedXmlName(childTag.getLocalName(), childTag.getNamespace());
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomAnnotator.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomAnnotator.java
index 3b52e14..cff0b24 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomAnnotator.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomAnnotator.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.
@@ -63,6 +63,7 @@
   }
 
 
+  @Override
   public void annotate(@NotNull final PsiElement psiElement, @NotNull AnnotationHolder holder) {
     final List<Annotation> list = (List<Annotation>)holder;
 
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomTargetDescriptionProvider.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomTargetDescriptionProvider.java
index dd016e7..a31aaea 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomTargetDescriptionProvider.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomTargetDescriptionProvider.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.
@@ -30,6 +30,7 @@
  * @author peter
  */
 public class DefaultDomTargetDescriptionProvider extends PomDescriptionProvider {
+  @Override
   public String getElementDescription(@NotNull PomTarget element, @NotNull ElementDescriptionLocation location) {
     if (!(element instanceof DomTarget)) return null;
 
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomTargetIconProvider.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomTargetIconProvider.java
index e5540c1..6add1e8 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomTargetIconProvider.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomTargetIconProvider.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.
@@ -27,6 +27,7 @@
  * @author peter
  */
 public class DefaultDomTargetIconProvider extends DomIconProvider implements DumbAware {
+  @Override
   public Icon getIcon(@NotNull DomElement element, int flags) {
     Icon icon = element.getPresentation().getIcon();
     return icon == null ? ElementPresentationManager.getIconOld(element) : icon;
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java
index c935525..94a3584 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java
@@ -140,9 +140,11 @@
     return t == null ? null : t.getXmlElement();
   }
 
+  @Override
   @Nullable
   public abstract T retrieveDomElement();
 
+  @Override
   @NotNull
   public abstract XmlFile getContainingFile();
 
@@ -184,6 +186,7 @@
       return result;
     }
 
+    @Override
     public T retrieveDomElement() {
       final DomElement parent = myParent.retrieveDomElement();
       if (parent == null) return null;
@@ -203,6 +206,7 @@
       return null;
     }
 
+    @Override
     @NotNull
     public XmlFile getContainingFile() {
       return myParent.getContainingFile();
@@ -243,6 +247,7 @@
       return result;
     }
 
+    @Override
     public T retrieveDomElement() {
       final DomElement parent = myParent.retrieveDomElement();
       if (parent == null) return null;
@@ -254,6 +259,7 @@
       return (T)list.get(myIndex);
     }
 
+    @Override
     @NotNull
     public XmlFile getContainingFile() {
       return myParent.getContainingFile();
@@ -290,11 +296,13 @@
       return result;
     }
 
+    @Override
     public T retrieveDomElement() {
       final DomFileElement<T> fileElement = DomManager.getDomManager(myFile.getProject()).getFileElement(myFile, myClass);
       return fileElement == null ? null : fileElement.getRootElement();
     }
 
+    @Override
     @NotNull
     public XmlFile getContainingFile() {
       return myFile;
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomApplicationComponent.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomApplicationComponent.java
index c2687fd..061ab6a 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomApplicationComponent.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomApplicationComponent.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.
@@ -43,6 +43,7 @@
  */
 public class DomApplicationComponent {
   private final FactoryMap<String,Set<DomFileDescription>> myRootTagName2FileDescription = new FactoryMap<String, Set<DomFileDescription>>() {
+    @Override
     protected Set<DomFileDescription> create(final String key) {
       return new THashSet<DomFileDescription>();
     }
@@ -76,6 +77,7 @@
   });
   private final ConcurrentFactoryMap<Class<? extends DomElementVisitor>, VisitorDescription> myVisitorDescriptions =
     new ConcurrentFactoryMap<Class<? extends DomElementVisitor>, VisitorDescription>() {
+      @Override
       @NotNull
       protected VisitorDescription create(final Class<? extends DomElementVisitor> key) {
         return new VisitorDescription(key);
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomChildDescriptionImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomChildDescriptionImpl.java
index 90ce7d2..d53fbd0 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomChildDescriptionImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomChildDescriptionImpl.java
@@ -33,20 +33,24 @@
     myTagName = tagName;
   }
 
+  @Override
   public String getName() {
     return myTagName.getLocalName();
   }
 
+  @Override
   @NotNull
   public String getXmlElementName() {
     return myTagName.getLocalName();
   }
 
+  @Override
   @NotNull
   public final XmlName getXmlName() {
     return myTagName;
   }
 
+  @Override
   @NotNull
   public String getCommonPresentableName(@NotNull DomElement parent) {
     return getCommonPresentableName(getDomNameStrategy(parent));
@@ -69,6 +73,7 @@
     return result;
   }
 
+  @Override
   public int compareTo(final AbstractDomChildDescriptionImpl o) {
     return o instanceof DomChildDescriptionImpl ? myTagName.compareTo(((DomChildDescriptionImpl)o).myTagName) : 1;
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomDeclarationSearcher.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomDeclarationSearcher.java
index 937cec8..2235f7b 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomDeclarationSearcher.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomDeclarationSearcher.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.
@@ -26,6 +26,7 @@
  */
 public class DomDeclarationSearcher extends AbstractDomDeclarationSearcher {
 
+  @Override
   @Nullable
   protected DomTarget createDomTarget(DomElement parent, DomElement nameElement) {
     final NameValue nameValue = nameElement.getAnnotation(NameValue.class);
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomDescriptorProvider.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomDescriptorProvider.java
index 9fe2273..64c797c 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomDescriptorProvider.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomDescriptorProvider.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.
@@ -31,6 +31,7 @@
  */
 public class DomDescriptorProvider implements XmlElementDescriptorProvider {
 
+  @Override
   @Nullable
   public XmlElementDescriptor getDescriptor(final XmlTag tag) {
     Project project = tag.getProject();
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomElementsNavigationManagerImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomElementsNavigationManagerImpl.java
index 6744005..a551133 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomElementsNavigationManagerImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomElementsNavigationManagerImpl.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.
@@ -43,6 +43,7 @@
     myProviders.put(myTextEditorProvider.getProviderName(), myTextEditorProvider);
   }
 
+  @Override
   public Set<DomElementNavigationProvider> getDomElementsNavigateProviders(DomElement domElement) {
     Set<DomElementNavigationProvider> result = new HashSet<DomElementNavigationProvider>();
 
@@ -52,20 +53,24 @@
     return result;
   }
 
+  @Override
   public DomElementNavigationProvider getDomElementsNavigateProvider(String providerName) {
     return myProviders.get(providerName);
   }
 
+  @Override
   public void registerDomElementsNavigateProvider(DomElementNavigationProvider provider) {
     myProviders.put(provider.getProviderName(), provider);
   }
 
   private class MyDomElementNavigateProvider extends DomElementNavigationProvider {
 
+    @Override
     public String getProviderName() {
       return DEFAULT_PROVIDER_NAME;
     }
 
+    @Override
     public void navigate(DomElement domElement, boolean requestFocus) {
       if (!domElement.isValid()) return;
 
@@ -84,6 +89,7 @@
       FileEditorManagerEx.getInstanceEx(myProject).openTextEditor(fileDescriptor, requestFocus);
     }
 
+    @Override
     public boolean canNavigate(DomElement domElement) {
       return domElement != null && domElement.isValid();
     }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomFileElementImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomFileElementImpl.java
index ea02aa8..b1546cb 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomFileElementImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomFileElementImpl.java
@@ -18,6 +18,7 @@
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleUtil;
+import com.intellij.openapi.module.ModuleUtilCore;
 import com.intellij.openapi.util.Factory;
 import com.intellij.openapi.util.Key;
 import com.intellij.psi.search.GlobalSearchScope;
@@ -47,74 +48,89 @@
   private static final Logger LOG = Logger.getInstance("#com.intellij.util.xml.impl.DomFileElementImpl");
   private static final DomGenericInfo EMPTY_DOM_GENERIC_INFO = new DomGenericInfo() {
 
+    @Override
     @Nullable
     public XmlElement getNameElement(DomElement element) {
       return null;
     }
 
+    @Override
     @Nullable
     public GenericDomValue getNameDomElement(DomElement element) {
       return null;
     }
 
+    @Override
     @NotNull
     public List<? extends CustomDomChildrenDescription> getCustomNameChildrenDescription() {
       return Collections.emptyList();
     }
 
+    @Override
     @Nullable
     public String getElementName(DomElement element) {
       return null;
     }
 
+    @Override
     @NotNull
     public List<DomChildrenDescription> getChildrenDescriptions() {
       return Collections.emptyList();
     }
 
+    @Override
     @NotNull
     public List<DomFixedChildDescription> getFixedChildrenDescriptions() {
       return Collections.emptyList();
     }
 
+    @Override
     @NotNull
     public List<DomCollectionChildDescription> getCollectionChildrenDescriptions() {
       return Collections.emptyList();
     }
 
+    @Override
     @NotNull
     public List<DomAttributeChildDescription> getAttributeChildrenDescriptions() {
       return Collections.emptyList();
     }
 
+    @Override
     public boolean isTagValueElement() {
       return false;
     }
 
+    @Override
     @Nullable
     public DomFixedChildDescription getFixedChildDescription(String tagName) {
       return null;
     }
 
+    @Override
     @Nullable
     public DomFixedChildDescription getFixedChildDescription(@NonNls String tagName, @NonNls String namespace) {
       return null;
     }
 
+    @Override
     @Nullable
     public DomCollectionChildDescription getCollectionChildDescription(String tagName) {
       return null;
     }
 
+    @Override
     @Nullable
     public DomCollectionChildDescription getCollectionChildDescription(@NonNls String tagName, @NonNls String namespace) {
       return null;
     }
 
+    @Override
     public DomAttributeChildDescription getAttributeChildDescription(String attributeName) {
       return null;
     }
 
+    @Override
     @Nullable
     public DomAttributeChildDescription getAttributeChildDescription(@NonNls String attributeName, @NonNls String namespace) {
       return null;
@@ -144,16 +160,19 @@
                                                  stub == null ? null : stub.getRootTagStub());
   }
 
+  @Override
   @NotNull
   public final XmlFile getFile() {
     return myFile;
   }
 
+  @Override
   @NotNull
   public XmlFile getOriginalFile() {
     return (XmlFile)myFile.getOriginalFile();
   }
 
+  @Override
   @Nullable
   public XmlTag getRootTag() {
     if (!myFile.isValid()) {
@@ -195,65 +214,80 @@
     return result;
   }
 
+  @Override
   @NotNull
   public final DomManagerImpl getManager() {
     return myManager;
   }
 
+  @Override
   public final Type getDomElementType() {
     return getClass();
   }
 
+  @Override
   @NotNull
   public AbstractDomChildrenDescription getChildDescription() {
     throw new UnsupportedOperationException("Method getChildDescription is not yet implemented in " + getClass().getName());
   }
 
+  @Override
   public DomNameStrategy getNameStrategy() {
     return getRootHandler().getNameStrategy();
   }
 
+  @Override
   @NotNull
   public ElementPresentation getPresentation() {
     return new ElementPresentation() {
 
+      @Override
       public @NonNls String getElementName() {
         return "<ROOT>";
       }
 
+      @Override
       public @NonNls String getTypeName() {
         return "<ROOT>";
       }
 
+      @Override
       public Icon getIcon() {
         return null;
       }
     };
   }
 
+  @Override
   public GlobalSearchScope getResolveScope() {
     return myFile.getResolveScope();
   }
 
+  @Override
   @Nullable
   public <T extends DomElement> T getParentOfType(Class<T> requiredClass, boolean strict) {
     return DomFileElement.class.isAssignableFrom(requiredClass) && !strict ? (T)this : null;
   }
 
+  @Override
   public Module getModule() {
-    return ModuleUtil.findModuleForPsiElement(getFile());
+    return ModuleUtilCore.findModuleForPsiElement(getFile());
   }
 
+  @Override
   public void copyFrom(DomElement other) {
     throw new UnsupportedOperationException("Method copyFrom is not yet implemented in " + getClass().getName());
   }
 
+  @Override
   public final <T extends DomElement> T createMockCopy(final boolean physical) {
     throw new UnsupportedOperationException("Method createMockCopy is not yet implemented in " + getClass().getName());
   }
 
+  @Override
   public final <T extends DomElement> T createStableCopy() {
     return myManager.createStableValue(new Factory<T>() {
+      @Override
       @Nullable
       public T create() {
         return (T)myManager.getFileElement(myFile);
@@ -261,17 +295,20 @@
     });
   }
 
+  @Override
   @NotNull
   public String getXmlElementNamespace() {
     return "";
   }
 
+  @Override
   @Nullable
   @NonNls
   public String getXmlElementNamespaceKey() {
     return null;
   }
 
+  @Override
   @NotNull
   public final T getRootElement() {
     if (!isValid()) {
@@ -291,11 +328,13 @@
     return (T)getRootHandler().getProxy();
   }
 
+  @Override
   @NotNull
   public Class<T> getRootElementClass() {
     return myRootElementClass;
   }
 
+  @Override
   @NotNull
   public DomFileDescription<T> getFileDescription() {
     return myFileDescription;
@@ -310,10 +349,12 @@
     return "File " + myFile.toString();
   }
 
+  @Override
   public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
     return null;
   }
 
+  @Override
   public final XmlTag getXmlTag() {
     return null;
   }
@@ -323,26 +364,32 @@
     return (DomFileElementImpl<T>)this;
   }
 
+  @Override
   @Nullable
   public DomElement getParent() {
     return null;
   }
 
+  @Override
   public final XmlTag ensureTagExists() {
     return null;
   }
 
+  @Override
   public final XmlElement getXmlElement() {
     return getFile();
   }
 
+  @Override
   public final XmlElement ensureXmlElementExists() {
     return ensureTagExists();
   }
 
+  @Override
   public void undefine() {
   }
 
+  @Override
   public final boolean isValid() {
     return checkValidity() == null;
   }
@@ -364,32 +411,39 @@
     return null;
   }
 
+  @Override
   @NotNull
   public final DomGenericInfo getGenericInfo() {
     return EMPTY_DOM_GENERIC_INFO;
   }
 
+  @Override
   @NotNull
   public String getXmlElementName() {
     return "";
   }
 
+  @Override
   public void accept(final DomElementVisitor visitor) {
     myManager.getApplicationComponent().getVisitorDescription(visitor.getClass()).acceptElement(visitor, this);
   }
 
+  @Override
   public void acceptChildren(DomElementVisitor visitor) {
     getRootElement().accept(visitor);
   }
 
+  @Override
   public <T> T getUserData(@NotNull Key<T> key) {
     return (T)myUserData.get(key);
   }
 
+  @Override
   public <T> void putUserData(@NotNull Key<T> key, T value) {
     myUserData.put(key, value);
   }
 
+  @Override
   public final long getModificationCount() {
     return myFile.getModificationStamp();
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomGenericInfoEx.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomGenericInfoEx.java
index 64ffab0..9184690 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomGenericInfoEx.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomGenericInfoEx.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.
@@ -38,6 +38,7 @@
   @Nullable
   public abstract Invocation createInvocation(final JavaMethod method);
 
+  @Override
   @NotNull
   public abstract List<AttributeChildDescriptionImpl> getAttributeChildrenDescriptions();
 
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomImplUtil.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomImplUtil.java
index a5e38a3..6650713 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomImplUtil.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomImplUtil.java
@@ -152,6 +152,7 @@
     }
 
     return ContainerUtil.findAll(tags, new Condition<XmlTag>() {
+      @Override
       public boolean value(XmlTag childTag) {
         try {
           return isNameSuitable(name, childTag.getLocalName(), childTag.getName(), childTag.getNamespace(), file);
@@ -176,6 +177,7 @@
     }
 
     return ContainerUtil.findAll(tags, new Condition<XmlTag>() {
+      @Override
       public boolean value(XmlTag childTag) {
         return isNameSuitable(name, childTag, file);
       }
@@ -272,6 +274,7 @@
       usedNames.add(description.getXmlName());
     }
     return ContainerUtil.findAll(subTags, new Condition<XmlTag>() {
+      @Override
       public boolean value(final XmlTag tag) {
         if (StringUtil.isEmpty(tag.getName())) return false;
 
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java
index af3aef0..bdad1cf 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java
@@ -18,6 +18,7 @@
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleUtil;
+import com.intellij.openapi.module.ModuleUtilCore;
 import com.intellij.openapi.progress.ProgressManager;
 import com.intellij.openapi.util.NullableFactory;
 import com.intellij.openapi.util.Pair;
@@ -108,6 +109,7 @@
     return nominalType;
   }
 
+  @Override
   @Nullable
   public DomElement getParent() {
     final DomInvocationHandler handler = getParentHandler();
@@ -131,6 +133,7 @@
     return myStub;
   }
 
+  @Override
   @NotNull
   public final Type getDomElementType() {
     return myType;
@@ -145,6 +148,7 @@
   protected void setValue(@Nullable final String value) {
     final XmlTag tag = ensureTagExists();
     myManager.runChange(new Runnable() {
+      @Override
       public void run() {
         setTagValue(tag, value);
       }
@@ -152,6 +156,7 @@
     myManager.fireEvent(new DomEvent(getProxy(), false));
   }
 
+  @Override
   public void copyFrom(final DomElement other) {
     if (other == getProxy()) return;
     assert other.getDomElementType().equals(myType) : "Can't copy from " + other.getDomElementType() + " to " + myType;
@@ -162,6 +167,7 @@
     }
 
     myManager.performAtomicChange(new Runnable() {
+      @Override
       public void run() {
         ensureXmlElementExists();
         final DomGenericInfoEx genericInfo = getGenericInfo();
@@ -203,6 +209,7 @@
     }
   }
 
+  @Override
   public <T extends DomElement> T createStableCopy() {
     XmlTag tag = getXmlTag();
     if (tag != null && tag.isPhysical()) {
@@ -221,12 +228,14 @@
     throw new UnsupportedOperationException();
   }
 
+  @Override
   public final <T extends DomElement> T createMockCopy(final boolean physical) {
     final T copy = myManager.createMockElement((Class<? extends T>)getRawType(), getProxy().getModule(), physical);
     copy.copyFrom(getProxy());
     return copy;
   }
 
+  @Override
   @NotNull
   public String getXmlElementNamespace() {
     final DomInvocationHandler parent = getParentHandler();
@@ -236,16 +245,19 @@
     return getXmlName().getNamespace(element, getFile());
   }
 
+  @Override
   @Nullable
   public String getXmlElementNamespaceKey() {
     return getXmlName().getXmlName().getNamespaceKey();
   }
 
+  @Override
   public final Module getModule() {
-    final Module module = ModuleUtil.findModuleForPsiElement(getFile());
-    return module != null ? module : DomUtil.getFile(this).getUserData(DomManagerImpl.MOCK_ELEMENT_MODULE);
+    final Module module = ModuleUtilCore.findModuleForPsiElement(getFile());
+    return module != null ? module : DomUtil.getFile(this).getUserData(DomManager.MOCK_ELEMENT_MODULE);
   }
 
+  @Override
   public XmlTag ensureTagExists() {
     assertValid();
 
@@ -262,10 +274,12 @@
     return getXmlTag();
   }
 
+  @Override
   public XmlElement getXmlElement() {
     return getParentStrategy().getXmlElement();
   }
 
+  @Override
   public boolean exists() {
     return getParentStrategy().isPhysical();
   }
@@ -275,6 +289,7 @@
     return myParentStrategy;
   }
 
+  @Override
   public XmlElement ensureXmlElementExists() {
     return ensureTagExists();
   }
@@ -295,6 +310,7 @@
     return getXmlTag().createChildTag(localName, tagName.getNamespace(element, getFile()), null, false);
   }
 
+  @Override
   public final boolean isValid() {
     return checkValidity() == null;
   }
@@ -342,6 +358,7 @@
   }
 
 
+  @Override
   @NotNull
   public final DomGenericInfoEx getGenericInfo() {
     return myGenericInfo;
@@ -349,6 +366,7 @@
 
   protected abstract void undefineInternal();
 
+  @Override
   public final void undefine() {
     undefineInternal();
   }
@@ -398,6 +416,7 @@
     }
   }
 
+  @Override
   @NotNull
   public final String getXmlElementName() {
     return myTagName.getXmlName().getLocalName();
@@ -408,11 +427,13 @@
     return myTagName;
   }
 
+  @Override
   public void accept(final DomElementVisitor visitor) {
     ProgressManager.checkCanceled();
     myManager.getApplicationComponent().getVisitorDescription(visitor.getClass()).acceptElement(visitor, getProxy());
   }
 
+  @Override
   @SuppressWarnings("ForLoopReplaceableByForEach")
   public void acceptChildren(DomElementVisitor visitor) {
     ProgressManager.checkCanceled();
@@ -463,10 +484,12 @@
     return converter;
   }
 
+  @Override
   public final T getChildDescription() {
     return myChildDescription;
   }
 
+  @Override
   @Nullable
   public <T extends Annotation> T getAnnotation(final Class<T> annotationClass) {
     final AnnotatedElement childDescription = getChildDescription();
@@ -529,6 +552,7 @@
     return getParentStrategy().getContainingFile(this);
   }
 
+  @Override
   @NotNull
   public DomNameStrategy getNameStrategy() {
     final Class<?> rawType = getRawType();
@@ -544,6 +568,7 @@
     return false;
   }
 
+  @Override
   @NotNull
   public ElementPresentation getPresentation() {
     ElementPresentationTemplate template = getChildDescription().getPresentationTemplate();
@@ -551,20 +576,24 @@
       return template.createPresentation(getProxy());
     }
     return new ElementPresentation() {
+      @Override
       public String getElementName() {
         return ElementPresentationManager.getElementName(getProxy());
       }
 
+      @Override
       public String getTypeName() {
         return ElementPresentationManager.getTypeNameForObject(getProxy());
       }
 
+      @Override
       public Icon getIcon() {
         return ElementPresentationManager.getIconOld(getProxy());
       }
     };
   }
 
+  @Override
   public final GlobalSearchScope getResolveScope() {
     return DomUtil.getFile(this).getResolveScope();
   }
@@ -576,6 +605,7 @@
     return (T)element;
   }
 
+  @Override
   public final <T extends DomElement> T getParentOfType(Class<T> requiredClass, boolean strict) {
     return _getParentOfType(requiredClass, strict ? getParent() : getProxy());
   }
@@ -643,6 +673,7 @@
     return new AttributeChildInvocationHandler(evaluatedXmlName, description, myManager, new VirtualDomParentStrategy(this), null);
   }
 
+  @Override
   @Nullable
   public final Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
     try {
@@ -700,6 +731,7 @@
     return ReflectionUtil.getRawType(myType);
   }
 
+  @Override
   @Nullable
   public XmlTag getXmlTag() {
     return (XmlTag) getXmlElement();
@@ -743,6 +775,7 @@
     myGenericInfo = dynamic ? new DynamicGenericInfo(this, staticInfo) : staticInfo;
   }
 
+  @Override
   @NotNull
   public final DomManagerImpl getManager() {
     return myManager;
@@ -855,6 +888,7 @@
       myHandlerClass = aClass;
     }
 
+    @Override
     public T create() {
       final XmlTag tag = myPointer.getElement();
       if (tag == null || !tag.isValid()) return null;
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomManagerImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomManagerImpl.java
index 64b36ad..7614c25 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomManagerImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomManagerImpl.java
@@ -93,6 +93,7 @@
 
     final PomModel pomModel = PomManager.getModel(project);
     pomModel.addModelListener(new PomModelListener() {
+      @Override
       public void modelChanged(PomModelEvent event) {
         if (myChanging) return;
         
@@ -107,6 +108,7 @@
         }
       }
 
+      @Override
       public boolean isAspectChangeInteresting(PomModelAspect aspect) {
         return aspect instanceof XmlAspect;
       }
@@ -115,6 +117,7 @@
     VirtualFileManager.getInstance().addVirtualFileListener(new VirtualFileAdapter() {
       private final List<DomEvent> myDeletionEvents = new SmartList<DomEvent>();
 
+      @Override
       public void contentsChanged(@NotNull VirtualFileEvent event) {
         if (!event.isFromSave()) {
           fireEvents(calcDomChangeEvents(event.getFile()));
@@ -126,10 +129,12 @@
         fireEvents(calcDomChangeEvents(event.getFile()));
       }
 
+      @Override
       public void beforeFileDeletion(@NotNull final VirtualFileEvent event) {
         myDeletionEvents.addAll(calcDomChangeEvents(event.getFile()));
       }
 
+      @Override
       public void fileDeleted(@NotNull VirtualFileEvent event) {
         if (!myDeletionEvents.isEmpty()) {
           fireEvents(myDeletionEvents);
@@ -137,6 +142,7 @@
         }
       }
 
+      @Override
       public void propertyChanged(@NotNull VirtualFilePropertyEvent event) {
         final VirtualFile file = event.getFile();
         if (!file.isDirectory() && VirtualFile.PROP_NAME.equals(event.getPropertyName())) {
@@ -193,18 +199,22 @@
     return (DomManagerImpl)DomManager.getDomManager(project);
   }
 
+  @Override
   public void addDomEventListener(DomEventListener listener, Disposable parentDisposable) {
     myListeners.addListener(listener, parentDisposable);
   }
 
+  @Override
   public final ConverterManager getConverterManager() {
     return ServiceManager.getService(ConverterManager.class);
   }
 
+  @Override
   public final void addPsiReferenceFactoryForClass(Class clazz, PsiReferenceFactory psiReferenceFactory) {
     myGenericValueReferenceProvider.addReferenceProviderForClass(clazz, psiReferenceFactory);
   }
 
+  @Override
   public final ModelMerger createModelMerger() {
     return new ModelMergerImpl();
   }
@@ -221,6 +231,7 @@
     }
   }
 
+  @Override
   public final DomGenericInfo getGenericInfo(final Type type) {
     return myApplicationComponent.getStaticGenericInfo(type);
   }
@@ -262,10 +273,12 @@
     return myApplicationComponent;
   }
 
+  @Override
   public final Project getProject() {
     return myProject;
   }
 
+  @Override
   @NotNull
   public final <T extends DomElement> DomFileElementImpl<T> getFileElement(final XmlFile file, final Class<T> aClass, String rootTagName) {
     //noinspection unchecked
@@ -319,6 +332,7 @@
     return oldChanging;
   }
 
+  @Override
   @Nullable
   public final <T extends DomElement> DomFileElementImpl<T> getFileElement(XmlFile file) {
     if (file == null) return null;
@@ -334,6 +348,7 @@
     return SoftReference.dereference(file.getUserData(CACHED_FILE_ELEMENT));
   }
 
+  @Override
   @Nullable
   public final <T extends DomElement> DomFileElementImpl<T> getFileElement(XmlFile file, Class<T> domClass) {
     final DomFileDescription description = getDomFileDescription(file);
@@ -343,6 +358,7 @@
     return null;
   }
 
+  @Override
   @Nullable
   public final DomElement getDomElement(final XmlTag element) {
     if (myChanging) return null;
@@ -351,6 +367,7 @@
     return handler != null ? handler.getProxy() : null;
   }
 
+  @Override
   @Nullable
   public GenericAttributeValue getDomElement(final XmlAttribute attribute) {
     if (myChanging) return null;
@@ -372,6 +389,7 @@
     return mySemService.getSemElement(DOM_HANDLER_KEY, tag);
   }
 
+  @Override
   @Nullable
   public AbstractDomChildrenDescription findChildrenDescription(@NotNull final XmlTag tag, @NotNull final DomElement parent) {
     return findChildrenDescription(tag, getDomInvocationHandler(parent));
@@ -397,6 +415,7 @@
     return null;
   }
 
+  @Override
   public final <T extends DomElement> T createMockElement(final Class<T> aClass, final Module module, final boolean physical) {
     final XmlFile file = (XmlFile)PsiFileFactory.getInstance(myProject).createFileFromText("a.xml", StdFileTypes.XML, "", (long)0, physical);
     file.putUserData(MOCK_ELEMENT_MODULE, module);
@@ -404,18 +423,22 @@
     return getFileElement(file, aClass, "I_sincerely_hope_that_nobody_will_have_such_a_root_tag_name").getRootElement();
   }
 
+  @Override
   public final boolean isMockElement(DomElement element) {
     return DomUtil.getFile(element).getUserData(MOCK) != null;
   }
 
+  @Override
   public final <T extends DomElement> T createStableValue(final Factory<T> provider) {
     return createStableValue(provider, new Condition<T>() {
+      @Override
       public boolean value(T t) {
         return t.isValid();
       }
     });
   }
 
+  @Override
   public final <T> T createStableValue(final Factory<T> provider, final Condition<T> validator) {
     final T initial = provider.create();
     assert initial != null;
@@ -433,6 +456,7 @@
   public final <T extends DomElement> void registerFileDescription(final DomFileDescription<T> description, Disposable parentDisposable) {
     registerFileDescription(description);
     Disposer.register(parentDisposable, new Disposable() {
+      @Override
       public void dispose() {
         getFileDescriptions(description.getRootTagName()).remove(description);
         getAcceptingOtherRootTagNameDescriptions().remove(description);
@@ -440,28 +464,33 @@
     });
   }
 
+  @Override
   public final void registerFileDescription(final DomFileDescription description) {
     mySemService.clearCache();
 
     myApplicationComponent.registerFileDescription(description);
   }
 
+  @Override
   @NotNull
   public final DomElement getResolvingScope(GenericDomValue element) {
     final DomFileDescription<?> description = DomUtil.getFileElement(element).getFileDescription();
     return description.getResolveScope(element);
   }
 
+  @Override
   @Nullable
   public final DomElement getIdentityScope(DomElement element) {
     final DomFileDescription description = DomUtil.getFileElement(element).getFileDescription();
     return description.getIdentityScope(element);
   }
 
+  @Override
   public TypeChooserManager getTypeChooserManager() {
     return myApplicationComponent.getTypeChooserManager();
   }
 
+  @Override
   public long getModificationCount() {
     return myModificationCount + PsiManager.getInstance(myProject).getModificationTracker().getOutOfCodeBlockModificationCount();
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomMetaDataContributor.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomMetaDataContributor.java
index 4e93b54..4a0d583 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomMetaDataContributor.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomMetaDataContributor.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.
@@ -31,6 +31,7 @@
   @Override
   public void contributeMetaData(MetaDataRegistrar registrar) {
     registrar.registerMetaData(new ElementFilter() {
+      @Override
       public boolean isAcceptable(Object element, PsiElement context) {
         if (element instanceof XmlTag) {
           final XmlTag tag = (XmlTag)element;
@@ -42,6 +43,7 @@
         return false;
       }
 
+      @Override
       public boolean isClassAcceptable(Class hintClass) {
         return XmlTag.class.isAssignableFrom(hintClass);
       }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomReferenceContributor.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomReferenceContributor.java
index 9c1d04b..f44fe05 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomReferenceContributor.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomReferenceContributor.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.
@@ -23,6 +23,7 @@
  * @author peter
  */
 public class DomReferenceContributor extends PsiReferenceContributor{
+  @Override
   public void registerReferenceProviders(final PsiReferenceRegistrar registrar) {
     GenericValueReferenceProvider provider = new GenericValueReferenceProvider();
 
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomRootInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomRootInvocationHandler.java
index f104762..f7d831e 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomRootInvocationHandler.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomRootInvocationHandler.java
@@ -48,11 +48,13 @@
                                   @Nullable ElementStub stub
   ) {
     super(aClass, strategy, tagName, new AbstractDomChildDescriptionImpl(aClass) {
+      @Override
       @NotNull
       public List<? extends DomElement> getValues(@NotNull final DomElement parent) {
         throw new UnsupportedOperationException();
       }
 
+      @Override
       public int compareTo(final AbstractDomChildDescriptionImpl o) {
         throw new UnsupportedOperationException();
       }
@@ -60,6 +62,7 @@
     myParent = fileElement;
   }
 
+  @Override
   public void undefineInternal() {
     try {
       final XmlTag tag = getXmlTag();
@@ -91,6 +94,7 @@
            getXmlElement() != null;
   }
 
+  @Override
   @NotNull
   public String getXmlElementNamespace() {
     return getXmlName().getNamespace(getFile(), getFile());
@@ -111,23 +115,28 @@
     return null;
   }
 
+  @Override
   @NotNull
   public DomFileElementImpl getParent() {
     return myParent;
   }
 
+  @Override
   public DomElement createPathStableCopy() {
     final DomFileElement stableCopy = myParent.createStableCopy();
     return getManager().createStableValue(new NullableFactory<DomElement>() {
+      @Override
       public DomElement create() {
         return stableCopy.isValid() ? stableCopy.getRootElement() : null;
       }
     });
   }
 
+  @Override
   protected XmlTag setEmptyXmlTag() {
     final XmlTag[] result = new XmlTag[]{null};
     getManager().runChange(new Runnable() {
+      @Override
       public void run() {
         try {
           final String namespace = getXmlElementNamespace();
@@ -144,6 +153,7 @@
     return result[0];
   }
 
+  @Override
   @NotNull
   public final DomNameStrategy getNameStrategy() {
     final Class<?> rawType = getRawType();
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomSemContributor.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomSemContributor.java
index 9e44e4f..f5a68aa 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomSemContributor.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomSemContributor.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.
@@ -60,8 +60,10 @@
     mySemService = semService;
   }
 
+  @Override
   public void registerSemProviders(SemRegistrar registrar) {
     registrar.registerSemElementProvider(DomManagerImpl.FILE_DESCRIPTION_KEY, xmlFile(), new NullableFunction<XmlFile, FileDescriptionCachedValueProvider>() {
+      @Override
       public FileDescriptionCachedValueProvider fun(XmlFile xmlFile) {
         ApplicationManager.getApplication().assertReadAccessAllowed();
         return new FileDescriptionCachedValueProvider(DomManagerImpl.getDomManager(xmlFile.getProject()), xmlFile);
@@ -69,6 +71,7 @@
     });
 
     registrar.registerSemElementProvider(DomManagerImpl.DOM_HANDLER_KEY, xmlTag().withParent(psiElement(XmlElementType.XML_DOCUMENT).withParent(xmlFile())), new NullableFunction<XmlTag, DomInvocationHandler>() {
+      @Override
       public DomInvocationHandler fun(XmlTag xmlTag) {
         final FileDescriptionCachedValueProvider provider =
           mySemService.getSemElement(DomManagerImpl.FILE_DESCRIPTION_KEY, xmlTag.getContainingFile());
@@ -86,6 +89,7 @@
 
     final ElementPattern<XmlTag> nonRootTag = xmlTag().withParent(or(xmlTag(), xmlEntityRef().withParent(xmlTag())));
     registrar.registerSemElementProvider(DomManagerImpl.DOM_INDEXED_HANDLER_KEY, nonRootTag, new NullableFunction<XmlTag, IndexedElementInvocationHandler>() {
+      @Override
       public IndexedElementInvocationHandler fun(XmlTag tag) {
         final XmlTag parentTag = PhysicalDomParentStrategy.getParentTag(tag);
         assert parentTag != null;
@@ -129,6 +133,7 @@
     });
 
     registrar.registerSemElementProvider(DomManagerImpl.DOM_COLLECTION_HANDLER_KEY, nonRootTag, new NullableFunction<XmlTag, CollectionElementInvocationHandler>() {
+      @Override
       public CollectionElementInvocationHandler fun(XmlTag tag) {
         final XmlTag parentTag = PhysicalDomParentStrategy.getParentTag(tag);
         assert parentTag != null;
@@ -156,6 +161,7 @@
     registrar.registerSemElementProvider(DomManagerImpl.DOM_CUSTOM_HANDLER_KEY, nonRootTag, new NullableFunction<XmlTag, CollectionElementInvocationHandler>() {
       private final RecursionGuard myGuard = RecursionManager.createGuard("customDomParent");
 
+      @Override
       public CollectionElementInvocationHandler fun(XmlTag tag) {
         if (StringUtil.isEmpty(tag.getName())) return null;
 
@@ -199,6 +205,7 @@
     });
 
     registrar.registerSemElementProvider(DomManagerImpl.DOM_ATTRIBUTE_HANDLER_KEY, xmlAttribute(), new NullableFunction<XmlAttribute, AttributeChildInvocationHandler>() {
+      @Override
       public AttributeChildInvocationHandler fun(final XmlAttribute attribute) {
         final XmlTag tag = PhysicalDomParentStrategy.getParentTag(attribute);
         final DomInvocationHandler handler = getParentDom(tag);
@@ -207,6 +214,7 @@
         final String localName = attribute.getLocalName();
         final Ref<AttributeChildInvocationHandler> result = Ref.create(null);
         handler.getGenericInfo().processAttributeChildrenDescriptions(new Processor<AttributeChildDescriptionImpl>() {
+          @Override
           public boolean process(AttributeChildDescriptionImpl description) {
             if (description.getXmlName().getLocalName().equals(localName)) {
               final EvaluatedXmlName evaluatedXmlName = handler.createEvaluatedXmlName(description.getXmlName());
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomServiceImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomServiceImpl.java
index b63a29d..94987bc 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomServiceImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomServiceImpl.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.
@@ -56,8 +56,10 @@
 public class DomServiceImpl extends DomService {
   private static final Key<CachedValue<XmlFileHeader>> ROOT_TAG_NS_KEY = Key.create("rootTag&ns");
   private static final UserDataCache<CachedValue<XmlFileHeader>,XmlFile,Object> ourRootTagCache = new UserDataCache<CachedValue<XmlFileHeader>, XmlFile, Object>() {
+    @Override
     protected CachedValue<XmlFileHeader> compute(final XmlFile file, final Object o) {
       return CachedValuesManager.getManager(file.getProject()).createCachedValue(new CachedValueProvider<XmlFileHeader>() {
+        @Override
         public Result<XmlFileHeader> compute() {
           return new Result<XmlFileHeader>(calcXmlFileHeader(file), file);
         }
@@ -128,6 +130,7 @@
     return XmlFileHeader.EMPTY;
   }
 
+  @Override
   public ModelMerger createModelMerger() {
     return new ModelMergerImpl();
   }
@@ -137,6 +140,7 @@
     return DomAnchorImpl.createAnchor(domElement);
   }
 
+  @Override
   @NotNull
   public XmlFile getContainingFile(@NotNull DomElement domElement) {
     if (domElement instanceof DomFileElement) {
@@ -145,21 +149,25 @@
     return DomManagerImpl.getNotNullHandler(domElement).getFile();
   }
 
+  @Override
   @NotNull
   public EvaluatedXmlName getEvaluatedXmlName(@NotNull final DomElement element) {
     return DomManagerImpl.getNotNullHandler(element).getXmlName();
   }
 
+  @Override
   @NotNull
   public XmlFileHeader getXmlFileHeader(XmlFile file) {
     return file.isValid() ? ourRootTagCache.get(ROOT_TAG_NS_KEY, file, null).getValue() : XmlFileHeader.EMPTY;
   }
 
 
+  @Override
   public Collection<VirtualFile> getDomFileCandidates(Class<? extends DomElement> description, Project project) {
     return FileBasedIndex.getInstance().getContainingFiles(DomFileIndex.NAME, description.getName(), GlobalSearchScope.allScope(project));
   }
 
+  @Override
   public <T extends DomElement> List<DomFileElement<T>> getFileElements(final Class<T> clazz, final Project project, @Nullable final GlobalSearchScope scope) {
     final Collection<VirtualFile> list = scope == null ? getDomFileCandidates(clazz, project) : getDomFileCandidates(clazz, project, scope);
     final ArrayList<DomFileElement<T>> result = new ArrayList<DomFileElement<T>>(list.size());
@@ -177,6 +185,7 @@
   }
 
 
+  @Override
   public StructureViewBuilder createSimpleStructureViewBuilder(final XmlFile file, final Function<DomElement, StructureViewMode> modeProvider) {
     return new DomStructureViewBuilder(file, modeProvider);
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomTemplateRunnerImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomTemplateRunnerImpl.java
index 97a66b9..cd86f01 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomTemplateRunnerImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomTemplateRunnerImpl.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.
@@ -40,6 +40,7 @@
     myProject = project;
   }
 
+  @Override
   public <T extends DomElement> void runTemplate(final T t, final String mappingId, final Editor editor) {
        runTemplate(t, mappingId, editor, new HashMap<String, String>());
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DynamicGenericInfo.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DynamicGenericInfo.java
index 96fbf46..eebe00d 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/DynamicGenericInfo.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DynamicGenericInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -66,10 +66,12 @@
     myCollections = staticGenericInfo.getCollections();
   }
 
+  @Override
   public Invocation createInvocation(final JavaMethod method) {
     return myStaticGenericInfo.createInvocation(method);
   }
 
+  @Override
   public final boolean checkInitialized() {
     if (myInitialized) return true;
     myStaticGenericInfo.buildMethodMaps();
@@ -177,14 +179,17 @@
     return registrar;
   }
 
+  @Override
   public XmlElement getNameElement(DomElement element) {
     return myStaticGenericInfo.getNameElement(element);
   }
 
+  @Override
   public GenericDomValue getNameDomElement(DomElement element) {
     return myStaticGenericInfo.getNameDomElement(element);
   }
 
+  @Override
   @NotNull
   public List<? extends CustomDomChildrenDescription> getCustomNameChildrenDescription() {
     checkInitialized();
@@ -192,10 +197,12 @@
     return myStaticGenericInfo.getCustomNameChildrenDescription();
   }
 
+  @Override
   public String getElementName(DomElement element) {
     return myStaticGenericInfo.getElementName(element);
   }
 
+  @Override
   @NotNull
   public List<AbstractDomChildDescriptionImpl> getChildrenDescriptions() {
     checkInitialized();
@@ -207,53 +214,63 @@
     return list;
   }
 
+  @Override
   @NotNull
   public final List<FixedChildDescriptionImpl> getFixedChildrenDescriptions() {
     checkInitialized();
     return myFixeds.getDescriptions();
   }
 
+  @Override
   @NotNull
   public final List<CollectionChildDescriptionImpl> getCollectionChildrenDescriptions() {
     checkInitialized();
     return myCollections.getDescriptions();
   }
 
+  @Override
   public FixedChildDescriptionImpl getFixedChildDescription(String tagName) {
     checkInitialized();
     return myFixeds.findDescription(tagName);
   }
 
+  @Override
   public DomFixedChildDescription getFixedChildDescription(@NonNls String tagName, @NonNls String namespace) {
     checkInitialized();
     return myFixeds.getDescription(tagName, namespace);
   }
 
+  @Override
   public CollectionChildDescriptionImpl getCollectionChildDescription(String tagName) {
     checkInitialized();
     return myCollections.findDescription(tagName);
   }
 
+  @Override
   public DomCollectionChildDescription getCollectionChildDescription(@NonNls String tagName, @NonNls String namespace) {
     checkInitialized();
     return myCollections.getDescription(tagName, namespace);
   }
 
+  @Override
   public AttributeChildDescriptionImpl getAttributeChildDescription(String attributeName) {
     checkInitialized();
     return myAttributes.findDescription(attributeName);
   }
 
 
+  @Override
   public DomAttributeChildDescription getAttributeChildDescription(@NonNls String attributeName, @NonNls String namespace) {
     checkInitialized();
     return myAttributes.getDescription(attributeName, namespace);
   }
 
+  @Override
   public boolean isTagValueElement() {
     return myStaticGenericInfo.isTagValueElement();
   }
 
+  @Override
   @NotNull
   public List<AttributeChildDescriptionImpl> getAttributeChildrenDescriptions() {
     checkInitialized();
@@ -264,6 +281,7 @@
   public boolean processAttributeChildrenDescriptions(final Processor<AttributeChildDescriptionImpl> processor) {
     final Set<AttributeChildDescriptionImpl> visited = new THashSet<AttributeChildDescriptionImpl>();
     if (!myStaticGenericInfo.processAttributeChildrenDescriptions(new Processor<AttributeChildDescriptionImpl>() {
+      @Override
       public boolean process(AttributeChildDescriptionImpl attributeChildDescription) {
         visited.add(attributeChildDescription);
         return processor.process(attributeChildDescription);
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/FileDescriptionCachedValueProvider.java b/xml/dom-impl/src/com/intellij/util/xml/impl/FileDescriptionCachedValueProvider.java
index 4b6ac95..3ddc390 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/FileDescriptionCachedValueProvider.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/FileDescriptionCachedValueProvider.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.
@@ -202,6 +202,7 @@
   private class MyCondition implements Condition<DomFileDescription> {
     public Module module;
 
+    @Override
     public boolean value(final DomFileDescription description) {
       return description.isMyFile(myXmlFile, module);
     }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/FixedChildDescriptionImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/FixedChildDescriptionImpl.java
index 3f22adf..2e37e40 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/FixedChildDescriptionImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/FixedChildDescriptionImpl.java
@@ -48,6 +48,7 @@
     myGetterMethods = getterMethods;
   }
 
+  @Override
   public JavaMethod getGetterMethod(int index) {
     if (myGetterMethods.length == 0) return null;
 
@@ -55,6 +56,7 @@
     return methods == null || methods.isEmpty() ? null : methods.iterator().next();
   }
 
+  @Override
   @Nullable
   public <T extends Annotation> T getAnnotation(int index, Class<? extends T> annotationClass) {
     final JavaMethod method = getGetterMethod(index);
@@ -72,10 +74,12 @@
     return super.getAnnotation(annotationClass);
   }
 
+  @Override
   public int getCount() {
     return myCount;
   }
 
+  @Override
   @NotNull
   public List<? extends DomElement> getValues(@NotNull final DomElement element) {
     final List<DomElement> result = new SmartList<DomElement>();
@@ -95,11 +99,13 @@
     return result;
   }
 
+  @Override
   @NotNull
   public String getCommonPresentableName(@NotNull DomNameStrategy strategy) {
     return StringUtil.capitalizeWords(strategy.splitIntoWords(getXmlElementName()), true);
   }
 
+  @Override
   @Nullable
   public final <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
     return getAnnotation(0, annotationClass);
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/GenericDomValueReference.java b/xml/dom-impl/src/com/intellij/util/xml/impl/GenericDomValueReference.java
index 881630e..18c97c2 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/GenericDomValueReference.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/GenericDomValueReference.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.
@@ -76,6 +76,7 @@
     return myGenericValue;
   }
 
+  @Override
   public boolean isSoft() {
     return true;
   }
@@ -106,6 +107,7 @@
     return o != null ? getElement() : null;
   }
 
+  @Override
   public boolean isReferenceTo(final PsiElement element) {
     final Converter<T> converter = getConverter();
     if (converter instanceof ResolvingConverter) {
@@ -131,17 +133,20 @@
     return WrappingConverter.getDeepestConverter(myGenericValue.getConverter(), myGenericValue);
   }
 
+  @Override
   @Nullable
   public PsiElement resolve() {
     final T value = myGenericValue.getValue();
     return value == null ? null : resolveInner(value);
   }
 
+  @Override
   @NotNull
   public String getCanonicalText() {
     return StringUtil.notNullize(getStringValue());
   }
 
+  @Override
   @NotNull
   public String getUnresolvedMessagePattern() {
     final ConvertContext context = getConvertContext();
@@ -152,6 +157,7 @@
     return ConvertContextFactory.createConvertContext(DomManagerImpl.getDomInvocationHandler(myGenericValue));
   }
 
+  @Override
   public PsiElement handleElementRename(final String newElementName) throws IncorrectOperationException {
     final Converter<T> converter = getConverter();
     if (converter instanceof ResolvingConverter) {
@@ -161,6 +167,7 @@
     return super.handleElementRename(newElementName);
   }
 
+  @Override
   public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
     final Converter<T> converter = getConverter();
     if (converter instanceof ResolvingConverter) {
@@ -180,6 +187,7 @@
     return null;
   }
 
+  @Override
   @NotNull
   public Object[] getVariants() {
     final Converter<T> converter = getConverter();
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/GenericValueReferenceProvider.java b/xml/dom-impl/src/com/intellij/util/xml/impl/GenericValueReferenceProvider.java
index 2df2c4c..c2050b5 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/GenericValueReferenceProvider.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/GenericValueReferenceProvider.java
@@ -43,6 +43,7 @@
     myProviders.put(clazz, provider);
   }
 
+  @Override
   @NotNull
   public final PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull final ProcessingContext context) {
     final DomManager domManager = DomManager.getDomManager(psiElement.getProject());
@@ -147,6 +148,7 @@
 
     if (ReflectionUtil.isAssignable(Integer.class, clazz)) {
       return new PsiReference[]{new GenericDomValueReference<Integer>((GenericDomValue<Integer>)domValue) {
+        @Override
         @NotNull
         public Object[] getVariants() {
           return new Object[]{"0"};
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/GetAttributeChildInvocation.java b/xml/dom-impl/src/com/intellij/util/xml/impl/GetAttributeChildInvocation.java
index 47951e0..92f69df 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/GetAttributeChildInvocation.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/GetAttributeChildInvocation.java
@@ -25,6 +25,7 @@
     myDescription = description;
   }
 
+  @Override
   public Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
     return handler.getAttributeChild(myDescription).getProxy();
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/GetCollectionChildInvocation.java b/xml/dom-impl/src/com/intellij/util/xml/impl/GetCollectionChildInvocation.java
index df122f2..e9fafaf 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/GetCollectionChildInvocation.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/GetCollectionChildInvocation.java
@@ -25,6 +25,7 @@
     myDescription = qname;
   }
 
+  @Override
   public Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
     return handler.getCollectionChildren(myDescription, myDescription.getTagsGetter());
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/GetCompositeCollectionInvocation.java b/xml/dom-impl/src/com/intellij/util/xml/impl/GetCompositeCollectionInvocation.java
index 97984c8..d8afda3 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/GetCompositeCollectionInvocation.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/GetCompositeCollectionInvocation.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.
@@ -32,6 +32,7 @@
     myQnames = qnames;
   }
 
+  @Override
   public Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
     Map<XmlTag,DomElement> map = new THashMap<XmlTag, DomElement>();
     for (final CollectionChildDescriptionImpl qname : myQnames) {
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/GetFixedChildInvocation.java b/xml/dom-impl/src/com/intellij/util/xml/impl/GetFixedChildInvocation.java
index ea69bc9..6bff198 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/GetFixedChildInvocation.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/GetFixedChildInvocation.java
@@ -27,6 +27,7 @@
     myPair = pair;
   }
 
+  @Override
   public Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
     return handler.getFixedChild(myPair).getProxy();
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/ImplementationClassCache.java b/xml/dom-impl/src/com/intellij/util/xml/impl/ImplementationClassCache.java
index 3cb49c9..6a62938 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/ImplementationClassCache.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/ImplementationClassCache.java
@@ -35,6 +35,7 @@
  */
 class ImplementationClassCache {
   private static final Comparator<Class> CLASS_COMPARATOR = new Comparator<Class>() {
+    @Override
     public int compare(final Class o1, final Class o2) {
       if (o1.isAssignableFrom(o2)) return 1;
       if (o2.isAssignableFrom(o1)) return -1;
@@ -98,6 +99,7 @@
     myImplementationClasses.putValue(domElementClass.getName(), ep);
     if (parentDisposable != null) {
       Disposer.register(parentDisposable, new Disposable() {
+        @Override
         public void dispose() {
           myImplementationClasses.remove(domElementClass.getName());
         }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/IndexedElementInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/IndexedElementInvocationHandler.java
index 3e1479c..b77a838 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/IndexedElementInvocationHandler.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/IndexedElementInvocationHandler.java
@@ -57,6 +57,7 @@
     return super.hashCode() * 239 + myIndex;
   }
 
+  @Override
   protected XmlElement recomputeXmlElement(@NotNull final DomInvocationHandler parentHandler) {
     final XmlTag tag = parentHandler.getXmlTag();
     if (tag == null) return null;
@@ -67,6 +68,7 @@
     return tags.get(myIndex);
   }
 
+  @Override
   protected XmlTag setEmptyXmlTag() {
     final DomInvocationHandler parent = getParentHandler();
     assert parent != null : "write operations should be performed on the DOM having a parent, your DOM may be not very fresh";
@@ -80,6 +82,7 @@
 
     final XmlTag[] newTag = new XmlTag[1];
     getManager().runChange(new Runnable() {
+      @Override
       public void run() {
         try {
           final XmlTag parentTag = parent.getXmlTag();
@@ -93,6 +96,7 @@
     return newTag[0];
   }
 
+  @Override
   public void undefineInternal() {
     final DomInvocationHandler parent = getParentHandler();
     assert parent != null : "write operations should be performed on the DOM having a parent, your DOM may be not very fresh";
@@ -134,6 +138,7 @@
     fireUndefinedEvent();
   }
 
+  @Override
   public final <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
     final T annotation = getChildDescription().getAnnotation(myIndex, annotationClass);
     if (annotation != null) return annotation;
@@ -141,10 +146,12 @@
     return getClassAnnotation(annotationClass);
   }
 
+  @Override
   public final DomElement createPathStableCopy() {
     final DomFixedChildDescription description = getChildDescription();
     final DomElement parentCopy = getParent().createStableCopy();
     return getManager().createStableValue(new Factory<DomElement>() {
+      @Override
       public DomElement create() {
         return parentCopy.isValid() ? description.getValues(parentCopy).get(myIndex) : null;
       }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/InvocationCache.java b/xml/dom-impl/src/com/intellij/util/xml/impl/InvocationCache.java
index 16be7dd..7b82589 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/InvocationCache.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/InvocationCache.java
@@ -83,11 +83,13 @@
     addCoreInvocations(AnnotatedElement.class);
     addCoreInvocations(Object.class);
     ourCoreInvocations.put(new JavaMethodSignature("getUserData", Key.class), new Invocation() {
+      @Override
       public Object invoke(DomInvocationHandler<?, ?> handler, Object[] args) throws Throwable {
         return handler.getUserData((Key<?>)args[0]);
       }
     });
     ourCoreInvocations.put(new JavaMethodSignature("putUserData", Key.class, Object.class), new Invocation() {
+      @Override
       public Object invoke(DomInvocationHandler<?, ?> handler, Object[] args) throws Throwable {
         //noinspection unchecked
         handler.putUserData((Key)args[0], args[1]);
@@ -95,49 +97,58 @@
       }
     });
     ourCoreInvocations.put(new JavaMethodSignature("getXmlElement"), new Invocation() {
+      @Override
       public Object invoke(DomInvocationHandler<?, ?> handler, Object[] args) throws Throwable {
         return handler.getXmlElement();
       }
     });
     ourCoreInvocations.put(new JavaMethodSignature("getXmlTag"), new Invocation() {
+      @Override
       public Object invoke(DomInvocationHandler<?, ?> handler, Object[] args) throws Throwable {
         return handler.getXmlTag();
       }
     });
     ourCoreInvocations.put(new JavaMethodSignature("getParent"), new Invocation() {
+      @Override
       public Object invoke(DomInvocationHandler<?, ?> handler, Object[] args) throws Throwable {
         return handler.getParent();
       }
     });
     ourCoreInvocations.put(new JavaMethodSignature("accept", DomElementVisitor.class), new Invocation() {
+      @Override
       public Object invoke(DomInvocationHandler<?, ?> handler, Object[] args) throws Throwable {
         handler.accept((DomElementVisitor)args[0]);
         return null;
       }
     });
     ourCoreInvocations.put(new JavaMethodSignature("acceptChildren", DomElementVisitor.class), new Invocation() {
+      @Override
       public Object invoke(DomInvocationHandler<?, ?> handler, Object[] args) throws Throwable {
         handler.acceptChildren((DomElementVisitor)args[0]);
         return null;
       }
     });
     ourCoreInvocations.put(new JavaMethodSignature("getAnnotation", Class.class), new Invocation() {
+      @Override
       public Object invoke(DomInvocationHandler<?, ?> handler, Object[] args) throws Throwable {
         //noinspection unchecked
         return handler.getAnnotation((Class<Annotation>)args[0]);
       }
     });
     ourCoreInvocations.put(new JavaMethodSignature("getRawText"), new Invocation() {
+      @Override
       public final Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
         return handler.getValue();
       }
     });
     ourCoreInvocations.put(new JavaMethodSignature("getXmlAttribute"), new Invocation() {
+      @Override
       public final Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
         return handler.getXmlElement();
       }
     });
     ourCoreInvocations.put(new JavaMethodSignature("getXmlAttributeValue"), new Invocation() {
+      @Override
       @Nullable
       public final Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
         final XmlAttribute attribute = (XmlAttribute)handler.getXmlElement();
@@ -145,6 +156,7 @@
       }
     });
     ourCoreInvocations.put(new JavaMethodSignature("getConverter"), new Invocation() {
+      @Override
       public final Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
         try {
           return handler.getScalarConverter();
@@ -164,6 +176,7 @@
     for (final Method method : ReflectionUtil.getClassDeclaredMethods(aClass)) {
       if ("equals".equals(method.getName())) {
         ourCoreInvocations.put(new JavaMethodSignature(method), new Invocation() {
+          @Override
           public Object invoke(DomInvocationHandler<?, ?> handler, Object[] args) throws Throwable {
             final DomElement proxy = handler.getProxy();
             final Object arg = args[0];
@@ -182,6 +195,7 @@
       }
       else if ("hashCode".equals(method.getName())) {
         ourCoreInvocations.put(new JavaMethodSignature(method), new Invocation() {
+          @Override
           public Object invoke(DomInvocationHandler<?, ?> handler, Object[] args) throws Throwable {
             return handler.hashCode();
           }
@@ -189,6 +203,7 @@
       }
       else {
         ourCoreInvocations.put(new JavaMethodSignature(method), new Invocation() {
+          @Override
           public Object invoke(DomInvocationHandler<?, ?> handler, Object[] args) throws Throwable {
             return method.invoke(handler, args);
           }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/MockDomFileDescription.java b/xml/dom-impl/src/com/intellij/util/xml/impl/MockDomFileDescription.java
index cad1544..3e68ed9 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/MockDomFileDescription.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/MockDomFileDescription.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.
@@ -31,17 +31,21 @@
     myFile = file;
   }
 
+  @Override
   public boolean isMyFile(@NotNull final XmlFile xmlFile, final Module module) {
     return myFile == xmlFile;
   }
 
+  @Override
   public boolean acceptsOtherRootTagNames() {
     return true;
   }
 
+  @Override
   protected void initializeFileDescription() {
   }
 
+  @Override
   public boolean isAutomaticHighlightingEnabled() {
     return false;
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/PhysicalDomParentStrategy.java b/xml/dom-impl/src/com/intellij/util/xml/impl/PhysicalDomParentStrategy.java
index a6427a4..3dba990 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/PhysicalDomParentStrategy.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/PhysicalDomParentStrategy.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.
@@ -40,6 +40,7 @@
     myDomManager = domManager;
   }
 
+  @Override
   public DomInvocationHandler getParentHandler() {
     final XmlTag parentTag = getParentTag(myElement);
     assert parentTag != null;
@@ -55,16 +56,19 @@
     return parent instanceof XmlEntityRef ? parent.getParent() : parent;
   }
 
+  @Override
   @NotNull
   public final XmlElement getXmlElement() {
     return myElement;
   }
 
+  @Override
   @NotNull
   public DomParentStrategy refreshStrategy(final DomInvocationHandler handler) {
     return this;
   }
 
+  @Override
   @NotNull
   public DomParentStrategy setXmlElement(@NotNull final XmlElement element) {
     myElement = element;
@@ -76,6 +80,7 @@
     return "Physical:" + myElement;
   }
 
+  @Override
   @NotNull
   public DomParentStrategy clearXmlElement() {
     final DomInvocationHandler parent = getParentHandler();
@@ -83,6 +88,7 @@
     return new VirtualDomParentStrategy(parent);
   }
 
+  @Override
   public String checkValidity() {
     return myElement.isValid() ? null : "Invalid PSI";
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/PropertyAccessorInvocation.java b/xml/dom-impl/src/com/intellij/util/xml/impl/PropertyAccessorInvocation.java
index 0d9ca11..c8a89c9 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/PropertyAccessorInvocation.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/PropertyAccessorInvocation.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.
@@ -34,6 +34,7 @@
     myLastElement = myMethods.length - 1;
   }
 
+  @Override
   public final Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
     return invoke(0, handler.getProxy());
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/RootDomParentStrategy.java b/xml/dom-impl/src/com/intellij/util/xml/impl/RootDomParentStrategy.java
index 10861c0..184dbe6 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/RootDomParentStrategy.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/RootDomParentStrategy.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.
@@ -30,25 +30,30 @@
     myFileElement = fileElement;
   }
 
+  @Override
   @NotNull
   public DomInvocationHandler getParentHandler() {
     throw new UnsupportedOperationException("Method getParentHandler is not yet implemented in " + getClass().getName());
   }
 
+  @Override
   public XmlTag getXmlElement() {
     return myFileElement.getRootTag();
   }
 
+  @Override
   @NotNull
   public DomParentStrategy refreshStrategy(final DomInvocationHandler handler) {
     return this;
   }
 
+  @Override
   @NotNull
   public DomParentStrategy setXmlElement(@NotNull final XmlElement element) {
     return this;
   }
 
+  @Override
   @NotNull
   public DomParentStrategy clearXmlElement() {
     return this;
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/SetInvocation.java b/xml/dom-impl/src/com/intellij/util/xml/impl/SetInvocation.java
index 95162df..fc920a5 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/SetInvocation.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/SetInvocation.java
@@ -28,6 +28,7 @@
     myConverter = converter;
   }
 
+  @Override
   public Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
     handler.assertValid();
     final SubTag annotation = handler.getAnnotation(SubTag.class);
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/StableInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/StableInvocationHandler.java
index d158301..0bbc82f 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/StableInvocationHandler.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/StableInvocationHandler.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.
@@ -53,6 +53,7 @@
   }
 
 
+  @Override
   public final Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable {
     if (StableElement.class.equals(method.getDeclaringClass())) {
       try {
@@ -113,6 +114,7 @@
     }
   }
 
+  @Override
   public final void revalidate() {
     final T t = myProvider.create();
     if (!isNotValid(t) && !t.equals(myCachedValue)) {
@@ -120,12 +122,14 @@
     }
   }
 
+  @Override
   public final void invalidate() {
     if (!isNotValid(myCachedValue)) {
       myCachedValue = null;
     }
   }
 
+  @Override
   public final T getWrappedElement() {
     if (isNotValid(myCachedValue)) {
       myCachedValue = myProvider.create();
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/StaticGenericInfo.java b/xml/dom-impl/src/com/intellij/util/xml/impl/StaticGenericInfo.java
index 72e7104..a497494 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/StaticGenericInfo.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/StaticGenericInfo.java
@@ -86,6 +86,7 @@
       }
 
       final NotNullFunction<String, CollectionChildDescriptionImpl> mapper = new NotNullFunction<String, CollectionChildDescriptionImpl>() {
+        @Override
         @NotNull
         public CollectionChildDescriptionImpl fun(final String xmlName) {
           return ObjectUtils.assertNotNull(myCollections.findDescription(xmlName));
@@ -115,10 +116,12 @@
     }
   }
 
+  @Override
   public boolean checkInitialized() {
     return buildMethodMaps();
   }
 
+  @Override
   public final Invocation createInvocation(final JavaMethod method) {
     buildMethodMaps();
 
@@ -143,6 +146,7 @@
 
     if (myCustomDescription != null && method.equals(myCustomDescription.getGetterMethod())) {
       return new Invocation() {
+        @Override
         @Nullable
         public Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
           return myCustomDescription.getValues(handler);
@@ -176,6 +180,7 @@
 
     if (parameterTypes.length == 2 && parameterTypes[1].equals(Class.class)) {
       return new Function<Object[], Type>() {
+        @Override
         public Type fun(final Object[] s) {
           return (Type)s[1];
         }
@@ -183,6 +188,7 @@
     }
 
     return new Function<Object[], Type>() {
+      @Override
       public Type fun(final Object[] s) {
         return method.getGenericReturnType();
       }
@@ -198,6 +204,7 @@
 
     if (parameterTypes.length == 2 && parameterTypes[1].equals(int.class)) {
       return new Function<Object[], Integer>() {
+        @Override
         public Integer fun(final Object[] s) {
           return (Integer)s[1];
         }
@@ -207,6 +214,7 @@
     return new ConstantFunction<Object[], Integer>(Integer.MAX_VALUE);
   }
 
+  @Override
   @Nullable
   public XmlElement getNameElement(DomElement element) {
     buildMethodMaps();
@@ -222,6 +230,7 @@
     }
   }
 
+  @Override
   @Nullable
   public GenericDomValue getNameDomElement(DomElement element) {
     buildMethodMaps();
@@ -230,6 +239,7 @@
     return o instanceof GenericDomValue ? (GenericDomValue)o : null;
   }
 
+  @Override
   @NotNull
   public List<? extends CustomDomChildrenDescriptionImpl> getCustomNameChildrenDescription() {
     return myCustomDescription == null ? Collections.<CustomDomChildrenDescriptionImpl>emptyList() : Collections.singletonList(myCustomDescription);
@@ -240,6 +250,7 @@
     return myNameValueGetter == null ? null : myNameValueGetter.invoke(element);
   }
 
+  @Override
   @Nullable
   public String getElementName(DomElement element) {
     buildMethodMaps();
@@ -247,6 +258,7 @@
     return o == null || o instanceof String ? (String)o : ((GenericValue)o).getStringValue();
   }
 
+  @Override
   @NotNull
   public List<AbstractDomChildDescriptionImpl> getChildrenDescriptions() {
     buildMethodMaps();
@@ -258,23 +270,27 @@
     return list;
   }
 
+  @Override
   @NotNull
   public List<? extends DomFixedChildDescription> getFixedChildrenDescriptions() {
     buildMethodMaps();
     return myFixed.getDescriptions();
   }
 
+  @Override
   @NotNull
   public List<? extends DomCollectionChildDescription> getCollectionChildrenDescriptions() {
     buildMethodMaps();
     return myCollections.getDescriptions();
   }
 
+  @Override
   public boolean isTagValueElement() {
     buildMethodMaps();
     return myValueElement;
   }
 
+  @Override
   @NotNull
   public List<AttributeChildDescriptionImpl> getAttributeChildrenDescriptions() {
     buildMethodMaps();
@@ -287,36 +303,42 @@
     return ContainerUtil.process(descriptions, processor);
   }
 
+  @Override
   @Nullable
   public DomFixedChildDescription getFixedChildDescription(@NonNls final String tagName) {
     buildMethodMaps();
     return myFixed.findDescription(tagName);
   }
 
+  @Override
   @Nullable
   public DomFixedChildDescription getFixedChildDescription(@NonNls final String tagName, @NonNls final String namespaceKey) {
     buildMethodMaps();
     return myFixed.getDescription(tagName, namespaceKey);
   }
 
+  @Override
   @Nullable
   public DomCollectionChildDescription getCollectionChildDescription(@NonNls final String tagName) {
     buildMethodMaps();
     return myCollections.findDescription(tagName);
   }
 
+  @Override
   @Nullable
   public DomCollectionChildDescription getCollectionChildDescription(@NonNls final String tagName, @NonNls final String namespaceKey) {
     buildMethodMaps();
     return myCollections.getDescription(tagName, namespaceKey);
   }
 
+  @Override
   @Nullable
   public DomAttributeChildDescription getAttributeChildDescription(@NonNls final String attributeName) {
     buildMethodMaps();
     return myAttributes.findDescription(attributeName);
   }
 
+  @Override
   @Nullable
   public DomAttributeChildDescription getAttributeChildDescription(@NonNls final String attributeName, @NonNls final String namespaceKey) {
     buildMethodMaps();
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/StaticGenericInfoBuilder.java b/xml/dom-impl/src/com/intellij/util/xml/impl/StaticGenericInfoBuilder.java
index 3968ff8..0874bbc 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/StaticGenericInfoBuilder.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/StaticGenericInfoBuilder.java
@@ -52,6 +52,7 @@
   private final Map<JavaMethodSignature, String[]> myCompositeCollectionGetters = new THashMap<JavaMethodSignature, String[]>();
   private final Map<JavaMethodSignature, Pair<String,String[]>> myCompositeCollectionAdders = new THashMap<JavaMethodSignature, Pair<String,String[]>>();
   private final FactoryMap<XmlName, TIntObjectHashMap<Collection<JavaMethod>>> myFixedChildrenGetters = new FactoryMap<XmlName, TIntObjectHashMap<Collection<JavaMethod>>>() {
+    @Override
     protected TIntObjectHashMap<Collection<JavaMethod>> create(final XmlName key) {
       return new TIntObjectHashMap<Collection<JavaMethod>>();
     }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/VirtualDomParentStrategy.java b/xml/dom-impl/src/com/intellij/util/xml/impl/VirtualDomParentStrategy.java
index 73da7d6..f031ef7 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/impl/VirtualDomParentStrategy.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/impl/VirtualDomParentStrategy.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.
@@ -38,15 +38,18 @@
     return myModificationTracker.getModificationStamp();
   }
 
+  @Override
   @NotNull
   public DomInvocationHandler getParentHandler() {
     return myParentHandler;
   }
 
+  @Override
   public XmlElement getXmlElement() {
     return null;
   }
 
+  @Override
   @NotNull
   public synchronized DomParentStrategy refreshStrategy(final DomInvocationHandler handler) {
     if (!myParentHandler.isValid()) return this;
@@ -62,11 +65,13 @@
     return this;
   }
 
+  @Override
   @NotNull
   public DomParentStrategy setXmlElement(@NotNull final XmlElement element) {
     return new PhysicalDomParentStrategy(element, DomManagerImpl.getDomManager(element.getProject()));
   }
 
+  @Override
   @NotNull
   public synchronized DomParentStrategy clearXmlElement() {
     myModCount = getModCount();
diff --git a/xml/dom-impl/src/com/intellij/util/xml/model/gotosymbol/GoToSymbolProvider.java b/xml/dom-impl/src/com/intellij/util/xml/model/gotosymbol/GoToSymbolProvider.java
index 1798e24..0419343 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/model/gotosymbol/GoToSymbolProvider.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/model/gotosymbol/GoToSymbolProvider.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.
@@ -57,6 +57,7 @@
     }
   }
 
+  @Override
   @NotNull
   public String[] getNames(final Project project, boolean includeNonProjectItems) {
     Set<String> result = new HashSet<String>();
@@ -70,6 +71,7 @@
     return ArrayUtil.toStringArray(result);
   }
 
+  @Override
   @NotNull
   public NavigationItem[] getItemsByName(final String name, final String pattern, final Project project, boolean includeNonProjectItems) {
     List<NavigationItem> result = new ArrayList<NavigationItem>();
@@ -126,27 +128,33 @@
       myIcon = icon;
     }
 
+    @Override
     @NotNull
     public PsiElement getNavigationElement() {
       return myPsiElement;
     }
 
+    @Override
     public Icon getIcon(boolean flags) {
       return myIcon;
     }
 
+    @Override
     public ItemPresentation getPresentation() {
       return new ItemPresentation() {
 
+        @Override
         public String getPresentableText() {
           return myText;
         }
 
+        @Override
         @Nullable
         public String getLocationString() {
           return '(' + myPsiElement.getContainingFile().getName() + ')';
         }
 
+        @Override
         @Nullable
         public Icon getIcon(boolean open) {
           return myIcon;
@@ -154,6 +162,7 @@
       };
     }
 
+    @Override
     public PsiElement getParent() {
       return myPsiElement.getParent();
     }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/reflect/DomExtensionImpl.java b/xml/dom-impl/src/com/intellij/util/xml/reflect/DomExtensionImpl.java
index d3931dd..f0c84fa 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/reflect/DomExtensionImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/reflect/DomExtensionImpl.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.
@@ -78,11 +78,13 @@
     return myXmlName;
   }
 
+  @Override
   @NotNull
   public Type getType() {
     return myType;
   }
 
+  @Override
   public DomExtension setDeclaringElement(@NotNull DomElement declaringElement) {
     putUserData(KEY_DOM_DECLARATION, DomAnchorImpl.createAnchor(declaringElement, true));
     return this;
@@ -94,26 +96,31 @@
     return this;
   }
 
+  @Override
   public DomExtension setConverter(@NotNull Converter converter) {
     return setConverter(converter, false);
   }
 
+  @Override
   public final DomExtension setConverter(@NotNull final Converter converter, final boolean soft) {
     myConverter = converter;
     mySoft = soft;
     return this;
   }
 
+  @Override
   public DomExtension addCustomAnnotation(@NotNull final Annotation anno) {
     myCustomAnnos.add(anno);
     return this;
   }
 
+  @Override
   public <T> void putUserData(final Key<T> key, final T value) {
     if (myUserMap == null) myUserMap = new THashMap();
     myUserMap.put(key, value);
   }
 
+  @Override
   public DomExtension addExtender(final DomExtender extender) {
     if (myUserMap == null || !myUserMap.containsKey(DOM_EXTENDER_KEY)) {
       putUserData(DOM_EXTENDER_KEY, new SmartList<DomExtender>());
diff --git a/xml/dom-impl/src/com/intellij/util/xml/reflect/DomExtensionsRegistrarImpl.java b/xml/dom-impl/src/com/intellij/util/xml/reflect/DomExtensionsRegistrarImpl.java
index 415b0f6..e5e88ba 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/reflect/DomExtensionsRegistrarImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/reflect/DomExtensionsRegistrarImpl.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.
@@ -60,27 +60,32 @@
     return addExtension(myFixeds, name, type).setCount(count);
   }
 
+  @Override
   @NotNull
   public DomExtension registerFixedNumberChildExtension(@NotNull final XmlName name, @NotNull final Type type) {
     return registerFixedNumberChildrenExtension(name, type, 1);
   }
 
+  @Override
   @NotNull
   public DomExtension registerCollectionChildrenExtension(@NotNull final XmlName name, @NotNull final Type type) {
     return addExtension(myCollections, name, type);
   }
 
+  @Override
   @NotNull
   public DomExtension registerGenericAttributeValueChildExtension(@NotNull final XmlName name, final Type parameterType) {
     return addExtension(myAttributes, name, new ParameterizedTypeImpl(GenericAttributeValue.class, parameterType));
   }
 
+  @Override
   @NotNull
   public DomExtension registerAttributeChildExtension(@NotNull final XmlName name, @NotNull final Type type) {
     assert GenericAttributeValue.class.isAssignableFrom(ReflectionUtil.getRawType(type));
     return addExtension(myAttributes, name, type);
   }
 
+  @Override
   @NotNull
   public DomExtension registerCustomChildrenExtension(@NotNull final Type type) {
     return registerCustomChildrenExtension(type, CustomDomChildrenDescription.TagNameDescriptor.EMPTY);
diff --git a/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureTreeElement.java b/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureTreeElement.java
index 548276f..552f0ad 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureTreeElement.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureTreeElement.java
@@ -47,21 +47,25 @@
     return myElement;
   }
 
+  @Override
   @Nullable
   public Object getValue() {
     return myElement.isValid() ? myElement.getXmlElement() : null;
   }
 
+  @Override
   @NotNull
   public ItemPresentation getPresentation() {
     return this;
   }
 
+  @Override
   @NotNull
   public TreeElement[] getChildren() {
     if (!myElement.isValid()) return EMPTY_ARRAY;
     final ArrayList<TreeElement> result = new ArrayList<TreeElement>();
     final DomElementVisitor elementVisitor = new DomElementVisitor() {
+      @Override
       public void visitDomElement(final DomElement element) {
         if (element instanceof GenericDomValue) return;
         final DomService.StructureViewMode viewMode = myDescriptor.fun(element);
@@ -85,18 +89,22 @@
     return new DomStructureTreeElement(element, myDescriptor, myNavigationProvider);
   }
 
+  @Override
   public void navigate(boolean requestFocus) {
     if (myNavigationProvider != null) myNavigationProvider.navigate(myElement, true);
   }
 
+  @Override
   public boolean canNavigate() {
     return myNavigationProvider != null && myNavigationProvider.canNavigate(myElement);
   }
 
+  @Override
   public boolean canNavigateToSource() {
     return myNavigationProvider != null && myNavigationProvider.canNavigate(myElement);
   }
 
+  @Override
   public String getPresentableText() {
     if (!myElement.isValid()) return "<unknown>";
     final ElementPresentation presentation = myElement.getPresentation();
@@ -104,11 +112,13 @@
     return name != null? name : presentation.getTypeName();
   }
 
+  @Override
   @Nullable
   public String getLocationString() {
     return null;
   }
 
+  @Override
   @Nullable
   public Icon getIcon(boolean open) {
     if (!myElement.isValid()) return null;
diff --git a/xml/dom-impl/src/com/intellij/util/xml/stubs/DomStub.java b/xml/dom-impl/src/com/intellij/util/xml/stubs/DomStub.java
index 8ddbada..45a4b86 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/stubs/DomStub.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/stubs/DomStub.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.
@@ -51,6 +51,7 @@
     myLocalName = localName;
   }
 
+  @Override
   public abstract List<DomStub> getChildrenStubs();
 
   public String getName() {
diff --git a/xml/dom-impl/src/com/intellij/util/xml/stubs/ElementStub.java b/xml/dom-impl/src/com/intellij/util/xml/stubs/ElementStub.java
index 04ef4b8..4e8597f 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/stubs/ElementStub.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/stubs/ElementStub.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -69,6 +69,7 @@
     return StringUtil.isEmpty(key) ? getName() : key + ":" + getName();
   }
 
+  @Override
   public boolean isCustom() {
     return myCustom;
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/AddDomElementActionGroup.java b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/AddDomElementActionGroup.java
index 07e2958..02c4286 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/AddDomElementActionGroup.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/AddDomElementActionGroup.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.
@@ -28,16 +28,19 @@
 public class AddDomElementActionGroup extends ActionGroup {
 
   private final AddElementInCollectionAction myAction = new AddElementInCollectionAction() {
+    @Override
     protected boolean showAsPopup() {
       return false;
     }
   };
 
+  @Override
   @NotNull
   public AnAction[] getChildren(@Nullable AnActionEvent e) {
     return myAction.getChildren(e);
   }
 
+  @Override
   public void update(AnActionEvent e) {
 //    myAction.getChildren(e).length
     getTemplatePresentation().setText(myAction.getTemplatePresentation().getText());
diff --git a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/AddElementInCollectionAction.java b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/AddElementInCollectionAction.java
index 0828d3c..029feda 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/AddElementInCollectionAction.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/AddElementInCollectionAction.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.
@@ -61,6 +61,7 @@
     return DomModelTreeView.DATA_KEY.getData(e.getDataContext());
   }
 
+  @Override
   protected boolean isEnabled(final AnActionEvent e) {
     final DomModelTreeView treeView = getTreeView(e);
 
@@ -71,6 +72,7 @@
   }
 
 
+  @Override
   protected void showPopup(final ListPopup groupPopup, final AnActionEvent e) {
     if (myTreeView == null) {
       if (e.getPlace().equals(DomModelTreeView.DOM_MODEL_TREE_VIEW_POPUP)) {
@@ -85,6 +87,7 @@
     }
   }
 
+  @Override
   @NotNull
   protected DomCollectionChildDescription[] getDomCollectionChildDescriptions(final AnActionEvent e) {
     final DomModelTreeView view = getTreeView(e);
@@ -104,6 +107,7 @@
            : new DomCollectionChildDescription[]{groupNode.getChildDescription()};
   }
 
+  @Override
   protected DomElement getParentDomElement(final AnActionEvent e) {
     final DomModelTreeView view = getTreeView(e);
     SimpleNode node = view.getTree().getSelectedNode();
@@ -117,14 +121,17 @@
     return groupNode == null ? null : groupNode.getDomElement();
   }
 
+  @Override
   protected JComponent getComponent(AnActionEvent e) {
     return getTreeView(e);
   }
 
+  @Override
   protected boolean showAsPopup() {
     return true;
   }
 
+  @Override
   protected String getActionText(final AnActionEvent e) {
     String text = ApplicationBundle.message("action.add");
     if (e.getPresentation().isEnabled()) {
@@ -150,6 +157,7 @@
   }
 
 
+  @Override
   protected AnAction createAddingAction(final AnActionEvent e,
                                                 final String name,
                                                 final Icon icon,
@@ -192,22 +200,27 @@
       myView = getTreeView(e);
     }
 
+    @Override
     protected Type getElementType() {
       return myType;
     }
 
+    @Override
     protected DomCollectionChildDescription getDomCollectionChildDescription() {
       return myDescription;
     }
 
+    @Override
     protected DomElement getParentDomElement() {
       return myParent;
     }
 
-    protected void afterAddition(final DomElement newElement) {
+    @Override
+    protected void afterAddition(@NotNull final DomElement newElement) {
       final DomElement copy = newElement.createStableCopy();
 
       ApplicationManager.getApplication().invokeLater(new Runnable() {
+        @Override
         public void run() {
           myView.setSelectedDomElement(copy);
         }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/BaseDomTreeAction.java b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/BaseDomTreeAction.java
index 81d5ef3..16c3084 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/BaseDomTreeAction.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/BaseDomTreeAction.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.
@@ -33,6 +33,7 @@
     myTreeView = treeView;
   }
 
+  @Override
   final public void update(AnActionEvent e) {
     final DomModelTreeView treeView = getTreeView(e);
 
@@ -50,6 +51,7 @@
     return DomModelTreeView.DATA_KEY.getData(e.getDataContext());
   }
 
+  @Override
   final public void actionPerformed(AnActionEvent e) {
     final DomModelTreeView treeView = getTreeView(e);
     if (treeView != null) {
diff --git a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/DeleteDomElement.java b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/DeleteDomElement.java
index d525acf..c293df5 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/DeleteDomElement.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/DeleteDomElement.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -43,6 +43,7 @@
     super(treeView);
   }
 
+  @Override
   public void actionPerformed(AnActionEvent e, DomModelTreeView treeView) {
     final SimpleNode selectedNode = treeView.getTree().getSelectedNode();
 
@@ -59,6 +60,7 @@
                                                   Messages.getQuestionIcon());
       if (ret == Messages.OK) {
       new WriteCommandAction(domElement.getManager().getProject(), DomUtil.getFile(domElement)) {
+        @Override
         protected void run(final Result result) throws Throwable {
           domElement.undefine();
         }
@@ -67,6 +69,7 @@
     }
   }
 
+  @Override
   public void update(AnActionEvent e, DomModelTreeView treeView) {
     final SimpleNode selectedNode = treeView.getTree().getSelectedNode();
 
diff --git a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/DomElementsToggleAction.java b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/DomElementsToggleAction.java
index 9a1cb04..e391ae5 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/DomElementsToggleAction.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/DomElementsToggleAction.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.
@@ -22,6 +22,7 @@
 import com.intellij.openapi.actionSystem.ToggleAction;
 import com.intellij.util.xml.DomUtil;
 import com.intellij.util.xml.ElementPresentationManager;
+import com.intellij.util.xml.tree.AbstractDomElementNode;
 import com.intellij.util.xml.tree.BaseDomElementNode;
 import com.intellij.util.xml.tree.DomModelTreeView;
 
@@ -51,11 +52,12 @@
 
     myText = TypePresentationService.getService().getTypePresentableName(myClass);
 
-    if(getHiders() == null) DomUtil.getFile(myTreeView.getRootElement()).putUserData(BaseDomElementNode.TREE_NODES_HIDERS_KEY, new HashMap<Class, Boolean>());
+    if(getHiders() == null) DomUtil.getFile(myTreeView.getRootElement()).putUserData(AbstractDomElementNode.TREE_NODES_HIDERS_KEY, new HashMap<Class, Boolean>());
 
     if(getHiders().get(myClass) == null) getHiders().put(myClass, true);
   }
 
+  @Override
   public void update(final AnActionEvent e) {
     super.update(e);
 
@@ -65,6 +67,7 @@
     e.getPresentation().setEnabled(getHiders() != null && getHiders().get(myClass)!=null);
   }
 
+  @Override
   public boolean isSelected(AnActionEvent e) {
     return getHiders().get(myClass);
   }
@@ -73,6 +76,7 @@
     return DomUtil.getFile(myTreeView.getRootElement()).getUserData(BaseDomElementNode.TREE_NODES_HIDERS_KEY);
   }
 
+  @Override
   public void setSelected(AnActionEvent e, boolean state) {
     getHiders().put(myClass, state);
     myTreeView.getBuilder().updateFromRoot();
diff --git a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/GotoDomElementDeclarationAction.java b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/GotoDomElementDeclarationAction.java
index 256a397..f096c16 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/GotoDomElementDeclarationAction.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/GotoDomElementDeclarationAction.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.
@@ -16,21 +16,21 @@
 
 package com.intellij.util.xml.tree.actions;
 
+import com.intellij.idea.ActionsBundle;
 import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.application.ApplicationBundle;
-import com.intellij.util.xml.tree.DomModelTreeView;
-import com.intellij.util.xml.tree.BaseDomElementNode;
-import com.intellij.util.xml.DomElementsNavigationManager;
+import com.intellij.ui.treeStructure.SimpleNode;
 import com.intellij.util.xml.DomElement;
 import com.intellij.util.xml.DomElementNavigationProvider;
-import com.intellij.ui.treeStructure.SimpleNode;
-import com.intellij.idea.ActionsBundle;
+import com.intellij.util.xml.DomElementsNavigationManager;
+import com.intellij.util.xml.tree.BaseDomElementNode;
+import com.intellij.util.xml.tree.DomModelTreeView;
 
 /**
  * User: Sergey.Vasiliev
  */
 public class GotoDomElementDeclarationAction extends BaseDomTreeAction {
 
+  @Override
   public void actionPerformed(AnActionEvent e, DomModelTreeView treeView) {
     final SimpleNode simpleNode = treeView.getTree().getSelectedNode();
 
@@ -44,6 +44,7 @@
     }
   }
 
+  @Override
   public void update(AnActionEvent e, DomModelTreeView treeView) {
     e.getPresentation().setVisible(treeView.getTree().getSelectedNode() instanceof BaseDomElementNode);
     e.getPresentation().setText(ActionsBundle.message("action.EditSource.text"));
diff --git a/xml/dom-impl/src/com/intellij/util/xml/ui/DomUIFactoryImpl.java b/xml/dom-impl/src/com/intellij/util/xml/ui/DomUIFactoryImpl.java
index d07b40f..168b6a5 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/ui/DomUIFactoryImpl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/ui/DomUIFactoryImpl.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.
@@ -60,6 +60,7 @@
 
   public DomUIFactoryImpl() {
     final Function<DomElement, TableCellEditor> booleanCreator = new Function<DomElement, TableCellEditor>() {
+      @Override
       public TableCellEditor fun(final DomElement domElement) {
         return new BooleanTableCellEditor();
       }
@@ -67,6 +68,7 @@
     registerCustomCellEditor(Boolean.class, booleanCreator);
     registerCustomCellEditor(boolean.class, booleanCreator);
     registerCustomCellEditor(String.class, new Function<DomElement, TableCellEditor>() {
+      @Override
       public TableCellEditor fun(final DomElement domElement) {
         return new DefaultCellEditor(removeBorder(new JTextField()));
       }
@@ -77,6 +79,7 @@
     }
   }
 
+  @Override
   protected TableCellEditor createCellEditor(DomElement element, Class type) {
     if (Enum.class.isAssignableFrom(type)) {
       return new ComboTableCellEditor((Class<? extends Enum>)type, false);
@@ -87,14 +90,17 @@
     return function.fun(element);
   }
 
+  @Override
   public final UserActivityWatcher createEditorAwareUserActivityWatcher() {
     return new UserActivityWatcher() {
       private final DocumentAdapter myListener = new DocumentAdapter() {
+        @Override
         public void documentChanged(DocumentEvent e) {
           fireUIChanged();
         }
       };
 
+      @Override
       protected void processComponent(final Component component) {
         super.processComponent(component);
         if (component instanceof EditorComponentImpl) {
@@ -102,6 +108,7 @@
         }
       }
 
+      @Override
       protected void unprocessComponent(final Component component) {
         super.unprocessComponent(component);
         if (component instanceof EditorComponentImpl) {
@@ -111,11 +118,13 @@
     };
   }
 
+  @Override
   public void setupErrorOutdatingUserActivityWatcher(final CommittablePanel panel, final DomElement... elements) {
     final UserActivityWatcher userActivityWatcher = createEditorAwareUserActivityWatcher();
     userActivityWatcher.addUserActivityListener(new UserActivityListener() {
       private boolean isProcessingChange;
 
+      @Override
       public void stateChanged() {
         if (isProcessingChange) return;
         isProcessingChange = true;
@@ -133,19 +142,23 @@
     userActivityWatcher.register(panel.getComponent());
   }
 
+  @Override
   @Nullable
   public BaseControl createCustomControl(final Type type, DomWrapper<String> wrapper, final boolean commitOnEveryChange) {
     final Function<DomWrapper<String>, BaseControl> factory = myCustomControlCreators.get(ReflectionUtil.getRawType(type));
     return factory == null ? null : factory.fun(wrapper);
   }
 
+  @Override
   public CaptionComponent addErrorPanel(CaptionComponent captionComponent, DomElement... elements) {
     captionComponent.initErrorPanel(new DomElementsErrorPanel(elements));
     return captionComponent;
   }
 
+  @Override
   public BackgroundEditorHighlighter createDomHighlighter(final Project project, final PerspectiveFileEditor editor, final DomElement element) {
     return new BackgroundEditorHighlighter() {
+      @Override
       @NotNull
       public HighlightingPass[] createPassesForEditor() {
         if (!element.isValid()) return HighlightingPass.EMPTY_ARRAY;
@@ -168,6 +181,7 @@
         return new HighlightingPass[]{ghp, lip};
       }
 
+      @Override
       @NotNull
       public HighlightingPass[] createPassesForVisibleArea() {
         return createPassesForEditor();
@@ -176,14 +190,17 @@
 
   }
 
+  @Override
   public BaseControl createTextControl(DomWrapper<String> wrapper, final boolean commitOnEveryChange) {
     return new TextControl(wrapper, commitOnEveryChange);
   }
 
+  @Override
   public void registerCustomControl(Class aClass, Function<DomWrapper<String>, BaseControl> creator) {
     myCustomControlCreators.put(aClass, creator);
   }
 
+  @Override
   public void registerCustomCellEditor(final Class aClass, final Function<DomElement, TableCellEditor> creator) {
     myCustomCellEditorCreators.put(aClass, creator);
   }
diff --git a/xml/dom-impl/src/com/intellij/util/xml/ui/EditorTextFieldControl.java b/xml/dom-impl/src/com/intellij/util/xml/ui/EditorTextFieldControl.java
index eb27a93..e9a9f70 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/ui/EditorTextFieldControl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/ui/EditorTextFieldControl.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.
@@ -47,16 +47,19 @@
  */
 public abstract class EditorTextFieldControl<T extends JComponent> extends BaseModifiableControl<T, String> {
   private static final JTextField J_TEXT_FIELD = new JTextField() {
+    @Override
     public void addNotify() {
       throw new UnsupportedOperationException("Shouldn't be shown");
     }
 
+    @Override
     public void setVisible(boolean aFlag) {
       throw new UnsupportedOperationException("Shouldn't be shown");
     }
   };
   private final boolean myCommitOnEveryChange;
   private final DocumentListener myListener = new DocumentAdapter() {
+    @Override
     public void documentChanged(DocumentEvent e) {
       setModified();
       if (myCommitOnEveryChange) {
@@ -77,6 +80,7 @@
 
   protected abstract EditorTextField getEditorTextField(@NotNull T component);
 
+  @Override
   protected void doReset() {
     final EditorTextField textField = getEditorTextField(getComponent());
     textField.getDocument().removeDocumentListener(myListener);
@@ -84,14 +88,17 @@
     textField.getDocument().addDocumentListener(myListener);
   }
 
+  @Override
   protected JComponent getComponentToListenFocusLost(final T component) {
     return getEditorTextField(getComponent());
   }
 
+  @Override
   protected JComponent getHighlightedComponent(final T component) {
     return J_TEXT_FIELD;
   }
 
+  @Override
   protected T createMainComponent(T boundedComponent) {
     final Project project = getProject();
     boundedComponent = createMainComponent(boundedComponent, project);
@@ -104,15 +111,19 @@
 
   protected abstract T createMainComponent(T boundedComponent, Project project);
 
+  @Override
   @NotNull
   protected String getValue() {
     return getEditorTextField(getComponent()).getText();
   }
 
+  @Override
   protected void setValue(final String value) {
     CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() {
+      @Override
       public void run() {
         new WriteAction() {
+          @Override
           protected void run(Result result) throws Throwable {
             final T component = getComponent();
             final Document document = getEditorTextField(component).getDocument();
@@ -123,6 +134,7 @@
     });
   }
 
+  @Override
   protected void updateComponent() {
     final DomElement domElement = getDomElement();
     if (domElement == null || !domElement.isValid()) return;
@@ -130,6 +142,7 @@
     final EditorTextField textField = getEditorTextField(getComponent());
     final Project project = getProject();
     ApplicationManager.getApplication().invokeLater(new Runnable() {
+      @Override
       public void run() {
         if (!project.isOpen()) return;
         if (!getDomWrapper().isValid()) return;
@@ -170,13 +183,16 @@
 
   }
 
+  @Override
   public boolean canNavigate(final DomElement element) {
     return getDomElement().equals(element);
   }
 
+  @Override
   public void navigate(final DomElement element) {
     final EditorTextField field = getEditorTextField(getComponent());
     SwingUtilities.invokeLater(new Runnable() {
+      @Override
       public void run() {
         field.requestFocus();
         field.selectAll();
diff --git a/xml/dom-impl/src/com/intellij/util/xml/ui/TextControl.java b/xml/dom-impl/src/com/intellij/util/xml/ui/TextControl.java
index c6dec44..51702cb 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/ui/TextControl.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/ui/TextControl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -47,6 +47,7 @@
     super(domWrapper, commitOnEveryChange);
   }
 
+  @Override
   protected EditorTextField getEditorTextField(@NotNull final TextPanel panel) {
     final Component component = panel.getComponent(0);
     if (component instanceof ReferenceEditorWithBrowseButton) {
@@ -55,12 +56,14 @@
     return (EditorTextField)component;
   }
 
+  @Override
   protected TextPanel createMainComponent(TextPanel boundedComponent, final Project project) {
     if (boundedComponent == null) {
       boundedComponent = new TextPanel();
     }
     boundedComponent.removeAll();
     final Function<String, Document> factory = new Function<String, Document>() {
+      @Override
       public Document fun(final String s) {
         return PsiDocumentManager.getInstance(project)
         .getDocument(PsiFileFactory.getInstance(project).createFileFromText("a.txt", PlainTextLanguage.INSTANCE, "", true, false));
@@ -68,6 +71,7 @@
     };
     final TextPanel boundedComponent1 = boundedComponent;
     final EditorTextField editorTextField = new EditorTextField(factory.fun(""), project, FileTypes.PLAIN_TEXT) {
+      @Override
       protected EditorEx createEditor() {
         final EditorEx editor = super.createEditor();
         return boundedComponent1 instanceof MultiLineTextPanel ? makeBigEditor(editor, ((MultiLineTextPanel)boundedComponent1).getRowCount()) : editor;
@@ -82,8 +86,10 @@
       final ReferenceEditorWithBrowseButton editor = new ReferenceEditorWithBrowseButton(null, editorTextField, factory);
       boundedComponent.add(editor);
       editor.addActionListener(new ActionListener() {
+        @Override
         public void actionPerformed(ActionEvent e) {
           EditorTextField textArea = new EditorTextField(editorTextField.getDocument(), project, FileTypes.PLAIN_TEXT) {
+            @Override
             protected EditorEx createEditor() {
               final EditorEx editor = super.createEditor();
               editor.setEmbeddedIntoDialogWrapper(true);
diff --git a/xml/dom-impl/src/com/intellij/xml/impl/dom/AbstractDomChildrenDescriptor.java b/xml/dom-impl/src/com/intellij/xml/impl/dom/AbstractDomChildrenDescriptor.java
index e003931..bc750c2 100644
--- a/xml/dom-impl/src/com/intellij/xml/impl/dom/AbstractDomChildrenDescriptor.java
+++ b/xml/dom-impl/src/com/intellij/xml/impl/dom/AbstractDomChildrenDescriptor.java
@@ -49,6 +49,7 @@
     myManager = manager;
   }
 
+  @Override
   public XmlElementDescriptor[] getElementsDescriptors(final XmlTag context) {
     final DomElement domElement = myManager.getDomElement(context);
     if (domElement == null) return EMPTY_ARRAY;
@@ -104,6 +105,7 @@
     return null;
   }
 
+  @Override
   @Nullable
   public XmlElementDescriptor getElementDescriptor(@NotNull final XmlTag childTag, @Nullable XmlTag contextTag) {
     DomElement domElement = myManager.getDomElement(childTag);
@@ -147,6 +149,7 @@
     return new DomElementXmlDescriptor((DomChildrenDescription)description, myManager);
   }
 
+  @Override
   public XmlAttributeDescriptor[] getAttributesDescriptors(final @Nullable XmlTag context) {
     if (context == null) return XmlAttributeDescriptor.EMPTY;
 
@@ -172,6 +175,7 @@
     return descriptors.toArray(new XmlAttributeDescriptor[descriptors.size()]);
   }
 
+  @Override
   @Nullable
   public XmlAttributeDescriptor getAttributeDescriptor(final String attributeName, final @Nullable XmlTag context) {
     DomElement domElement = myManager.getDomElement(context);
@@ -185,57 +189,69 @@
     return null;
   }
 
+  @Override
   @Nullable
   public XmlAttributeDescriptor getAttributeDescriptor(final XmlAttribute attribute) {
     return getAttributeDescriptor(attribute.getName(), attribute.getParent());
   }
 
+  @Override
   public XmlNSDescriptor getNSDescriptor() {
     return new XmlNSDescriptor() {
+      @Override
       @Nullable
       public XmlElementDescriptor getElementDescriptor(@NotNull final XmlTag tag) {
         throw new UnsupportedOperationException("Method getElementDescriptor not implemented in " + getClass());
       }
 
+      @Override
       @NotNull
       public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable final XmlDocument document) {
         throw new UnsupportedOperationException("Method getRootElementsDescriptors not implemented in " + getClass());
       }
 
+      @Override
       @Nullable
       public XmlFile getDescriptorFile() {
         return null;
       }
 
+      @Override
       public boolean isHierarhyEnabled() {
         throw new UnsupportedOperationException("Method isHierarhyEnabled not implemented in " + getClass());
       }
 
+      @Override
       @Nullable
       public PsiElement getDeclaration() {
         throw new UnsupportedOperationException("Method getDeclaration not implemented in " + getClass());
       }
 
+      @Override
       @NonNls
       public String getName(final PsiElement context) {
         throw new UnsupportedOperationException("Method getName not implemented in " + getClass());
       }
 
+      @Override
       @NonNls
       public String getName() {
         throw new UnsupportedOperationException("Method getName not implemented in " + getClass());
       }
 
+      @Override
       public void init(final PsiElement element) {
         throw new UnsupportedOperationException("Method init not implemented in " + getClass());
       }
 
+      @Override
       public Object[] getDependences() {
         throw new UnsupportedOperationException("Method getDependences not implemented in " + getClass());
       }
     };
   }
 
+  @Override
   public int getContentType() {
     return CONTENT_TYPE_UNKNOWN;
   }
@@ -245,19 +261,23 @@
     return null;
   }
 
+  @Override
   public void init(final PsiElement element) {
     throw new UnsupportedOperationException("Method init not implemented in " + getClass());
   }
 
+  @Override
   public Object[] getDependences() {
     throw new UnsupportedOperationException("Method getDependences not implemented in " + getClass());
   }
 
+  @Override
   @NonNls
   public String getName() {
     return getDefaultName();
   }
 
+  @Override
   public String getQualifiedName() {
     return getDefaultName();
   }
diff --git a/xml/dom-impl/src/com/intellij/xml/impl/dom/DomAttributeXmlDescriptor.java b/xml/dom-impl/src/com/intellij/xml/impl/dom/DomAttributeXmlDescriptor.java
index 6354200..282215b 100644
--- a/xml/dom-impl/src/com/intellij/xml/impl/dom/DomAttributeXmlDescriptor.java
+++ b/xml/dom-impl/src/com/intellij/xml/impl/dom/DomAttributeXmlDescriptor.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.
@@ -43,47 +43,57 @@
     myProject = project;
   }
 
+  @Override
   public boolean isRequired() {
     final Required required = myDescription.getAnnotation(Required.class);
     return required != null && required.value();
   }
 
+  @Override
   public boolean isFixed() {
     return false;
   }
 
+  @Override
   public boolean hasIdType() {
     return false;
   }
 
+  @Override
   public boolean hasIdRefType() {
     return false;
   }
 
+  @Override
   @Nullable
   public String getDefaultValue() {
     return null;
   }//todo: refactor to hierarchy of value descriptor?
 
+  @Override
   public boolean isEnumerated() {
     return false;
   }
 
+  @Override
   @Nullable
   public String[] getEnumeratedValues() {
     return null;
   }
 
+  @Override
   @Nullable
   public String validateValue(final XmlElement context, final String value) {
     return null;
   }
 
+  @Override
   @Nullable
   public PsiElement getDeclaration() {
     return myDescription.getDeclaration(myProject);
   }
 
+  @Override
   @NonNls
   public String getName(final PsiElement context) {
     return getQualifiedAttributeName(context, myDescription.getXmlName());
@@ -108,6 +118,7 @@
     return localName;
   }
 
+  @Override
   @NonNls
   public String getName() {
     return getLocalName();
@@ -117,6 +128,7 @@
     return myDescription.getXmlName().getLocalName();
   }
 
+  @Override
   @Nullable
   public String getNamespace(@NotNull XmlTag context) {
     final DomInvocationHandler handler = DomManagerImpl.getDomManager(myProject).getDomHandler(context);
@@ -127,10 +139,12 @@
     return handler.createEvaluatedXmlName(myDescription.getXmlName()).getNamespace(context, handler.getFile());
   }
 
+  @Override
   public void init(final PsiElement element) {
     throw new UnsupportedOperationException("Method init not implemented in " + getClass());
   }
 
+  @Override
   public Object[] getDependences() {
     throw new UnsupportedOperationException("Method getDependences not implemented in " + getClass());
   }
diff --git a/xml/dom-impl/src/com/intellij/xml/impl/dom/DomElementXmlDescriptor.java b/xml/dom-impl/src/com/intellij/xml/impl/dom/DomElementXmlDescriptor.java
index d589485..e754a54 100644
--- a/xml/dom-impl/src/com/intellij/xml/impl/dom/DomElementXmlDescriptor.java
+++ b/xml/dom-impl/src/com/intellij/xml/impl/dom/DomElementXmlDescriptor.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.
@@ -50,15 +50,18 @@
     myChildrenDescription = childrenDescription;
   }
 
+  @Override
   public String getDefaultName() {
     return myChildrenDescription.getXmlElementName();
   }
 
+  @Override
   @Nullable
   public PsiElement getDeclaration() {
     return myChildrenDescription.getDeclaration(myManager.getProject());
   }
 
+  @Override
   @NonNls
   public String getName(final PsiElement context) {
     final String name = getDefaultName();
@@ -95,65 +98,79 @@
       myDomElement = domElement;
     }
 
+    @Override
     public String getName() {
       return getXmlElementName();
     }
 
+    @Override
     public boolean isValid() {
       return true;
     }
 
+    @Override
     public void navigate(boolean requestFocus) {
     }
 
+    @Override
     public boolean canNavigate() {
       return false;
     }
 
+    @Override
     public boolean canNavigateToSource() {
       return false;
     }
 
+    @Override
     @NotNull
     public XmlName getXmlName() {
       throw new UnsupportedOperationException("Method getXmlName not implemented in " + getClass());
     }
 
+    @Override
     @NotNull
     public String getXmlElementName() {
       return myDomElement.getXmlElementName();
     }
 
+    @Override
     @NotNull
       public String getCommonPresentableName(@NotNull final DomNameStrategy strategy) {
       throw new UnsupportedOperationException("Method getCommonPresentableName not implemented in " + getClass());
     }
 
+    @Override
     @NotNull
       public String getCommonPresentableName(@NotNull final DomElement parent) {
       throw new UnsupportedOperationException("Method getCommonPresentableName not implemented in " + getClass());
     }
 
+    @Override
     @NotNull
       public List<? extends DomElement> getValues(@NotNull final DomElement parent) {
       throw new UnsupportedOperationException("Method getValues not implemented in " + getClass());
     }
 
+    @Override
     @NotNull
       public List<? extends DomElement> getStableValues(@NotNull final DomElement parent) {
       throw new UnsupportedOperationException("Method getStableValues not implemented in " + getClass());
     }
 
+    @Override
     @NotNull
       public Type getType() {
       throw new UnsupportedOperationException("Method getType not implemented in " + getClass());
     }
 
+    @Override
     @NotNull
       public DomNameStrategy getDomNameStrategy(@NotNull final DomElement parent) {
       throw new UnsupportedOperationException("Method getDomNameStrategy not implemented in " + getClass());
     }
 
+    @Override
     public <T> T getUserData(final Key<T> key) {
       return null;
     }
@@ -163,11 +180,13 @@
       return null;
     }
 
+    @Override
     @Nullable
       public <T extends Annotation> T getAnnotation(final Class<T> annotationClass) {
           throw new UnsupportedOperationException("Method getAnnotation not implemented in " + getClass());
         }
 
+    @Override
     @Nullable
     public PsiElement getDeclaration(final Project project) {
       return PomService.convertToPsi(project, this);
diff --git a/xml/dom-openapi/src/com/intellij/patterns/DomElementPattern.java b/xml/dom-openapi/src/com/intellij/patterns/DomElementPattern.java
index e68cf0d..3e24bd6 100644
--- a/xml/dom-openapi/src/com/intellij/patterns/DomElementPattern.java
+++ b/xml/dom-openapi/src/com/intellij/patterns/DomElementPattern.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.
@@ -38,13 +38,16 @@
     super(condition);
   }
 
+  @Override
   protected DomElement getParent(@NotNull DomElement t) {
     return t.getParent();
   }
 
+  @Override
   protected DomElement[] getChildren(@NotNull final DomElement domElement) {
     final List<DomElement> children = new ArrayList<DomElement>();
     domElement.acceptChildren(new DomElementVisitor() {
+      @Override
       public void visitDomElement(final DomElement element) {
         children.add(element);
       }
@@ -61,6 +64,7 @@
 
   public Self withChild(@NonNls @NotNull final String localName, final ElementPattern pattern) {
     return with(new PatternCondition<T>("withChild") {
+      @Override
       public boolean accepts(@NotNull final T t, final ProcessingContext context) {
         for (final AbstractDomChildrenDescription description : t.getGenericInfo().getChildrenDescriptions()) {
           if (!(description instanceof DomChildrenDescription) || localName.equals(((DomChildrenDescription)description).getXmlElementName())) {
diff --git a/xml/dom-openapi/src/com/intellij/patterns/DomPatterns.java b/xml/dom-openapi/src/com/intellij/patterns/DomPatterns.java
index 025b42c..aa5bfdb 100644
--- a/xml/dom-openapi/src/com/intellij/patterns/DomPatterns.java
+++ b/xml/dom-openapi/src/com/intellij/patterns/DomPatterns.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.
@@ -52,6 +52,7 @@
 
   public static XmlElementPattern.Capture withDom(final ElementPattern<? extends DomElement> pattern) {
     return new XmlElementPattern.Capture().with(new PatternCondition<XmlElement>("tagWithDom") {
+      @Override
       public boolean accepts(@NotNull final XmlElement xmlElement, final ProcessingContext context) {
         final DomManager manager = DomManager.getDomManager(xmlElement.getProject());
         if (xmlElement instanceof XmlAttribute) {
diff --git a/xml/dom-openapi/src/com/intellij/patterns/GenericDomValuePattern.java b/xml/dom-openapi/src/com/intellij/patterns/GenericDomValuePattern.java
index f02965b..b990f9b 100644
--- a/xml/dom-openapi/src/com/intellij/patterns/GenericDomValuePattern.java
+++ b/xml/dom-openapi/src/com/intellij/patterns/GenericDomValuePattern.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.
@@ -26,6 +26,7 @@
  */
 public class GenericDomValuePattern<T> extends DomElementPattern<GenericDomValue<T>, GenericDomValuePattern<T>>{
   private static final InitialPatternCondition CONDITION = new InitialPatternCondition(GenericDomValue.class) {
+    @Override
     public boolean accepts(@Nullable final Object o, final ProcessingContext context) {
       return o instanceof GenericDomValue;
     }
@@ -37,6 +38,7 @@
 
   protected GenericDomValuePattern(final Class<T> aClass) {
     super(new InitialPatternCondition(aClass) {
+      @Override
       public boolean accepts(@Nullable final Object o, final ProcessingContext context) {
         return o instanceof GenericDomValue && aClass.equals(DomUtil.getGenericValueParameter(((GenericDomValue)o).getDomElementType()));
       }
@@ -46,6 +48,7 @@
 
   public GenericDomValuePattern<T> withStringValue(final ElementPattern<String> pattern) {
     return with(new PatternCondition<GenericDomValue<T>>("withStringValue") {
+      @Override
       public boolean accepts(@NotNull final GenericDomValue<T> genericDomValue, final ProcessingContext context) {
         return pattern.getCondition().accepts(genericDomValue.getStringValue(), context);
       }
@@ -59,6 +62,7 @@
 
   public GenericDomValuePattern<T> withValue(final ElementPattern<?> pattern) {
     return with(new PatternCondition<GenericDomValue<T>>("withValue") {
+      @Override
       public boolean accepts(@NotNull final GenericDomValue<T> genericDomValue, final ProcessingContext context) {
         return pattern.getCondition().accepts(genericDomValue.getValue(), context);
       }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/AbstractConvertContext.java b/xml/dom-openapi/src/com/intellij/util/xml/AbstractConvertContext.java
index fc7cbef..c2799d7 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/AbstractConvertContext.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/AbstractConvertContext.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -34,33 +34,39 @@
  */
 public abstract class AbstractConvertContext extends ConvertContext {
 
+  @Override
   public final XmlTag getTag() {
     return getInvocationElement().getXmlTag();
   }
 
+  @Override
   @Nullable
   public XmlElement getXmlElement() {
     return getInvocationElement().getXmlElement();
   }
 
+  @Override
   @NotNull
   public final XmlFile getFile() {
     return DomUtil.getFile(getInvocationElement());
   }
 
+  @Override
   public Module getModule() {
     final DomFileElement<DomElement> fileElement = DomUtil.getFileElement(getInvocationElement());
     if (fileElement == null) {
       final XmlElement xmlElement = getInvocationElement().getXmlElement();
       return xmlElement == null ? null : ModuleUtilCore.findModuleForPsiElement(xmlElement);
     }
-    return fileElement.getRootElement().getModule();
+    return fileElement.isValid() ? fileElement.getRootElement().getModule() : null;
   }
 
+  @Override
   public PsiManager getPsiManager() {
     return getFile().getManager();
   }
 
+  @Override
   @Nullable
   public GlobalSearchScope getSearchScope() {
     GlobalSearchScope scope = null;
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/Converter.java b/xml/dom-openapi/src/com/intellij/util/xml/Converter.java
index 48a02fc..38f542d 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/Converter.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/Converter.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.
@@ -53,6 +53,7 @@
    */
   @Deprecated
   public static final Converter<Integer> INTEGER_CONVERTER = new Converter<Integer>() {
+    @Override
     public Integer fromString(final String s, final ConvertContext context) {
       if (s == null) return null;
       try {
@@ -63,10 +64,12 @@
       }
     }
 
+    @Override
     public String toString(final Integer t, final ConvertContext context) {
       return t == null? null: t.toString();
     }
 
+    @Override
     public String getErrorMessage(final String s, final ConvertContext context) {
       return IdeBundle.message("value.should.be.integer");
     }
@@ -74,10 +77,12 @@
 
   @Deprecated
   public static final Converter<String> EMPTY_CONVERTER = new Converter<String>() {
+    @Override
     public String fromString(final String s, final ConvertContext context) {
       return s;
     }
 
+    @Override
     public String toString(final String t, final ConvertContext context) {
       return t;
     }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DomFileDescription.java b/xml/dom-openapi/src/com/intellij/util/xml/DomFileDescription.java
index 74dc6a8..eb5de3e 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/DomFileDescription.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/DomFileDescription.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.
@@ -220,7 +220,7 @@
    * @return dependency item set 
    */
   @NotNull
-  public Set<? extends Object> getDependencyItems(XmlFile file) {
+  public Set<?> getDependencyItems(XmlFile file) {
     return Collections.emptySet();
   }
 
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DomIconProvider.java b/xml/dom-openapi/src/com/intellij/util/xml/DomIconProvider.java
index fd47a61..bd5a9c2 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/DomIconProvider.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/DomIconProvider.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.
@@ -28,6 +28,7 @@
  * @see com.intellij.ide.presentation.Presentation
  */
 public abstract class DomIconProvider extends PomIconProvider {
+  @Override
   public Icon getIcon(@NotNull PomTarget target, int flags) {
     if (target instanceof DomTarget) {
       return getIcon(((DomTarget)target).getDomElement(), flags);
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DomMetaData.java b/xml/dom-openapi/src/com/intellij/util/xml/DomMetaData.java
index 0975c4a..dd94f5b 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/DomMetaData.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/DomMetaData.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.
@@ -34,6 +34,7 @@
   @Nullable
   private GenericDomValue myNameElement;
 
+  @Override
   public final PsiElement getDeclaration() {
     return myElement.getXmlTag();
   }
@@ -42,11 +43,13 @@
     return myElement;
   }
 
+  @Override
   @NonNls
   public String getName(PsiElement context) {
     return getName();
   }
 
+  @Override
   @NonNls
   public final String getName() {
     final String s = ElementPresentationManager.getElementName(myElement);
@@ -56,6 +59,7 @@
     return value == null ? null : value.getStringValue();
   }
 
+  @Override
   public void init(PsiElement element) {
     myElement = (T) DomManager.getDomManager(element.getProject()).getDomElement((XmlTag)element);
     assert myElement != null : element;
@@ -71,6 +75,7 @@
     return myElement.getGenericInfo().getNameDomElement(t);
   }
 
+  @Override
   public Object[] getDependences() {
     final PsiElement declaration = getDeclaration();
     if (myElement != null && myElement.isValid()) {
@@ -79,16 +84,19 @@
     return new Object[]{declaration};
   }
 
+  @Override
   public void setName(String name) throws IncorrectOperationException {
     if (myNameElement != null) {
       myNameElement.setStringValue(name);
     }
   }
 
+  @Override
   public String getTypeName() {
     return ElementPresentationManager.getTypeNameForObject(myElement);
   }
 
+  @Override
   public Icon getIcon() {
     return ElementPresentationManager.getIcon(myElement);
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DomResolveConverter.java b/xml/dom-openapi/src/com/intellij/util/xml/DomResolveConverter.java
index 22a59e2..6bcc8a9 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/DomResolveConverter.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/DomResolveConverter.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.
@@ -44,6 +44,7 @@
  */
 public class DomResolveConverter<T extends DomElement> extends ResolvingConverter<T>{
   private static final FactoryMap<Class<? extends DomElement>,DomResolveConverter> ourCache = new ConcurrentFactoryMap<Class<? extends DomElement>, DomResolveConverter>() {
+    @Override
     @NotNull
     protected DomResolveConverter create(final Class<? extends DomElement> key) {
       return new DomResolveConverter(key);
@@ -51,11 +52,13 @@
   };
   private final boolean myAttribute;
   private final SoftFactoryMap<DomElement, CachedValue<Map<String, DomElement>>> myResolveCache = new SoftFactoryMap<DomElement, CachedValue<Map<String, DomElement>>>() {
+    @Override
     @NotNull
     protected CachedValue<Map<String, DomElement>> create(final DomElement scope) {
       final DomManager domManager = scope.getManager();
       final Project project = domManager.getProject();
       return CachedValuesManager.getManager(project).createCachedValue(new CachedValueProvider<Map<String, DomElement>>() {
+        @Override
         public Result<Map<String, DomElement>> compute() {
           final Map<String, DomElement> map = new THashMap<String, DomElement>();
           visitDomElement(scope, map);
@@ -91,6 +94,7 @@
     return ourCache.get(aClass);
   }
 
+  @Override
   public final T fromString(final String s, final ConvertContext context) {
     if (s == null) return null;
     return (T) myResolveCache.get(getResolvingScope(context)).getValue().get(s);
@@ -113,16 +117,19 @@
     return invocationElement.getManager().getResolvingScope((GenericDomValue)invocationElement);
   }
 
+  @Override
   public String getErrorMessage(final String s, final ConvertContext context) {
 
     return CodeInsightBundle.message("error.cannot.resolve.0.1", TypePresentationService.getService().getTypePresentableName(myClass), s);
   }
 
+  @Override
   public final String toString(final T t, final ConvertContext context) {
     if (t == null) return null;
     return ElementPresentationManager.getElementName(t);
   }
 
+  @Override
   @NotNull
   public Collection<? extends T> getVariants(final ConvertContext context) {
     final DomElement reference = context.getInvocationElement();
@@ -130,6 +137,7 @@
     return (Collection<T>)myResolveCache.get(scope).getValue().values();
   }
 
+  @Override
   public LocalQuickFix[] getQuickFixes(final ConvertContext context) {
     final DomElement element = context.getInvocationElement();
     final GenericDomValue value = ((GenericDomValue)element).createStableCopy();
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DomService.java b/xml/dom-openapi/src/com/intellij/util/xml/DomService.java
index 11a6b63..dced490 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/DomService.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/DomService.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.
@@ -54,6 +54,7 @@
    */
   public Collection<VirtualFile> getDomFileCandidates(Class<? extends DomElement> rootElementClass, Project project, final GlobalSearchScope scope) {
     return ContainerUtil.findAll(getDomFileCandidates(rootElementClass, project), new Condition<VirtualFile>() {
+      @Override
       public boolean value(final VirtualFile file) {
         return scope.contains(file);
       }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DomTarget.java b/xml/dom-openapi/src/com/intellij/util/xml/DomTarget.java
index 9f061d0..21236fe 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/DomTarget.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/DomTarget.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.
@@ -81,19 +81,23 @@
     return new DomTarget(element, tag, XmlTagUtil.getTrimmedValueRange(tag), nameElement);
   }
 
+  @Override
   public TextRange getNameIdentifierRange() {
     return myRange;
   }
 
+  @Override
   public boolean isWritable() {
     return getNavigationElement().isWritable();
   }
 
+  @Override
   public Object setName(@NotNull String newName) {
     myNameDomElement.setStringValue(newName);
     return myDomElement;
   }
 
+  @Override
   @Nullable
   public String getName() {
     return myNameDomElement.getStringValue();
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DomUtil.java b/xml/dom-openapi/src/com/intellij/util/xml/DomUtil.java
index 2622a2b..723568d 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/DomUtil.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/DomUtil.java
@@ -53,6 +53,7 @@
   private static final Key<DomFileElement> FILE_ELEMENT_KEY = Key.create("dom file element");
 
   private static final ConcurrentFactoryMap<Type, Class> ourTypeParameters = new ConcurrentFactoryMap<Type, Class>() {
+    @Override
     @NotNull
     protected Class create(final Type key) {
       final Class<?> result = substituteGenericType(GENERIC_VALUE_TYPE_VARIABLE, key);
@@ -60,6 +61,7 @@
     }
   };
   private static final ConcurrentFactoryMap<Couple<Type>, Class> ourVariableSubstitutions = new ConcurrentFactoryMap<Couple<Type>, Class>() {
+    @Override
     @Nullable
     protected Class create(final Couple<Type> key) {
       return ReflectionUtil.substituteGenericType(key.first, key.second);
@@ -160,7 +162,7 @@
   }
 
   public static Class<?> substituteGenericType(Type genericType, Type classType) {
-    return ourVariableSubstitutions.get(Couple.newOne(genericType, classType));
+    return ourVariableSubstitutions.get(Couple.of(genericType, classType));
   }
 
   @Nullable
@@ -208,6 +210,7 @@
   public static <T> List<T> getChildrenOfType(@NotNull final DomElement parent, final Class<T> type) {
     final List<T> result = new SmartList<T>();
     parent.acceptChildren(new DomElementVisitor() {
+      @Override
       public void visitDomElement(final DomElement element) {
         if (type.isInstance(element)) {
           result.add((T)element);
@@ -221,6 +224,7 @@
     if (parent instanceof MergedObject) {
       final SmartList<DomElement> result = new SmartList<DomElement>();
       parent.acceptChildren(new DomElementVisitor() {
+        @Override
         public void visitDomElement(final DomElement element) {
           if (hasXml(element)) {
             result.add(element);
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DummyEvaluatedXmlName.java b/xml/dom-openapi/src/com/intellij/util/xml/DummyEvaluatedXmlName.java
index 30dbe7f..dedd40e 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/DummyEvaluatedXmlName.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/DummyEvaluatedXmlName.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.
@@ -36,10 +36,12 @@
     myNamespace = namespace;
   }
 
+  @Override
   public XmlName getXmlName() {
     return myXmlName;
   }
 
+  @Override
   public EvaluatedXmlName evaluateChildName(@NotNull final XmlName name) {
     String namespaceKey = name.getNamespaceKey();
     if (namespaceKey == null) {
@@ -48,10 +50,12 @@
     return EvaluatedXmlNameImpl.createEvaluatedXmlName(name, namespaceKey, false);
   }
 
+  @Override
   public boolean isNamespaceAllowed(final String namespace, final XmlFile file, boolean qualified) {
     return namespace.equals(myNamespace);
   }
 
+  @Override
   @NotNull
   @NonNls
   public String getNamespace(@NotNull final XmlElement parentElement, final XmlFile file) {
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ElementPresentationManager.java b/xml/dom-openapi/src/com/intellij/util/xml/ElementPresentationManager.java
index 1092a54..72a33b8 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ElementPresentationManager.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ElementPresentationManager.java
@@ -43,6 +43,7 @@
  */
 public abstract class ElementPresentationManager {
   private static final ConcurrentFactoryMap<Class,Method> ourNameValueMethods = new ConcurrentFactoryMap<Class, Method>() {
+    @Override
     @Nullable
     protected Method create(final Class key) {
       for (final Method method : ReflectionUtil.getClassPublicMethods(key)) {
@@ -55,6 +56,7 @@
   };
 
   private final static Function<Object, String> DEFAULT_NAMER = new Function<Object, String>() {
+    @Override
     @Nullable
     public String fun(final Object element) {
       return getElementName(element);
@@ -96,6 +98,7 @@
 
   static {
     ourIconProviders.add(new NullableFunction<Object, Icon>() {
+      @Override
       public Icon fun(final Object o) {
         return o instanceof Iconable ? ((Iconable)o).getIcon(Iconable.ICON_FLAG_READ_STATUS) : null;
       }
@@ -115,8 +118,9 @@
   public static void registerDocumentationProvider(Function<Object, String> function) { ourDocumentationProviders.add(function); }
 
 
-  public static final <T>NullableFunction<T, String> NAMER() {
+  public static <T>NullableFunction<T, String> NAMER() {
     return new NullableFunction<T, String>() {
+      @Override
       public String fun(final T o) {
         return getElementName(o);
       }
@@ -124,6 +128,7 @@
   }
 
   public static final NullableFunction<Object, String> NAMER = new NullableFunction<Object, String>() {
+    @Override
     public String fun(final Object o) {
       return getElementName(o);
     }
@@ -259,7 +264,7 @@
     return null;
   }
 
-  public static Method findNameValueMethod(final Class<? extends Object> aClass) {
+  public static Method findNameValueMethod(final Class<?> aClass) {
     synchronized (ourNameValueMethods) {
       return ourNameValueMethods.get(aClass);
     }
@@ -268,6 +273,7 @@
   @Nullable
   public static <T> T findByName(Collection<T> collection, final String name) {
     return ContainerUtil.find(collection, new Condition<T>() {
+      @Override
       public boolean value(final T object) {
         return Comparing.equal(name, getElementName(object), true);
       }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/EvaluatedXmlNameImpl.java b/xml/dom-openapi/src/com/intellij/util/xml/EvaluatedXmlNameImpl.java
index c2422f0..a0caa34 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/EvaluatedXmlNameImpl.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/EvaluatedXmlNameImpl.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.
@@ -55,10 +55,12 @@
     return myXmlName.getLocalName();
   }
 
+  @Override
   public final XmlName getXmlName() {
     return myXmlName;
   }
 
+  @Override
   public final EvaluatedXmlName evaluateChildName(@NotNull final XmlName name) {
     String namespaceKey = name.getNamespaceKey();
     final boolean equalToParent = Comparing.equal(namespaceKey, myNamespaceKey);
@@ -105,8 +107,10 @@
     CachedValue<FactoryMap<String, List<String>>> value = file.getUserData(NAMESPACE_PROVIDER_KEY);
     if (value == null) {
       file.putUserData(NAMESPACE_PROVIDER_KEY, value = CachedValuesManager.getManager(file.getProject()).createCachedValue(new CachedValueProvider<FactoryMap<String, List<String>>>() {
+          @Override
           public Result<FactoryMap<String, List<String>>> compute() {
             final FactoryMap<String, List<String>> map = new ConcurrentFactoryMap<String, List<String>>() {
+              @Override
               protected List<String> create(final String key) {
                 final DomFileDescription<?> description = DomManager.getDomManager(file.getProject()).getDomFileDescription(file);
                 if (description == null) return Collections.emptyList();
@@ -128,10 +132,12 @@
 
   }
 
+  @Override
   public final boolean isNamespaceAllowed(String namespace, final XmlFile file, boolean qualified) {
     return myNamespaceKey == null || myEqualToParent && !qualified || isNamespaceAllowed(namespace, getNamespaceList(file));
   }
 
+  @Override
   @NotNull @NonNls
   public final String getNamespace(@NotNull XmlElement parentElement, final XmlFile file) {
     final String xmlElementNamespace = getXmlElementNamespace(parentElement);
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/GenericDomValue.java b/xml/dom-openapi/src/com/intellij/util/xml/GenericDomValue.java
index ce75a5f..3eecaa4 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/GenericDomValue.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/GenericDomValue.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.
@@ -25,9 +25,11 @@
   @NotNull
   Converter<T> getConverter();
 
+  @Override
   @TagValue
   void setStringValue(String value);
 
+  @Override
   void setValue(T value);
 
   /**
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/GenericValueUtil.java b/xml/dom-openapi/src/com/intellij/util/xml/GenericValueUtil.java
index d83c043..814f46f 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/GenericValueUtil.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/GenericValueUtil.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.
@@ -31,11 +31,13 @@
   }
 
   public static NullableFunction<GenericValue, String> STRING_VALUE = new NullableFunction<GenericValue, String>() {
+    @Override
     public String fun(final GenericValue genericValue) {
       return genericValue.getStringValue();
     }
   };
   public static NullableFunction<GenericValue, Object> OBJECT_VALUE = new NullableFunction<GenericValue, Object>() {
+    @Override
     public Object fun(final GenericValue genericValue) {
       return genericValue.getValue();
     }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/HyphenNameStrategy.java b/xml/dom-openapi/src/com/intellij/util/xml/HyphenNameStrategy.java
index 2242e0f..dd1c111 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/HyphenNameStrategy.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/HyphenNameStrategy.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.
@@ -25,6 +25,7 @@
  * @author peter
  */
 public class HyphenNameStrategy extends DomNameStrategy {
+  @Override
   public String convertName(String propertyName) {
     final String[] words = NameUtil.nameToWords(propertyName);
     for (int i = 0; i < words.length; i++) {
@@ -33,6 +34,7 @@
     return StringUtil.join(words, "-");
   }
 
+  @Override
   public String splitIntoWords(final String tagName) {
     return tagName.replace('-', ' ');
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/JavaMethod.java b/xml/dom-openapi/src/com/intellij/util/xml/JavaMethod.java
index c4fe1c9..4f615da 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/JavaMethod.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/JavaMethod.java
@@ -92,6 +92,7 @@
     return myMethod.getName();
   }
 
+  @Override
   public final <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
     Object annotation = myAnnotationsMap.get(annotationClass);
     if (annotation == null) {
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/JavaNameStrategy.java b/xml/dom-openapi/src/com/intellij/util/xml/JavaNameStrategy.java
index e6cabb9..998f406 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/JavaNameStrategy.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/JavaNameStrategy.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.
@@ -28,15 +28,18 @@
  */
 public class JavaNameStrategy extends DomNameStrategy {
   public static final Function<String,String> DECAPITALIZE_FUNCTION = new Function<String, String>() {
+    @Override
     public String fun(final String s) {
       return StringUtil.decapitalize(s);
     }
   };
 
+  @Override
   public final String convertName(String propertyName) {
     return StringUtil.decapitalize(propertyName);
   }
 
+  @Override
   public final String splitIntoWords(final String tagName) {
     return StringUtil.join(Arrays.asList(NameUtil.nameToWords(tagName)), DECAPITALIZE_FUNCTION, " ");
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/MergingFileDescription.java b/xml/dom-openapi/src/com/intellij/util/xml/MergingFileDescription.java
index 1dbe3d4..451e275 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/MergingFileDescription.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/MergingFileDescription.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.
@@ -38,6 +38,7 @@
   @NotNull
   protected abstract Set<XmlFile> getFilesToMerge(DomElement element);
 
+  @Override
   @NotNull
   public DomElement getResolveScope(GenericDomValue<?> reference) {
     final DomElement annotation = getScopeFromAnnotation(reference);
@@ -82,6 +83,7 @@
     return myMerger.mergeModels(getRootElementClass(), roots);
   }
 
+  @Override
   @NotNull
   public DomElement getIdentityScope(DomElement element) {
     final DomElement annotation = getScopeFromAnnotation(element);
@@ -98,6 +100,7 @@
     return (DomElement)o;
   }
 
+  @Override
   public boolean isAutomaticHighlightingEnabled() {
     return false;
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ModelMergerUtil.java b/xml/dom-openapi/src/com/intellij/util/xml/ModelMergerUtil.java
index 2481f42..2b38c6a 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ModelMergerUtil.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ModelMergerUtil.java
@@ -59,6 +59,7 @@
   public static <T, V> V getImplementation(final T element, final Class<V> clazz) {
     if (element == null) return null;
     CommonProcessors.FindFirstProcessor<T> processor = new CommonProcessors.FindFirstProcessor<T>() {
+      @Override
       public boolean process(final T t) {
         return !ReflectionUtil.isAssignable(clazz, t.getClass()) || super.process(t);
       }
@@ -71,6 +72,7 @@
   public static <T, V> Collection<V> getImplementations(final T element, final Class<V> clazz) {
     if (element == null) return Collections.emptyList();
     CommonProcessors.CollectProcessor<T> processor = new CommonProcessors.CollectProcessor<T>() {
+      @Override
       public boolean process(final T t) {
         return !ReflectionUtil.isAssignable(clazz, t.getClass()) || super.process(t);
       }
@@ -115,6 +117,7 @@
       myProcessMerged = processMerged;
     }
 
+    @Override
     public boolean process(final T t) {
       final boolean merged = t instanceof MergedObject;
       if ((!merged || myProcessMerged) && !myProcessor.process(t)) {
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ModuleContentRootSearchScope.java b/xml/dom-openapi/src/com/intellij/util/xml/ModuleContentRootSearchScope.java
index 8a50940..2b54b14 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ModuleContentRootSearchScope.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ModuleContentRootSearchScope.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -31,18 +31,22 @@
     myModule = module;
   }
 
+  @Override
   public boolean contains(@NotNull final VirtualFile file) {
     return myRootManager.getFileIndex().isInContent(file);
   }
 
+  @Override
   public int compare(@NotNull final VirtualFile file1, @NotNull final VirtualFile file2) {
     return 0;
   }
 
+  @Override
   public boolean isSearchInModuleContent(@NotNull final Module aModule) {
     return aModule == myModule;
   }
 
+  @Override
   public boolean isSearchInLibraries() {
     return false;
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/NamedEnumUtil.java b/xml/dom-openapi/src/com/intellij/util/xml/NamedEnumUtil.java
index 85a59b8..d8bada0 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/NamedEnumUtil.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/NamedEnumUtil.java
@@ -24,11 +24,13 @@
  */
 public class NamedEnumUtil {
   private static final Function<Enum, String> NAMED_SHOW = new Function<Enum, String>() {
+    @Override
     public String fun(final Enum s) {
       return ((NamedEnum) s).getValue();
     }
   };
   private static final Function<Enum, String> SIMPLE_SHOW = new Function<Enum, String>() {
+    @Override
     public String fun(final Enum s) {
       return s.name();
     }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ParentScopeProvider.java b/xml/dom-openapi/src/com/intellij/util/xml/ParentScopeProvider.java
index c84fa31..a476377 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ParentScopeProvider.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ParentScopeProvider.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.
@@ -19,6 +19,7 @@
  * @author peter
  */
 public class ParentScopeProvider extends ScopeProvider{
+  @Override
   public DomElement getScope(DomElement element) {
     return element.getParent();
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ResolvingConverter.java b/xml/dom-openapi/src/com/intellij/util/xml/ResolvingConverter.java
index f6aa635..7c39d3e 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ResolvingConverter.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ResolvingConverter.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.
@@ -37,15 +37,18 @@
 public abstract class ResolvingConverter<T> extends Converter<T> {
   @Deprecated
   public static final ResolvingConverter EMPTY_CONVERTER = new ResolvingConverter() {
+    @Override
     @NotNull
     public Collection getVariants(final ConvertContext context) {
       return Collections.emptyList();
     }
 
+    @Override
     public Object fromString(final String s, final ConvertContext context) {
       return s;
     }
 
+    @Override
     public String toString(final Object t, final ConvertContext context) {
       return String.valueOf(t);
     }
@@ -54,6 +57,7 @@
   /** @see com.intellij.util.xml.converters.values.BooleanValueConverter */
   @Deprecated
   public static final Converter<Boolean> BOOLEAN_CONVERTER = new ResolvingConverter<Boolean>() {
+    @Override
     public Boolean fromString(final String s, final ConvertContext context) {
       if ("true".equalsIgnoreCase(s)) {
         return Boolean.TRUE;
@@ -64,10 +68,12 @@
       return null;
     }
 
+    @Override
     public String toString(final Boolean t, final ConvertContext context) {
       return t == null? null:t.toString();
     }
 
+    @Override
     @NotNull
     public Collection<? extends Boolean> getVariants(final ConvertContext context) {
       final DomElement element = context.getInvocationElement();
@@ -80,6 +86,7 @@
     }
   };
 
+  @Override
   public String getErrorMessage(@Nullable String s, final ConvertContext context) {
     return CodeInsightBundle.message("error.cannot.resolve.default.message", s);
   }
@@ -202,10 +209,12 @@
    */
   public static abstract class StringConverter extends ResolvingConverter<String> {
 
+    @Override
     public String fromString(final String s, final ConvertContext context) {
       return s;
     }
 
+    @Override
     public String toString(final String s, final ConvertContext context) {
       return s;
     }
@@ -223,10 +232,12 @@
       myWrappedConverter = converter;
     }
 
+    @Override
     public T fromString(final String s, final ConvertContext context) {
       return myWrappedConverter.fromString(s, context);
     }
 
+    @Override
     public String toString(final T t, final ConvertContext context) {
       return myWrappedConverter.toString(t, context);
     }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/RootScopeProvider.java b/xml/dom-openapi/src/com/intellij/util/xml/RootScopeProvider.java
index 79e1923..53e559a 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/RootScopeProvider.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/RootScopeProvider.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.
@@ -22,6 +22,7 @@
  */
 public class RootScopeProvider extends ScopeProvider{
 
+  @Override
   public DomElement getScope(@NotNull DomElement element) {
     return DomUtil.getRoot(element);
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/TypeChooserManager.java b/xml/dom-openapi/src/com/intellij/util/xml/TypeChooserManager.java
index 5086052..6602d0f 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/TypeChooserManager.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/TypeChooserManager.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.
@@ -30,13 +30,16 @@
   public TypeChooser getTypeChooser(final Type type) {
     final TypeChooser typeChooser = myClassChoosers.get(type);
     return typeChooser != null ? typeChooser : new TypeChooser() {
+      @Override
       public Type chooseType(final XmlTag tag) {
         return type;
       }
 
+      @Override
       public void distinguishTag(final XmlTag tag, final Type aClass) {
       }
 
+      @Override
       public Type[] getChooserTypes() {
         return new Type[]{type};
       }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/WrappingConverter.java b/xml/dom-openapi/src/com/intellij/util/xml/WrappingConverter.java
index c80c89b..a0305a9 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/WrappingConverter.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/WrappingConverter.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.
@@ -30,6 +30,7 @@
  */
 public abstract class WrappingConverter extends Converter<Object> {
 
+  @Override
   public Object fromString(@Nullable @NonNls String s, final ConvertContext context) {
     final List<Converter> converters = getConverters((GenericDomValue)context.getInvocationElement());
     if (converters.isEmpty()) return s;
@@ -42,6 +43,7 @@
     return null;
   }
 
+  @Override
   public String toString(@Nullable Object t, final ConvertContext context) {
     final List<Converter> converters = getConverters((GenericDomValue)context.getInvocationElement());
     if (converters.isEmpty()) return String.valueOf(t);
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/XmlName.java b/xml/dom-openapi/src/com/intellij/util/xml/XmlName.java
index a3a562e..6691822 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/XmlName.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/XmlName.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.
@@ -69,6 +69,7 @@
   }
 
 
+  @Override
   public int compareTo(XmlName o) {
     final int i = myLocalName.compareTo(o.myLocalName);
     if (i != 0) {
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/AbstractDomGenerateProvider.java b/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/AbstractDomGenerateProvider.java
index 769d848..536ef38 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/AbstractDomGenerateProvider.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/AbstractDomGenerateProvider.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.
@@ -45,6 +45,7 @@
     myMappingId = mappingId;
   }
 
+  @Override
   public T generate(final Project project, final Editor editor, final PsiFile file) {
     DomElement parentDomElement = getParentDomElement(project, editor, file);
 
@@ -87,8 +88,10 @@
     DomTemplateRunner.getInstance(file.getProject()).runTemplate(t, myMappingId, editor, predefinedVars);
   }
 
+  @Override
   protected abstract DomElement getParentDomElement(final Project project, final Editor editor, final PsiFile file);
 
+  @Override
   @SuppressWarnings({"unchecked"})
   protected void doNavigate(final DomElementNavigationProvider navigateProvider, final DomElement copy) {
     final DomElement element = getElementToNavigate((T)copy);
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/DefaultGenerateElementProvider.java b/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/DefaultGenerateElementProvider.java
index a14ad68..2ab81a6 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/DefaultGenerateElementProvider.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/DefaultGenerateElementProvider.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.
@@ -48,6 +48,7 @@
   }
 
 
+  @Override
   @Nullable
   public T generate(final Project project, final Editor editor, final PsiFile file) {
     return generate(getParentDomElement(project, editor, file), editor);
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/converters/DelimitedListConverter.java b/xml/dom-openapi/src/com/intellij/util/xml/converters/DelimitedListConverter.java
index f7b946d..a951032 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/converters/DelimitedListConverter.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/converters/DelimitedListConverter.java
@@ -60,6 +60,7 @@
 
   protected abstract String getUnresolvedMessage(String value);
 
+  @Override
   @NotNull
   public Collection<? extends List<T>> getVariants(final ConvertContext context) {
     return Collections.emptyList();
@@ -84,6 +85,7 @@
     return myDelimiters.charAt(0);
   }
 
+  @Override
   public List<T> fromString(@Nullable final String str, final ConvertContext context) {
     if (str == null) {
       return null;
@@ -99,6 +101,7 @@
     return values;
   }
 
+  @Override
   public String toString(final List<T> ts, final ConvertContext context) {
     final StringBuilder buffer = new StringBuilder();
     final char delimiter = getDefaultDelimiter();
@@ -114,6 +117,7 @@
     return buffer.toString();
   }
 
+  @Override
   @NotNull
   public PsiReference[] createReferences(final GenericDomValue<List<T>> genericDomValue,
                                          final PsiElement element,
@@ -126,6 +130,7 @@
 
     final ArrayList<PsiReference> references = new ArrayList<PsiReference>();
     new DelimitedListProcessor(myDelimiters) {
+      @Override
       protected void processToken(final int start, final int end, final boolean delimitersOnly) {
         references.add(createPsiReference(element, start + 1, end + 1, context, genericDomValue, delimitersOnly));
       }
@@ -182,6 +187,7 @@
       myDelimitersOnly = delimitersOnly;
     }
 
+    @Override
     @Nullable
     public PsiElement resolve() {
       if (myDelimitersOnly) {
@@ -191,6 +197,7 @@
       return resolveReference(convertString(value, myContext), myContext);
     }
 
+    @Override
     @NotNull
     public Object[] getVariants() {
       return getReferenceVariants(myContext, myGenericDomValue);
@@ -226,6 +233,7 @@
 
     private Function<PsiElement, PsiElement> getSuperBindToElementFunction(final Ref<IncorrectOperationException> ref) {
       return new Function<PsiElement, PsiElement>() {
+        @Override
         public PsiElement fun(final PsiElement s) {
           try {
             return MyPsiReference.super.bindToElement(s);
@@ -240,6 +248,7 @@
 
     private Function<String, PsiElement> getSuperElementRenameFunction(final Ref<IncorrectOperationException> ref) {
       return new Function<String, PsiElement>() {
+        @Override
         public PsiElement fun(final String s) {
           try {
             return MyPsiReference.super.handleElementRename(s);
@@ -253,6 +262,7 @@
     }
 
 
+    @Override
     @NotNull
     public String getUnresolvedMessagePattern() {
       return getUnresolvedMessage(getValue());
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/converters/PathReferenceConverter.java b/xml/dom-openapi/src/com/intellij/util/xml/converters/PathReferenceConverter.java
index 2d578a1..2b0aa7c 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/converters/PathReferenceConverter.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/converters/PathReferenceConverter.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.
@@ -16,16 +16,15 @@
 
 package com.intellij.util.xml.converters;
 
-import com.intellij.util.xml.Converter;
+import com.intellij.openapi.paths.PathReference;
+import com.intellij.openapi.paths.PathReferenceManager;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiReference;
+import com.intellij.psi.xml.XmlElement;
 import com.intellij.util.xml.ConvertContext;
+import com.intellij.util.xml.Converter;
 import com.intellij.util.xml.CustomReferenceConverter;
 import com.intellij.util.xml.GenericDomValue;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.paths.PathReferenceManager;
-import com.intellij.openapi.paths.PathReference;
-import com.intellij.psi.PsiReference;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.xml.XmlElement;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -35,15 +34,18 @@
 public class PathReferenceConverter extends Converter<PathReference> implements CustomReferenceConverter {
   public final static Converter<PathReference> INSTANCE = new PathReferenceConverter();
 
+  @Override
   public PathReference fromString(@Nullable final String s, final ConvertContext context) {
     final XmlElement element = context.getXmlElement();
     return s == null || element == null ? null : PathReferenceManager.getInstance().getPathReference(s, element);
   }
 
+  @Override
   public String toString(final PathReference t, final ConvertContext context) {
     return t == null ? null : t.getPath();
   }
 
+  @Override
   @NotNull
   public PsiReference[] createReferences(final GenericDomValue genericDomValue, final PsiElement element, final ConvertContext context) {
     return createReferences(element, true);
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/converters/values/BooleanValueConverter.java b/xml/dom-openapi/src/com/intellij/util/xml/converters/values/BooleanValueConverter.java
index ed98cb7..be6fe9b 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/converters/values/BooleanValueConverter.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/converters/values/BooleanValueConverter.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.
@@ -69,6 +69,7 @@
     return Arrays.binarySearch(getTrueValues(), s) >= 0;
   }
 
+  @Override
   public String fromString(@Nullable @NonNls final String stringValue, final ConvertContext context) {
     if (stringValue != null && ((myAllowEmpty && stringValue.trim().length() == 0) || Arrays.binarySearch(getAllValues(), stringValue) >= 0)) {
       return stringValue;
@@ -76,15 +77,18 @@
     return null;
   }
 
+  @Override
   public String toString(@Nullable final String s, final ConvertContext context) {
     return s;
   }
 
+  @Override
   @NotNull
   public Collection<? extends String> getVariants(final ConvertContext context) {
     return Arrays.asList(VARIANTS);
   }
 
+  @Override
   public String getErrorMessage(@Nullable final String s, final ConvertContext context) {
     return DomBundle.message("value.converter.format.exception", s, BOOLEAN);
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/converters/values/CharacterValueConverter.java b/xml/dom-openapi/src/com/intellij/util/xml/converters/values/CharacterValueConverter.java
index d740a82..c6654ba 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/converters/values/CharacterValueConverter.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/converters/values/CharacterValueConverter.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.
@@ -31,6 +31,7 @@
   }
 
 
+  @Override
   public String fromString(@Nullable @NonNls String s, final ConvertContext context) {
     if (s == null) return null;
 
@@ -52,10 +53,12 @@
     return sequence.startsWith(UNICODE_PREFIX) && sequence.length() == UNICODE_LENGTH;
   }
 
+  @Override
   public String toString(@Nullable String s, final ConvertContext context) {
     return s;
   }
 
+  @Override
   public String getErrorMessage(@Nullable final String s, final ConvertContext context) {
    return DomBundle.message("value.converter.format.exception", s, "char");
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/converters/values/NumberValueConverter.java b/xml/dom-openapi/src/com/intellij/util/xml/converters/values/NumberValueConverter.java
index 7aa3b9d..bf24b6b 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/converters/values/NumberValueConverter.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/converters/values/NumberValueConverter.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.
@@ -17,7 +17,6 @@
 package com.intellij.util.xml.converters.values;
 
 import com.intellij.util.xml.ConvertContext;
-import com.intellij.util.xml.Converter;
 import com.intellij.util.xml.DomBundle;
 import com.intellij.util.xml.ResolvingConverter;
 import org.jetbrains.annotations.NonNls;
@@ -40,6 +39,7 @@
     myAllowEmpty = allowEmpty;
   }
 
+  @Override
   public String fromString(@Nullable @NonNls final String s, final ConvertContext context) {
     if (s == null) return null;
 
@@ -48,10 +48,12 @@
     return parseNumber(s, myNumberClass) == null ? null : s;
   }
 
+  @Override
   public String toString(@Nullable final String s, final ConvertContext context) {
     return null;
   }
 
+  @Override
   public String getErrorMessage(@Nullable final String s, final ConvertContext context) {
     if (s == null) return super.getErrorMessage(s, context);
 
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/AddDomElementQuickFix.java b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/AddDomElementQuickFix.java
index b7a4a74..5a735bd 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/AddDomElementQuickFix.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/AddDomElementQuickFix.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.
@@ -37,6 +37,7 @@
     myName = computeName();
   }
 
+  @Override
   @NotNull
   public String getName() {
     return myName;
@@ -53,11 +54,13 @@
     return myElement.getXmlElement() instanceof XmlTag;
   }
 
+  @Override
   @NotNull
   public String getFamilyName() {
     return DomBundle.message("quick.fixes.family");
   }
 
+  @Override
   public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
     myElement.ensureXmlElementExists();
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/BasicDomElementsInspection.java b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/BasicDomElementsInspection.java
index f1c7c08..d62ef2d 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/BasicDomElementsInspection.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/BasicDomElementsInspection.java
@@ -53,6 +53,7 @@
    * @param holder  a place to add problems to
    * @param helper  helper object
    */
+  @Override
   protected void checkDomElement(DomElement element, DomElementAnnotationHolder holder, DomHighlightingHelper helper) {
     final int oldSize = holder.getSize();
     if (element instanceof GenericDomValue) {
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptor.java b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptor.java
index b67b1a6..c456049 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptor.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptor.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.
@@ -26,6 +26,7 @@
   @NotNull
   PsiReference getPsiReference();
 
+  @Override
   @NotNull
   GenericDomValue getDomElement();
 }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementsInspection.java b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementsInspection.java
index 3c7844b..2200e6f 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementsInspection.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementsInspection.java
@@ -65,6 +65,7 @@
     final DomHighlightingHelper helper =
       DomElementAnnotationsManager.getInstance(domFileElement.getManager().getProject()).getHighlightingHelper();
     final Consumer<DomElement> consumer = new Consumer<DomElement>() {
+      @Override
       public void consume(final DomElement element) {
         checkChildren(element, this);
         checkDomElement(element, holder, helper);
@@ -111,6 +112,7 @@
    * Override {@link #checkFileElement(com.intellij.util.xml.DomFileElement, DomElementAnnotationHolder)} (which is preferred) or
    * {@link #checkDomElement(com.intellij.util.xml.DomElement, DomElementAnnotationHolder, DomHighlightingHelper)} instead.
    */
+  @Override
   @Nullable
   public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) {
     if (file instanceof XmlFile && (file.isPhysical() || ApplicationManager.getApplication().isUnitTestMode())) {
@@ -125,11 +127,13 @@
     return null;
   }
 
+  @Override
   @NotNull
   public HighlightDisplayLevel getDefaultLevel() {
     return HighlightDisplayLevel.ERROR;
   }
 
+  @Override
   public boolean isEnabledByDefault() {
     return true;
   }
@@ -148,6 +152,7 @@
 
     List<ProblemDescriptor> problems =
       ContainerUtil.concat(list, new Function<DomElementProblemDescriptor, Collection<? extends ProblemDescriptor>>() {
+        @Override
         public Collection<ProblemDescriptor> fun(final DomElementProblemDescriptor s) {
           return annotationsManager.createProblemDescriptors(manager, s);
         }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/RemoveDomElementQuickFix.java b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/RemoveDomElementQuickFix.java
index d24f7ca..67710fa 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/RemoveDomElementQuickFix.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/RemoveDomElementQuickFix.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.
@@ -39,6 +39,7 @@
     myName = element.getXmlElementName();
   }
 
+  @Override
   @NotNull
   public String getName() {
     return myIsTag ?
@@ -46,11 +47,13 @@
            DomBundle.message("remove.attribute.fix.name", myName);
   }
 
+  @Override
   @NotNull
   public String getFamilyName() {
     return DomBundle.message("quick.fixes.family");
   }
 
+  @Override
   public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
     if (myIsTag) {
       final XmlTag tag = (XmlTag)descriptor.getPsiElement();
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/ResolvingElementQuickFix.java b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/ResolvingElementQuickFix.java
index 5dafd7e..7b0bdbd 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/ResolvingElementQuickFix.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/ResolvingElementQuickFix.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.
@@ -65,41 +65,50 @@
     myTypeName = typeName;
   }
 
+  @Override
   @NotNull
   public String getName() {
     return DomBundle.message("create.new.element", myTypeName, myNewName);
   }
 
+  @Override
   @NotNull
   public String getText() {
     return getName();
   }
 
+  @Override
   @NotNull
   public String getFamilyName() {
     return DomBundle.message("quick.fixes.family");
   }
 
+  @Override
   public boolean isAvailable(@NotNull final Project project, final Editor editor, final PsiFile file) {
     return true;
   }
 
+  @Override
   public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
     applyFix();
   }
 
+  @Override
   public boolean startInWriteAction() {
     return false;
   }
 
+  @Override
   public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
     applyFix();
   }
 
   private void applyFix() {
     chooseParent(myParents, new Consumer<DomElement>() {
+      @Override
       public void consume(final DomElement parent) {
         new WriteCommandAction.Simple(parent.getManager().getProject(), DomUtil.getFile(parent)) {
+          @Override
           protected void run() throws Throwable {
             doFix(parent, myChildDescription, myNewName);
           }
@@ -125,15 +134,18 @@
         return;
       default:
         JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<DomElement>(DomBundle.message("choose.file"), files) {
+          @Override
           public PopupStep onChosen(final DomElement selectedValue, final boolean finalChoice) {
             onChoose.consume(selectedValue);
             return super.onChosen(selectedValue, finalChoice);
           }
 
+          @Override
           public Icon getIconFor(final DomElement aValue) {
             return DomUtil.getFile(aValue).getIcon(0);
           }
 
+          @Override
           @NotNull
           public String getTextFor(final DomElement value) {
             final String name = DomUtil.getFile(value).getName();
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/model/DomModelCache.java b/xml/dom-openapi/src/com/intellij/util/xml/model/DomModelCache.java
index 1a1829e..dfe2f7e 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/model/DomModelCache.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/model/DomModelCache.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.
@@ -19,7 +19,6 @@
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Key;
 import com.intellij.openapi.util.UserDataHolder;
-import com.intellij.psi.PsiManager;
 import com.intellij.psi.util.CachedValue;
 import com.intellij.psi.util.CachedValueProvider;
 import com.intellij.psi.util.CachedValuesManager;
@@ -45,6 +44,7 @@
     CachedValue<T> cachedValue = dataHolder.getUserData(myKey);
     if (cachedValue == null) {
       final CachedValueProvider<T> myProvider = new CachedValueProvider<T>() {
+        @Override
         @Nullable
         public Result<T> compute() {
           return computeValue(dataHolder);
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/BaseDomModelFactory.java b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/BaseDomModelFactory.java
index 70c0b2e..dbeaeac 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/BaseDomModelFactory.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/BaseDomModelFactory.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.
@@ -74,11 +74,13 @@
     return null;
   }
 
+  @Override
   @NotNull
   public List<M> getAllModels(@NotNull S scope) {
     return myMultipleDomModelFactory.getAllModels(scope);
   }
 
+  @Override
   @Nullable
   public M getModelByConfigFile(@Nullable XmlFile psiFile) {
     return mySimpleDomModelFactory.getModelByConfigFile(psiFile);
@@ -110,16 +112,19 @@
     return null;
   }
 
+  @Override
   @Nullable
   public M getCombinedModel(@Nullable S scope) {
     return myMultipleDomModelFactory.getCombinedModel(scope);
   }
 
+  @Override
   @NotNull
   public Set<XmlFile> getAllConfigFiles(@NotNull S scope) {
     return myMultipleDomModelFactory.getAllConfigFiles(scope);
   }
 
+  @Override
   @Nullable
   public DomFileElement<T> createMergedModelRoot(final Set<XmlFile> configFiles) {
     return mySimpleDomModelFactory.createMergedModelRoot(configFiles);
@@ -130,14 +135,17 @@
                                                                                   final Project project,
                                                                                   final String name) {
     return new CachedMultipleDomModelFactory<S, T, M, C>(aClass, modelMerger, project, name) {
+      @Override
       public M getModel(@NotNull final C context) {
         return BaseDomModelFactory.this.getModel(context);
       }
 
+      @Override
       protected List<M> computeAllModels(@NotNull final S scope) {
         return BaseDomModelFactory.this.computeAllModels(scope);
       }
 
+      @Override
       protected M createCombinedModel(final Set<XmlFile> configFiles,
                                       final DomFileElement<T> mergedModel,
                                       final M firstModel,
@@ -145,11 +153,13 @@
         return BaseDomModelFactory.this.createCombinedModel(configFiles, mergedModel, firstModel, scope);
       }
 
+      @Override
       @NotNull
       public Object[] computeDependencies(@Nullable final M model, @Nullable final S scope) {
         return BaseDomModelFactory.this.computeDependencies(model, scope);
       }
 
+      @Override
       public S getModelScope(@NotNull final XmlFile xmlFile) {
         return BaseDomModelFactory.this.getModelScope(xmlFile);
       }
@@ -162,15 +172,18 @@
                                                                         final String name) {
     return new CachedSimpleDomModelFactory<T, M, S>(aClass, modelMerger, project, name) {
 
+      @Override
       protected M computeModel(@NotNull final XmlFile psiFile, @Nullable final S scope) {
         return BaseDomModelFactory.this.computeModel(psiFile, scope);
       }
 
+      @Override
       @NotNull
       public Object[] computeDependencies(@Nullable final M model, @Nullable final S scope) {
         return BaseDomModelFactory.this.computeDependencies(model, scope);
       }
 
+      @Override
       public S getModelScope(@NotNull XmlFile file) {
         return BaseDomModelFactory.this.getModelScope(file);
       }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/CachedMultipleDomModelFactory.java b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/CachedMultipleDomModelFactory.java
index fba3581..3109e8c 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/CachedMultipleDomModelFactory.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/CachedMultipleDomModelFactory.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.
@@ -52,6 +52,7 @@
       super(aClass,modelMerger);
 
       myCombinedModelCache = new DomModelCache<M, Scope>(project, name + " combined model") {
+        @Override
         @NotNull
         protected CachedValueProvider.Result<M> computeValue(@NotNull final Scope scope) {
           final M combinedModel = computeCombinedModel(scope);
@@ -60,6 +61,7 @@
       };
 
       myAllModelsCache = new DomModelCache<List<M>, Scope>(project, name + " models list") {
+        @Override
         @NotNull
         protected CachedValueProvider.Result<List<M>> computeValue(@NotNull final Scope scope) {
           final List<M> models = computeAllModels(scope);
@@ -71,6 +73,7 @@
     @Nullable
     public abstract M getModel(@NotNull C context);
 
+    @Override
     @NotNull
     public List<M> getAllModels(@NotNull Scope scope) {
 
@@ -86,6 +89,7 @@
     @Nullable
     protected abstract List<M> computeAllModels(@NotNull Scope scope);
 
+    @Override
     @Nullable
     public M getCombinedModel(@Nullable Scope scope) {
       if (scope == null) {
@@ -143,6 +147,7 @@
       }
     }
 
+    @Override
     @NotNull
     public Set<XmlFile> getAllConfigFiles(@NotNull Scope scope) {
       final HashSet<XmlFile> xmlFiles = new HashSet<XmlFile>();
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/CachedSimpleDomModelFactory.java b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/CachedSimpleDomModelFactory.java
index ec4f9d4..0a8f30e 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/CachedSimpleDomModelFactory.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/CachedSimpleDomModelFactory.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.
@@ -43,6 +43,7 @@
     super(aClass, modelMerger);
 
     myModelCache = new DomModelCache<M, XmlFile>(project, name + " model") {
+       @Override
        @NotNull
        protected CachedValueProvider.Result<M> computeValue(@NotNull XmlFile file) {
          file = (XmlFile)file.getOriginalFile();
@@ -54,6 +55,7 @@
     };
   }
 
+  @Override
   @Nullable
   public M getModelByConfigFile(@Nullable XmlFile psiFile) {
     if (psiFile == null) {
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/DomModelFactory.java b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/DomModelFactory.java
index 5f5f4dd..95681f7 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/DomModelFactory.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/DomModelFactory.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.
@@ -40,6 +40,7 @@
     super(aClass, project, name);
   }
 
+  @Override
   protected Module getModelScope(final XmlFile file) {
 
     return ModuleUtil.findModuleForPsiElement(file);
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/DomModelImpl.java b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/DomModelImpl.java
index c104108..5785048 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/DomModelImpl.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/DomModelImpl.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.
@@ -60,11 +60,13 @@
     myClass = clazz;
   }
 
+  @Override
   @NotNull
   public T getMergedModel() {
     if (myMergedModel == null) {
       final DomManager domManager = DomManager.getDomManager(myProject);
       return domManager.createModelMerger().mergeModels(myClass, ContainerUtil.mapNotNull(myConfigFiles, new NullableFunction<XmlFile, T>() {
+        @Override
         public T fun(XmlFile xmlFile) {
           DomFileElement<T> fileElement = domManager.getFileElement(xmlFile, myClass);
           return fileElement == null ? null : fileElement.getRootElement();
@@ -74,15 +76,18 @@
     return myMergedModel.getRootElement();
   }
 
+  @Override
   @NotNull
   public Set<XmlFile> getConfigFiles() {
     return myConfigFiles;
   }
 
+  @Override
   @NotNull
   public List<DomFileElement<T>> getRoots() {
     if (myMergedModel == null) {
       return ContainerUtil.mapNotNull(myConfigFiles, new NullableFunction<XmlFile, DomFileElement<T>>() {
+        @Override
         public DomFileElement<T> fun(XmlFile xmlFile) {
           return DomManager.getDomManager(xmlFile.getProject()).getFileElement(xmlFile, myClass);
         }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/SimpleDomModelFactory.java b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/SimpleDomModelFactory.java
index 72d0e3a..77e1591 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/SimpleDomModelFactory.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/SimpleDomModelFactory.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.
@@ -40,6 +40,7 @@
     super(aClass, modelMerger);
   }
 
+  @Override
   @Nullable
   public DomFileElement<T> createMergedModelRoot(Set<XmlFile> configFiles) {
     List<DomFileElement<T>> configs = new ArrayList<DomFileElement<T>>(configFiles.size());
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/reflect/DomFixedChildDescription.java b/xml/dom-openapi/src/com/intellij/util/xml/reflect/DomFixedChildDescription.java
index fcfde5c..0dae377 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/reflect/DomFixedChildDescription.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/reflect/DomFixedChildDescription.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,7 +15,6 @@
  */
 package com.intellij.util.xml.reflect;
 
-import com.intellij.util.xml.DomElement;
 import com.intellij.util.xml.JavaMethod;
 import org.jetbrains.annotations.Nullable;
 
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/tree/AbstractDomElementNode.java b/xml/dom-openapi/src/com/intellij/util/xml/tree/AbstractDomElementNode.java
index e2c00c5..1beb01a 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/tree/AbstractDomElementNode.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/tree/AbstractDomElementNode.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.
@@ -32,6 +32,7 @@
   public static final Key<Map<Class, Boolean>> TREE_NODES_HIDERS_KEY = Key.create("TREE_NODES_HIDERS_KEY");
 
   private final static Comparator<Class> INHERITORS_COMPARATOR = new Comparator<Class>() {
+    @Override
     public int compare(final Class o1, final Class o2) {
       return o1.isAssignableFrom(o2) ? 1 : -1;
     }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/tree/BaseDomElementNode.java b/xml/dom-openapi/src/com/intellij/util/xml/tree/BaseDomElementNode.java
index 92aaede..e5f08bb 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/tree/BaseDomElementNode.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/tree/BaseDomElementNode.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.
@@ -65,10 +65,12 @@
     folder = isMarkedType(modelElement.getDomElementType(), FOLDER_NODES_KEY);
   }
 
+  @Override
   public SimpleNode[] getChildren() {
     return doGetChildren(myDomElement);
   }
 
+  @Override
   public void handleDoubleClickOrEnter(SimpleTree tree, InputEvent inputEvent) {
     if (inputEvent instanceof MouseEvent) {
       inputEvent.consume();
@@ -146,6 +148,7 @@
         final XmlElementDescriptor[] childDescriptors = descriptor.getElementsDescriptors(tag);
         if (childDescriptors != null && childDescriptors.length > 1) {
           return new Comparator<AbstractDomElementNode>() {
+            @Override
             public int compare(final AbstractDomElementNode o1, final AbstractDomElementNode o2) {
               return findDescriptor(childDescriptors, o1.getTagName()) - findDescriptor(childDescriptors, o2.getTagName());
             }
@@ -178,11 +181,13 @@
     return consolidated;
   }
 
+  @Override
   @NotNull
   public Object[] getEqualityObjects() {
     return new Object[]{myDomElement};
   }
 
+  @Override
   protected void doUpdate() {
     if (!myDomElement.isValid()) return;
     final Project project = myDomElement.getManager().getProject();
@@ -236,6 +241,7 @@
     return true;
   }
 
+  @Override
   public String getNodeName() {
     if (!myDomElement.isValid()) return "";
 
@@ -243,18 +249,22 @@
     return name != null && name.trim().length() > 0 ? name : getPropertyName();
   }
 
+  @Override
   public String getTagName() {
     return myTagName;
   }
 
+  @Override
   public DomElement getDomElement() {
     return myDomElement;
   }
 
+  @Override
   public boolean isAutoExpandNode() {
     return getParent() == null;
   }
 
+  @Override
   public boolean expandOnDoubleClick() {
     return true;
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/tree/DomElementsGroupNode.java b/xml/dom-openapi/src/com/intellij/util/xml/tree/DomElementsGroupNode.java
index ea8ca19..501b3a0 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/tree/DomElementsGroupNode.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/tree/DomElementsGroupNode.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.
@@ -49,6 +49,7 @@
     myRootDomElement = rootDomElement;
   }
 
+  @Override
   public SimpleNode[] getChildren() {
     if (!myParentElement.isValid()) return NO_CHILDREN;
 
@@ -61,11 +62,13 @@
     return simpleNodes.toArray(new SimpleNode[simpleNodes.size()]);
   }
 
+  @Override
   @NotNull
   public Object[] getEqualityObjects() {
     return new Object[]{myParentElement, myChildrenTagName};
   }
 
+  @Override
   protected void doUpdate() {
     setUniformIcon(getNodeIcon());
 
@@ -100,16 +103,19 @@
     return false;
   }
 
+  @Override
   public String getNodeName() {
     if (!myParentElement.isValid()) return "";
 
     return myChildDescription.getCommonPresentableName(myParentElement);
   }
 
+  @Override
   public String getTagName() {
     return myChildrenTagName;
   }
 
+  @Override
   public DomElement getDomElement() {
     return myParentElement;
   }
@@ -120,6 +126,7 @@
   }
 
 
+  @Override
   public Icon getNodeIcon() {
     Class clazz = ReflectionUtil.getRawType(myChildDescription.getType());
 //        Class arrayClass = Array.newInstance(clazz, 0).getClass();
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/tree/DomFileElementNode.java b/xml/dom-openapi/src/com/intellij/util/xml/tree/DomFileElementNode.java
index 6ce17cd..8c57658 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/tree/DomFileElementNode.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/tree/DomFileElementNode.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.
@@ -28,16 +28,19 @@
     myFileElement = fileElement;
   }
 
+  @Override
   public SimpleNode[] getChildren() {
     return doGetChildren(myFileElement.getRootElement());
   }
 
 
+  @Override
   public DomFileElement getDomElement() {
     return (DomFileElement)super.getDomElement();
   }
 
 
+  @Override
   public boolean isShowContainingFileInfo() {
     return false;
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/tree/DomModelTreeStructure.java b/xml/dom-openapi/src/com/intellij/util/xml/tree/DomModelTreeStructure.java
index ceda5e1..415574e 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/tree/DomModelTreeStructure.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/tree/DomModelTreeStructure.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.
@@ -31,6 +31,7 @@
     return new BaseDomElementNode(myDomElement);
   }
 
+  @Override
   public AbstractDomElementNode getRootElement() {
     if (myRootNode == null) {
       myRootNode = createRoot(myDomElement);
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/tree/DomModelTreeView.java b/xml/dom-openapi/src/com/intellij/util/xml/tree/DomModelTreeView.java
index 14886eb..1935228 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/tree/DomModelTreeView.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/tree/DomModelTreeView.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.
@@ -83,6 +83,7 @@
     add(myTree, BorderLayout.CENTER);
 
     myTree.addTreeExpansionListener(new TreeExpansionListener() {
+      @Override
       public void treeExpanded(TreeExpansionEvent event) {
         final SimpleNode simpleNode = myTree.getNodeFor(event.getPath());
 
@@ -91,6 +92,7 @@
         }
       }
 
+      @Override
       public void treeCollapsed(TreeExpansionEvent event) {
         final SimpleNode simpleNode = myTree.getNodeFor(event.getPath());
 
@@ -102,6 +104,7 @@
     });
 
     myDomManager.addDomEventListener(new DomChangeAdapter() {
+      @Override
       protected void elementChanged(DomElement element) {
         if (element.isValid()) {
           queueUpdate(DomUtil.getFile(element).getVirtualFile());
@@ -115,6 +118,7 @@
 
     final Project project = myDomManager.getProject();
     DomElementAnnotationsManager.getInstance(project).addHighlightingListener(new DomElementAnnotationsManager.DomHighlightingListener() {
+      @Override
       public void highlightingFinished(DomFileElement element) {
         if (element.isValid()) {
           queueUpdate(DomUtil.getFile(element).getVirtualFile());
@@ -133,6 +137,7 @@
     if (file == null) return;
     if (getProject().isDisposed()) return;
     ApplicationManager.getApplication().invokeLater(new Runnable() {
+      @Override
       public void run() {
         if (getProject().isDisposed()) return;
         if (!file.isValid() || isRightFile(file)) {
@@ -162,6 +167,7 @@
     return myBuilder;
   }
 
+  @Override
   public void dispose() {
   }
 
@@ -181,6 +187,7 @@
     return group;
   }
 
+  @Override
   @Nullable
   public Object getData(String dataId) {
     if (DomModelTreeView.DATA_KEY.is(dataId)) {
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/tree/GenericValueNode.java b/xml/dom-openapi/src/com/intellij/util/xml/tree/GenericValueNode.java
index d71a64c..dce3154 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/tree/GenericValueNode.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/tree/GenericValueNode.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.
@@ -33,18 +33,22 @@
     myTagName = modelElement.getXmlElementName();
    }
 
+  @Override
   public String getNodeName() {
     return getPropertyName();
   }
 
+  @Override
   public String getTagName() {
     return myTagName;
   }
 
+  @Override
   public DomElement getDomElement() {
     return myModelElement;
   }
 
+  @Override
   protected void doUpdate() {
     setUniformIcon(getNodeIcon());
     clearColoredText();
@@ -63,10 +67,12 @@
     }
   }
 
+  @Override
   public SimpleNode[] getChildren() {
     return NO_CHILDREN;
   }
 
+  @Override
   @NotNull
   public Object[] getEqualityObjects() {
     return new Object[]{myModelElement};
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/AbstractDomElementComponent.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/AbstractDomElementComponent.java
index a01f73f..f161f3b 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/AbstractDomElementComponent.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/AbstractDomElementComponent.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.
@@ -18,8 +18,6 @@
 
 import com.intellij.util.ui.UIUtil;
 import com.intellij.util.xml.DomElement;
-import com.intellij.util.xml.DomFileElement;
-import com.intellij.util.xml.highlighting.DomElementAnnotationsManager;
 
 import java.awt.*;
 
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/AbstractTableView.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/AbstractTableView.java
index 2e372bf..eb254c2 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/AbstractTableView.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/AbstractTableView.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.
@@ -80,11 +80,13 @@
 
     final JTableHeader header = myTable.getTableHeader();
     header.addMouseMotionListener(new MouseMotionAdapter() {
+      @Override
       public void mouseMoved(MouseEvent e) {
         updateTooltip(e);
       }
     });
     header.addMouseListener(new MouseAdapter() {
+      @Override
       public void mouseEntered(MouseEvent e) {
         updateTooltip(e);
       }
@@ -135,6 +137,7 @@
     toolbarComponent.setBorder(BorderFactory.createCompoundBorder(matteBorder, toolbarComponent.getBorder()));
 
     getTable().getSelectionModel().addListSelectionListener(new ListSelectionListener() {
+      @Override
       public void valueChanged(ListSelectionEvent e) {
         myActionToolbar.updateActionsImmediately();
       }
@@ -164,6 +167,7 @@
     if (getEmptyPaneText() != null) {
       final CardLayout cardLayout = ((CardLayout)myInnerPanel.getLayout());
       myTable.getModel().addTableModelListener(new TableModelListener() {
+        @Override
         public void tableChanged(TableModelEvent e) {
           cardLayout.show(myInnerPanel, myTable.getRowCount() == 0 ? EMPTY_PANE : TREE);
         }
@@ -220,6 +224,7 @@
     return myTableModel;
   }
 
+  @Override
   public void calcData(DataKey key, DataSink sink) {
     if (PlatformDataKeys.HELP_ID.equals(key)) {
       sink.put(PlatformDataKeys.HELP_ID, getHelpId());
@@ -294,6 +299,7 @@
       setSortable(false);
     }
 
+    @Override
     public Object getValueAt(final int rowIndex, final int columnIndex) {
       return myTableData[rowIndex][columnIndex];
     }
@@ -310,10 +316,12 @@
       myTableData = objects;
     }
 
+    @Override
     public void setValueAt(final Object aValue, final int rowIndex, final int columnIndex) {
       final Object oldValue = getValueAt(rowIndex, columnIndex);
       if (!Comparing.equal(oldValue, aValue)) {
         wrapValueSetting(getItems().get(rowIndex), new Runnable() {
+          @Override
           public void run() {
             MyListTableModel.super.setValueAt("".equals(aValue) ? null : aValue, rowIndex, columnIndex);
           }
@@ -350,6 +358,7 @@
       return super.getCellRenderer(row, column);
     }
 
+    @Override
     public final TableCellRenderer getCellRenderer(int row, int column) {
       return myCachedRenderers[row][column];
     }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/BaseControl.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/BaseControl.java
index d6dbc13..d809b86 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/BaseControl.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/BaseControl.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.
@@ -90,9 +90,11 @@
     final JComponent component = getComponentToListenFocusLost(myBoundComponent);
     if (component != null) {
       component.addFocusListener(new FocusListener() {
+        @Override
         public void focusGained(FocusEvent e) {
         }
 
+        @Override
         public void focusLost(FocusEvent e) {
           if (!e.isTemporary() && isValid()) {
             commit();
@@ -111,18 +113,22 @@
 
   protected abstract Bound createMainComponent(Bound boundedComponent);
 
+  @Override
   public void bind(JComponent component) {
     initialize((Bound)component);
   }
 
+  @Override
   public void addCommitListener(CommitListener listener) {
     myDispatcher.addListener(listener);
   }
 
+  @Override
   public void removeCommitListener(CommitListener listener) {
     myDispatcher.removeListener(listener);
   }
 
+  @Override
   public final DomElement getDomElement() {
     return myDomWrapper.getWrappedElement();
   }
@@ -131,14 +137,17 @@
     return myDomWrapper;
   }
 
+  @Override
   public final Bound getComponent() {
     checkInitialized();
     return myBoundComponent;
   }
 
+  @Override
   public void dispose() {
   }
 
+  @Override
   public final void commit() {
     if (isValid() && !isCommitted()) {
       setValueToXml(getValue());
@@ -160,6 +169,7 @@
     return valueInXml instanceof String && valueInControl instanceof String && ((String)valueInXml).trim().equals(((String)valueInControl).trim());
   }
 
+  @Override
   public final void reset() {
     if (!myCommitting) {
       doReset();
@@ -167,6 +177,7 @@
     }
   }
 
+  @Override
   public void updateHighlighting() {
     updateComponent();
   }
@@ -195,6 +206,7 @@
       final CommitListener multicaster = myDispatcher.getMulticaster();
       multicaster.beforeCommit(this);
       new WriteCommandAction(getProject(), getDomWrapper().getFile()) {
+        @Override
         protected void run(Result result) throws Throwable {
           doCommit(value);
         }
@@ -227,10 +239,12 @@
   }
 
 
+  @Override
   public boolean canNavigate(DomElement element) {
     return false;
   }
 
+  @Override
   public void navigate(DomElement element) {
   }
 
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/BaseModifiableControl.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/BaseModifiableControl.java
index 3d0c4f9..52a7be3 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/BaseModifiableControl.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/BaseModifiableControl.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.
@@ -33,11 +33,13 @@
     myModified = true;
   }
 
+  @Override
   protected void doCommit(final T value) throws IllegalAccessException, InvocationTargetException {
     super.doCommit(value);
     myModified = false;
   }
 
+  @Override
   protected boolean isCommitted() {
     return !myModified;
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/BasicDomElementComponent.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/BasicDomElementComponent.java
index 7ba3553..d2a17dd 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/BasicDomElementComponent.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/BasicDomElementComponent.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.
@@ -62,8 +62,10 @@
     if (domElement == null) return;
 
     DomElementAnnotationsManager.getInstance(domElement.getManager().getProject()).addHighlightingListener(new DomElementAnnotationsManager.DomHighlightingListener() {
+      @Override
       public void highlightingFinished(@NotNull final DomFileElement element) {
         ApplicationManager.getApplication().invokeLater(new Runnable() {
+          @Override
           public void run() {
             if (getComponent().isShowing() && element.isValid()) {
               updateHighlighting();
@@ -79,6 +81,7 @@
         if (description instanceof DomFixedChildDescription && DomUtil.isGenericValueType(description.getType())) {
           if ((description.getValues(domElement)).size() == 1) {
             final GenericDomValue element = domElement.getManager().createStableValue(new Factory<GenericDomValue>() {
+              @Override
               public GenericDomValue create() {
                 return domElement.isValid() ? (GenericDomValue)description.getValues(domElement).get(0) : null;
               }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/BigStringComponent.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/BigStringComponent.java
index e4a60e0..fa49bf1 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/BigStringComponent.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/BigStringComponent.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.
@@ -37,6 +37,7 @@
     myWindowTitle = windowTitle;
     setButtonIcon(PlatformIcons.OPEN_EDIT_DIALOG_ICON);
     addActionListener(new ActionListener() {
+      @Override
       public void actionPerformed(ActionEvent e) {
         Messages.showTextAreaDialog(getTextField(), myWindowTitle, "DescriptionDialogEditor");
       }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanColumnInfo.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanColumnInfo.java
index 0b977a5..293fa0f 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanColumnInfo.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanColumnInfo.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.
@@ -30,18 +30,22 @@
     super(name, new BooleanTableCellRenderer());
   }
 
+  @Override
   public TableCellEditor getEditor(GenericDomValue<Boolean> value) {
     return new DefaultCellEditor(new JCheckBox());
   }
 
+  @Override
   public final Class<Boolean> getColumnClass() {
     return Boolean.class;
   }
 
+  @Override
   public final void setValue(final GenericDomValue<Boolean> o, final Boolean aValue) {
     o.setValue(aValue);
   }
 
+  @Override
   public final Boolean valueOf(GenericDomValue<Boolean> object) {
     final Boolean value = object.getValue();
     return value == null ? Boolean.FALSE : value;
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanControl.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanControl.java
index 86f32c3..ca921d0 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanControl.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanControl.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.
@@ -29,10 +29,12 @@
     super(domWrapper);
   }
 
+  @Override
   protected JCheckBox createMainComponent(JCheckBox boundComponent) {
     JCheckBox checkBox = boundComponent == null ? new JCheckBox() : boundComponent;
 
     checkBox.addActionListener(new ActionListener() {
+      @Override
       public void actionPerformed(ActionEvent e) {
         myUndefined = false;
         setModified();
@@ -43,10 +45,12 @@
     return checkBox;
   }
 
+  @Override
   protected Boolean getValue() {
     return myUndefined ? null : getComponent().isSelected();
   }
 
+  @Override
   protected void setValue(final Boolean value) {
     myUndefined = value == null;
     getComponent().setSelected(value != null && value);
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanEnumControl.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanEnumControl.java
index c567fcc..255a60c 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanEnumControl.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanEnumControl.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.
@@ -40,10 +40,12 @@
     assert enumClass.getEnumConstants().length == 2 : enumClass;
   }
 
+  @Override
   protected JCheckBox createMainComponent(JCheckBox boundComponent) {
     JCheckBox checkBox = boundComponent == null ? new JCheckBox() : boundComponent;
 
     checkBox.addActionListener(new ActionListener() {
+      @Override
       public void actionPerformed(ActionEvent e) {
         myUndefined = false;
         setModified();
@@ -54,10 +56,12 @@
     return checkBox;
   }
 
+  @Override
   protected String getValue() {
     return myUndefined ? null : (getComponent().isSelected() ? mySelectedValue : myUnselectedValue);
   }
 
+  @Override
   protected void setValue(final String value) {
     myUndefined = value == null;
     getComponent().setSelected(mySelectedValue.equals(value));
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/CaptionComponent.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/CaptionComponent.java
index ed30d6b..c4bd055 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/CaptionComponent.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/CaptionComponent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -63,6 +63,7 @@
     }
   }
 
+  @Override
   public void updateHighlighting() {
     CommittableUtil.updateHighlighting(myCommittableErrorPanel);
   }
@@ -105,13 +106,16 @@
     updateBorder();
   }
 
+  @Override
   public final void commit() {
   }
 
+  @Override
   public void reset() {
     if (myCommittableErrorPanel != null) myCommittableErrorPanel.reset();
   }
 
+  @Override
   public final void dispose() {
   }
 
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/ChildGenericValueColumnInfo.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/ChildGenericValueColumnInfo.java
index dfaa714..0978d3b 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/ChildGenericValueColumnInfo.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/ChildGenericValueColumnInfo.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.
@@ -64,14 +64,17 @@
     return result;
   }
 
+  @Override
   public final TableCellEditor getEditor(T value) {
     return myEditor;
   }
 
+  @Override
   public final Class<T> getColumnClass() {
     return (Class<T>)ReflectionUtil.getRawType(myChildDescription.getType());
   }
 
+  @Override
   public TableCellRenderer getCustomizedRenderer(final T domElement, final TableCellRenderer renderer) {
     assert domElement.isValid();
     return getErrorableCellRenderer(renderer, domElement);
@@ -81,6 +84,7 @@
     return new ErrorableTableCellRenderer<GenericDomValue>(getGenericValue(domElement), renderer, domElement);
   }
 
+  @Override
   public void setValue(final T o, final String aValue) {
     getGenericValue(o).setStringValue(aValue);
   }
@@ -89,6 +93,7 @@
     return (GenericDomValue)myChildDescription.getValues(o).get(0);
   }
 
+  @Override
   public final String valueOf(T object) {
     if (!object.isValid()) return null;
     final String stringValue = getGenericValue(object).getStringValue();
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboControl.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboControl.java
index 4966c85..81b615f 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboControl.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboControl.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.
@@ -48,6 +48,7 @@
   private boolean myNullable;
   private final Map<String, Icon> myIcons = new HashMap<String, Icon>();
   private final ItemListener myCommitListener = new ItemListener() {
+    @Override
     public void itemStateChanged(ItemEvent e) {
       setModified();
       commit();
@@ -84,10 +85,12 @@
 
   public static Factory<List<Pair<String, Icon>>> createResolvingFunction(final GenericDomValue<?> reference) {
     return new Factory<List<Pair<String, Icon>>>() {
+      @Override
       public List<Pair<String, Icon>> create() {
         final Converter converter = reference.getConverter();
         if (converter instanceof ResolvingConverter) {
           final AbstractConvertContext context = new AbstractConvertContext() {
+            @Override
             @NotNull
             public DomElement getInvocationElement() {
               return reference;
@@ -97,11 +100,13 @@
           final Collection<Object> variants = resolvingConverter.getVariants(context);
           final List<Pair<String, Icon>> all =
             new ArrayList<Pair<String, Icon>>(ContainerUtil.map(variants, new Function<Object, Pair<String, Icon>>() {
+              @Override
               public Pair<String, Icon> fun(final Object s) {
                 return Pair.create(ElementPresentationManager.getElementName(s), ElementPresentationManager.getIcon(s));
               }
             }));
           all.addAll(ContainerUtil.map(resolvingConverter.getAdditionalVariants(context), new Function() {
+            @Override
             public Object fun(final Object s) {
               return new Pair(s, null);
             }
@@ -113,11 +118,13 @@
     };
   }
 
-  public static Factory<List<Pair<String, Icon>>> createPresentationFunction(final Factory<Collection<? extends Object>> variantFactory) {
+  public static Factory<List<Pair<String, Icon>>> createPresentationFunction(final Factory<Collection<?>> variantFactory) {
     return new Factory<List<Pair<String, Icon>>>() {
+      @Override
       public List<Pair<String, Icon>> create() {
 
         return ContainerUtil.map(variantFactory.create(), new Function<Object, Pair<String, Icon>>() {
+          @Override
           public Pair<String, Icon> fun(final Object s) {
             return Pair.create(ElementPresentationManager.getElementName(s), ElementPresentationManager.getIcon(s));
           }
@@ -129,8 +136,10 @@
 
   static Factory<List<Pair<String, Icon>>> createEnumFactory(final Class<? extends Enum> aClass) {
     return new Factory<List<Pair<String, Icon>>>() {
+      @Override
       public List<Pair<String, Icon>> create() {
         return ContainerUtil.map2List(aClass.getEnumConstants(), new Function<Enum, Pair<String, Icon>>() {
+          @Override
           public Pair<String, Icon> fun(final Enum s) {
             return Pair.create(NamedEnumUtil.getEnumValueByElement(s), ElementPresentationManager.getIcon(s));
           }
@@ -151,6 +160,7 @@
       standardValues.add(pair.first);
     }
     return initComboBox(comboBox, new Condition<String>() {
+      @Override
       public boolean value(final String object) {
         return standardValues.contains(object);
       }
@@ -176,6 +186,7 @@
     comboBox.setEditable(false);
     comboBox.setPrototypeDisplayValue(new ComboBoxItem("A", null));
     comboBox.setRenderer(new DefaultListCellRenderer() {
+      @Override
       public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
         super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
         final Pair<String, Icon> pair = (Pair<String, Icon>)value;
@@ -194,8 +205,10 @@
     return comboBox;
   }
 
+  @Override
   protected JComboBox createMainComponent(final JComboBox boundedComponent) {
     return initComboBox(boundedComponent == null ? new JComboBox() : boundedComponent, new Condition<String>() {
+      @Override
       public boolean value(final String object) {
         return isValidValue(object);
       }
@@ -223,10 +236,12 @@
     return !newData.equals(oldData);
   }
 
+  @Override
   protected boolean isCommitted() {
     return getComponent().isPopupVisible() || super.isCommitted();
   }
 
+  @Override
   protected void doReset() {
     final List<Pair<String, Icon>> data = myDataFactory.create();
     final JComboBox comboBox = getComponent();
@@ -255,12 +270,14 @@
     }
   }
 
+  @Override
   @Nullable
   protected final String getValue() {
     final Pair<String, Icon> pair = (Pair<String, Icon>)getComponent().getSelectedItem();
     return pair == null || pair == EMPTY ? null : pair.first;
   }
 
+  @Override
   protected final void setValue(final String value) {
     final JComboBox component = getComponent();
     if (!isValidValue(value)) {
@@ -271,6 +288,7 @@
   }
 
 
+  @Override
   protected void updateComponent() {
     final DomElement domElement = getDomElement();
     if (domElement == null || !domElement.isValid()) return;
@@ -279,6 +297,7 @@
 
     final Project project = getProject();
     ApplicationManager.getApplication().invokeLater(new Runnable() {
+      @Override
       public void run() {
         if (!project.isOpen()) return;
         if (!getDomWrapper().isValid()) return;
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboTableCellEditor.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboTableCellEditor.java
index 8e0ef03..c9f61c9 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboTableCellEditor.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboTableCellEditor.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.
@@ -43,6 +43,7 @@
     comboBox.setBorder(null);
     comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
     ComboControl.initComboBox(comboBox, new Condition<String>() {
+      @Override
       public boolean value(final String object) {
         return myData != null && myData.containsKey(object) || myNullable && EMPTY.first == object;
       }
@@ -53,11 +54,13 @@
     this(ComboControl.createEnumFactory(anEnum), nullable);
   }
 
+  @Override
   public Object getCellEditorValue() {
     final Pair<String,Icon> cellEditorValue = (Pair<String,Icon>)super.getCellEditorValue();
     return EMPTY == cellEditorValue || null == cellEditorValue ? null : cellEditorValue.first;
   }
 
+  @Override
   public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
     final List<Pair<String, Icon>> list = myDataFactory.create();
     myData = new HashMap<String,Icon>();
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/CommitAdapter.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/CommitAdapter.java
index 537fc1f..d03cf97 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/CommitAdapter.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/CommitAdapter.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.
@@ -19,9 +19,11 @@
  * @author peter
  */
 public abstract class CommitAdapter implements CommitListener{
+  @Override
   public void beforeCommit(DomUIControl control) {
   }
 
+  @Override
   public void afterCommit(DomUIControl control) {
   }
 }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/CommitablePanelUserActivityListener.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/CommitablePanelUserActivityListener.java
index d34619d..6e008c5 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/CommitablePanelUserActivityListener.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/CommitablePanelUserActivityListener.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.
@@ -42,11 +42,13 @@
     myProject = project;
   }
 
+  @Override
   final public void stateChanged() {
     if (myApplying) return;
     cancel();
     cancelAllRequests();
     myAlarm.addRequest(new Runnable() {
+      @Override
       public void run() {
         myApplying = true;
         cancel();
@@ -89,6 +91,7 @@
     myAlarm.cancelAllRequests();
   }
 
+  @Override
   public void dispose() {
     cancelAllRequests();
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/CompositeCommittable.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/CompositeCommittable.java
index edb0749..1563f3b 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/CompositeCommittable.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/CompositeCommittable.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.
@@ -32,18 +32,21 @@
     return panel;
   }
 
+  @Override
   public void commit() {
     for (final Committable committable : myComponents) {
       committable.commit();
     }
   }
 
+  @Override
   public void reset() {
     for (final Committable committable : myComponents) {
       committable.reset();
     }
   }
 
+  @Override
   public void dispose() {
   }
 
@@ -51,6 +54,7 @@
     return myComponents;
   }
 
+  @Override
   public void updateHighlighting() {
     for (final Committable component : myComponents) {
       CommittableUtil.updateHighlighting(component);
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomCollectionControl.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomCollectionControl.java
index ba69ab5..54ec270 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomCollectionControl.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomCollectionControl.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.
@@ -98,21 +98,25 @@
     return myEditable;
   }
 
+  @Override
   public void bind(JComponent component) {
     assert component instanceof DomTableView;
 
     initialize((DomTableView)component);
   }
 
+  @Override
   public void addCommitListener(CommitListener listener) {
     myDispatcher.addListener(listener);
   }
 
+  @Override
   public void removeCommitListener(CommitListener listener) {
     myDispatcher.removeListener(listener);
   }
 
 
+  @Override
   public boolean canNavigate(DomElement element) {
     final Class<DomElement> aClass = (Class<DomElement>)ReflectionUtil.getRawType(myChildDescription.getType());
 
@@ -121,6 +125,7 @@
     return domElement != null && myCollectionElements.contains(domElement);
   }
 
+  @Override
   public void navigate(DomElement element) {
     final Class<DomElement> aClass = (Class<DomElement>)ReflectionUtil.getRawType(myChildDescription.getType());
     final DomElement domElement = element.getParentOfType(aClass, false);
@@ -131,6 +136,7 @@
     myCollectionPanel.getTable().setRowSelectionInterval(index, index);
   }
 
+  @Override
   public void calcData(final DataKey key, final DataSink sink) {
     if (DOM_COLLECTION_CONTROL.equals(key)) {
       sink.put(DOM_COLLECTION_CONTROL, this);
@@ -158,7 +164,8 @@
     myCollectionPanel.installPopup(ActionPlaces.J2EE_ATTRIBUTES_VIEW_POPUP, createPopupActionGroup());
     myCollectionPanel.initializeTable();
     myCollectionPanel.addCustomDataProvider(this);
-    myCollectionPanel.addChangeListener(new DomTableView.ChangeListener() {
+    myCollectionPanel.addChangeListener(new AbstractTableView.ChangeListener() {
+      @Override
       public void changed() {
         reset();
       }
@@ -197,6 +204,7 @@
     }
 
     new WriteCommandAction(getProject(), PsiUtilCore.toPsiFileArray(files)) {
+      @Override
       protected void run(Result result) throws Throwable {
         for (final T t : toDelete) {
           if (t.isValid()) {
@@ -209,6 +217,7 @@
 
   protected final void doRemove() {
     ApplicationManager.getApplication().invokeLater(new Runnable() {
+      @Override
       public void run() {
         final int[] selected = myCollectionPanel.getTable().getSelectedRows();
         if (selected == null || selected.length == 0) return;
@@ -234,6 +243,7 @@
     writeCommandAction.execute();
   }
 
+  @Override
   public void commit() {
     final CommitListener listener = myDispatcher.getMulticaster();
     listener.beforeCommit(this);
@@ -256,6 +266,7 @@
     myCollectionPanel.repaint();
   }
 
+  @Override
   public void dispose() {
     if (myCollectionPanel != null) {
       myCollectionPanel.dispose();
@@ -266,6 +277,7 @@
     return myParentDomElement.getManager().getProject();
   }
 
+  @Override
   public DomTableView getComponent() {
     if (myCollectionPanel == null) initialize(null);
 
@@ -276,10 +288,12 @@
     return myChildDescription;
   }
 
+  @Override
   public final DomElement getDomElement() {
     return myParentDomElement;
   }
 
+  @Override
   public final void reset() {
     myCollectionElements = new ArrayList<T>(getCollectionElements());
     myCollectionPanel.reset(createColumnInfos(myParentDomElement), myCollectionElements);
@@ -297,6 +311,7 @@
 
   protected DefaultAddAction createDefaultAction(final String name, final Icon icon, final Type type) {
     return new ControlAddAction(name, name, icon) {
+      @Override
       protected Type getElementType() {
         return type;
       }
@@ -321,6 +336,7 @@
     return (DomEditorManager)component;
   }
 
+  @Override
   public void updateHighlighting() {
     if (myCollectionPanel != null) {
       myCollectionPanel.revalidate();
@@ -341,10 +357,12 @@
       super(text, description, icon);
     }
 
+    @Override
     protected final DomCollectionChildDescription getDomCollectionChildDescription() {
       return myChildDescription;
     }
 
+    @Override
     protected final DomElement getParentDomElement() {
       return myParentDomElement;
     }
@@ -365,7 +383,8 @@
       }
     }
 
-    protected final void afterAddition(final T newElement) {
+    @Override
+    protected final void afterAddition(@NotNull final T newElement) {
       reset();
       afterAddition(myCollectionPanel.getTable(), myCollectionElements.size() - 1);
     }
@@ -381,6 +400,7 @@
       setShortcutSet(CommonActionsPanel.getCommonShortcut(CommonActionsPanel.Buttons.ADD));
     }
 
+    @Override
     protected boolean isEnabled(final AnActionEvent e) {
       return getDomCollectionControl(e) != null;
     }
@@ -389,19 +409,23 @@
       return DomCollectionControl.getDomCollectionControl(e);
     }
 
+    @Override
     @NotNull
     protected DomCollectionChildDescription[] getDomCollectionChildDescriptions(final AnActionEvent e) {
       return new DomCollectionChildDescription[] {getDomCollectionControl(e).getChildDescription()};
     }
 
+    @Override
     protected DomElement getParentDomElement(final AnActionEvent e) {
       return getDomCollectionControl(e).getDomElement();
     }
 
+    @Override
     protected JComponent getComponent(AnActionEvent e) {
       return getDomCollectionControl(e).getComponent();
     }
 
+    @Override
     @NotNull
     public AnAction[] getChildren(final AnActionEvent e) {
       final DomCollectionControl control = getDomCollectionControl(e);
@@ -409,6 +433,7 @@
       return actions == null ? super.getChildren(e) : actions;
     }
 
+    @Override
     protected DefaultAddAction createAddingAction(final AnActionEvent e,
                                                   final String name,
                                                   final Icon icon,
@@ -426,12 +451,14 @@
       setShortcutSet(CommonActionsPanel.getCommonShortcut(CommonActionsPanel.Buttons.EDIT));
     }
 
+    @Override
     public void actionPerformed(AnActionEvent e) {
       final DomCollectionControl control = DomCollectionControl.getDomCollectionControl(e);
       control.doEdit();
       control.reset();
     }
 
+    @Override
     public void update(AnActionEvent e) {
       final DomCollectionControl control = DomCollectionControl.getDomCollectionControl(e);
       final boolean visible = control != null && control.isEditable();
@@ -446,12 +473,14 @@
       setShortcutSet(CommonActionsPanel.getCommonShortcut(CommonActionsPanel.Buttons.REMOVE));
     }
 
+    @Override
     public void actionPerformed(AnActionEvent e) {
       final DomCollectionControl control = DomCollectionControl.getDomCollectionControl(e);
       control.doRemove();
       control.reset();
     }
 
+    @Override
     public void update(AnActionEvent e) {
       final boolean enabled;
       final DomCollectionControl control = DomCollectionControl.getDomCollectionControl(e);
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomCollectionWrapper.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomCollectionWrapper.java
index b2c25d9..77d2be6 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomCollectionWrapper.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomCollectionWrapper.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.
@@ -50,16 +50,19 @@
     myGetter = getter;
   }
 
+  @Override
   @NotNull
   public DomElement getExistingDomElement() {
     return myDomElement;
   }
 
+  @Override
   public DomElement getWrappedElement() {
     final List<? extends DomElement> list = myChildDescription.getValues(myDomElement);
     return list.isEmpty() ? null : list.get(0);
   }
 
+  @Override
   public void setValue(final T value) throws IllegalAccessException, InvocationTargetException {
     final List<? extends DomElement> list = myChildDescription.getValues(myDomElement);
     final DomElement domElement;
@@ -71,6 +74,7 @@
     mySetter.invoke(domElement, value);
   }
 
+  @Override
   public T getValue() throws IllegalAccessException, InvocationTargetException {
     if (!myDomElement.isValid()) return null;
     final List<? extends DomElement> list = myChildDescription.getValues(myDomElement);
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomColumnInfo.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomColumnInfo.java
index 044bb44..eea9a26 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomColumnInfo.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomColumnInfo.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.
@@ -35,10 +35,12 @@
     myRenderer = renderer;
   }
 
+  @Override
   public boolean isCellEditable(final T o) {
     return getEditor(o) != null;
   }
 
+  @Override
   public TableCellRenderer getRenderer(T value) {
     return myRenderer;
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomFileEditor.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomFileEditor.java
index a4f1964..ee8f1fa 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomFileEditor.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomFileEditor.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.
@@ -46,6 +46,7 @@
 
   public DomFileEditor(final Project project, final VirtualFile file, final String name, final T component) {
     this(project, file, name, new Factory<T>() {
+      @Override
       public T create() {
         return component;
       }
@@ -58,6 +59,7 @@
     myName = name;
     
     DomElementAnnotationsManager.getInstance(project).addHighlightingListener(new DomElementAnnotationsManager.DomHighlightingListener() {
+      @Override
       public void highlightingFinished(@NotNull DomFileElement element) {
         if (isInitialised() && getComponent().isShowing() && element.isValid()) {
           updateHighlighting();
@@ -66,12 +68,14 @@
     }, this);
   }
 
+  @Override
   public void updateHighlighting() {
     if (checkIsValid()) {
       CommittableUtil.updateHighlighting(myComponent);
     }
   }
 
+  @Override
   public void commit() {
     if (checkIsValid() && isInitialised()) {
       setShowing(false);
@@ -84,6 +88,7 @@
     }
   }
 
+  @Override
   @Nullable
   public JComponent getPreferredFocusedComponent() {
     ensureInitialized();
@@ -94,12 +99,14 @@
     return myComponent;
   }
 
+  @Override
   @NotNull
   protected JComponent createCustomComponent() {
     new MnemonicHelper().register(getComponent());
     myComponent = myComponentFactory.create();
     DomUIFactory.getDomUIFactory().setupErrorOutdatingUserActivityWatcher(this, getDomElement());
     DomManager.getDomManager(getProject()).addDomEventListener(new DomEventListener() {
+      @Override
       public void eventOccured(DomEvent event) {
         checkIsValid();
       }
@@ -108,16 +115,19 @@
     return myComponent.getComponent();
   }
 
+  @Override
   @NotNull
   public final String getName() {
     return myName;
   }
 
+  @Override
   protected DomElement getSelectedDomElement() {
     if (myComponent == null) return null;
     return DomUINavigationProvider.findDomElement(myComponent);
   }
 
+  @Override
   protected void setSelectedDomElement(DomElement domElement) {
     final DomUIControl domControl = DomUINavigationProvider.findDomControl(myComponent, domElement);
     if (domControl != null) {
@@ -125,6 +135,7 @@
     }
   }
 
+  @Override
   public BackgroundEditorHighlighter getBackgroundHighlighter() {
     ensureInitialized();
     return DomUIFactory.getDomUIFactory().createDomHighlighter(getProject(), this, getDomElement());
@@ -135,10 +146,12 @@
   }
 
 
+  @Override
   public boolean isValid() {
     return super.isValid() && (!isInitialised() || getDomElement().isValid());
   }
 
+  @Override
   public void reset() {
     if (checkIsValid()) {
       myComponent.reset();
@@ -152,6 +165,7 @@
 
     final XmlFile file = DomUtil.getFile(element);
     final Factory<BasicDomElementComponent> factory = new Factory<BasicDomElementComponent>() {
+      @Override
       public BasicDomElementComponent create() {
 
         CaptionComponent captionComponent = new CaptionComponent(name, icon);
@@ -162,6 +176,7 @@
       }
     };
     return new DomFileEditor<BasicDomElementComponent>(file.getProject(), file.getVirtualFile(), name, factory) {
+      @Override
       public JComponent getPreferredFocusedComponent() {
         return null;
       }
@@ -176,6 +191,7 @@
     panel.add(element.isValid() ? committablePanel.getComponent() : new JPanel(), BorderLayout.CENTER);
 
     BasicDomElementComponent component = new BasicDomElementComponent(element) {
+      @Override
       public JComponent getComponent() {
         return panel;
       }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomFixedWrapper.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomFixedWrapper.java
index 7597791..b43eb03 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomFixedWrapper.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomFixedWrapper.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.
@@ -31,19 +31,23 @@
     myDomElement = domElement;
   }
 
+  @Override
   public DomElement getWrappedElement() {
     return myDomElement;
   }
 
+  @Override
   public void setValue(final T value) throws IllegalAccessException, InvocationTargetException {
     DomUIFactory.SET_VALUE_METHOD.invoke(getWrappedElement(), value);
   }
 
+  @Override
   public T getValue() throws IllegalAccessException, InvocationTargetException {
     final DomElement element = getWrappedElement();
     return element.isValid() ? (T)DomUIFactory.GET_VALUE_METHOD.invoke(element) : null;
   }
 
+  @Override
   @NotNull
   public DomElement getExistingDomElement() {
     return myDomElement;
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomStringWrapper.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomStringWrapper.java
index b2e9c29..3294690 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomStringWrapper.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomStringWrapper.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.
@@ -31,19 +31,23 @@
     myDomElement = domElement;
   }
 
+  @Override
   @NotNull
   public DomElement getExistingDomElement() {
     return myDomElement;
   }
 
+  @Override
   public DomElement getWrappedElement() {
     return myDomElement;
   }
 
+  @Override
   public void setValue(final String value) throws IllegalAccessException, InvocationTargetException {
     myDomElement.setStringValue(value);
   }
 
+  @Override
   public String getValue() throws IllegalAccessException, InvocationTargetException {
     return myDomElement.isValid() ? myDomElement.getStringValue() : null;
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomTableView.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomTableView.java
index f25fbfc..e228ad7 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomTableView.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomTableView.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.
@@ -44,6 +44,7 @@
     myCustomDataProviders.add(provider);
   }
 
+  @Override
   public void calcData(final DataKey key, final DataSink sink) {
     super.calcData(key, sink);
     for (final TypeSafeDataProvider customDataProvider : myCustomDataProviders) {
@@ -56,9 +57,11 @@
     installPopup(ActionPlaces.J2EE_ATTRIBUTES_VIEW_POPUP, group);
   }
 
+  @Override
   protected void wrapValueSetting(@NotNull final DomElement domElement, final Runnable valueSetter) {
     if (domElement.isValid()) {
       new WriteCommandAction(getProject(), DomUtil.getFile(domElement)) {
+        @Override
         protected void run(final Result result) throws Throwable {
           valueSetter.run();
         }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomUIFactory.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomUIFactory.java
index e5effb1..2184ff8 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomUIFactory.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomUIFactory.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.
@@ -44,8 +44,8 @@
 
   public final static ExtensionPointName<Consumer<DomUIFactory>> EXTENSION_POINT_NAME = ExtensionPointName.create("com.intellij.dom.uiControlsProvider");
 
-  public static Method GET_VALUE_METHOD = ReflectionUtil.getMethod(GenericDomValue.class, "getValue");
-  public static Method SET_VALUE_METHOD = findMethod(GenericDomValue.class, "setValue");
+  public static final Method GET_VALUE_METHOD = ReflectionUtil.getMethod(GenericDomValue.class, "getValue");
+  public static final Method SET_VALUE_METHOD = findMethod(GenericDomValue.class, "setValue");
   public static Method GET_STRING_METHOD = ReflectionUtil.getMethod(GenericDomValue.class, "getStringValue");
   public static Method SET_STRING_METHOD = findMethod(GenericDomValue.class, "setStringValue");
 
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomUINavigationProvider.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomUINavigationProvider.java
index 7aa1e5f..adfa209 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomUINavigationProvider.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomUINavigationProvider.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.
@@ -35,10 +35,12 @@
   }
 
 
+  @Override
   public String getProviderName() {
     return DOM_UI_NAVIGATION_PROVIDER_NAME;
   }
 
+  @Override
   public void navigate(DomElement domElement, boolean requestFocus) {
     final DomUIControl domUIControl = findDomControl(myComponent, domElement);
     if(domUIControl != null) {
@@ -46,6 +48,7 @@
     }
   }
 
+  @Override
   public boolean canNavigate(DomElement domElement) {
     return findDomControl(myComponent, domElement) != null;
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/ErrorableTableCellRenderer.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/ErrorableTableCellRenderer.java
index 59b40c1..a92015c 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/ErrorableTableCellRenderer.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/ErrorableTableCellRenderer.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.
@@ -48,6 +48,7 @@
     myRoot = DomUtil.getRoot(myRowDomElement);
   }
 
+  @Override
   public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
     final Component component = myRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
     if (!myRoot.isValid()) {
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/GenericValueColumnInfo.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/GenericValueColumnInfo.java
index 033e609..16644b1 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/GenericValueColumnInfo.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/GenericValueColumnInfo.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.
@@ -38,18 +38,22 @@
     this(name, columnClass, new DefaultTableCellRenderer(), editor);
   }
 
+  @Override
   public final TableCellEditor getEditor(GenericDomValue<T> value) {
     return myEditor;
   }
 
+  @Override
   public final Class<T> getColumnClass() {
     return myColumnClass;
   }
 
+  @Override
   public final void setValue(final GenericDomValue<T> o, final String aValue) {
     o.setStringValue(aValue);
   }
 
+  @Override
   public final String valueOf(GenericDomValue<T> object) {
     return object.getStringValue();
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/MockDomElementsEditor.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/MockDomElementsEditor.java
index 5cd8a74..ee99db4 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/MockDomElementsEditor.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/MockDomElementsEditor.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.
@@ -50,6 +50,7 @@
   protected final <T extends DomElement> T addEditedElement(final Class<T> aClass, final EditedElementDescription<T> description) {
     final DomManager domManager = DomManager.getDomManager(myModule.getProject());
     final T t = domManager.createStableValue(new Factory<T>() {
+      @Override
       public T create() {
         T t = description.find();
         if (t == null) {
@@ -68,6 +69,7 @@
 
   protected final DomFileEditor initFileEditor(final BasicDomElementComponent component, final VirtualFile virtualFile, final String name) {
     initFileEditor(component.getProject(), virtualFile, name, new Factory<BasicDomElementComponent>() {
+      @Override
       public BasicDomElementComponent create() {
         return component;
       }
@@ -78,10 +80,12 @@
 
   protected final DomFileEditor initFileEditor(final Project project, final VirtualFile virtualFile, final String name, final Factory<? extends BasicDomElementComponent> component) {
     myFileEditor = new DomFileEditor<BasicDomElementComponent>(project, virtualFile, name, component) {
+      @Override
       public JComponent getPreferredFocusedComponent() {
         return null;
       }
 
+      @Override
       @NotNull
       protected JComponent createCustomComponent() {
         final JComponent customComponent = super.createCustomComponent();
@@ -89,6 +93,7 @@
         return customComponent;
       }
 
+      @Override
       public void reset() {
         for (final Map.Entry<EditedElementDescription<? extends DomElement>, DomElement> entry : myDomElements.entrySet()) {
           final DomElement newValue = entry.getKey().find();
@@ -100,6 +105,7 @@
         super.reset();
       }
 
+      @Override
       public void commit() {
         super.commit();
         final List<EditedElementDescription> descriptions = new ArrayList<EditedElementDescription>();
@@ -116,6 +122,7 @@
             }
         }
         new WriteCommandAction(project, PsiUtilCore.toPsiFileArray(changedFiles)) {
+          @Override
           protected void run(Result result) throws Throwable {
             for (EditedElementDescription description : descriptions) {
               final DomElement editedElement = myDomElements.get(description);
@@ -145,6 +152,7 @@
   private <T extends DomElement> T createMockElement(final Class<T> aClass, final Module module) {
     final Project project = module.getProject();
     ApplicationManager.getApplication().invokeLater(new Runnable() {
+      @Override
       public void run() {
         if (myFileEditor.isInitialised()) {
           myContents.reset();
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/StringColumnInfo.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/StringColumnInfo.java
index edb3f41..c20a715 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/StringColumnInfo.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/StringColumnInfo.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.
@@ -25,6 +25,7 @@
     super(name);
   }
 
+  @Override
   public String valueOf(final T object) {
     return object.getPresentation().getTypeName();
   }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/StripeTableCellRenderer.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/StripeTableCellRenderer.java
index 9853719..85b27dc 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/StripeTableCellRenderer.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/StripeTableCellRenderer.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.
@@ -41,6 +41,7 @@
                      Math.max((int)(color.getBlue() *FACTOR), 0));
   }
 
+  @Override
   public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
     final JComponent component = (JComponent)getRenderer(row, column).getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
     if (row % 2 != 0 && !isSelected) {
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/UndoHelper.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/UndoHelper.java
index 8af5568..ad671b1 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/UndoHelper.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/UndoHelper.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.
@@ -36,6 +36,7 @@
   private final Set<Document> myCurrentDocuments = new HashSet<Document>();
   private boolean myDirty;
   private final DocumentAdapter myDocumentAdapter = new DocumentAdapter() {
+    @Override
     public void documentChanged(DocumentEvent e) {
       if (myShowing) {
         myDirty = true;
@@ -47,14 +48,17 @@
     myProject = project;
     final PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(project);
     CommandProcessor.getInstance().addCommandListener(new CommandAdapter() {
+      @Override
       public void commandStarted(CommandEvent event) {
         undoTransparentActionStarted();
       }
 
+      @Override
       public void undoTransparentActionStarted() {
         myDirty = false;
       }
 
+      @Override
       public void undoTransparentActionFinished() {
         if (myDirty) {
           psiDocumentManager.commitAllDocuments();
@@ -62,6 +66,7 @@
         }
       }
 
+      @Override
       public void commandFinished(CommandEvent event) {
         undoTransparentActionFinished();
       }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/AddDomElementAction.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/AddDomElementAction.java
index 31629d5..4e6cf8a 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/AddDomElementAction.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/AddDomElementAction.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.
@@ -48,6 +48,7 @@
     super(ApplicationBundle.message("action.add"), null, DomCollectionControl.ADD_ICON);
   }
 
+  @Override
   public void update(AnActionEvent e) {
     if (!isEnabled(e)) {
       e.getPresentation().setEnabled(false);
@@ -75,6 +76,7 @@
     super.update(e);
   }
 
+  @Override
   public void actionPerformed(AnActionEvent e) {
     final AnAction[] actions = getChildren(e);
     if (actions.length > 1) {
@@ -138,6 +140,7 @@
     }
     if (actions.size() > 1 && showAsPopup()) {
       ActionGroup group = new ActionGroup() {
+        @Override
         @NotNull
         public AnAction[] getChildren(@Nullable AnActionEvent e) {
           return actions.toArray(new AnAction[actions.size()]);
@@ -183,6 +186,7 @@
       setShortcutSet(CommonActionsPanel.getCommonShortcut(CommonActionsPanel.Buttons.ADD));
     }
 
+    @Override
     public void actionPerformed(AnActionEvent e) {
       final ListPopup groupPopup =
         JBPopupFactory.getInstance().createActionGroupPopup(null,
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/DefaultAddAction.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/DefaultAddAction.java
index a564e03..eafc360 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/DefaultAddAction.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/DefaultAddAction.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.
@@ -66,6 +66,7 @@
   protected void afterAddition(@NotNull T newElement) {
   }
 
+  @Override
   public final void actionPerformed(final AnActionEvent e) {
     final T result = performElementAddition();
     if (result != null) {
@@ -80,6 +81,7 @@
     final TypeChooser[] oldChoosers = new TypeChooser[]{null};
     final Type[] aClass = new Type[]{null};
     final StableElement<T> result = new WriteCommandAction<StableElement<T>>(domManager.getProject(), DomUtil.getFile(parent)) {
+      @Override
       protected void run(Result<StableElement<T>> result) throws Throwable {
         final DomElement parentDomElement = getParentDomElement();
         final T t = (T)getDomCollectionChildDescription().addValue(parentDomElement, getElementType());
@@ -89,6 +91,7 @@
         final SmartPsiElementPointer pointer =
           SmartPointerManager.getInstance(getProject()).createSmartPsiElementPointer(t.getXmlTag());
         domManager.getTypeChooserManager().registerTypeChooser(aClass[0], new TypeChooser() {
+          @Override
           public Type chooseType(final XmlTag tag) {
             if (tag == pointer.getElement()) {
               return getElementType();
@@ -96,10 +99,12 @@
             return oldChoosers[0].chooseType(tag);
           }
 
+          @Override
           public void distinguishTag(final XmlTag tag, final Type aClass) throws IncorrectOperationException {
             oldChoosers[0].distinguishTag(tag, aClass);
           }
 
+          @Override
           public Type[] getChooserTypes() {
             return oldChoosers[0].getChooserTypes();
           }
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/GenerateDomElementAction.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/GenerateDomElementAction.java
index dd6f1c0..8922919 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/GenerateDomElementAction.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/GenerateDomElementAction.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.
@@ -50,11 +50,14 @@
       this(generateProvider, null);
   }
 
+  @Override
   @NotNull
   protected CodeInsightActionHandler getHandler() {
     return new CodeInsightActionHandler() {
+      @Override
       public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) {
         final Runnable runnable = new Runnable() {
+          @Override
           public void run() {
             final DomElement element = myProvider.generate(project, editor, file);
             myProvider.navigate(element);
@@ -63,6 +66,7 @@
         
         if (GenerateDomElementAction.this.startInWriteAction()) {
           new WriteCommandAction(project, file) {
+            @Override
             protected void run(final Result result) throws Throwable {
               runnable.run();
             }
@@ -73,6 +77,7 @@
         }
       }
 
+      @Override
       public boolean startInWriteAction() {
         return false;
       }
@@ -83,6 +88,7 @@
     return true;
   }
 
+  @Override
   protected boolean isValidForFile(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) {
     final DomElement element = DomUtil.getContextElement(editor);
     return element != null && myProvider.isAvailableForElement(element);
diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/GenerateDomElementProvider.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/GenerateDomElementProvider.java
index 810a778..1115521 100644
--- a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/GenerateDomElementProvider.java
+++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/GenerateDomElementProvider.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.
@@ -51,6 +51,7 @@
 
       if (navigateProvider != null && navigateProvider.canNavigate(copy)) {
         ApplicationManager.getApplication().invokeLater(new Runnable() {
+          @Override
           public void run() {
             if (!project.isDisposed()) {
               doNavigate(navigateProvider, copy);
diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomBasicsTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomBasicsTest.java
index 7f059e4..630ad79 100644
--- a/xml/dom-tests/tests/com/intellij/util/xml/DomBasicsTest.java
+++ b/xml/dom-tests/tests/com/intellij/util/xml/DomBasicsTest.java
@@ -200,7 +200,7 @@
 
   private void assertFixedChildDescription(final DomFixedChildDescription description,
                                            final DomElement child,
-                                           final String tagName) throws NoSuchMethodException {
+                                           final String tagName) {
     assertEquals(1, description.getCount());
     assertEquals(Arrays.asList(child), description.getValues(child.getParent()));
     assertEquals(tagName, description.getXmlElementName());
@@ -210,7 +210,7 @@
 
   private static void assertGenericChildDescription(final DomFixedChildDescription description,
                                              final DomElement child,
-                                             final String tagName) throws NoSuchMethodException {
+                                             final String tagName) {
     assertEquals(1, description.getCount());
     assertEquals(Arrays.asList(child), description.getValues(child.getParent()));
     assertEquals(tagName, description.getXmlElementName());
diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomChildrenTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomChildrenTest.java
index efd9325..60cb32b 100644
--- a/xml/dom-tests/tests/com/intellij/util/xml/DomChildrenTest.java
+++ b/xml/dom-tests/tests/com/intellij/util/xml/DomChildrenTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -207,6 +207,7 @@
     assertEquals(element, child2.getParent());
 
     WriteCommandAction.runWriteCommandAction(null, new Runnable() {
+      @Override
       public void run() {
         child2.undefine();
         assertFalse(child2.isValid());
@@ -409,6 +410,7 @@
     final MyElement element = createElement("<a><child/></a>");
     final MyElement child = element.getChild();
     ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      @Override
       public void run() {
         element.undefine();
       }
diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomConcurrencyStressTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomConcurrencyStressTest.java
index 4a94d0e..d7df24e 100644
--- a/xml/dom-tests/tests/com/intellij/util/xml/DomConcurrencyStressTest.java
+++ b/xml/dom-tests/tests/com/intellij/util/xml/DomConcurrencyStressTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -82,6 +82,7 @@
       public void run() {
         for (int i = 0; i < ITERATIONS; i++) {
           ApplicationManager.getApplication().runReadAction(new Runnable() {
+            @Override
             public void run() {
               final DomFileElementImpl<DomElement> element = getDomManager().getFileElement(file);
               assertNotNull(element);
@@ -197,6 +198,7 @@
         final Random random = new Random();
         for (int i = 0; i < ITERATIONS; i++) {
           ApplicationManager.getApplication().runReadAction(new Runnable() {
+            @Override
             public void run() {
               int offset = random.nextInt(file.getTextLength() - 10);
               XmlTag tag = PsiTreeUtil.findElementOfClassAtOffset(file, offset, XmlTag.class, false);
diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomExtensionsTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomExtensionsTest.java
index 5aa8c0b..c75fe42 100644
--- a/xml/dom-tests/tests/com/intellij/util/xml/DomExtensionsTest.java
+++ b/xml/dom-tests/tests/com/intellij/util/xml/DomExtensionsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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,6 +18,7 @@
 import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.util.Key;
 import com.intellij.testFramework.IdeaTestUtil;
+import com.intellij.testFramework.PlatformTestUtil;
 import com.intellij.util.Consumer;
 import com.intellij.util.ParameterizedTypeImpl;
 import com.intellij.util.ReflectionUtil;
@@ -212,7 +213,7 @@
     final DomExtenderEP extenderEP = new DomExtenderEP();
     extenderEP.domClassName = domClass.getName();
     extenderEP.extenderClassName = extenderClass.getName();
-    IdeaTestUtil.registerExtension(Extensions.getRootArea(), DomExtenderEP.EP_NAME, extenderEP, myTestRootDisposable);
+    PlatformTestUtil.registerExtension(Extensions.getRootArea(), DomExtenderEP.EP_NAME, extenderEP, myTestRootDisposable);
   }
 
 
diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomIncludesTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomIncludesTest.java
index 095c9d4..d141ce0 100644
--- a/xml/dom-tests/tests/com/intellij/util/xml/DomIncludesTest.java
+++ b/xml/dom-tests/tests/com/intellij/util/xml/DomIncludesTest.java
@@ -66,7 +66,7 @@
         assertEquals("a", element.getXxx().getValue());
       }
     };
-    assertOrderedCollection(children, new Consumer[] { consumer1, consumer2 });
+    assertOrderedCollection(children, consumer1, consumer2);
   }
 
   public void testNamespaces() throws Throwable {
@@ -127,6 +127,7 @@
           try {
             for (int k = 0; k < iterationCount; k++) {
               ApplicationManager.getApplication().runReadAction(new Runnable() {
+                @Override
                 public void run() {
                   final List<Boy> boys = rootElement.getBoys();
                   Thread.yield();
@@ -151,6 +152,7 @@
 
     for (int i = 0; i < iterationCount; i++) {
       WriteCommandAction.runWriteCommandAction(null, new Runnable() {
+        @Override
         public void run() {
           fileB.getViewProvider().getDocument().insertString(0, " ");
           fileD.getViewProvider().getDocument().insertString(0, " ");
@@ -158,14 +160,18 @@
         }
       });
       Thread.sleep(10);
-      WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+      WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+        @Override
+        public void run() {
           fileC.getViewProvider().getDocument().insertString(0, " ");
           fileE.getViewProvider().getDocument().insertString(0, " ");
           PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); //clear xinclude caches
         }
       });
       Thread.sleep(10);
-      WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+      WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+        @Override
+        public void run() {
 
           fileB.getViewProvider().getDocument().setText(textB);
           fileC.getViewProvider().getDocument().setText(textC);
diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomSaxParserTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomSaxParserTest.java
index c5ec2d4..e9ab730 100644
--- a/xml/dom-tests/tests/com/intellij/util/xml/DomSaxParserTest.java
+++ b/xml/dom-tests/tests/com/intellij/util/xml/DomSaxParserTest.java
@@ -1,6 +1,17 @@
 /*
- * Copyright (c) 2000-2005 by JetBrains s.r.o. All Rights Reserved.
- * Use is subject to license terms.
+ * 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.util.xml;
 
@@ -100,7 +111,7 @@
                "<!ENTITY % globals SYSTEM \"classpath://auction/persistence/globals.dtd\">\n" + "%globals;\n" + "]><a/>", "a", null, null, "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd");
   }
 
-  private void assertData(final String start, @Nullable final String localName, @Nullable String namespace, @Nullable String publicId, @Nullable String systemId) throws IOException, SAXException {
+  private void assertData(final String start, @Nullable final String localName, @Nullable String namespace, @Nullable String publicId, @Nullable String systemId) {
     XmlFileHeader expected = new XmlFileHeader(localName, namespace, publicId, systemId);
 
     XmlFile file = createXmlFile(start);
diff --git a/xml/dom-tests/tests/com/intellij/util/xml/ProxyTest.java b/xml/dom-tests/tests/com/intellij/util/xml/ProxyTest.java
index 95c25fc..3db1009 100644
--- a/xml/dom-tests/tests/com/intellij/util/xml/ProxyTest.java
+++ b/xml/dom-tests/tests/com/intellij/util/xml/ProxyTest.java
@@ -201,6 +201,7 @@
   }
 
   interface ConcreteInterface extends GenericInterface<String> {
+    @Override
     Object foo(String t);
   }
 
diff --git a/xml/dom-tests/tests/com/intellij/util/xml/impl/IncrementalUpdateEventsTest.java b/xml/dom-tests/tests/com/intellij/util/xml/impl/IncrementalUpdateEventsTest.java
index 41c6b49..5568b31 100644
--- a/xml/dom-tests/tests/com/intellij/util/xml/impl/IncrementalUpdateEventsTest.java
+++ b/xml/dom-tests/tests/com/intellij/util/xml/impl/IncrementalUpdateEventsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -124,6 +124,7 @@
 
   private void deleteTag(final int index) throws IncorrectOperationException {
     WriteCommandAction.runWriteCommandAction(null, new Runnable() {
+      @Override
       public void run() {
         myElement.getXmlTag().getSubTags()[index].delete();
       }
diff --git a/xml/dom-tests/tests/com/intellij/util/xml/impl/TreeIncrementalUpdateTest.java b/xml/dom-tests/tests/com/intellij/util/xml/impl/TreeIncrementalUpdateTest.java
index 3ad475a..32e9f2d 100644
--- a/xml/dom-tests/tests/com/intellij/util/xml/impl/TreeIncrementalUpdateTest.java
+++ b/xml/dom-tests/tests/com/intellij/util/xml/impl/TreeIncrementalUpdateTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -373,6 +373,7 @@
     final XmlTag tag = element.getXmlTag();
     final XmlTag childTag = tag.getSubTags()[0];
     WriteCommandAction.runWriteCommandAction(null, new Runnable() {
+      @Override
       public void run() {
         childTag.delete();
       }
@@ -391,7 +392,9 @@
     final Sepulka element = createElement("<a><foo/><bar/></a>", Sepulka.class);
     final List<MyElement> list = element.getCustomChildren();
     final XmlTag tag = element.getXmlTag();
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         tag.getSubTags()[0].delete();
         tag.getSubTags()[0].delete();
       }
@@ -420,6 +423,7 @@
     assertNoCache(leafTag);
 
     ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      @Override
       public void run() {
         tag.getSubTags()[1].delete();
 
diff --git a/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.java b/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.java
index bde6a85..ba5a72a 100644
--- a/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.java
+++ b/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.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.
@@ -26,6 +26,7 @@
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.codeStyle.CodeStyleSettings;
+import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
 import com.intellij.ui.components.JBScrollPane;
 import com.intellij.util.ArrayUtil;
 import com.intellij.util.PlatformIcons;
@@ -88,6 +89,7 @@
     addPanelToWatch(myPanel);
   }
 
+  @Override
   protected EditorHighlighter createHighlighter(final EditorColorsScheme scheme) {
     return XmlHighlighterFactory.createXMLHighlighter(scheme);
   }
@@ -106,6 +108,7 @@
     uiField.getTextField().setEditable(false);
     uiField.setButtonIcon(PlatformIcons.OPEN_EDIT_DIALOG_ICON);
     uiField.addActionListener(new ActionListener() {
+      @Override
       public void actionPerformed(ActionEvent e) {
         final TagListDialog tagListDialog = new TagListDialog(title);
         tagListDialog.setData(createCollectionOn(uiField.getText()));
@@ -129,14 +132,16 @@
     });
   }
 
+  @Override
   protected int getRightMargin() {
     return 60;
   }
 
+  @Override
   public void apply(CodeStyleSettings settings) {
     settings.HTML_KEEP_BLANK_LINES = getIntValue(myKeepBlankLines);
     settings.HTML_ATTRIBUTE_WRAP = ourWrappings[myWrapAttributes.getSelectedIndex()];
-    settings.HTML_TEXT_WRAP = myWrapText.isSelected() ? CodeStyleSettings.WRAP_AS_NEEDED : CodeStyleSettings.DO_NOT_WRAP;
+    settings.HTML_TEXT_WRAP = myWrapText.isSelected() ? CommonCodeStyleSettings.WRAP_AS_NEEDED : CommonCodeStyleSettings.DO_NOT_WRAP;
     settings.HTML_SPACE_INSIDE_EMPTY_TAG = mySpaceInEmptyTag.isSelected();
     settings.HTML_ALIGN_ATTRIBUTES = myAlignAttributes.isSelected();
     settings.HTML_ALIGN_TEXT = myAlignText.isSelected();
@@ -164,10 +169,11 @@
     }
   }
 
+  @Override
   protected void resetImpl(final CodeStyleSettings settings) {
     myKeepBlankLines.setText(String.valueOf(settings.HTML_KEEP_BLANK_LINES));
     myWrapAttributes.setSelectedIndex(getIndexForWrapping(settings.HTML_ATTRIBUTE_WRAP));
-    myWrapText.setSelected(settings.HTML_TEXT_WRAP != CodeStyleSettings.DO_NOT_WRAP);
+    myWrapText.setSelected(settings.HTML_TEXT_WRAP != CommonCodeStyleSettings.DO_NOT_WRAP);
     mySpaceInEmptyTag.setSelected(settings.HTML_SPACE_INSIDE_EMPTY_TAG);
     myAlignAttributes.setSelected(settings.HTML_ALIGN_ATTRIBUTES);
     myAlignText.setSelected(settings.HTML_ALIGN_TEXT);
@@ -186,6 +192,7 @@
     myKeepWhiteSpacesTagNames.setText(settings.HTML_KEEP_WHITESPACES_INSIDE);
   }
 
+  @Override
   public boolean isModified(CodeStyleSettings settings) {
     if (settings.HTML_KEEP_BLANK_LINES != getIntValue(myKeepBlankLines)) {
       return true;
@@ -194,7 +201,7 @@
       return true;
     }
 
-    if ((settings.HTML_TEXT_WRAP == CodeStyleSettings.WRAP_AS_NEEDED) != myWrapText.isSelected()) {
+    if ((settings.HTML_TEXT_WRAP == CommonCodeStyleSettings.WRAP_AS_NEEDED) != myWrapText.isSelected()) {
       return true;
     }
 
@@ -256,20 +263,24 @@
     return false;
   }
 
+  @Override
   public JComponent getPanel() {
     return myPanel;
   }
 
+  @Override
   protected String getPreviewText() {
     return readFromFile(this.getClass(), "preview.html.template");
 
   }
 
+  @Override
   @NotNull
   protected FileType getFileType() {
     return StdFileTypes.HTML;
   }
 
+  @Override
   protected void prepareForReformat(final PsiFile psiFile) {
     //psiFile.putUserData(PsiUtil.FILE_LANGUAGE_LEVEL_KEY, LanguageLevel.HIGHEST);
   }
diff --git a/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.java b/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.java
index b7f0bd3..ab31261 100644
--- a/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.java
+++ b/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.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.
@@ -22,6 +22,7 @@
 import com.intellij.openapi.fileTypes.StdFileTypes;
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.codeStyle.CodeStyleSettings;
+import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
 import com.intellij.psi.formatter.xml.XmlCodeStyleSettings;
 import com.intellij.ui.components.JBScrollPane;
 import org.jetbrains.annotations.NotNull;
@@ -57,21 +58,24 @@
     addPanelToWatch(myPanel);
   }
 
+  @Override
   protected EditorHighlighter createHighlighter(final EditorColorsScheme scheme) {
     return XmlHighlighterFactory.createXMLHighlighter(scheme);
   }
 
+  @Override
   protected int getRightMargin() {
     return 60;
   }
 
+  @Override
   public void apply(CodeStyleSettings settings) {
     XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
     xmlSettings.XML_KEEP_BLANK_LINES = getIntValue(myKeepBlankLines);
     xmlSettings.XML_KEEP_LINE_BREAKS = myKeepLineBreaks.isSelected();
     xmlSettings.XML_KEEP_LINE_BREAKS_IN_TEXT = myKeepLineBreaksInText.isSelected();
     xmlSettings.XML_ATTRIBUTE_WRAP = ourWrappings[myWrapAttributes.getSelectedIndex()];
-    xmlSettings.XML_TEXT_WRAP = myWrapText.isSelected() ? CodeStyleSettings.WRAP_AS_NEEDED : CodeStyleSettings.DO_NOT_WRAP;
+    xmlSettings.XML_TEXT_WRAP = myWrapText.isSelected() ? CommonCodeStyleSettings.WRAP_AS_NEEDED : CommonCodeStyleSettings.DO_NOT_WRAP;
     xmlSettings.XML_ALIGN_ATTRIBUTES = myAlignAttributes.isSelected();
     xmlSettings.XML_KEEP_WHITESPACES = myKeepWhiteSpaces.isSelected();
     xmlSettings.XML_SPACE_AROUND_EQUALITY_IN_ATTRIBUTE = mySpacesAroundEquality.isSelected();
@@ -90,6 +94,7 @@
     }
   }
 
+  @Override
   protected void resetImpl(final CodeStyleSettings settings) {
     XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
     myKeepBlankLines.setText(String.valueOf(xmlSettings.XML_KEEP_BLANK_LINES));
@@ -106,6 +111,7 @@
     myKeepWhitespaceInsideCDATACheckBox.setSelected(xmlSettings.XML_KEEP_WHITE_SPACES_INSIDE_CDATA);
   }
 
+  @Override
   public boolean isModified(CodeStyleSettings settings) {
     XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
     if (myWrapText.isSelected() != wrapText(settings)) {
@@ -155,22 +161,26 @@
 
   private boolean wrapText(final CodeStyleSettings settings) {
     XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
-    return xmlSettings.XML_TEXT_WRAP == CodeStyleSettings.WRAP_AS_NEEDED;
+    return xmlSettings.XML_TEXT_WRAP == CommonCodeStyleSettings.WRAP_AS_NEEDED;
   }
 
+  @Override
   public JComponent getPanel() {
     return myPanel;
   }
 
+  @Override
   protected String getPreviewText() {
     return readFromFile(getClass(), "preview.xml.template");
   }
 
+  @Override
   @NotNull
   protected FileType getFileType() {
     return StdFileTypes.XML;
   }
 
+  @Override
   protected void prepareForReformat(final PsiFile psiFile) {
     //psiFile.putUserData(PsiUtil.FILE_LANGUAGE_LEVEL_KEY, LanguageLevel.HIGHEST);
   }
diff --git a/xml/impl/src/com/intellij/application/options/HtmlCodeStyleMainPanel.java b/xml/impl/src/com/intellij/application/options/HtmlCodeStyleMainPanel.java
index ba622bf..96fadfa 100644
--- a/xml/impl/src/com/intellij/application/options/HtmlCodeStyleMainPanel.java
+++ b/xml/impl/src/com/intellij/application/options/HtmlCodeStyleMainPanel.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.
@@ -15,10 +15,8 @@
  */
 package com.intellij.application.options;
 
-import com.intellij.lang.Language;
 import com.intellij.lang.html.HTMLLanguage;
 import com.intellij.psi.codeStyle.CodeStyleSettings;
-import org.jetbrains.annotations.Nullable;
 
 /**
  * @author Rustam Vishnyakov
diff --git a/xml/impl/src/com/intellij/application/options/HtmlCodeStyleSettingsProvider.java b/xml/impl/src/com/intellij/application/options/HtmlCodeStyleSettingsProvider.java
index 0d2edf5..9593c46 100644
--- a/xml/impl/src/com/intellij/application/options/HtmlCodeStyleSettingsProvider.java
+++ b/xml/impl/src/com/intellij/application/options/HtmlCodeStyleSettingsProvider.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.
@@ -25,13 +25,16 @@
  * @author yole
  */
 public class HtmlCodeStyleSettingsProvider extends CodeStyleSettingsProvider {
+  @Override
   @NotNull
   public Configurable createSettingsPage(final CodeStyleSettings settings, final CodeStyleSettings originalSettings) {
     return new CodeStyleAbstractConfigurable(settings, originalSettings, ApplicationBundle.message("title.html")) {
+      @Override
       protected CodeStyleAbstractPanel createPanel(final CodeStyleSettings settings) {
         return new HtmlCodeStyleMainPanel(settings, originalSettings);
       }
 
+      @Override
       public String getHelpTopic() {
         return "reference.settingsdialog.IDE.globalcodestyle.html";
       }
diff --git a/xml/impl/src/com/intellij/application/options/TagListDialog.java b/xml/impl/src/com/intellij/application/options/TagListDialog.java
index 9cdb941..22389c1 100644
--- a/xml/impl/src/com/intellij/application/options/TagListDialog.java
+++ b/xml/impl/src/com/intellij/application/options/TagListDialog.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.
@@ -88,10 +88,12 @@
     return myData;
   }
 
+  @Override
   protected JComponent createCenterPanel() {
     return myPanel;
   }
 
+  @Override
   public JComponent getPreferredFocusedComponent() {
     return myList;
   }
diff --git a/xml/impl/src/com/intellij/application/options/XmlAutoImportOptionsProvider.java b/xml/impl/src/com/intellij/application/options/XmlAutoImportOptionsProvider.java
index 23e7083..2e56128 100644
--- a/xml/impl/src/com/intellij/application/options/XmlAutoImportOptionsProvider.java
+++ b/xml/impl/src/com/intellij/application/options/XmlAutoImportOptionsProvider.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.
@@ -28,22 +28,27 @@
   private JPanel myPanel;
   private JCheckBox myShowAutoImportPopups;
 
+  @Override
   public JComponent createComponent() {
     return myPanel;
   }
 
+  @Override
   public boolean isModified() {
     return XmlSettings.getInstance().SHOW_XML_ADD_IMPORT_HINTS != myShowAutoImportPopups.isSelected();
   }
 
+  @Override
   public void apply() throws ConfigurationException {
     XmlSettings.getInstance().SHOW_XML_ADD_IMPORT_HINTS = myShowAutoImportPopups.isSelected();
   }
 
+  @Override
   public void reset() {
     myShowAutoImportPopups.setSelected(XmlSettings.getInstance().SHOW_XML_ADD_IMPORT_HINTS);    
   }
 
+  @Override
   public void disposeUIResources() {
 
   }
diff --git a/xml/impl/src/com/intellij/application/options/XmlCodeStyleSettingsProvider.java b/xml/impl/src/com/intellij/application/options/XmlCodeStyleSettingsProvider.java
index 62ae4f8..5a4ac56 100644
--- a/xml/impl/src/com/intellij/application/options/XmlCodeStyleSettingsProvider.java
+++ b/xml/impl/src/com/intellij/application/options/XmlCodeStyleSettingsProvider.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.
@@ -30,13 +30,16 @@
 
   public static final String CONFIGURABLE_DISPLAY_NAME = ApplicationBundle.message("title.xml");
 
+  @Override
   @NotNull
   public Configurable createSettingsPage(final CodeStyleSettings settings, final CodeStyleSettings originalSettings) {
     return new CodeStyleAbstractConfigurable(settings, originalSettings, ApplicationBundle.message("title.xml")){
+      @Override
       protected CodeStyleAbstractPanel createPanel(final CodeStyleSettings settings) {
         return new XmlCodeStyleMainPanel(getCurrentSettings(), settings);
       }
 
+      @Override
       public String getHelpTopic() {
         return "reference.settingsdialog.IDE.globalcodestyle.xml";
       }
diff --git a/xml/impl/src/com/intellij/application/options/XmlSettings.java b/xml/impl/src/com/intellij/application/options/XmlSettings.java
index 5dd5a46..fef3c0e 100644
--- a/xml/impl/src/com/intellij/application/options/XmlSettings.java
+++ b/xml/impl/src/com/intellij/application/options/XmlSettings.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.
@@ -42,19 +42,23 @@
     return ServiceManager.getService(XmlSettings.class);
   }
 
+  @Override
   public XmlSettings getState() {
     return this;
   }
 
+  @Override
   public void loadState(final XmlSettings state) {
     XmlSerializerUtil.copyBean(state, this);
   }
 
+  @Override
   @NotNull
   public File[] getExportFiles() {
     return new File[]{PathManager.getOptionsFile("editor.codeinsight")};
   }
 
+  @Override
   @NotNull
   public String getPresentableName() {
     return XmlBundle.message("xml.settings");
diff --git a/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsProvider.java b/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsProvider.java
index 077d450..1341f95 100644
--- a/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsProvider.java
+++ b/xml/impl/src/com/intellij/application/options/editor/WebEditorOptionsProvider.java
@@ -35,18 +35,22 @@
   private JBCheckBox myAddQuotasForAttributeValue;
 
 
+  @Override
   public String getDisplayName() {
     return XmlBundle.message("web.editor.configuration.title");
   }
 
+  @Override
   public String getHelpTopic() {
     return null;
   }
 
+  @Override
   public JComponent createComponent() {
     return myWholePanel;
   }
 
+  @Override
   public boolean isModified() {
     final WebEditorOptions xmlEditorOptions = WebEditorOptions.getInstance();
     return xmlEditorOptions.isAutomaticallyInsertClosingTag() != myAutomaticallyInsertClosingTagCheckBox.isSelected() ||
@@ -57,6 +61,7 @@
            xmlEditorOptions.isInsertQuotesForAttributeValue() != myAddQuotasForAttributeValue.isSelected();
   }
 
+  @Override
   public void apply() throws ConfigurationException {
     final WebEditorOptions xmlEditorOptions = WebEditorOptions.getInstance();
     xmlEditorOptions.setAutomaticallyInsertClosingTag(myAutomaticallyInsertClosingTagCheckBox.isSelected());
@@ -67,6 +72,7 @@
     xmlEditorOptions.setInsertQuotesForAttributeValue(myAddQuotasForAttributeValue.isSelected());
   }
 
+  @Override
   public void reset() {
     final WebEditorOptions xmlEditorOptions = WebEditorOptions.getInstance();
     myAutomaticallyInsertClosingTagCheckBox.setSelected(xmlEditorOptions.isAutomaticallyInsertClosingTag());
@@ -77,14 +83,17 @@
     myAddQuotasForAttributeValue.setSelected(xmlEditorOptions.isInsertQuotesForAttributeValue());
   }
 
+  @Override
   public void disposeUIResources() {
   }
 
+  @Override
   @NotNull
   public String getId() {
     return "editor.preferences.webOptions";
   }
 
+  @Override
   public Runnable enableSearch(final String option) {
     return null;
   }
diff --git a/xml/impl/src/com/intellij/application/options/editor/XmlFoldingSettings.java b/xml/impl/src/com/intellij/application/options/editor/XmlFoldingSettings.java
deleted file mode 100644
index b35a26a..0000000
--- a/xml/impl/src/com/intellij/application/options/editor/XmlFoldingSettings.java
+++ /dev/null
@@ -1,80 +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.application.options.editor;
-
-import com.intellij.lang.XmlCodeFoldingSettings;
-import com.intellij.openapi.application.PathManager;
-import com.intellij.openapi.components.*;
-import com.intellij.util.xmlb.XmlSerializerUtil;
-import com.intellij.xml.XmlBundle;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-
-
-@State(
-  name="XmlFoldingSettings",
-  storages= {
-    @Storage(
-      file = StoragePathMacros.APP_CONFIG + "/editor.codeinsight.xml"
-    )}
-)
-public class XmlFoldingSettings implements XmlCodeFoldingSettings, PersistentStateComponent<XmlFoldingSettings>, ExportableComponent {
-
-  public static XmlFoldingSettings getInstance() {
-    return ServiceManager.getService(XmlFoldingSettings.class);
-  }
-
-  @Override
-  public boolean isCollapseXmlTags() {
-    return COLLAPSE_XML_TAGS;
-  }
-
-  public void setCollapseXmlTags(boolean value) {
-    COLLAPSE_XML_TAGS = value;
-  }
-
-  @Override
-  public boolean isCollapseHtmlStyleAttribute() {
-    return COLLAPSE_HTML_STYLE_ATTRIBUTE;
-  }
-
-  public void setCollapseHtmlStyleAttribute(boolean value) {
-    this.COLLAPSE_HTML_STYLE_ATTRIBUTE = value;
-  }
-
-  @SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_XML_TAGS = false;
-  @SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_HTML_STYLE_ATTRIBUTE = true;
-
-  @NotNull
-  public File[] getExportFiles() {
-    return new File[]{PathManager.getOptionsFile("editor.codeinsight")};
-  }
-
-  @NotNull
-  public String getPresentableName() {
-    return XmlBundle.message("xml.folding.settings");
-  }
-
-  public XmlFoldingSettings getState() {
-    return this;
-  }
-
-  public void loadState(final XmlFoldingSettings state) {
-    XmlSerializerUtil.copyBean(state, this);
-  }
-}
\ No newline at end of file
diff --git a/xml/impl/src/com/intellij/codeInsight/actions/GenerateDTDAction.java b/xml/impl/src/com/intellij/codeInsight/actions/GenerateDTDAction.java
index 0c9c6d7..c0930b4 100644
--- a/xml/impl/src/com/intellij/codeInsight/actions/GenerateDTDAction.java
+++ b/xml/impl/src/com/intellij/codeInsight/actions/GenerateDTDAction.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -46,13 +46,15 @@
  */
 public class GenerateDTDAction extends BaseCodeInsightAction{
   private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.actions.GenerateDTDAction");
+  @Override
   @NotNull
   protected CodeInsightActionHandler getHandler(){
     return new CodeInsightActionHandler(){
+      @Override
       public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
         final XmlDocument document = findSuitableXmlDocument(file);
         if (document != null) {
-          final @NonNls StringBuffer buffer = new StringBuffer();
+          final @NonNls StringBuilder buffer = new StringBuilder();
           buffer.append("<!DOCTYPE " + document.getRootTag().getName() + " [\n");
           buffer.append(XmlUtil.generateDocumentDTD(document, true));
           buffer.append("]>\n");
@@ -77,6 +79,7 @@
         }
       }
 
+      @Override
       public boolean startInWriteAction(){
         return true;
       }
@@ -94,6 +97,7 @@
     return null;
   }
 
+  @Override
   public void update(AnActionEvent event) {
     super.update(event);
     if (ActionPlaces.isPopupPlace(event.getPlace())) {
@@ -102,6 +106,7 @@
     }
   }
 
+  @Override
   protected boolean isValidForFile(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file){
     return file.getLanguage() == XMLLanguage.INSTANCE && findSuitableXmlDocument(file) != null;
   }
diff --git a/xml/impl/src/com/intellij/codeInsight/completion/DtdCompletionData.java b/xml/impl/src/com/intellij/codeInsight/completion/DtdCompletionData.java
index cdc9649..6b07b13 100644
--- a/xml/impl/src/com/intellij/codeInsight/completion/DtdCompletionData.java
+++ b/xml/impl/src/com/intellij/codeInsight/completion/DtdCompletionData.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.
@@ -61,7 +61,7 @@
         new AndFilter(
           new LeftNeighbour(
             new OrFilter(
-              new XmlTextFilter(new String[] {"#", "!", "(", ",", "|", "["}),
+              new XmlTextFilter("#", "!", "(", ",", "|", "["),
               new XmlTokenTypeFilter(XmlTokenType.XML_NAME)
             )
           ),
@@ -89,6 +89,7 @@
     }
   }
 
+  @Override
   public String findPrefix(PsiElement insertedElement, int offset) {
     final PsiElement prevLeaf = PsiTreeUtil.prevLeaf(insertedElement);
     final PsiElement prevPrevLeaf = prevLeaf != null ? PsiTreeUtil.prevLeaf(prevLeaf):null;
@@ -109,10 +110,12 @@
 
   static class DtdEntityGetter implements ContextGetter {
 
+    @Override
     public Object[] get(final PsiElement context, CompletionContext completionContext) {
       final List<String> results = new LinkedList<String>();
 
       final PsiElementProcessor processor = new PsiElementProcessor() {
+        @Override
         public boolean execute(@NotNull final PsiElement element) {
           if (element instanceof XmlEntityDecl) {
             final XmlEntityDecl xmlEntityDecl = (XmlEntityDecl)element;
@@ -130,6 +133,7 @@
   }
   static class MyInsertHandler extends BasicInsertHandler {
 
+    @Override
     public void handleInsert(InsertionContext context, LookupElement item) {
       super.handleInsert(context, item);
 
diff --git a/xml/impl/src/com/intellij/codeInsight/completion/ExtendedTagInsertHandler.java b/xml/impl/src/com/intellij/codeInsight/completion/ExtendedTagInsertHandler.java
index a96090b..cbcface 100644
--- a/xml/impl/src/com/intellij/codeInsight/completion/ExtendedTagInsertHandler.java
+++ b/xml/impl/src/com/intellij/codeInsight/completion/ExtendedTagInsertHandler.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.
@@ -55,6 +55,7 @@
     myNamespacePrefix = namespacePrefix;
   }
 
+  @Override
   public void handleInsert(final InsertionContext context, final LookupElement item) {
 
     final XmlFile contextFile = (XmlFile)context.getFile();
@@ -81,6 +82,7 @@
     final XmlNamespaceHelper.Runner<String, IncorrectOperationException> runAfter =
       new XmlNamespaceHelper.Runner<String, IncorrectOperationException>() {
 
+        @Override
         public void run(final String namespacePrefix) {
 
           PsiDocumentManager.getInstance(project).commitDocument(document);
diff --git a/xml/impl/src/com/intellij/codeInsight/completion/XHtmlCompletionData.java b/xml/impl/src/com/intellij/codeInsight/completion/XHtmlCompletionData.java
index c7ce4e6..546583b 100644
--- a/xml/impl/src/com/intellij/codeInsight/completion/XHtmlCompletionData.java
+++ b/xml/impl/src/com/intellij/codeInsight/completion/XHtmlCompletionData.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.
@@ -23,6 +23,7 @@
     super(false);
   }
 
+  @Override
   protected boolean isCaseInsensitive() {
     return false;
   }
diff --git a/xml/impl/src/com/intellij/codeInsight/completion/XmlAttributeInsertHandler.java b/xml/impl/src/com/intellij/codeInsight/completion/XmlAttributeInsertHandler.java
index af533a7..3e52b81 100644
--- a/xml/impl/src/com/intellij/codeInsight/completion/XmlAttributeInsertHandler.java
+++ b/xml/impl/src/com/intellij/codeInsight/completion/XmlAttributeInsertHandler.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.
@@ -58,6 +58,7 @@
     myNamespaceToInsert = namespaceToInsert;
   }
 
+  @Override
   public void handleInsert(final InsertionContext context, final LookupElement item) {
     final Editor editor = context.getEditor();
 
diff --git a/xml/impl/src/com/intellij/codeInsight/completion/XmlCharFilter.java b/xml/impl/src/com/intellij/codeInsight/completion/XmlCharFilter.java
index 9f09962..8f708b7 100644
--- a/xml/impl/src/com/intellij/codeInsight/completion/XmlCharFilter.java
+++ b/xml/impl/src/com/intellij/codeInsight/completion/XmlCharFilter.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.
@@ -83,6 +83,7 @@
     return false;
   }
 
+  @Override
   public Result acceptChar(char c, final int prefixLength, final Lookup lookup) {
     if (!isInXmlContext(lookup)) return null;
 
diff --git a/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionContributor.java b/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionContributor.java
index 453a825..86a2155 100644
--- a/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionContributor.java
+++ b/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionContributor.java
@@ -56,6 +56,7 @@
 
   @NonNls public static final String TAG_NAME_COMPLETION_FEATURE = "tag.name.completion";
   private static final InsertHandlerDecorator<LookupElement> QUOTE_EATER = new InsertHandlerDecorator<LookupElement>() {
+    @Override
     public void handleInsert(InsertionContext context, LookupElementDecorator<LookupElement> item) {
       final char completionChar = context.getCompletionChar();
       if (completionChar == '\'' || completionChar == '\"') {
@@ -95,6 +96,7 @@
                final Set<String> usedWords = new THashSet<String>();
                final Ref<Boolean> addWordVariants = Ref.create(true);
                result.runRemainingContributors(parameters, new Consumer<CompletionResult>() {
+                 @Override
                  public void consume(CompletionResult r) {
                    if (r.getLookupElement().getUserData(WORD_COMPLETION_COMPATIBLE) == null) {
                      addWordVariants.set(false);
@@ -119,6 +121,7 @@
     return node != null && node.getElementType() == XmlTokenType.XML_NAME;
   }
 
+  @Override
   public void fillCompletionVariants(final CompletionParameters parameters, final CompletionResultSet result) {
     super.fillCompletionVariants(parameters, result);
     if (result.isStopped()) {
@@ -195,6 +198,7 @@
     return super.advertise(parameters);
   }
 
+  @Override
   public void beforeCompletion(@NotNull final CompletionInitializationContext context) {
     final int offset = context.getStartOffset();
     final PsiFile file = context.getFile();
diff --git a/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionData.java b/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionData.java
index 8446e88..1ccfd07 100644
--- a/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionData.java
+++ b/xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionData.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.
@@ -87,6 +87,7 @@
     {
       final CompletionVariant variant = new CompletionVariant(
         new AndFilter(new XmlTokenTypeFilter(XmlTokenType.XML_DATA_CHARACTERS), new NotFilter(entityCompletionFilter), new ElementFilter() {
+          @Override
           public boolean isAcceptable(Object element, PsiElement context) {
             XmlTag tag = PsiTreeUtil.getParentOfType(context, XmlTag.class, false);
             if (tag != null) {
@@ -95,6 +96,7 @@
             return false;
           }
 
+          @Override
           public boolean isClassAcceptable(Class hintClass) {
             return true;
           }
@@ -144,6 +146,7 @@
   }
 
   private static class SimpleTagContentEnumerationValuesGetter implements ContextGetter {
+    @Override
     public Object[] get(final PsiElement context, CompletionContext completionContext) {
       XmlTag tag = PsiTreeUtil.getParentOfType(context, XmlTag.class, false);
       if (tag != null) {
@@ -199,6 +202,7 @@
       return null;
     }
 
+    @Override
     public Object[] get(final PsiElement context, CompletionContext completionContext) {
       XmlFile containingFile = null;
       XmlFile descriptorFile = null;
@@ -236,6 +240,7 @@
         final boolean acceptSystemEntities = containingFile.getFileType() == StdFileTypes.XML;
 
         final PsiElementProcessor processor = new PsiElementProcessor() {
+          @Override
           public boolean execute(@NotNull final PsiElement element) {
             if (element instanceof XmlEntityDecl) {
               final XmlEntityDecl xmlEntityDecl = (XmlEntityDecl)element;
@@ -275,6 +280,7 @@
   }
 
   protected static class EntityRefInsertHandler extends BasicInsertHandler {
+    @Override
     public void handleInsert(InsertionContext context, LookupElement item) {
       super.handleInsert(context, item);
       context.setAddCompletionChar(false);
diff --git a/xml/impl/src/com/intellij/codeInsight/completion/XmlSmartEnterProcessor.java b/xml/impl/src/com/intellij/codeInsight/completion/XmlSmartEnterProcessor.java
index 108ba09..a819b65 100644
--- a/xml/impl/src/com/intellij/codeInsight/completion/XmlSmartEnterProcessor.java
+++ b/xml/impl/src/com/intellij/codeInsight/completion/XmlSmartEnterProcessor.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.
@@ -37,6 +37,7 @@
 public class XmlSmartEnterProcessor extends SmartEnterProcessor {
   private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.completion.XmlSmartEnterProcessor");
 
+  @Override
   public boolean process(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile psiFile) {
     return completeEndTag(project, editor, psiFile);
   }
diff --git a/xml/impl/src/com/intellij/codeInsight/completion/XmlTagInsertHandler.java b/xml/impl/src/com/intellij/codeInsight/completion/XmlTagInsertHandler.java
index 40b7db8..aa983fc 100644
--- a/xml/impl/src/com/intellij/codeInsight/completion/XmlTagInsertHandler.java
+++ b/xml/impl/src/com/intellij/codeInsight/completion/XmlTagInsertHandler.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.
@@ -57,6 +57,7 @@
 
   public static final XmlTagInsertHandler INSTANCE = new XmlTagInsertHandler();
 
+  @Override
   public void handleInsert(InsertionContext context, LookupElement item) {
     Project project = context.getProject();
     Editor editor = context.getEditor();
@@ -149,6 +150,7 @@
         myAttrValueMarker = editor.getDocument().createRangeMarker(offset + 1, offset + 4);
       }
 
+      @Override
       public void templateFinished(final Template template, boolean brokenOff) {
         final int offset = editor.getCaretModel().getOffset();
 
@@ -156,6 +158,7 @@
           char c = editor.getDocument().getCharsSequence().charAt(offset - 3);
           if (c == '/' || (c == ' ' && brokenOff)) {
             new WriteCommandAction.Simple(project) {
+              @Override
               protected void run() throws Throwable {
                 editor.getDocument().replaceString(offset - 2, offset + 1, ">");
               }
@@ -164,6 +167,7 @@
         }
       }
 
+      @Override
       public void templateCancelled(final Template template) {
         if (myAttrValueMarker == null) {
           return;
@@ -178,6 +182,7 @@
           final int startOffset = myAttrValueMarker.getStartOffset();
           final int endOffset = myAttrValueMarker.getEndOffset();
           new WriteCommandAction.Simple(project) {
+            @Override
             protected void run() throws Throwable {
               editor.getDocument().replaceString(startOffset, endOffset, ">");
             }
diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/AddSchemaPrefixIntention.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/AddSchemaPrefixIntention.java
index 5ce032e..2cec8ca 100644
--- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/AddSchemaPrefixIntention.java
+++ b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/AddSchemaPrefixIntention.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -82,7 +82,7 @@
       final List<XmlAttributeValue> values = new ArrayList<XmlAttributeValue>();
       new WriteCommandAction(project, NAME, tag.getContainingFile()) {
         @Override
-        protected void run(Result result) throws Throwable {
+        protected void run(@NotNull Result result) throws Throwable {
           tag.accept(new XmlRecursiveElementVisitor() {
             @Override
             public void visitXmlTag(XmlTag tag) {
diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/InsertRequiredAttributeFix.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/InsertRequiredAttributeFix.java
index 1a4a584..ae3b124 100644
--- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/InsertRequiredAttributeFix.java
+++ b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/InsertRequiredAttributeFix.java
@@ -107,7 +107,7 @@
     }
 
     Expression expression = new Expression() {
-      TextResult result = new TextResult("");
+      final TextResult result = new TextResult("");
 
       @Override
       public Result calculateResult(ExpressionContext context) {
diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlErrorQuickFixProvider.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlErrorQuickFixProvider.java
deleted file mode 100644
index 44a6db7..0000000
--- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlErrorQuickFixProvider.java
+++ /dev/null
@@ -1,77 +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.codeInsight.daemon.impl.analysis;
-
-import com.intellij.codeInsight.FileModificationService;
-import com.intellij.codeInsight.daemon.XmlErrorMessages;
-import com.intellij.codeInsight.daemon.impl.HighlightInfo;
-import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction;
-import com.intellij.codeInsight.intention.IntentionAction;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.PsiErrorElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.psi.xml.XmlTag;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-public class XmlErrorQuickFixProvider implements ErrorQuickFixProvider {
-  @NonNls private static final String AMP_ENTITY = "&amp;";
-
-  @Override
-  public void registerErrorQuickFix(@NotNull final PsiErrorElement element, @NotNull final HighlightInfo highlightInfo) {
-    if (PsiTreeUtil.getParentOfType(element, XmlTag.class) != null) {
-      registerXmlErrorQuickFix(element,highlightInfo);
-    }
-  }
-
-  private static void registerXmlErrorQuickFix(final PsiErrorElement element, final HighlightInfo highlightInfo) {
-    final String text = element.getErrorDescription();
-    if (text != null && text.startsWith(XmlErrorMessages.message("unescaped.ampersand"))) {
-      QuickFixAction.registerQuickFixAction(highlightInfo, new IntentionAction() {
-        @Override
-        @NotNull
-        public String getText() {
-          return XmlErrorMessages.message("escape.ampersand.quickfix");
-        }
-
-        @Override
-        @NotNull
-        public String getFamilyName() {
-          return getText();
-        }
-
-        @Override
-        public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
-          return true;
-        }
-
-        @Override
-        public void invoke(@NotNull Project project, Editor editor, PsiFile file) {
-          if (!FileModificationService.getInstance().prepareFileForWrite(file)) return;
-          final int textOffset = element.getTextOffset();
-          editor.getDocument().replaceString(textOffset,textOffset + 1,AMP_ENTITY);
-        }
-
-        @Override
-        public boolean startInWriteAction() {
-          return true;
-        }
-      });
-    }
-  }
-}
diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlNsPrefixAnnotator.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlNsPrefixAnnotator.java
deleted file mode 100644
index eacbd5c..0000000
--- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlNsPrefixAnnotator.java
+++ /dev/null
@@ -1,49 +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.codeInsight.daemon.impl.analysis;
-
-import com.intellij.lang.annotation.AnnotationHolder;
-import com.intellij.lang.annotation.Annotator;
-import com.intellij.openapi.editor.XmlHighlighterColors;
-import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.impl.source.xml.SchemaPrefixReference;
-import com.intellij.psi.xml.XmlAttribute;
-import com.intellij.psi.xml.XmlTag;
-import com.intellij.util.containers.ContainerUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-/**
- * @author Dmitry Avdeev
- *         Date: 25.10.13
- */
-public class XmlNsPrefixAnnotator implements Annotator {
-  @Override
-  public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
-    if (element instanceof XmlTag || element instanceof XmlAttribute) {
-      List<SchemaPrefixReference> references = ContainerUtil.findAll(element.getReferences(), SchemaPrefixReference.class);
-      for (SchemaPrefixReference reference : references) {
-        TextRange rangeInElement = reference.getRangeInElement();
-        if (!rangeInElement.isEmpty()) {
-          TextRange range = rangeInElement.shiftRight(element.getTextRange().getStartOffset());
-          holder.createInfoAnnotation(range, null).setTextAttributes(XmlHighlighterColors.XML_NS_PREFIX);
-        }
-      }
-    }
-  }
-}
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/DtdSelectioner.java b/xml/impl/src/com/intellij/codeInsight/editorActions/DtdSelectioner.java
index b394bf9..2e09e97 100644
--- a/xml/impl/src/com/intellij/codeInsight/editorActions/DtdSelectioner.java
+++ b/xml/impl/src/com/intellij/codeInsight/editorActions/DtdSelectioner.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.
@@ -27,10 +27,12 @@
 import java.util.List;
 
 public class DtdSelectioner extends ExtendWordSelectionHandlerBase {
+  @Override
   public boolean canSelect(PsiElement e) {
     return e instanceof XmlAttlistDecl || e instanceof XmlElementDecl;
   }
 
+  @Override
   public List<TextRange> select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) {
     PsiElement[] children = e.getChildren();
 
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/EnterBetweenXmlTagsHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/EnterBetweenXmlTagsHandler.java
index 9a3e9d6..96309e2 100644
--- a/xml/impl/src/com/intellij/codeInsight/editorActions/EnterBetweenXmlTagsHandler.java
+++ b/xml/impl/src/com/intellij/codeInsight/editorActions/EnterBetweenXmlTagsHandler.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.
@@ -18,7 +18,6 @@
 import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegateAdapter;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
 import com.intellij.openapi.editor.ex.EditorEx;
@@ -36,6 +35,7 @@
 import org.jetbrains.annotations.NotNull;
 
 public class EnterBetweenXmlTagsHandler extends EnterHandlerDelegateAdapter {
+  @Override
   public Result preprocessEnter(@NotNull final PsiFile file, @NotNull final Editor editor, @NotNull final Ref<Integer> caretOffset, @NotNull final Ref<Integer> caretAdvance,
                                 @NotNull final DataContext dataContext, final EditorActionHandler originalHandler) {
     final Project project = CommonDataKeys.PROJECT.getData(dataContext);
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlQuoteHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlQuoteHandler.java
index 1c66926..7c3b196 100644
--- a/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlQuoteHandler.java
+++ b/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlQuoteHandler.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.
@@ -22,7 +22,7 @@
  * @author peter
 */
 public class HtmlQuoteHandler implements QuoteHandler {
-  private QuoteHandler myBaseQuoteHandler;
+  private final QuoteHandler myBaseQuoteHandler;
 
   public HtmlQuoteHandler() {
     this(new XmlQuoteHandler());
@@ -32,23 +32,27 @@
     myBaseQuoteHandler = _baseHandler;
   }
 
+  @Override
   public boolean isClosingQuote(HighlighterIterator iterator, int offset) {
     if (myBaseQuoteHandler.isClosingQuote(iterator, offset)) return true;
     return false;
   }
 
+  @Override
   public boolean isOpeningQuote(HighlighterIterator iterator, int offset) {
     if (myBaseQuoteHandler.isOpeningQuote(iterator, offset)) return true;
 
     return false;
   }
 
+  @Override
   public boolean hasNonClosedLiteral(Editor editor, HighlighterIterator iterator, int offset) {
     if (myBaseQuoteHandler.hasNonClosedLiteral(editor,iterator, offset)) return true;
 
     return false;
   }
 
+  @Override
   public boolean isInsideLiteral(HighlighterIterator iterator) {
     if (myBaseQuoteHandler.isInsideLiteral(iterator)) return true;
 
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlSelectioner.java b/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlSelectioner.java
index be90356..d9f7d5d 100644
--- a/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlSelectioner.java
+++ b/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlSelectioner.java
@@ -56,6 +56,7 @@
   };
   private static final String CLASS_ATTRIBUTE_NAME = "class";
 
+  @Override
   public boolean canSelect(PsiElement e) {
     return canSelectElement(e);
   }
@@ -67,6 +68,7 @@
     return false;
   }
 
+  @Override
   public List<TextRange> select(PsiElement e, @NotNull CharSequence editorText, int cursorOffset, @NotNull Editor editor) {
     List<TextRange> result;
 
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlAutoPopupHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlAutoPopupHandler.java
index 97cbbce..a3a6ec7 100644
--- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlAutoPopupHandler.java
+++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlAutoPopupHandler.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.
@@ -32,6 +32,7 @@
 import com.intellij.xml.util.XmlUtil;
 
 public class XmlAutoPopupHandler extends TypedHandlerDelegate {
+  @Override
   public Result checkAutoPopup(final char charTyped, final Project project, final Editor editor, final PsiFile file) {
     final boolean isXmlLikeFile = file.getLanguage() instanceof XMLLanguage || file.getViewProvider().getBaseLanguage() instanceof XMLLanguage;
     boolean spaceInTag = isXmlLikeFile && charTyped == ' ';
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlBasicWordSelectionFilter.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlBasicWordSelectionFilter.java
index d17ddc0..3874666 100644
--- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlBasicWordSelectionFilter.java
+++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlBasicWordSelectionFilter.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,6 +24,7 @@
  * @author yole
  */
 public class XmlBasicWordSelectionFilter implements Condition<PsiElement> {
+  @Override
   public boolean value(final PsiElement e) {
     return !(e instanceof XmlToken) &&
            !(e instanceof XmlElement);
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlCDATAContentSelectioner.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlCDATAContentSelectioner.java
index fe440e0..eda5c4f 100644
--- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlCDATAContentSelectioner.java
+++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlCDATAContentSelectioner.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.
@@ -26,11 +26,13 @@
 import java.util.List;
 
 public class XmlCDATAContentSelectioner extends ExtendWordSelectionHandlerBase {
+  @Override
   public boolean canSelect(PsiElement e) {
     return e instanceof CompositePsiElement &&
            ((CompositePsiElement)e).getElementType() == XmlElementType.XML_CDATA;
   }
 
+  @Override
   public List<TextRange> select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) {
     List<TextRange> result = super.select(e, editorText, cursorOffset, editor);
     PsiElement[] children = e.getChildren();
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlCopyPastePreProcessor.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlCopyPastePreProcessor.java
index 2d75db7..fa2f9c2 100644
--- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlCopyPastePreProcessor.java
+++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlCopyPastePreProcessor.java
@@ -27,10 +27,7 @@
 import com.intellij.psi.impl.source.xml.behavior.EncodeEachSymbolPolicy;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtilCore;
-import com.intellij.psi.xml.XmlAttributeValue;
-import com.intellij.psi.xml.XmlElement;
-import com.intellij.psi.xml.XmlElementType;
-import com.intellij.psi.xml.XmlText;
+import com.intellij.psi.xml.*;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -41,11 +38,13 @@
 
   private static final EncodeEachSymbolPolicy ENCODE_EACH_SYMBOL_POLICY = new EncodeEachSymbolPolicy();
 
+  @Override
   @Nullable
   public String preprocessOnCopy(PsiFile file, int[] startOffsets, int[] endOffsets, String text) {
     return null;
   }
 
+  @Override
   @NotNull
   public String preprocessOnPaste(Project project, PsiFile file, Editor editor, String text, RawText rawText) {
     final Document document = editor.getDocument();
@@ -57,8 +56,8 @@
     if (node != null) {
       boolean hasMarkup = text.indexOf('>') >= 0 || text.indexOf('<') >= 0;
       if (element.getTextOffset() == caretOffset &&
-          node.getElementType() == XmlElementType.XML_END_TAG_START &&
-          node.getTreePrev().getElementType() == XmlElementType.XML_TAG_END) {
+          node.getElementType() == XmlTokenType.XML_END_TAG_START &&
+          node.getTreePrev().getElementType() == XmlTokenType.XML_TAG_END) {
 
          return hasMarkup ? text : encode(text, element);
       } else {
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlElementSelectioner.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlElementSelectioner.java
index a0b5121..2adc391 100644
--- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlElementSelectioner.java
+++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlElementSelectioner.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.
@@ -20,6 +20,7 @@
 import com.intellij.psi.xml.XmlAttributeValue;
 
 class XmlElementSelectioner extends ExtendWordSelectionHandlerBase {
+  @Override
   public boolean canSelect(PsiElement e) {
     return e instanceof XmlAttribute || e instanceof XmlAttributeValue;
   }
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java
index 35080e9..4308467 100644
--- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java
+++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java
@@ -31,7 +31,7 @@
 import java.util.List;
 
 public class XmlEqTypedHandler extends TypedHandlerDelegate {
-  private List<Caret> caretsForInsertingQuotes = ContainerUtil.newSmartList();
+  private final List<Caret> caretsForInsertingQuotes = ContainerUtil.newSmartList();
 
   @Override
   public Result beforeCharTyped(char c, Project project, Editor editor, PsiFile file, FileType fileType) {
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlGtTypedHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlGtTypedHandler.java
index c504030..2c0143e 100644
--- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlGtTypedHandler.java
+++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlGtTypedHandler.java
@@ -36,7 +36,6 @@
 import com.intellij.psi.templateLanguages.OuterLanguageElement;
 import com.intellij.psi.templateLanguages.TemplateLanguageFileViewProvider;
 import com.intellij.psi.tree.IElementType;
-import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.xml.*;
 import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.containers.ContainerUtil;
@@ -51,6 +50,7 @@
 public class XmlGtTypedHandler extends TypedHandlerDelegate {
   private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.editorActions.TypedHandler");
 
+  @Override
   public Result beforeCharTyped(final char c, final Project project, Editor editor, PsiFile editedFile, final FileType fileType) {
     final WebEditorOptions webEditorOptions = WebEditorOptions.getInstance();
     if (c == '>' && webEditorOptions != null && webEditorOptions.isAutomaticallyInsertClosingTag() && fileContainsXmlLanguage(editedFile)) {
@@ -182,55 +182,24 @@
       if (BraceMatchingUtil.matchBrace(editor.getDocument().getCharsSequence(), editedFile.getFileType(), iterator, true,true)) {
         PsiElement parent = tag.getParent();
         boolean hasBalance = true;
-        
-        while(parent instanceof XmlTag && name.equals(((XmlTag)parent).getName())) {
-          ASTNode astNode = XmlChildRole.CLOSING_TAG_NAME_FINDER.findChild(parent.getNode());
-          if (astNode == null) {
+        loop: while(parent instanceof XmlTag) {
+          if (name.equals(((XmlTag)parent).getName())) {
             hasBalance = false;
-            break;
+            ASTNode astNode = XmlChildRole.CLOSING_TAG_NAME_FINDER.findChild(parent.getNode());
+            if (astNode == null) {
+              hasBalance = true;
+              break;
+            }
+            for (PsiElement el = parent.getNextSibling(); el != null; el = el.getNextSibling()) {
+              if (el instanceof PsiErrorElement && el.getText().startsWith("</" + name)) {
+                hasBalance = true;
+                break loop;
+              }
+            }
           }
-
           parent = parent.getParent();
         }
-        
-        if (hasBalance) {
-          hasBalance = false;
-          for(ASTNode node=parent.getNode().getLastChildNode(); node != null; node = node.getTreePrev()) {
-            ASTNode leaf = node;
-            if (leaf.getElementType() == TokenType.ERROR_ELEMENT) {
-              ASTNode firstChild = leaf.getFirstChildNode();
-              if (firstChild != null) leaf = firstChild;
-              else {
-                PsiElement psiElement = PsiTreeUtil.nextLeaf(leaf.getPsi());
-                leaf = psiElement != null ? psiElement.getNode() : null;
-              }
-              if (leaf != null && leaf.getElementType() == TokenType.WHITE_SPACE) {
-                PsiElement psiElement = PsiTreeUtil.nextLeaf(leaf.getPsi());
-                if (psiElement != null) leaf = psiElement.getNode();
-              }
-            }
-            
-            if (leaf != null && leaf.getElementType() == XmlTokenType.XML_END_TAG_START) {
-              ASTNode treeNext = leaf.getTreeNext();
-              IElementType treeNextType;
-              if (treeNext != null && 
-                  ((treeNextType = treeNext.getElementType()) == XmlTokenType.XML_NAME ||
-                   treeNextType == XmlTokenType.XML_TAG_NAME
-                  )
-                ) {
-                if (name.equals(treeNext.getText())) {
-                  ASTNode parentEndName = parent instanceof XmlTag ?
-                                          XmlChildRole.CLOSING_TAG_NAME_FINDER.findChild(parent.getNode()):null;
-                  hasBalance = !(parent instanceof XmlTag) || 
-                    parentEndName != null && !parentEndName.getText().equals(name);
-                  break;
-                }
-              }
-            }
-          }
-        }
-        
-        if (hasBalance) return Result.CONTINUE; 
+        if (hasBalance) return Result.CONTINUE;
       }
 
       Collection<TextRange> cdataReformatRanges = null;
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlLineSelectioner.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlLineSelectioner.java
index 76a25de..4a11e84 100644
--- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlLineSelectioner.java
+++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlLineSelectioner.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.
@@ -28,6 +28,7 @@
  * @author yole
  */
 public class XmlLineSelectioner extends ExtendWordSelectionHandlerBase {
+  @Override
   public boolean canSelect(final PsiElement e) {
     return e instanceof XmlToken && ((XmlToken)e).getTokenType() == XmlTokenType.XML_DATA_CHARACTERS;
   }
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlQuoteHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlQuoteHandler.java
index 1f87de2..b6a35a5 100644
--- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlQuoteHandler.java
+++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlQuoteHandler.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.
@@ -23,18 +23,22 @@
  * @author peter
 */
 public class XmlQuoteHandler implements QuoteHandler {
+  @Override
   public boolean isClosingQuote(HighlighterIterator iterator, int offset) {
     return iterator.getTokenType() == XmlTokenType.XML_ATTRIBUTE_VALUE_END_DELIMITER;
   }
 
+  @Override
   public boolean isOpeningQuote(HighlighterIterator iterator, int offset) {
     return iterator.getTokenType() == XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER;
   }
 
+  @Override
   public boolean hasNonClosedLiteral(Editor editor, HighlighterIterator iterator, int offset) {
     return true;
   }
 
+  @Override
   public boolean isInsideLiteral(HighlighterIterator iterator) {
     return false;
   }
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlSlashTypedHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlSlashTypedHandler.java
index 051a750..fbfc6df 100644
--- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlSlashTypedHandler.java
+++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlSlashTypedHandler.java
@@ -29,10 +29,12 @@
 import com.intellij.psi.tree.IElementType;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.xml.*;
+import com.intellij.xml.util.XmlTagUtil;
 import com.intellij.xml.util.XmlUtil;
 import org.jetbrains.annotations.NotNull;
 
-public class XmlSlashTypedHandler extends TypedHandlerDelegate implements XmlTokenType {
+public class XmlSlashTypedHandler extends TypedHandlerDelegate {
+  @Override
   public Result beforeCharTyped(final char c, final Project project, final Editor editor, final PsiFile editedFile, final FileType fileType) {
     if ((editedFile.getLanguage() instanceof XMLLanguage || editedFile.getViewProvider().getBaseLanguage() instanceof XMLLanguage) && c == '/') {
       PsiDocumentManager.getInstance(project).commitAllDocuments();
@@ -67,6 +69,7 @@
     return Result.CONTINUE;
   }
 
+  @Override
   public Result charTyped(final char c, final Project project, @NotNull final Editor editor, @NotNull final PsiFile editedFile) {
     if ((editedFile.getLanguage() instanceof XMLLanguage || editedFile.getViewProvider().getBaseLanguage() instanceof XMLLanguage) && c == '/') {
       PsiDocumentManager.getInstance(project).commitAllDocuments();
@@ -82,7 +85,7 @@
       ASTNode prevLeaf = element.getNode();
       if (prevLeaf == null) return Result.CONTINUE;
       final String prevLeafText = prevLeaf.getText();
-      if ("</".equals(prevLeafText) && prevLeaf.getElementType() == XML_END_TAG_START) {
+      if ("</".equals(prevLeafText) && prevLeaf.getElementType() == XmlTokenType.XML_END_TAG_START) {
         XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class);
         if (tag != null && StringUtil.isNotEmpty(tag.getName()) && TreeUtil.findSibling(prevLeaf, XmlTokenType.XML_NAME) == null) {
           // check for template language like JSP
@@ -91,13 +94,13 @@
             if (element1 != null && element1.getText().startsWith("</")) {
               // case of top-level jsp tag
               XmlTag tag1 = PsiTreeUtil.getParentOfType(element1, XmlTag.class);
-              if (tag1 != null && tag1 != tag && tag1.getTextOffset() > tag.getTextOffset()) {
+              if (shouldReplace(tag, tag1)) {
                 tag = tag1;
               }
               else {
                 // if we have enclosing jsp tag, actual tag to be completed will be previous sibling
                 tag1 = PsiTreeUtil.getPrevSiblingOfType(element1.getParent(), XmlTag.class);
-                if (tag1 != null && tag1 != tag && tag1.getTextOffset() > tag.getTextOffset()) {
+                if (shouldReplace(tag, tag1)) {
                   tag = tag1;
                 }
               }
@@ -135,4 +138,9 @@
     }
     return Result.CONTINUE;
   }
+
+  public boolean shouldReplace(XmlTag tag, XmlTag tag1) {
+    return tag1 != null && tag1 != tag && tag1.getTextOffset() > tag.getTextOffset() &&
+           XmlUtil.getTokenOfType(tag1, XmlTokenType.XML_EMPTY_ELEMENT_END) == null && XmlTagUtil.getEndTagNameElement(tag1) == null;
+  }
 }
\ No newline at end of file
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlTagSelectioner.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlTagSelectioner.java
index cc05cea..8641ec8 100644
--- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlTagSelectioner.java
+++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlTagSelectioner.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,10 +24,12 @@
 import java.util.List;
 
 public class XmlTagSelectioner extends ExtendWordSelectionHandlerBase {
+  @Override
   public boolean canSelect(PsiElement e) {
     return e instanceof XmlTag;
   }
 
+  @Override
   public List<TextRange> select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) {
     List<TextRange> result = super.select(e, editorText, cursorOffset, editor);
     PsiElement[] children = e.getChildren();
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlTokenSelectioner.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlTokenSelectioner.java
index c7e4b51..76c72a5 100644
--- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlTokenSelectioner.java
+++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlTokenSelectioner.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.
@@ -25,11 +25,13 @@
 import java.util.ArrayList;
 
 class XmlTokenSelectioner extends ExtendWordSelectionHandlerBase {
+  @Override
   public boolean canSelect(PsiElement e) {
     return e instanceof XmlToken &&
            !HtmlSelectioner.canSelectElement(e);
   }
 
+  @Override
   public List<TextRange> select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) {
     XmlToken token = (XmlToken)e;
 
diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/moveUpDown/XmlMover.java b/xml/impl/src/com/intellij/codeInsight/editorActions/moveUpDown/XmlMover.java
index da385b0..a010c43 100644
--- a/xml/impl/src/com/intellij/codeInsight/editorActions/moveUpDown/XmlMover.java
+++ b/xml/impl/src/com/intellij/codeInsight/editorActions/moveUpDown/XmlMover.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.
@@ -39,6 +39,7 @@
 class XmlMover extends LineMover {
   //private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.actions.moveUpDown.XmlMover");
 
+  @Override
   public boolean checkAvailable(@NotNull final Editor editor, @NotNull final PsiFile file, @NotNull final MoveInfo info, final boolean down) {
     if (!(file instanceof XmlFile)) {
       return false;
diff --git a/xml/impl/src/com/intellij/codeInsight/folding/impl/XmlElementSignatureProvider.java b/xml/impl/src/com/intellij/codeInsight/folding/impl/XmlElementSignatureProvider.java
index b9b576c..84289eb 100644
--- a/xml/impl/src/com/intellij/codeInsight/folding/impl/XmlElementSignatureProvider.java
+++ b/xml/impl/src/com/intellij/codeInsight/folding/impl/XmlElementSignatureProvider.java
@@ -34,6 +34,7 @@
 public class XmlElementSignatureProvider extends AbstractElementSignatureProvider {
   private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.folding.impl.XmlElementSignatureProvider");
 
+  @Override
   public String getSignature(@NotNull PsiElement element) {
     if (element instanceof XmlTag) {
       XmlTag tag = (XmlTag)element;
diff --git a/xml/impl/src/com/intellij/codeInsight/highlighting/XmlReadWriteAccessDetector.java b/xml/impl/src/com/intellij/codeInsight/highlighting/XmlReadWriteAccessDetector.java
deleted file mode 100644
index 1a12263..0000000
--- a/xml/impl/src/com/intellij/codeInsight/highlighting/XmlReadWriteAccessDetector.java
+++ /dev/null
@@ -1,57 +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.codeInsight.highlighting;
-
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiReference;
-import com.intellij.psi.xml.XmlAttributeValue;
-import com.intellij.psi.xml.XmlComment;
-import com.intellij.psi.xml.XmlElementDecl;
-import com.intellij.psi.xml.XmlTag;
-
-/**
- * @author yole
- */
-public class XmlReadWriteAccessDetector extends ReadWriteAccessDetector {
-  @Override
-  public boolean isReadWriteAccessible(final PsiElement element) {
-    return element instanceof XmlAttributeValue ||
-        element instanceof XmlTag ||
-        element instanceof XmlElementDecl ||
-        element instanceof XmlComment; // e.g. <!--@elvariable name="xxx" type="yyy"-->
-  }
-
-  @Override
-  public boolean isDeclarationWriteAccess(final PsiElement element) {
-    return false;
-  }
-
-  @Override
-  public Access getReferenceAccess(final PsiElement referencedElement, final PsiReference reference) {
-    PsiElement refElement = reference.getElement();
-    return refElement instanceof XmlAttributeValue &&
-           (!(referencedElement instanceof XmlTag) || refElement.getParent().getParent() == referencedElement) ||
-            refElement instanceof XmlElementDecl ||
-            refElement instanceof XmlComment   // e.g. <!--@elvariable name="xxx" type="yyy"-->
-           ? Access.Write : Access.Read;
-
-  }
-
-  @Override
-  public Access getExpressionAccess(final PsiElement expression) {
-    return expression instanceof XmlAttributeValue ? Access.Write : Access.Read;
-  }
-}
diff --git a/xml/impl/src/com/intellij/codeInsight/hint/TagDeclarationRangeHandler.java b/xml/impl/src/com/intellij/codeInsight/hint/TagDeclarationRangeHandler.java
index 34fe453..52a308d 100644
--- a/xml/impl/src/com/intellij/codeInsight/hint/TagDeclarationRangeHandler.java
+++ b/xml/impl/src/com/intellij/codeInsight/hint/TagDeclarationRangeHandler.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,6 +24,7 @@
 import com.intellij.psi.xml.XmlTokenType;
 
 public class TagDeclarationRangeHandler implements DeclarationRangeHandler {
+  @Override
   @NotNull
   public TextRange getDeclarationRange(@NotNull final PsiElement container) {
     XmlTag xmlTag = (XmlTag)container;
diff --git a/xml/impl/src/com/intellij/codeInsight/hint/XmlImplementationTextSelectioner.java b/xml/impl/src/com/intellij/codeInsight/hint/XmlImplementationTextSelectioner.java
index 977a0dd..ada24ed 100644
--- a/xml/impl/src/com/intellij/codeInsight/hint/XmlImplementationTextSelectioner.java
+++ b/xml/impl/src/com/intellij/codeInsight/hint/XmlImplementationTextSelectioner.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.
@@ -30,10 +30,12 @@
 public class XmlImplementationTextSelectioner implements ImplementationTextSelectioner {
   private static final Logger LOG = Logger.getInstance("#" + XmlImplementationTextSelectioner.class.getName());
 
+  @Override
   public int getTextStartOffset(@NotNull final PsiElement parent) {
     return parent.getTextRange().getStartOffset();
   }
 
+  @Override
   public int getTextEndOffset(@NotNull PsiElement element) {
     if (element instanceof XmlAttributeValue) {
       final XmlTag xmlTag = PsiTreeUtil.getParentOfType(element, XmlTag.class);// for convenience
diff --git a/xml/impl/src/com/intellij/codeInsight/hint/api/impls/XmlParameterInfoHandler.java b/xml/impl/src/com/intellij/codeInsight/hint/api/impls/XmlParameterInfoHandler.java
index 087943d..62e7a22 100644
--- a/xml/impl/src/com/intellij/codeInsight/hint/api/impls/XmlParameterInfoHandler.java
+++ b/xml/impl/src/com/intellij/codeInsight/hint/api/impls/XmlParameterInfoHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -41,11 +41,13 @@
  */
 public class XmlParameterInfoHandler implements ParameterInfoHandler<XmlTag,XmlElementDescriptor> {
   private static final Comparator<XmlAttributeDescriptor> COMPARATOR = new Comparator<XmlAttributeDescriptor>() {
+    @Override
     public int compare(final XmlAttributeDescriptor o1, final XmlAttributeDescriptor o2) {
       return o1.getName().compareTo(o2.getName());
     }
   };
 
+  @Override
   public Object[] getParametersForLookup(LookupElement item, ParameterInfoContext context) {
     if (!(item instanceof MutableLookupElement)) return null;
     final Object lookupItem = item.getObject();
@@ -53,6 +55,7 @@
     return null;
   }
 
+  @Override
   public Object[] getParametersForDocumentation(final XmlElementDescriptor p, final ParameterInfoContext context) {
     return getSortedDescriptors(p);
   }
@@ -63,10 +66,12 @@
     return xmlAttributeDescriptors;
   }
 
+  @Override
   public boolean couldShowInLookup() {
     return true;
   }
 
+  @Override
   public XmlTag findElementForParameterInfo(@NotNull final CreateParameterInfoContext context) {
     final XmlTag tag = findXmlTag(context.getFile(), context.getOffset());
     final XmlElementDescriptor descriptor = tag != null ? tag.getDescriptor() : null;
@@ -80,10 +85,12 @@
     return tag;
   }
 
+  @Override
   public void showParameterInfo(final @NotNull XmlTag element, @NotNull final CreateParameterInfoContext context) {
     context.showHint(element, element.getTextRange().getStartOffset() + 1, this);
   }
 
+  @Override
   public XmlTag findElementForUpdatingParameterInfo(@NotNull final UpdateParameterInfoContext context) {
     final XmlTag tag = findXmlTag(context.getFile(), context.getOffset());
     if (tag != null) {
@@ -94,6 +101,7 @@
     return null;
   }
 
+  @Override
   public void updateParameterInfo(@NotNull final XmlTag parameterOwner, @NotNull final UpdateParameterInfoContext context) {
     if (context.getParameterOwner() == null || parameterOwner.equals(context.getParameterOwner())) {
       context.setParameterOwner(parameterOwner);
@@ -102,10 +110,12 @@
     }
   }
 
+  @Override
   public String getParameterCloseChars() {
     return null;
   }
 
+  @Override
   public boolean tracksParameterIndex() {
     return false;
   }
@@ -145,6 +155,7 @@
     return null;
   }
 
+  @Override
   public void updateUI(XmlElementDescriptor o, @NotNull final ParameterInfoUIContext context) {
     updateElementDescriptor(
       o,
@@ -152,8 +163,9 @@
       new Function<String, Boolean>() {
         final XmlTag parameterOwner  = (XmlTag)context.getParameterOwner();
 
+        @Override
         public Boolean fun(String s) {
-          return parameterOwner != null ? parameterOwner.getAttributeValue(s) != null:false;
+          return parameterOwner != null && parameterOwner.getAttributeValue(s) != null;
         }
       });
   }
@@ -162,7 +174,7 @@
                                              Function<String, Boolean> attributePresentFun) {
     final XmlAttributeDescriptor[] attributes = descriptor != null ? getSortedDescriptors(descriptor) : XmlAttributeDescriptor.EMPTY;
 
-    StringBuffer buffer = new StringBuffer();
+    StringBuilder buffer = new StringBuilder();
     int highlightStartOffset = -1;
     int highlightEndOffset = -1;
 
@@ -170,9 +182,9 @@
       buffer.append(CodeInsightBundle.message("xml.tag.info.no.attributes"));
     }
     else {
-      StringBuffer text1 = new StringBuffer(" ");
-      StringBuffer text2 = new StringBuffer(" ");
-      StringBuffer text3 = new StringBuffer(" ");
+      StringBuilder text1 = new StringBuilder(" ");
+      StringBuilder text2 = new StringBuilder(" ");
+      StringBuilder text3 = new StringBuilder(" ");
 
       for (XmlAttributeDescriptor attribute : attributes) {
         if (Boolean.TRUE.equals(attributePresentFun.fun(attribute.getName()))) {
diff --git a/xml/impl/src/com/intellij/codeInsight/intentions/XmlChooseColorIntentionAction.java b/xml/impl/src/com/intellij/codeInsight/intentions/XmlChooseColorIntentionAction.java
index b8cc180..1ebde34 100644
--- a/xml/impl/src/com/intellij/codeInsight/intentions/XmlChooseColorIntentionAction.java
+++ b/xml/impl/src/com/intellij/codeInsight/intentions/XmlChooseColorIntentionAction.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.
@@ -47,11 +47,13 @@
     setText(CodeInsightBundle.message("intention.color.chooser.dialog"));
   }
 
+  @Override
   public boolean isAvailable(@NotNull final Project project, final Editor editor, @NotNull final PsiElement element) {
     final PsiElement parent = element.getParent();
     return parent instanceof XmlAttributeValue && ColorUtil.fromHex(((XmlAttributeValue)parent).getValue(), null) != null;
   }
 
+  @Override
   @NotNull
   public String getFamilyName() {
     return getText();
@@ -82,6 +84,7 @@
       final PsiManager manager = literal.getManager();
       final XmlAttribute newAttribute = XmlElementFactory.getInstance(manager.getProject()).createXmlAttribute("name", newText);
       final Runnable replaceRunnable = new Runnable() {
+        @Override
         public void run() {
           final XmlAttributeValue valueElement = newAttribute.getValueElement();
           assert valueElement != null;
diff --git a/xml/impl/src/com/intellij/codeInsight/template/XmlDefaultLiveTemplatesProvider.java b/xml/impl/src/com/intellij/codeInsight/template/XmlDefaultLiveTemplatesProvider.java
index 9b13138..edb58e8 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/XmlDefaultLiveTemplatesProvider.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/XmlDefaultLiveTemplatesProvider.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.
@@ -21,6 +21,7 @@
  * @author yole
  */
 public class XmlDefaultLiveTemplatesProvider implements DefaultLiveTemplatesProvider {
+  @Override
   public String[] getDefaultLiveTemplateFiles() {
     return new String[] { "/liveTemplates/html_xml", "/liveTemplates/zen_html", "/liveTemplates/zen_xsl" };
   }
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetParser.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetParser.java
index b9fb54d..6bc71f9 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetParser.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/EmmetParser.java
@@ -67,12 +67,11 @@
       }
 
       final String filterSuffix = ((IdentifierToken)token).getText();
-      if (!ZenCodingUtil.checkFilterSuffix(filterSuffix)) {
-        return null;
+      if (ZenCodingUtil.checkFilterSuffix(filterSuffix)) {
+        result = new FilterNode(result, filterSuffix);
       }
 
       advance();
-      result = new FilterNode(result, filterSuffix);
     }
   }
 
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java
index f3977a5..4ab715a 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/XmlEmmetParser.java
@@ -263,10 +263,10 @@
       final List<Couple<String>> attrList = parseSelector();
       if (attrList == null) {
         if (classAttrPosition != -1) {
-          result.set(classAttrPosition, Couple.newOne(CLASS, classAttrBuilder.toString()));
+          result.set(classAttrPosition, Couple.of(CLASS, classAttrBuilder.toString()));
         }
         if (idAttrPosition != -1) {
-          result.set(idAttrPosition, Couple.newOne(ID, idAttrBuilder.toString()));
+          result.set(idAttrPosition, Couple.of(ID, idAttrBuilder.toString()));
         }
         return result;
       }
@@ -320,7 +320,7 @@
       if (!value.isEmpty()) {
         advance();
       }
-      return Collections.singletonList(Couple.newOne(name, value));
+      return Collections.singletonList(Couple.of(name, value));
     }
 
     return null;
@@ -369,7 +369,7 @@
     advance();
     token = getToken();
     if (token != ZenCodingTokens.EQ) {
-      return Couple.newOne(name, "");
+      return Couple.of(name, "");
     }
 
     advance();
@@ -386,6 +386,6 @@
     }
     while (token != null && token != ZenCodingTokens.CLOSING_SQ_BRACKET
            && token != ZenCodingTokens.SPACE && token != ZenCodingTokens.COMMA);
-    return Couple.newOne(name, attrValueBuilder.toString());
+    return Couple.of(name, attrValueBuilder.toString());
   }
 }
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/ZenCodingTemplate.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/ZenCodingTemplate.java
index a4db758..46d5a56 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/ZenCodingTemplate.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/ZenCodingTemplate.java
@@ -120,6 +120,7 @@
     return parse(key, callback, generator, null) != null;
   }
 
+  @Override
   public void expand(@NotNull String key, @NotNull CustomTemplateCallback callback) {
     ZenCodingGenerator defaultGenerator = findApplicableDefaultGenerator(callback.getContext(), false);
     assert defaultGenerator != null;
@@ -300,6 +301,7 @@
     return false;
   }
 
+  @Override
   public void wrap(@NotNull final String selection, @NotNull final CustomTemplateCallback callback) {
     final TextFieldWithStoredHistory field = new TextFieldWithStoredHistory(EMMET_RECENT_WRAP_ABBREVIATIONS_KEY);
     final Dimension fieldPreferredSize = field.getPreferredSize();
@@ -321,7 +323,7 @@
     });
     field.addKeyboardListener(new KeyAdapter() {
       @Override
-      public void keyPressed(KeyEvent e) {
+      public void keyPressed(@NotNull KeyEvent e) {
         if (!field.isPopupVisible()) {
           switch (e.getKeyCode()) {
             case KeyEvent.VK_ENTER:
@@ -396,6 +398,7 @@
     return checkTemplateKey(inputString, callback, generator);
   }
 
+  @Override
   public boolean isApplicable(PsiFile file, int offset, boolean wrapping) {
     if (file == null) {
       return false;
@@ -416,10 +419,13 @@
     final ZenCodingGenerator defaultGenerator = findApplicableDefaultGenerator(callback.getContext(), true);
     assert defaultGenerator != null;
     ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      @Override
       public void run() {
         CommandProcessor.getInstance().executeCommand(callback.getProject(), new Runnable() {
+          @Override
           public void run() {
             callback.getEditor().getCaretModel().runForEachCaret(new CaretAction() {
+              @Override
               public void perform(Caret caret) {
                 String selectedText = callback.getEditor().getSelectionModel().getSelectedText();
                 if (selectedText != null) {
@@ -443,21 +449,25 @@
     });
   }
 
+  @Override
   @NotNull
   public String getTitle() {
     return XmlBundle.message("emmet.title");
   }
 
+  @Override
   public char getShortcut() {
     return (char)EmmetOptions.getInstance().getEmmetExpandShortcut();
   }
 
+  @Override
   public String computeTemplateKey(@NotNull CustomTemplateCallback callback) {
     ZenCodingGenerator generator = findApplicableDefaultGenerator(callback.getContext(), false);
     if (generator == null) return null;
     return generator.computeTemplateKey(callback);
   }
 
+  @Override
   public boolean supportsWrapping() {
     return true;
   }
@@ -499,6 +509,8 @@
           }
         }).isEmpty();
         
+        CompletionResultSet resultSet = result.withPrefixMatcher(result.getPrefixMatcher().cloneWithPrefix(templatePrefix));
+        resultSet.restartCompletionOnPrefixChange(StandardPatterns.string().startsWith(templatePrefix));
         if (!regularTemplateWithSamePrefixExists) {
           // exclude perfect matches with existing templates because LiveTemplateCompletionContributor handles it
           final Collection<SingleLineEmmetFilter> extraFilters = ContainerUtil.newLinkedList(new SingleLineEmmetFilter());
@@ -508,9 +520,8 @@
             template.setKey(templatePrefix);
             template.setDescription(template.getTemplateText());
 
-            CompletionResultSet resultSet = result.withPrefixMatcher(result.getPrefixMatcher().cloneWithPrefix(templatePrefix));
-            resultSet.restartCompletionOnPrefixChange(StandardPatterns.string().startsWith(templatePrefix));
-            resultSet.addElement(new CustomLiveTemplateLookupElement(this, template.getKey(), template.getKey(), template.getDescription(), true, true));
+            resultSet.addElement(new CustomLiveTemplateLookupElement(this, template.getKey(), template.getKey(), template.getDescription(), 
+              !LiveTemplateCompletionContributor.shouldShowAllTemplates(), true));
           }
         }
       }
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/BemEmmetFilter.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/BemEmmetFilter.java
index 5d91960..64d097d 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/BemEmmetFilter.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/filters/BemEmmetFilter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -123,7 +123,7 @@
           return processClassName(className, node);
         }
       })));
-      attribute2Value.add(Couple.newOne("class", CLASS_NAME_JOINER.join(newClassNames)));
+      attribute2Value.add(Couple.of("class", CLASS_NAME_JOINER.join(newClassNames)));
     }
     return node;
   }
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/XmlZenCodingGenerator.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/XmlZenCodingGenerator.java
index 6bcd6fd..62e7523 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/XmlZenCodingGenerator.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/XmlZenCodingGenerator.java
@@ -15,13 +15,20 @@
  */
 package com.intellij.codeInsight.template.emmet.generators;
 
+import com.intellij.codeInsight.template.CustomTemplateCallback;
+import com.intellij.codeInsight.template.emmet.ZenCodingTemplate;
 import com.intellij.codeInsight.template.emmet.tokens.TemplateToken;
 import com.intellij.codeInsight.template.impl.TemplateImpl;
+import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.util.Couple;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.PsiElement;
+import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.xml.XmlDocument;
 import com.intellij.psi.xml.XmlFile;
 import com.intellij.psi.xml.XmlTag;
+import com.intellij.psi.xml.XmlTokenType;
 import com.intellij.xml.util.HtmlUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -36,7 +43,9 @@
   @Override
   public TemplateImpl generateTemplate(@NotNull TemplateToken token, boolean hasChildren, @NotNull PsiElement context) {
     String s = toString(token, hasChildren, context);
-    TemplateImpl template = token.getTemplate().copy();
+    TemplateImpl tokenTemplate = token.getTemplate();
+    assert tokenTemplate != null;
+    TemplateImpl template = tokenTemplate.copy();
     template.setString(s);
     return template;
   }
@@ -75,5 +84,31 @@
                                                int numberInIteration,
                                                int totalIterations, @Nullable String surroundedText);
 
+  @Override
   public abstract boolean isMyContext(@NotNull PsiElement context, boolean wrapping);
+
+  @Nullable
+  @Override
+  public String computeTemplateKey(@NotNull CustomTemplateCallback callback) {
+    Editor editor = callback.getEditor();
+    int currentOffset = editor.getCaretModel().getOffset();
+    int startOffset = editor.getDocument().getLineStartOffset(editor.getCaretModel().getLogicalPosition().line);
+
+    CharSequence documentText = editor.getDocument().getCharsSequence();
+    PsiElement prevVisibleLeaf = callback.getContext();
+    while (prevVisibleLeaf != null) {
+      TextRange textRange = prevVisibleLeaf.getTextRange();
+      if (textRange.getEndOffset() <= startOffset) {
+        break;
+      }
+      if (prevVisibleLeaf.getNode().getElementType() == XmlTokenType.XML_TAG_END) {
+        startOffset = textRange.getEndOffset();
+        break;
+      }
+      prevVisibleLeaf = PsiTreeUtil.prevVisibleLeaf(prevVisibleLeaf);
+    }
+
+    String key = computeKey(documentText.subSequence(startOffset, currentOffset));
+    return !StringUtil.isEmpty(key) && ZenCodingTemplate.checkTemplateKey(key, callback, this) ? key : null;
+  }
 }
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/XmlZenCodingGeneratorImpl.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/XmlZenCodingGeneratorImpl.java
index 1bf6998..488247c 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/XmlZenCodingGeneratorImpl.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/XmlZenCodingGeneratorImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -51,6 +51,7 @@
     return type == StdFileTypes.XHTML || type == StdFileTypes.JSPX || type == StdFileTypes.XML;
   }
 
+  @Override
   @NotNull
   public String toString(@NotNull XmlTag tag,
                          @NotNull List<Couple<String>> attribute2Value,
@@ -63,6 +64,7 @@
     return tag.getContainingFile().getText();
   }
 
+  @Override
   @NotNull
   public String buildAttributesString(@NotNull List<Couple<String>> attribute2value,
                                       boolean hasChildren,
@@ -81,6 +83,7 @@
     return result.toString();
   }
 
+  @Override
   public boolean isMyContext(@NotNull PsiElement context, boolean wrapping) {
     return isMyLanguage(context.getLanguage()) && (wrapping || HtmlTextContextType.isInContext(context));
   }
@@ -89,6 +92,7 @@
     return language instanceof XMLLanguage;
   }
 
+  @Override
   public String getSuffix() {
     return "html";
   }
@@ -98,6 +102,7 @@
     return EmmetOptions.getInstance().isEmmetEnabled();
   }
 
+  @Override
   public boolean isAppliedByDefault(@NotNull PsiElement context) {
     return true;
   }
@@ -131,6 +136,7 @@
             final Document document = FileDocumentManager.getInstance().getDocument(file);
             documentManager.doPostponedOperationsAndUnblockDocument(document);
             ApplicationManager.getApplication().runWriteAction(new Runnable() {
+              @Override
               public void run() {
                 document.replaceString(offset, tag.getTextRange().getEndOffset(), "/>");
                 documentManager.commitDocument(document);
diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/ZenCodingGenerator.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/ZenCodingGenerator.java
index 4e1dbdf..c919eac 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/ZenCodingGenerator.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/generators/ZenCodingGenerator.java
@@ -25,12 +25,8 @@
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.extensions.ExtensionPointName;
 import com.intellij.openapi.options.UnnamedConfigurable;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiErrorElement;
-import com.intellij.psi.PsiWhiteSpace;
-import com.intellij.psi.impl.source.tree.LeafPsiElement;
-import com.intellij.psi.tree.TokenSet;
-import com.intellij.psi.xml.XmlTokenType;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -43,9 +39,7 @@
  * @author Eugene.Kudelevsky
  */
 public abstract class ZenCodingGenerator {
-  private static final ExtensionPointName<ZenCodingGenerator> EP_NAME =
-    new ExtensionPointName<ZenCodingGenerator>("com.intellij.xml.zenCodingGenerator");
-  private static final TokenSet VALID_LEAF_TYPES = TokenSet.create(XmlTokenType.XML_DATA_CHARACTERS, XmlTokenType.XML_CHAR_ENTITY_REF);
+  private static final ExtensionPointName<ZenCodingGenerator> EP_NAME = new ExtensionPointName<ZenCodingGenerator>("com.intellij.xml.zenCodingGenerator");
 
   public abstract TemplateImpl generateTemplate(@NotNull TemplateToken token, boolean hasChildren, @NotNull PsiElement context);
 
@@ -75,96 +69,71 @@
   @Nullable
   public String computeTemplateKey(@NotNull CustomTemplateCallback callback) {
     Editor editor = callback.getEditor();
-    final int currentOffset = editor.getCaretModel().getOffset();
-    final CharSequence documentText = editor.getDocument().getCharsSequence();
-    PsiElement element = callback.getContext();
-    int line = editor.getCaretModel().getLogicalPosition().line;
-    int lineStart = editor.getDocument().getLineStartOffset(line);
-    int elementStart = -1;
-    do {
-      PsiElement e = element;
-      while ((e instanceof LeafPsiElement && VALID_LEAF_TYPES.contains(((LeafPsiElement)e).getElementType())) || 
-             e instanceof PsiWhiteSpace || e instanceof PsiErrorElement) {
-        elementStart = e.getTextRange().getStartOffset();
-        e = e.getPrevSibling();
-      }
-      if (elementStart >= 0) {
-        int startOffset = Math.max(elementStart, lineStart);
-        String key = computeKey(startOffset, currentOffset, documentText);
-        if (key != null) {
-          while (key.length() > 0 && !ZenCodingTemplate.checkTemplateKey(key, callback, this)) {
-            key = key.substring(1);
-          }
-          if (key.length() > 0) {
-            return key;
-          }
-        }
-      }
-      element = element.getParent();
-    }
-    while (element != null && elementStart > lineStart);
-    return null;
+    int currentOffset = editor.getCaretModel().getOffset();
+    int startOffset = editor.getDocument().getLineStartOffset(editor.getCaretModel().getLogicalPosition().line);
+    String key = computeKey(editor.getDocument().getCharsSequence().subSequence(startOffset, currentOffset));
+    return !StringUtil.isEmpty(key) && ZenCodingTemplate.checkTemplateKey(key, callback, this) ? key : null;
   }
-
+  
   @Nullable
-  protected static String computeKey(int startOffset, int currentOffset, CharSequence documentText) {
-    if (currentOffset < startOffset || startOffset > documentText.length() || currentOffset > documentText.length()) {
-      return null;
-    }
-    String s = documentText.subSequence(startOffset, currentOffset).toString();
-    int index = 0;
-    while (index < s.length() && Character.isWhitespace(s.charAt(index))) {
-      index++;
-    }
-    String key = s.substring(index);
-    int lastWhitespaceIndex = -1;
-    int lastQuoteIndex = -1;
-    int lastApostropheIndex = -1;
-    boolean inBrackets = false;
-    int bracesStack = 0;
+  protected String computeKey(@NotNull CharSequence text) {
+    int currentOffset = text.length();
+    int groupCount = 0;
+    int bracketCount = 0;
+    int textCount = 0;
 
-    for (int i = 0; i < key.length(); i++) {
-      char c = key.charAt(i);
-      if (lastQuoteIndex >= 0 || lastApostropheIndex >= 0) {
-        if (c == '"') {
-          lastQuoteIndex = -1;
-        }
-        else if (c == '\'') lastApostropheIndex = -1;
-      }
-      else if (Character.isWhitespace(c)) {
-        lastWhitespaceIndex = i;
-      }
-      else if (c == '"') {
-        lastQuoteIndex = i;
-      }
-      else if (c == '\'') {
-        lastApostropheIndex = i;
+    while (currentOffset > 0) {
+      currentOffset--;
+      char c = text.charAt(currentOffset);
+
+      if (c == ']') {
+        bracketCount++;
       }
       else if (c == '[') {
-        inBrackets = true;
+        if (bracketCount == 0) {
+          currentOffset++;
+          break;
+        }
+        bracketCount--;
       }
-      else if (c == ']' && inBrackets) {
-        lastWhitespaceIndex = -1;
-        inBrackets = false;
+      else if (c == '}') {
+        textCount++;
       }
       else if (c == '{') {
-        bracesStack++;
+        if (textCount == 0) {
+          currentOffset++;
+          break;
+        }
+        textCount--;
       }
-      else if (c == '}' && bracesStack > 0) {
-        bracesStack--;
-        if (bracesStack == 0) {
-          lastWhitespaceIndex = -1;
+      else if (c == ')') {
+        groupCount++;
+      }
+      else if (c == '(') {
+        if (groupCount == 0) {
+          currentOffset++;
+          break;
+        }
+        groupCount--;
+      }
+      else {
+        if (bracketCount > 0 || textCount > 0) {
+          // respect all characters inside attribute sets or text nodes
+          continue;
+        }
+        if (!isAllowedChar(c)) {
+          currentOffset++;
+          break;
         }
       }
     }
-    if (lastQuoteIndex >= 0 || lastApostropheIndex >= 0) {
-      int max = Math.max(lastQuoteIndex, lastApostropheIndex);
-      return max < key.length() - 1 ? key.substring(max) : null;
-    }
-    if (lastWhitespaceIndex >= 0 && lastWhitespaceIndex < key.length() - 1) {
-      return key.substring(lastWhitespaceIndex + 1);
-    }
-    return key;
+    return groupCount == 0 && textCount == 0 && bracketCount == 0 && currentOffset >= 0 && currentOffset < text.length() 
+           ? text.subSequence(currentOffset, text.length()).toString().replaceFirst("^[*+>^]+", "") 
+           : null;
+  }
+
+  private static boolean isAllowedChar(char c) {
+    return (Character.isDigit(c) || Character.isLetter(c) || StringUtil.containsChar("/>+^[](){}#.*:$-_!@|%", c));
   }
 
   @NotNull
diff --git a/xml/impl/src/com/intellij/featureStatistics/XmlProductivityFeatureProvider.java b/xml/impl/src/com/intellij/featureStatistics/XmlProductivityFeatureProvider.java
index 78d4479..0ded2bd 100644
--- a/xml/impl/src/com/intellij/featureStatistics/XmlProductivityFeatureProvider.java
+++ b/xml/impl/src/com/intellij/featureStatistics/XmlProductivityFeatureProvider.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,6 +24,7 @@
  * @author Dmitry Avdeev
  */
 public class XmlProductivityFeatureProvider extends ProductivityFeaturesProvider {
+  @Override
   public FeatureDescriptor[] getFeatureDescriptors() {
     return new FeatureDescriptor[] { new FeatureDescriptor(XmlCompletionContributor.TAG_NAME_COMPLETION_FEATURE,
                                                            "completion",
@@ -36,10 +37,12 @@
                                                            this)};
   }
 
+  @Override
   public GroupDescriptor[] getGroupDescriptors() {
     return new GroupDescriptor[0];
   }
 
+  @Override
   public ApplicabilityFilter[] getApplicabilityFilters() {
     return new ApplicabilityFilter[0];
   }
diff --git a/xml/impl/src/com/intellij/html/HtmlLineMarkerProvider.java b/xml/impl/src/com/intellij/html/HtmlLineMarkerProvider.java
index a9c9a33..1d6e5bd 100644
--- a/xml/impl/src/com/intellij/html/HtmlLineMarkerProvider.java
+++ b/xml/impl/src/com/intellij/html/HtmlLineMarkerProvider.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.
@@ -38,6 +38,7 @@
 public class HtmlLineMarkerProvider implements LineMarkerProvider {
   private final Map<Language, LineMarkerProvider> embeddedLanguagesLineMarkerProviders = new THashMap<Language, LineMarkerProvider>();
 
+  @Override
   public LineMarkerInfo getLineMarkerInfo(@NotNull final PsiElement element) {
     if (element instanceof PsiWhiteSpace) return null;
     final Language language = element.getLanguage();
@@ -62,6 +63,7 @@
     return markerProvider;
   }
 
+  @Override
   public void collectSlowLineMarkers(@NotNull final List<PsiElement> elements, @NotNull final Collection<LineMarkerInfo> result) {
     Map<Language, LineMarkerProvider> localEmbeddedLanguagesLineMarkerProviders = null;
     Map<LineMarkerProvider, List<PsiElement>> embeddedLineMarkersWorkItems = null;
diff --git a/xml/impl/src/com/intellij/html/impl/util/MicrodataUtil.java b/xml/impl/src/com/intellij/html/impl/util/MicrodataUtil.java
deleted file mode 100644
index 5374558..0000000
--- a/xml/impl/src/com/intellij/html/impl/util/MicrodataUtil.java
+++ /dev/null
@@ -1,207 +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.html.impl.util;
-
-import com.intellij.openapi.util.Key;
-import com.intellij.openapi.util.TextRange;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiReference;
-import com.intellij.psi.XmlRecursiveElementVisitor;
-import com.intellij.psi.impl.source.resolve.reference.impl.providers.DependentNSReference;
-import com.intellij.psi.impl.source.resolve.reference.impl.providers.URLReference;
-import com.intellij.psi.xml.XmlAttribute;
-import com.intellij.psi.xml.XmlAttributeValue;
-import com.intellij.psi.xml.XmlFile;
-import com.intellij.psi.xml.XmlTag;
-import com.intellij.util.PairFunction;
-import com.intellij.util.text.StringTokenizer;
-import com.intellij.xml.util.HtmlUtil;
-import gnu.trove.THashMap;
-import gnu.trove.THashSet;
-import org.jetbrains.annotations.Nls;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.*;
-
-/**
- * @author: Fedor.Korotkov
- */
-public class MicrodataUtil {
-  public static final Key<List<String>> ITEM_PROP_KEYS = Key.create("microdata.prop");
-  public static final String ITEM_REF = "itemref";
-  public static final String ITEM_SCOPE = "itemscope";
-  public static final String ITEM_TYPE = "itemtype";
-  public static final String ITEM_PROP = "itemprop";
-  public static final String ITEM_ID = "itemid";
-
-  public static boolean hasScopeTag(@Nullable XmlTag tag) {
-    return findScopeTag(tag) != null;
-  }
-
-  @Nullable
-  public static XmlTag findScopeTag(@Nullable XmlTag context) {
-    Map<String, XmlTag> id2tag = findScopesWithItemRef(context != null ? context.getContainingFile() : null);
-    XmlTag tag = context;
-    while (tag != null) {
-      if (tag != context && tag.getAttribute(ITEM_SCOPE) != null) return tag;
-      final String id = getStripedAttributeValue(tag, "id");
-      if (id != null && id2tag.containsKey(id)) return id2tag.get(id);
-      tag = tag.getParentTag();
-    }
-    return null;
-  }
-
-  private static Map<String, XmlTag> findScopesWithItemRef(@Nullable PsiFile file) {
-    if (!(file instanceof XmlFile)) return Collections.emptyMap();
-    final Map<String, XmlTag> result = new THashMap<String, XmlTag>();
-    file.accept(new XmlRecursiveElementVisitor() {
-      @Override
-      public void visitXmlTag(final XmlTag tag) {
-        super.visitXmlTag(tag);
-        XmlAttribute refAttr = tag.getAttribute(ITEM_REF);
-        if (refAttr != null && tag.getAttribute(ITEM_SCOPE) != null) {
-          getReferencesForAttributeValue(refAttr.getValueElement(), new PairFunction<String, Integer, PsiReference>() {
-            @Nullable
-            @Override
-            public PsiReference fun(String t, Integer v) {
-              result.put(t, tag);
-              return null;
-            }
-          });
-        }
-      }
-    });
-    return result;
-  }
-
-  public static List<String> extractProperties(PsiFile file, String type) {
-    final VirtualFile virtualFile = file.getVirtualFile();
-    List<String> result = virtualFile != null ? virtualFile.getUserData(ITEM_PROP_KEYS) : null;
-    if (virtualFile != null && result == null) {
-      result = collectNames(file, type);
-      virtualFile.putUserData(ITEM_PROP_KEYS, result);
-    }
-    return result;
-  }
-
-  private static List<String> collectNames(PsiFile file, String type) {
-    if (file instanceof XmlFile) {
-      final CollectNamesVisitor collectNamesVisitor = getVisitorByType(type);
-      file.accept(collectNamesVisitor);
-      return collectNamesVisitor.getValues();
-    }
-    return Collections.emptyList();
-  }
-
-  private static CollectNamesVisitor getVisitorByType(String type) {
-    if (type.contains("schema.org")) {
-      return new CollectNamesFromSchemaOrgVisitor();
-    }
-    return new CollectNamesByMicrodataVisitor(type);
-  }
-
-  public static PsiReference[] getUrlReferencesForAttributeValue(final XmlAttributeValue element) {
-    return getReferencesForAttributeValue(element, new PairFunction<String, Integer, PsiReference>() {
-      @Nullable
-      @Override
-      public PsiReference fun(String token, Integer offset) {
-        if (HtmlUtil.hasHtmlPrefix(token)) {
-          final TextRange range = TextRange.from(offset, token.length());
-          final URLReference urlReference = new URLReference(element, range, true);
-          return new DependentNSReference(element, range, urlReference, true);
-        }
-        return null;
-      }
-    });
-  }
-
-  public static PsiReference[] getReferencesForAttributeValue(@Nullable XmlAttributeValue element,
-                                                              PairFunction<String, Integer, PsiReference> refFun) {
-    if (element == null) {
-      return PsiReference.EMPTY_ARRAY;
-    }
-    String text = element.getText();
-    String urls = StringUtil.stripQuotesAroundValue(text);
-    StringTokenizer tokenizer = new StringTokenizer(urls);
-    List<PsiReference> result = new ArrayList<PsiReference>();
-    while (tokenizer.hasMoreTokens()) {
-      String token = tokenizer.nextToken();
-      int index = text.indexOf(token);
-      PsiReference ref = refFun.fun(token, index);
-      if (ref != null) {
-        result.add(ref);
-      }
-    }
-    return result.toArray(new PsiReference[result.size()]);
-  }
-
-  @Nullable
-  public static String getStripedAttributeValue(@Nullable XmlTag tag, @Nls String attributeName) {
-    String value = tag != null ? tag.getAttributeValue(attributeName) : null;
-    return value != null ? StringUtil.stripQuotesAroundValue(value) : null;
-  }
-
-  private static class CollectNamesVisitor extends XmlRecursiveElementVisitor {
-    protected final Set<String> myValues = new THashSet<String>();
-
-    public List<String> getValues() {
-      return new ArrayList<String>(myValues);
-    }
-  }
-
-  public static class CollectNamesByMicrodataVisitor extends CollectNamesVisitor {
-    protected final String myType;
-    private boolean myCollecting = false;
-
-    public CollectNamesByMicrodataVisitor(String type) {
-      myType = type;
-    }
-
-    @Override
-    public void visitXmlTag(XmlTag tag) {
-      String value = getStripedAttributeValue(tag, ITEM_ID);
-      final boolean isTypeTag = myType.equalsIgnoreCase(value);
-      if (isTypeTag) {
-        myCollecting = true;
-      }
-
-      if (myCollecting && "name".equalsIgnoreCase(getStripedAttributeValue(tag, ITEM_PROP))) {
-        myValues.add(tag.getValue().getTrimmedText());
-      }
-
-      super.visitXmlTag(tag);
-
-      if (isTypeTag) {
-        myCollecting = false;
-      }
-    }
-  }
-
-  public static class CollectNamesFromSchemaOrgVisitor extends CollectNamesVisitor {
-    @Override
-    public void visitXmlTag(XmlTag tag) {
-      super.visitXmlTag(tag);
-      if ("prop-nam".equalsIgnoreCase(getStripedAttributeValue(tag, "class"))) {
-        final String code = tag.getSubTagText("code");
-        if (code != null) {
-          myValues.add(code);
-        }
-      }
-    }
-  }
-}
diff --git a/xml/impl/src/com/intellij/javaee/EditLocationDialog.java b/xml/impl/src/com/intellij/javaee/EditLocationDialog.java
index a07d232..d836401 100644
--- a/xml/impl/src/com/intellij/javaee/EditLocationDialog.java
+++ b/xml/impl/src/com/intellij/javaee/EditLocationDialog.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,9 +18,9 @@
 import com.intellij.openapi.fileChooser.FileChooser;
 import com.intellij.openapi.fileChooser.FileChooserDescriptor;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.ComponentWithBrowseButton;
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.ui.FixedSizeButton;
-import com.intellij.openapi.ui.TextFieldWithBrowseButton;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.Consumer;
 import com.intellij.xml.XmlBundle;
@@ -93,7 +93,7 @@
         new GridBagConstraints(1, 3, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 10, 5), 0, 0)
       );
 
-      TextFieldWithBrowseButton.MyDoClickAction.addTo(myBtnBrowseLocalPath, myTfPath);
+      ComponentWithBrowseButton.MyDoClickAction.addTo(myBtnBrowseLocalPath, myTfPath);
       myBtnBrowseLocalPath.addActionListener(new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent ignored) {
diff --git a/xml/impl/src/com/intellij/javaee/ExternalResourceConfigurable.java b/xml/impl/src/com/intellij/javaee/ExternalResourceConfigurable.java
index 26d956a..a0df2d2 100644
--- a/xml/impl/src/com/intellij/javaee/ExternalResourceConfigurable.java
+++ b/xml/impl/src/com/intellij/javaee/ExternalResourceConfigurable.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.
@@ -64,27 +64,33 @@
     myNewPairs = newResources;
   }
 
+  @Override
   public String getDisplayName() {
     return XmlBundle.message("display.name.edit.external.resource");
   }
 
+  @Override
   public JComponent createComponent() {
     myPanel = new JPanel(new GridBagLayout()) {
+      @Override
       public Dimension getPreferredSize() {
         return new Dimension(-1, 400);
       }
     };
 
     myExtPanel = new AddEditRemovePanel<NameLocationPair>(new ExtUrlsTableModel(), myPairs, XmlBundle.message("label.edit.external.resource.configure.external.resources")) {
+      @Override
       protected NameLocationPair addItem() {
         return addExtLocation();
       }
 
+      @Override
       protected boolean removeItem(NameLocationPair o) {
         setModified(true);
         return true;
       }
 
+      @Override
       protected NameLocationPair editItem(NameLocationPair o) {
         return editExtLocation(o);
       }
@@ -100,20 +106,24 @@
     }
 
     table.getModel().addTableModelListener(new TableModelListener() {
+      @Override
       public void tableChanged(TableModelEvent e) {
         setModified(true);
       }
     });
     myIgnorePanel = new AddEditRemovePanel<String>(new IgnoredUrlsModel(), myIgnoredUrls, XmlBundle.message("label.edit.external.resource.configure.ignored.resources")) {
+      @Override
       protected String addItem() {
         return addIgnoreLocation();
       }
 
+      @Override
       protected boolean removeItem(String o) {
         setModified(true);
         return true;
       }
 
+      @Override
       protected String editItem(String o) {
         return editIgnoreLocation(o);
       }
@@ -149,8 +159,10 @@
     return myPanel;
   }
 
+  @Override
   public void apply() {
     ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      @Override
       public void run() {
         ExternalResourceManagerEx manager = ExternalResourceManagerEx.getInstanceEx();
 
@@ -183,6 +195,7 @@
     setModified(false);
   }
 
+  @Override
   public void reset() {
 
     myPairs = new ArrayList<NameLocationPair>(myNewPairs);
@@ -230,6 +243,7 @@
     setModified(!myNewPairs.isEmpty());
   }
 
+  @Override
   public void disposeUIResources() {
     myPanel = null;
     myExtPanel = null;
@@ -237,6 +251,7 @@
     myHtmlLanguageLevelForm = null;
   }
 
+  @Override
   public String getHelpTopic() {
     return "preferences.externalResources";
   }
@@ -282,6 +297,7 @@
   }
 
   private static class PathRenderer extends DefaultTableCellRenderer {
+    @Override
     public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
       final Component rendererComponent = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
       if (value != null) {
@@ -304,26 +320,32 @@
   private static class IgnoredUrlsModel extends AddEditRemovePanel.TableModel<String> {
     private final String[] myNames = {XmlBundle.message("column.name.edit.external.resource.uri")};
 
+    @Override
     public int getColumnCount() {
       return myNames.length;
     }
 
+    @Override
     public Object getField(String o, int columnIndex) {
       return o;
     }
 
+    @Override
     public Class getColumnClass(int columnIndex) {
       return String.class;
     }
 
+    @Override
     public boolean isEditable(int column) {
       return false;
     }
 
+    @Override
     public void setValue(Object aValue, String data, int columnIndex) {
 
     }
 
+    @Override
     public String getColumnName(int column) {
       return myNames[column];
     }
@@ -342,10 +364,12 @@
       myNames = ArrayUtil.toStringArray(names);
     }
 
+    @Override
     public int getColumnCount() {
       return myNames.length;
     }
 
+    @Override
     public Object getField(NameLocationPair pair, int columnIndex) {
       switch (columnIndex) {
         case 0:
@@ -359,18 +383,22 @@
       return "";
     }
 
+    @Override
     public Class getColumnClass(int columnIndex) {
       return columnIndex == 2 ? Boolean.class : String.class;
     }
 
+    @Override
     public boolean isEditable(int column) {
       return column == 2;
     }
 
+    @Override
     public void setValue(Object aValue, NameLocationPair data, int columnIndex) {
       data.myShared = !((Boolean)aValue).booleanValue();
     }
 
+    @Override
     public String getColumnName(int column) {
       return myNames[column];
     }
diff --git a/xml/impl/src/com/intellij/javaee/ExternalResourceManagerImpl.java b/xml/impl/src/com/intellij/javaee/ExternalResourceManagerImpl.java
deleted file mode 100644
index 8606e11..0000000
--- a/xml/impl/src/com/intellij/javaee/ExternalResourceManagerImpl.java
+++ /dev/null
@@ -1,43 +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.javaee;
-
-import com.intellij.application.options.PathMacrosImpl;
-import com.intellij.openapi.components.ServiceManager;
-import com.intellij.openapi.components.State;
-import com.intellij.openapi.components.Storage;
-import com.intellij.openapi.components.StoragePathMacros;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.JDOMExternalizable;
-import com.intellij.openapi.util.NotNullLazyKey;
-
-/**
- * @author mike
- */
-@State(name = "ExternalResourceManagerImpl",
-       storages = {@Storage( file = StoragePathMacros.APP_CONFIG + "/other.xml")})
-public class ExternalResourceManagerImpl extends ExternalResourceManagerExImpl implements JDOMExternalizable {
-  public ExternalResourceManagerImpl(PathMacrosImpl pathMacros) {
-    super(pathMacros);
-  }
-
-  private static final NotNullLazyKey<ProjectResources, Project> INSTANCE_CACHE = ServiceManager.createLazyKey(ProjectResources.class);
-
-  @Override
-  protected ExternalResourceManagerExImpl getProjectResources(Project project) {
-    return INSTANCE_CACHE.getValue(project);
-  }
-}
diff --git a/xml/impl/src/com/intellij/javaee/ExternalResourcesRootsProvider.java b/xml/impl/src/com/intellij/javaee/ExternalResourcesRootsProvider.java
index ddfcd65..5dc5226 100644
--- a/xml/impl/src/com/intellij/javaee/ExternalResourcesRootsProvider.java
+++ b/xml/impl/src/com/intellij/javaee/ExternalResourcesRootsProvider.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -38,13 +38,13 @@
     @NotNull
     @Override
     protected Set<String> compute() {
-      ExternalResourceManagerImpl manager = (ExternalResourceManagerImpl)ExternalResourceManager.getInstance();
-      Collection<Map<String,ExternalResourceManagerImpl.Resource>> resources = manager.getStandardResources();
-      Set<ExternalResourceManagerImpl.Resource> dirs = new HashSet<ExternalResourceManagerImpl.Resource>();
+      ExternalResourceManagerExImpl manager = (ExternalResourceManagerExImpl)ExternalResourceManager.getInstance();
+      Collection<Map<String, ExternalResourceManagerExImpl.Resource>> resources = manager.getStandardResources();
+      Set<ExternalResourceManagerExImpl.Resource> dirs = new HashSet<ExternalResourceManagerExImpl.Resource>();
       Set<String> set = new HashSet<String>();
-      for (Map<String, ExternalResourceManagerImpl.Resource> map : resources) {
-        for (ExternalResourceManagerImpl.Resource resource : map.values()) {
-          ExternalResourceManagerImpl.Resource dir = new ExternalResourceManagerImpl.Resource(
+      for (Map<String, ExternalResourceManagerExImpl.Resource> map : resources) {
+        for (ExternalResourceManagerExImpl.Resource resource : map.values()) {
+          ExternalResourceManagerExImpl.Resource dir = new ExternalResourceManagerExImpl.Resource(
             resource.directoryName(), resource);
 
           if (dirs.add(dir)) {
@@ -59,6 +59,7 @@
     }
   };
 
+  @Override
   public Set<VirtualFile> getAdditionalRootsToIndex() {
 
     HashSet<VirtualFile> roots = new HashSet<VirtualFile>();
diff --git a/xml/impl/src/com/intellij/javaee/MapExternalResourceDialog.java b/xml/impl/src/com/intellij/javaee/MapExternalResourceDialog.java
index 617f5a9..e09101a 100644
--- a/xml/impl/src/com/intellij/javaee/MapExternalResourceDialog.java
+++ b/xml/impl/src/com/intellij/javaee/MapExternalResourceDialog.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.
@@ -28,7 +28,7 @@
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiManager;
@@ -163,7 +163,7 @@
       schema = XmlUtil.findNamespaceByLocation(file, uri);
     }
     else if (location != null) {
-      VirtualFile virtualFile = VfsUtil.findRelativeFile(location, null);
+      VirtualFile virtualFile = VfsUtilCore.findRelativeFile(location, null);
       if (virtualFile != null) {
         schema = PsiManager.getInstance(project).findFile(virtualFile);
       }
diff --git a/xml/impl/src/com/intellij/javaee/NameLocationPair.java b/xml/impl/src/com/intellij/javaee/NameLocationPair.java
index 724d2a5..bd3dd46 100644
--- a/xml/impl/src/com/intellij/javaee/NameLocationPair.java
+++ b/xml/impl/src/com/intellij/javaee/NameLocationPair.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.
@@ -20,8 +20,8 @@
 *         Date: 7/18/12
 */
 public class NameLocationPair implements Comparable {
-  String myName;
-  String myLocation;
+  final String myName;
+  final String myLocation;
   boolean myShared;
 
   public NameLocationPair(String name, String location, boolean shared) {
@@ -30,6 +30,7 @@
     myShared = shared;
   }
 
+  @Override
   public int compareTo(Object o) {
     return myName.compareTo(((NameLocationPair)o).myName);
   }
diff --git a/xml/impl/src/com/intellij/javaee/ProjectResources.java b/xml/impl/src/com/intellij/javaee/ProjectResources.java
deleted file mode 100644
index 7bf3a03..0000000
--- a/xml/impl/src/com/intellij/javaee/ProjectResources.java
+++ /dev/null
@@ -1,54 +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.javaee;
-
-import com.intellij.application.options.PathMacrosImpl;
-import com.intellij.openapi.components.PersistentStateComponent;
-import com.intellij.openapi.components.State;
-import com.intellij.openapi.components.Storage;
-import com.intellij.openapi.components.StoragePathMacros;
-import com.intellij.openapi.util.JDOMExternalizableAdapter;
-import org.jdom.Element;
-
-import java.util.Collections;
-import java.util.Map;
-
-/**
-* @author Dmitry Avdeev
-*/
-@State(name = "ProjectResources", storages = {@Storage( file = StoragePathMacros.PROJECT_FILE)})
-public class ProjectResources extends ExternalResourceManagerImpl implements PersistentStateComponent<Element> {
-
-  private final JDOMExternalizableAdapter myAdapter;
-
-  public ProjectResources(PathMacrosImpl pathMacros) {
-    super(pathMacros);
-    myAdapter = new JDOMExternalizableAdapter(this, "ProjectResources");
-  }
-
-  @Override
-  protected Map<String, Map<String, Resource>> computeStdResources() {
-    return Collections.emptyMap();   
-  }
-
-  public Element getState() {
-    return myAdapter.getState();
-  }
-
-  public void loadState(Element state) {
-    myAdapter.loadState(state);
-  }
-}
diff --git a/xml/impl/src/com/intellij/javaee/PsiExternalResourceNotifier.java b/xml/impl/src/com/intellij/javaee/PsiExternalResourceNotifier.java
index 30fa2e2..3f55593 100644
--- a/xml/impl/src/com/intellij/javaee/PsiExternalResourceNotifier.java
+++ b/xml/impl/src/com/intellij/javaee/PsiExternalResourceNotifier.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.
@@ -40,18 +40,21 @@
     final ExternalResourceListener myExternalResourceListener = new MyExternalResourceListener();
     myExternalResourceManager.addExternalResourceListener(myExternalResourceListener);
     Disposer.register(project, new Disposable() {
+      @Override
       public void dispose() {
         myExternalResourceManager.removeExternalResourceListener(myExternalResourceListener);
       }
     });
   }
 
+  @Override
   @NotNull
   public String getComponentName() {
     return "PsiExternalResourceNotifier";
   }
 
   private class MyExternalResourceListener implements ExternalResourceListener {
+    @Override
     public void externalResourceChanged() {
       myPsiManager.beforeChange(true);
       myDaemonCodeAnalyzer.restart();
diff --git a/xml/impl/src/com/intellij/lang/html/HtmlFormattingModelBuilder.java b/xml/impl/src/com/intellij/lang/html/HtmlFormattingModelBuilder.java
index 1b004ec..16259e8 100644
--- a/xml/impl/src/com/intellij/lang/html/HtmlFormattingModelBuilder.java
+++ b/xml/impl/src/com/intellij/lang/html/HtmlFormattingModelBuilder.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.
@@ -34,6 +34,7 @@
 import org.jetbrains.annotations.NotNull;
 
 public class HtmlFormattingModelBuilder implements FormattingModelBuilder {
+  @Override
   @NotNull
     public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
     final PsiFile psiFile = element.getContainingFile();
@@ -44,6 +45,7 @@
                                                            documentModel);
   }
 
+  @Override
   public TextRange getRangeAffectingIndent(PsiFile file, int offset, ASTNode elementAtOffset) {
     return null;
   }
diff --git a/xml/impl/src/com/intellij/lang/xhtml/XhtmlFormattingModelBuilder.java b/xml/impl/src/com/intellij/lang/xhtml/XhtmlFormattingModelBuilder.java
index 769f7cc..b1001fc 100644
--- a/xml/impl/src/com/intellij/lang/xhtml/XhtmlFormattingModelBuilder.java
+++ b/xml/impl/src/com/intellij/lang/xhtml/XhtmlFormattingModelBuilder.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.
@@ -34,6 +34,7 @@
 import org.jetbrains.annotations.NotNull;
 
 public class XhtmlFormattingModelBuilder implements FormattingModelBuilder {
+  @Override
   @NotNull
     public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
     final PsiFile psiFile = element.getContainingFile();
@@ -45,6 +46,7 @@
                                                             documentModel);
   }
 
+  @Override
   public TextRange getRangeAffectingIndent(PsiFile file, int offset, ASTNode elementAtOffset) {
     return null;
   }
diff --git a/xml/impl/src/com/intellij/lang/xml/XMLExternalAnnotator.java b/xml/impl/src/com/intellij/lang/xml/XMLExternalAnnotator.java
deleted file mode 100644
index 599ed5d..0000000
--- a/xml/impl/src/com/intellij/lang/xml/XMLExternalAnnotator.java
+++ /dev/null
@@ -1,143 +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.xml;
-
-import com.intellij.codeInsight.daemon.Validator;
-import com.intellij.codeInsight.intention.IntentionAction;
-import com.intellij.lang.annotation.Annotation;
-import com.intellij.lang.annotation.AnnotationHolder;
-import com.intellij.lang.annotation.ExternalAnnotator;
-import com.intellij.openapi.util.Trinity;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.xml.XmlDocument;
-import com.intellij.psi.xml.XmlFile;
-import com.intellij.psi.xml.XmlTag;
-import com.intellij.psi.xml.XmlToken;
-import com.intellij.xml.XmlNSDescriptor;
-import com.intellij.xml.util.XmlTagUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author ven
- */
-public class XMLExternalAnnotator extends ExternalAnnotator<XMLExternalAnnotator.MyHost, XMLExternalAnnotator.MyHost> {
-  @Nullable
-  @Override
-  public MyHost collectInformation(@NotNull PsiFile file) {
-    if (!(file instanceof XmlFile)) return null;
-    final XmlDocument document = ((XmlFile)file).getDocument();
-    if (document == null) return null;
-    XmlTag rootTag = document.getRootTag();
-    XmlNSDescriptor nsDescriptor = rootTag == null ? null : rootTag.getNSDescriptor(rootTag.getNamespace(), false);
-
-    if (nsDescriptor instanceof Validator) {
-      //noinspection unchecked
-      MyHost host = new MyHost();
-      ((Validator<XmlDocument>)nsDescriptor).validate(document, host);
-      return host;
-    }
-    return null;
-  }
-
-  @Nullable
-  @Override
-  public MyHost doAnnotate(MyHost collectedInfo) {
-    return collectedInfo;
-  }
-
-  @Override
-  public void apply(@NotNull PsiFile file, MyHost annotationResult, @NotNull AnnotationHolder holder) {
-    annotationResult.apply(holder);
-  }
-
-  private static void appendFixes(final Annotation annotation, final IntentionAction... actions) {
-    if (actions != null) {
-      for (IntentionAction action : actions) annotation.registerFix(action);
-    }
-  }
-
-  static class MyHost implements Validator.ValidationHost {
-    private final List<Trinity<PsiElement, String, ErrorType>> messages = new ArrayList<Trinity<PsiElement, String, ErrorType>>();
-
-    @Override
-    public void addMessage(PsiElement context, String message, int type) {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void addMessage(PsiElement context, String message, @NotNull ErrorType type) {
-      messages.add(Trinity.create(context, message, type));
-    }
-
-    void apply (AnnotationHolder holder) {
-      for (Trinity<PsiElement, String, ErrorType> message : messages) {
-        addMessageWithFixes(message.first, message.second, message.third, holder);
-      }
-    }
-  }
-  
-  
-  public static void addMessageWithFixes(final PsiElement context,
-                                         final String message,
-                                         @NotNull final Validator.ValidationHost.ErrorType type,
-                                         AnnotationHolder myHolder,
-                                         @NotNull final IntentionAction... fixes) {
-    if (message != null && !message.isEmpty()) {
-      if (context instanceof XmlTag) {
-        addMessagesForTag((XmlTag)context, message, type, myHolder, fixes);
-      }
-      else {
-        if (type == Validator.ValidationHost.ErrorType.ERROR) {
-          appendFixes(myHolder.createErrorAnnotation(context, message), fixes);
-        }
-        else {
-          appendFixes(myHolder.createWarningAnnotation(context, message), fixes);
-        }
-      }
-    }
-  }
-
-  private static void addMessagesForTag(XmlTag tag, String message, Validator.ValidationHost.ErrorType type, AnnotationHolder myHolder, IntentionAction... actions) {
-    XmlToken childByRole = XmlTagUtil.getStartTagNameElement(tag);
-
-    addMessagesForTreeChild(childByRole, type, message, myHolder, actions);
-
-    childByRole = XmlTagUtil.getEndTagNameElement(tag);
-    addMessagesForTreeChild(childByRole, type, message, myHolder, actions);
-  }
-
-  private static void addMessagesForTreeChild(final XmlToken childByRole,
-                                              final Validator.ValidationHost.ErrorType type,
-                                              final String message,
-                                              AnnotationHolder myHolder, IntentionAction... actions) {
-    if (childByRole != null) {
-      Annotation annotation;
-      if (type == Validator.ValidationHost.ErrorType.ERROR) {
-        annotation = myHolder.createErrorAnnotation(childByRole, message);
-      }
-      else {
-        annotation = myHolder.createWarningAnnotation(childByRole, message);
-      }
-
-      appendFixes(annotation, actions);
-    }
-  }
-}
diff --git a/xml/impl/src/com/intellij/lang/xml/XmlAttributeValueRenameValidator.java b/xml/impl/src/com/intellij/lang/xml/XmlAttributeValueRenameValidator.java
index b0618e7..4f8f104 100644
--- a/xml/impl/src/com/intellij/lang/xml/XmlAttributeValueRenameValidator.java
+++ b/xml/impl/src/com/intellij/lang/xml/XmlAttributeValueRenameValidator.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.
@@ -29,6 +29,7 @@
     return psiElement(XmlAttributeValue.class);
   }
 
+  @Override
   public boolean isInputValid(final String newName, final PsiElement element, final ProcessingContext context) {
     return true;
   }
diff --git a/xml/impl/src/com/intellij/lang/xml/XmlCommenter.java b/xml/impl/src/com/intellij/lang/xml/XmlCommenter.java
deleted file mode 100644
index 4701036..0000000
--- a/xml/impl/src/com/intellij/lang/xml/XmlCommenter.java
+++ /dev/null
@@ -1,44 +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.xml;
-
-import com.intellij.lang.Commenter;
-
-/**
- * @author max
- */
-public class XmlCommenter implements Commenter {
-
-  public String getLineCommentPrefix() {
-    return null;
-  }
-
-  public String getBlockCommentPrefix() {
-    return "<!--";
-  }
-
-  public String getBlockCommentSuffix() {
-    return "-->";
-  }
-
-  public String getCommentedBlockCommentPrefix() {
-    return "&lt;!&ndash;";
-  }
-
-  public String getCommentedBlockCommentSuffix() {
-    return "&ndash;&gt;";
-  }
-}
diff --git a/xml/impl/src/com/intellij/lang/xml/XmlElementRenameValidator.java b/xml/impl/src/com/intellij/lang/xml/XmlElementRenameValidator.java
index 3324366..a37be99 100644
--- a/xml/impl/src/com/intellij/lang/xml/XmlElementRenameValidator.java
+++ b/xml/impl/src/com/intellij/lang/xml/XmlElementRenameValidator.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.
@@ -16,7 +16,7 @@
 package com.intellij.lang.xml;
 
 import com.intellij.patterns.ElementPattern;
-import com.intellij.patterns.PlatformPatterns;
+import com.intellij.patterns.StandardPatterns;
 import com.intellij.patterns.XmlPatterns;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.xml.XmlAttributeDecl;
@@ -34,18 +34,19 @@
   public ElementPattern<? extends PsiElement> getPattern() {
     return or(
       XmlPatterns.xmlTag().withMetaData(
-        or(PlatformPatterns.instanceOf(XmlElementDescriptor.class),
-           PlatformPatterns.instanceOf(XmlAttributeDescriptor.class))
+        or(StandardPatterns.instanceOf(XmlElementDescriptor.class),
+           StandardPatterns.instanceOf(XmlAttributeDescriptor.class))
       ),
       psiElement(XmlElementDecl.class),
       psiElement(XmlAttributeDecl.class),
       XmlPatterns.xmlTag().withDescriptor(
-        or(PlatformPatterns.instanceOf(XmlElementDescriptor.class),
-           PlatformPatterns.instanceOf(XmlAttributeDescriptor.class))
+        or(StandardPatterns.instanceOf(XmlElementDescriptor.class),
+           StandardPatterns.instanceOf(XmlAttributeDescriptor.class))
       )
     );
   }
 
+  @Override
   public boolean isInputValid(final String newName, final PsiElement element, final ProcessingContext context) {
     return newName.trim().matches("([\\d\\w\\_\\.\\-]+:)?[\\d\\w\\_\\.\\-]+");
   }
diff --git a/xml/impl/src/com/intellij/lang/xml/XmlEnclosingTagUnwrapper.java b/xml/impl/src/com/intellij/lang/xml/XmlEnclosingTagUnwrapper.java
index 825f168..b40ca4b 100644
--- a/xml/impl/src/com/intellij/lang/xml/XmlEnclosingTagUnwrapper.java
+++ b/xml/impl/src/com/intellij/lang/xml/XmlEnclosingTagUnwrapper.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.
@@ -30,21 +30,26 @@
 import java.util.Collections;
 
 public class XmlEnclosingTagUnwrapper implements Unwrapper {
+  @Override
   public boolean isApplicableTo(PsiElement e) {
     return true;
   }
 
+  @Override
   public void collectElementsToIgnore(PsiElement element, Set<PsiElement> result) {
   }
 
+  @Override
   public String getDescription(PsiElement e) {
     return XmlBundle.message("unwrap.enclosing.tag.name.action.name", ((XmlTag)e).getName());
   }
 
+  @Override
   public PsiElement collectAffectedElements(PsiElement e, List<PsiElement> toExtract) {
     return e;
   }
 
+  @Override
   public List<PsiElement> unwrap(Editor editor, PsiElement element) throws IncorrectOperationException {
     final TextRange range = element.getTextRange();
     final ASTNode startTagNameEnd = XmlChildRole.START_TAG_END_FINDER.findChild(element.getNode());
diff --git a/xml/impl/src/com/intellij/lang/xml/XmlFindUsagesProvider.java b/xml/impl/src/com/intellij/lang/xml/XmlFindUsagesProvider.java
deleted file mode 100644
index 41b456d..0000000
--- a/xml/impl/src/com/intellij/lang/xml/XmlFindUsagesProvider.java
+++ /dev/null
@@ -1,116 +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.xml;
-
-import com.intellij.lang.LangBundle;
-import com.intellij.lang.cacheBuilder.WordsScanner;
-import com.intellij.lang.findUsages.DescriptiveNameUtil;
-import com.intellij.lang.findUsages.FindUsagesProvider;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiNamedElement;
-import com.intellij.psi.meta.PsiMetaData;
-import com.intellij.psi.xml.*;
-import com.intellij.usageView.UsageViewBundle;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author ven
- */
-public class XmlFindUsagesProvider implements FindUsagesProvider {
-
-  public boolean canFindUsagesFor(@NotNull PsiElement element) {
-    return element instanceof XmlElementDecl ||
-           element instanceof XmlAttributeDecl ||
-           element instanceof XmlEntityDecl ||
-           element instanceof XmlTag ||
-           element instanceof XmlAttributeValue ||
-           element instanceof PsiFile ||
-           element instanceof XmlComment;
-  }
-
-  @NotNull
-  public String getType(@NotNull PsiElement element) {
-    if (element instanceof XmlTag) {
-      final PsiMetaData metaData = ((XmlTag)element).getMetaData();
-      if (metaData != null && metaData.getDeclaration() instanceof XmlTag) {
-        return ((XmlTag)metaData.getDeclaration()).getName();
-      }
-      return LangBundle.message("xml.terms.xml.tag");
-    }
-    if (element instanceof XmlElementDecl) {
-      return LangBundle.message("xml.terms.tag");
-    }
-    else if (element instanceof XmlAttributeDecl) {
-      return LangBundle.message("xml.terms.attribute");
-    }
-    else if (element instanceof XmlAttributeValue) {
-      return LangBundle.message("xml.terms.attribute.value");
-    }
-    else if (element instanceof XmlEntityDecl) {
-      return LangBundle.message("xml.terms.entity");
-    }
-    else if (element instanceof XmlAttribute) {
-      return LangBundle.message("xml.terms.attribute");
-    } else if (element instanceof XmlComment) {
-      return LangBundle.message("xml.terms.variable");
-    }
-    throw new IllegalArgumentException("Cannot get type for " + element);
-  }
-
-  public String getHelpId(@NotNull PsiElement element) {
-    return com.intellij.lang.HelpID.FIND_OTHER_USAGES;
-  }
-
-  @NotNull
-  public String getDescriptiveName(@NotNull PsiElement element) {
-    if (element instanceof XmlTag) {
-      return ((XmlTag)element).getName();
-    }
-
-    if (element instanceof XmlAttributeValue) {
-      return ((XmlAttributeValue)element).getValue();
-    }
-
-    if (element instanceof PsiNamedElement) {
-      return ((PsiNamedElement)element).getName();
-    } else {
-      return element.getText();
-    }
-  }
-
-  @NotNull
-  public String getNodeText(@NotNull PsiElement element, boolean useFullName) {
-    if (element instanceof XmlTag) {
-      final XmlTag xmlTag = (XmlTag)element;
-      final PsiMetaData metaData = xmlTag.getMetaData();
-      final String name = metaData != null ? DescriptiveNameUtil.getMetaDataName(metaData) : xmlTag.getName();
-      return UsageViewBundle.message("usage.target.xml.tag.of.file", metaData == null ? "<" + name + ">" : name, xmlTag.getContainingFile().getName());
-    }
-    else if (element instanceof XmlAttributeValue) {
-      return ((XmlAttributeValue)element).getValue();
-    }
-    if (element instanceof PsiNamedElement) {
-      return ((PsiNamedElement)element).getName();
-    } else {
-      return element.getText();
-    }
-  }
-
-  public WordsScanner getWordsScanner() {
-    return null;
-  }
-}
diff --git a/xml/impl/src/com/intellij/lang/xml/XmlFoldingBuilder.java b/xml/impl/src/com/intellij/lang/xml/XmlFoldingBuilder.java
deleted file mode 100644
index 55feb0b..0000000
--- a/xml/impl/src/com/intellij/lang/xml/XmlFoldingBuilder.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.lang.xml;
-
-import com.intellij.application.options.editor.XmlFoldingSettings;
-import com.intellij.lang.ASTNode;
-import com.intellij.lang.XmlCodeFoldingBuilder;
-import com.intellij.lang.XmlCodeFoldingSettings;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.xml.*;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Maxim.Mossienko
- */
-public class XmlFoldingBuilder extends XmlCodeFoldingBuilder {
-  @Override
-  protected XmlCodeFoldingSettings getFoldingSettings() {
-    return XmlFoldingSettings.getInstance();
-  }
-}
diff --git a/xml/impl/src/com/intellij/lang/xml/XmlFormattingModel.java b/xml/impl/src/com/intellij/lang/xml/XmlFormattingModel.java
index 522a645..0bf523f 100644
--- a/xml/impl/src/com/intellij/lang/xml/XmlFormattingModel.java
+++ b/xml/impl/src/com/intellij/lang/xml/XmlFormattingModel.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.
@@ -32,7 +32,7 @@
 import com.intellij.psi.formatter.PsiBasedFormattingModel;
 import com.intellij.psi.impl.source.tree.TreeUtil;
 import com.intellij.psi.tree.IElementType;
-import com.intellij.psi.xml.XmlElementType;
+import com.intellij.psi.xml.XmlTokenType;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.Nullable;
 
@@ -49,10 +49,12 @@
     myProject = file.getProject();
   }
 
+  @Override
   public TextRange shiftIndentInsideRange(TextRange textRange, int shift) {
     return shiftIndentInsideWithPsi(textRange, shift);
   }
 
+  @Override
   public void commitChanges() {
   }
 
@@ -68,6 +70,7 @@
     return textRange;
   }
 
+  @Override
   protected String replaceWithPsiInLeaf(final TextRange textRange, String whiteSpace, ASTNode leafElement) {
      if (!myCanModifyAllWhiteSpaces) {
        if (leafElement.getElementType() == TokenType.WHITE_SPACE) return null;
@@ -91,7 +94,7 @@
          }
 
          final @NonNls String cdataEndMarker = "]]>";
-         if(type == XmlElementType.XML_CDATA_END && whiteSpace.indexOf(cdataEndMarker) == -1) {
+         if(type == XmlTokenType.XML_CDATA_END && whiteSpace.indexOf(cdataEndMarker) == -1) {
            final ASTNode at = findElementAt(prevNode.getStartOffset());
 
            if (at != null && at.getPsi() instanceof PsiWhiteSpace) {
diff --git a/xml/impl/src/com/intellij/lang/xml/XmlFormattingModelBuilder.java b/xml/impl/src/com/intellij/lang/xml/XmlFormattingModelBuilder.java
index 8eaa97e..138a1bd 100644
--- a/xml/impl/src/com/intellij/lang/xml/XmlFormattingModelBuilder.java
+++ b/xml/impl/src/com/intellij/lang/xml/XmlFormattingModelBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -36,6 +36,7 @@
 
 public class XmlFormattingModelBuilder implements FormattingModelBuilder {
 
+  @Override
   @NotNull
   public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
     final ASTNode root = TreeUtil.getFileElement((TreeElement)SourceTreeToPsiMap.psiElementToTree(element));
@@ -47,6 +48,7 @@
     return new XmlBlock(root, null, null, new XmlPolicy(settings, documentModel), null, null, false);
   }
 
+  @Override
   public TextRange getRangeAffectingIndent(PsiFile file, int offset, ASTNode elementAtOffset) {
     return null;
   }
diff --git a/xml/impl/src/com/intellij/lang/xml/XmlSurroundDescriptor.java b/xml/impl/src/com/intellij/lang/xml/XmlSurroundDescriptor.java
index 1cce551..3d9e1a8 100644
--- a/xml/impl/src/com/intellij/lang/xml/XmlSurroundDescriptor.java
+++ b/xml/impl/src/com/intellij/lang/xml/XmlSurroundDescriptor.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.
@@ -38,6 +38,7 @@
  * @author ven
  */
 public class XmlSurroundDescriptor implements SurroundDescriptor {
+  @Override
   @NotNull public PsiElement[] getElementsToSurround(PsiFile file, int startOffset, int endOffset) {
     final Pair<XmlTagChild, XmlTagChild> childrenInRange = XmlUtil.findTagChildrenInRange(file, startOffset, endOffset);
     if (childrenInRange == null) {
@@ -60,6 +61,7 @@
     return PsiUtilCore.toPsiElementArray(result);
   }
 
+  @Override
   @NotNull public Surrounder[] getSurrounders() {
     return new Surrounder[0]; //everything is in live templates now
   }
diff --git a/xml/impl/src/com/intellij/lang/xml/XmlUnwrapDescriptor.java b/xml/impl/src/com/intellij/lang/xml/XmlUnwrapDescriptor.java
index deb5187..1462e97 100644
--- a/xml/impl/src/com/intellij/lang/xml/XmlUnwrapDescriptor.java
+++ b/xml/impl/src/com/intellij/lang/xml/XmlUnwrapDescriptor.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.
@@ -35,6 +35,7 @@
 import java.util.List;
 
 public class XmlUnwrapDescriptor implements UnwrapDescriptor {
+  @Override
   public List<Pair<PsiElement, Unwrapper>> collectUnwrappers(Project project, Editor editor, PsiFile file) {
     int offset = editor.getCaretModel().getOffset();
 
@@ -78,10 +79,12 @@
     return result;
   }
 
+  @Override
   public boolean showOptionsDialog() {
     return true;
   }
 
+  @Override
   public boolean shouldTryToRestoreCaretPosition() {
     return false;
   }
diff --git a/xml/impl/src/com/intellij/lang/xml/XmlWhiteSpaceFormattingStrategy.java b/xml/impl/src/com/intellij/lang/xml/XmlWhiteSpaceFormattingStrategy.java
index 10cab62..2f8c47a 100644
--- a/xml/impl/src/com/intellij/lang/xml/XmlWhiteSpaceFormattingStrategy.java
+++ b/xml/impl/src/com/intellij/lang/xml/XmlWhiteSpaceFormattingStrategy.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -78,6 +78,7 @@
     return false;
   }
 
+  @Override
   public boolean addWhitespace(@NotNull final ASTNode treePrev, @NotNull final LeafElement whiteSpaceElement) {
     if (isInsideTagBody(treePrev)) {
       addWhitespaceToTagBody(treePrev, whiteSpaceElement);
@@ -87,6 +88,7 @@
     return false;
   }
 
+  @Override
   public boolean containsWhitespacesOnly(@NotNull final ASTNode node) {
     return (node.getElementType() == XmlTokenType.XML_DATA_CHARACTERS) &&
            node.getText().trim().length() == 0;
diff --git a/xml/impl/src/com/intellij/lang/xml/XmlWordCompletionFilter.java b/xml/impl/src/com/intellij/lang/xml/XmlWordCompletionFilter.java
index 3fbd001..7057ed4 100644
--- a/xml/impl/src/com/intellij/lang/xml/XmlWordCompletionFilter.java
+++ b/xml/impl/src/com/intellij/lang/xml/XmlWordCompletionFilter.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.
@@ -19,8 +19,6 @@
  */
 package com.intellij.lang.xml;
 
-import com.intellij.codeInsight.completion.CompletionProcess;
-import com.intellij.codeInsight.completion.CompletionService;
 import com.intellij.lang.DefaultWordCompletionFilter;
 import com.intellij.psi.tree.IElementType;
 import com.intellij.psi.tree.TokenSet;
@@ -31,6 +29,7 @@
   private final static TokenSet ENABLED_TOKENS = TokenSet.create(XmlElementType.XML_CDATA,
                                                                  XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN,
                                                                  XmlTokenType.XML_DATA_CHARACTERS);
+  @Override
   public boolean isWordCompletionEnabledIn(final IElementType element) {
     return super.isWordCompletionEnabledIn(element) || ENABLED_TOKENS.contains(element);
   }
diff --git a/xml/impl/src/com/intellij/openapi/options/colors/pages/HTMLColorsPage.java b/xml/impl/src/com/intellij/openapi/options/colors/pages/HTMLColorsPage.java
index 417fcf3..5608faf 100644
--- a/xml/impl/src/com/intellij/openapi/options/colors/pages/HTMLColorsPage.java
+++ b/xml/impl/src/com/intellij/openapi/options/colors/pages/HTMLColorsPage.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.
@@ -44,20 +44,24 @@
   };
   private static final String FULL_PRODUCT_NAME = ApplicationNamesInfo.getInstance().getFullProductName();
 
+  @Override
   @NotNull
   public String getDisplayName() {
     return OptionsBundle.message("options.html.display.name");
   }
 
+  @Override
   public Icon getIcon() {
     return StdFileTypes.HTML.getIcon();
   }
 
+  @Override
   @NotNull
   public AttributesDescriptor[] getAttributeDescriptors() {
     return ATTRS;
   }
 
+  @Override
   @NotNull
   public ColorDescriptor[] getColorDescriptors() {
     // todo: make preview for it
@@ -73,11 +77,13 @@
     return colorDescriptors;
   }
 
+  @Override
   @NotNull
   public SyntaxHighlighter getHighlighter() {
     return new HtmlFileHighlighter();
   }
 
+  @Override
   @NotNull
   public String getDemoText() {
     return "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n" +
@@ -96,6 +102,7 @@
            "</html>";
   }
 
+  @Override
   public Map<String, TextAttributesKey> getAdditionalHighlightingTagToDescriptorMap() {
     return null;
   }
diff --git a/xml/impl/src/com/intellij/openapi/options/colors/pages/XMLColorsPage.java b/xml/impl/src/com/intellij/openapi/options/colors/pages/XMLColorsPage.java
index 93098c1..b774c8e 100644
--- a/xml/impl/src/com/intellij/openapi/options/colors/pages/XMLColorsPage.java
+++ b/xml/impl/src/com/intellij/openapi/options/colors/pages/XMLColorsPage.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.
@@ -44,30 +44,36 @@
     new AttributesDescriptor(OptionsBundle.message("options.xml.attribute.descriptor.descriptor.entity,reference"), XmlHighlighterColors.XML_ENTITY_REFERENCE),
   };
 
+  @Override
   @NotNull
   public String getDisplayName() {
     return OptionsBundle.message("options.xml.display.name");
   }
 
+  @Override
   public Icon getIcon() {
     return StdFileTypes.XML.getIcon();
   }
 
+  @Override
   @NotNull
   public AttributesDescriptor[] getAttributeDescriptors() {
     return ATTRS;
   }
 
+  @Override
   @NotNull
   public ColorDescriptor[] getColorDescriptors() {
     return ColorDescriptor.EMPTY_ARRAY;                       
   }
 
+  @Override
   @NotNull
   public SyntaxHighlighter getHighlighter() {
     return new XmlFileHighlighter();
   }
 
+  @Override
   @NotNull
   public String getDemoText() {
     return "<?xml version='1.0' encoding='ISO-8859-1'  ?>\n" +
@@ -84,6 +90,7 @@
            "</index>";
   }
 
+  @Override
   public Map<String, TextAttributesKey> getAdditionalHighlightingTagToDescriptorMap() {
     return ContainerUtil.newHashMap(Pair.create("np", XmlHighlighterColors.XML_NS_PREFIX),
                                     Pair.create("bg", XmlHighlighterColors.XML_TAG));
diff --git a/xml/impl/src/com/intellij/pom/xml/impl/XmlAspectImpl.java b/xml/impl/src/com/intellij/pom/xml/impl/XmlAspectImpl.java
deleted file mode 100644
index db75802..0000000
--- a/xml/impl/src/com/intellij/pom/xml/impl/XmlAspectImpl.java
+++ /dev/null
@@ -1,213 +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.pom.xml.impl;
-
-import com.intellij.lang.ASTNode;
-import com.intellij.pom.PomModel;
-import com.intellij.pom.PomModelAspect;
-import com.intellij.pom.event.PomModelEvent;
-import com.intellij.pom.tree.TreeAspect;
-import com.intellij.pom.tree.events.ChangeInfo;
-import com.intellij.pom.tree.events.ReplaceChangeInfo;
-import com.intellij.pom.tree.events.TreeChange;
-import com.intellij.pom.tree.events.TreeChangeEvent;
-import com.intellij.pom.tree.events.impl.ChangeInfoImpl;
-import com.intellij.pom.tree.events.impl.TreeChangeImpl;
-import com.intellij.pom.xml.XmlAspect;
-import com.intellij.pom.xml.impl.events.*;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.TokenType;
-import com.intellij.psi.XmlElementVisitor;
-import com.intellij.psi.impl.source.tree.FileElement;
-import com.intellij.psi.tree.IElementType;
-import com.intellij.psi.xml.*;
-import com.intellij.util.CharTable;
-
-import java.util.Collections;
-
-public class XmlAspectImpl implements XmlAspect {
-  private final PomModel myModel;
-  private final TreeAspect myTreeAspect;
-
-  public XmlAspectImpl(PomModel model, TreeAspect aspect) {
-    myModel = model;
-    myTreeAspect = aspect;
-    myModel.registerAspect(XmlAspect.class, this, Collections.singleton((PomModelAspect)myTreeAspect));
-  }
-
-  public void update(PomModelEvent event) {
-    if (!event.getChangedAspects().contains(myTreeAspect)) return;
-    final TreeChangeEvent changeSet = (TreeChangeEvent)event.getChangeSet(myTreeAspect);
-    if (changeSet == null) return;
-    final ASTNode rootElement = changeSet.getRootElement();
-    final PsiFile file = (PsiFile)rootElement.getPsi();
-    if (!(file instanceof XmlFile)) return;
-    final XmlAspectChangeSetImpl xmlChangeSet = event.registerChangeSetIfAbsent(this, new XmlAspectChangeSetImpl(myModel));
-    xmlChangeSet.addChangedFile((XmlFile)file);
-
-    final ASTNode[] changedElements = changeSet.getChangedElements();
-    final CharTable table = ((FileElement)changeSet.getRootElement()).getCharTable();
-    for (ASTNode changedElement : changedElements) {
-      TreeChange changesByElement = changeSet.getChangesByElement(changedElement);
-      PsiElement psiElement = null;
-      while (changedElement != null && (psiElement = changedElement.getPsi()) == null) {
-        final ASTNode parent = changedElement.getTreeParent();
-        final ChangeInfoImpl changeInfo = ChangeInfoImpl.create(ChangeInfo.CONTENTS_CHANGED, changedElement);
-        changeInfo.compactChange(changesByElement);
-        changesByElement = new TreeChangeImpl(parent);
-        changesByElement.addChange(changedElement, changeInfo);
-        changedElement = parent;
-      }
-      if (changedElement == null) continue;
-      final TreeChange finalChangedElement = changesByElement;
-      psiElement.accept(new XmlElementVisitor() {
-        TreeChange myChange = finalChangedElement;
-
-        @Override
-        public void visitElement(PsiElement element) {
-          final ASTNode child = element.getNode();
-          final ASTNode treeParent = child.getTreeParent();
-          if (treeParent == null) return;
-          final PsiElement parent = treeParent.getPsi();
-          final ChangeInfoImpl changeInfo = ChangeInfoImpl.create(ChangeInfo.CONTENTS_CHANGED, child);
-
-          changeInfo.compactChange(myChange);
-          myChange = new TreeChangeImpl(treeParent);
-
-          myChange.addChange(child, changeInfo);
-          parent.accept(this);
-        }
-
-        @Override
-        public void visitXmlAttribute(XmlAttribute attribute) {
-          final ASTNode[] affectedChildren = myChange.getAffectedChildren();
-          String oldName = null;
-          String oldValue = null;
-          for (final ASTNode treeElement : affectedChildren) {
-            final ChangeInfo changeByChild = myChange.getChangeByChild(treeElement);
-            final int changeType = changeByChild.getChangeType();
-            if (treeElement.getElementType() == XmlTokenType.XML_NAME) {
-              if (changeType == ChangeInfo.REMOVED) {
-                oldName = treeElement.getText();
-              }
-              else if (changeType == ChangeInfo.REPLACE) {
-                oldName = ((ReplaceChangeInfo)changeByChild).getReplaced().getText();
-              }
-            }
-            if (treeElement.getElementType() == XmlElementType.XML_ATTRIBUTE_VALUE) {
-              if (changeType == ChangeInfo.REMOVED) {
-                oldValue = treeElement.getText();
-              }
-              else if (changeType == ChangeInfo.REPLACE) {
-                oldValue = ((ReplaceChangeInfo)changeByChild).getReplaced().getText();
-              }
-            }
-          }
-          if (oldName != null && !oldName.equals(attribute.getName())) {
-            xmlChangeSet.add(new XmlAttributeSetImpl(attribute.getParent(), oldName, null));
-            xmlChangeSet.add(new XmlAttributeSetImpl(attribute.getParent(), attribute.getName(), attribute.getValue()));
-          }
-          else if (oldValue != null) {
-            xmlChangeSet.add(new XmlAttributeSetImpl(attribute.getParent(), attribute.getName(), attribute.getValue()));
-          }
-          else {
-            xmlChangeSet.add(new XmlElementChangedImpl(attribute));
-          }
-        }
-
-        @Override
-        public void visitXmlTag(XmlTag tag) {
-          ASTNode[] affectedChildren = shortenChange(myChange.getAffectedChildren(), changeSet);
-
-          for (final ASTNode treeElement : affectedChildren) {
-            /*final IElementType type = treeElement.getElementType();
-            if (type == ElementType.WHITE_SPACE) continue;
-            if (type == ElementType.XML_NAME) {
-              if (myChange.getChangeByChild(treeElement).getChangeType() == ChangeInfo.REPLACE) {
-                continue;
-              }
-            }*/
-
-            if (!(treeElement.getPsi() instanceof XmlTagChild)) {
-              visitElement(tag);
-              return;
-            }
-          }
-
-          for (final ASTNode treeElement : affectedChildren) {
-            final ChangeInfo changeByChild = myChange.getChangeByChild(treeElement);
-            final int changeType = changeByChild.getChangeType();
-            final IElementType type = treeElement.getElementType();
-            if (type == TokenType.WHITE_SPACE) continue;
-            /*
-            if (type == ElementType.XML_NAME) {
-              final XmlToken xmlToken = (XmlToken)((ReplaceChangeInfo)changeByChild).getReplaced();
-              xmlChangeSet.add(new XmlTagNameChangedImpl(tag, xmlToken.getText()));
-              continue;
-            }
-            */
-
-            final PsiElement element = treeElement.getPsi();
-
-            switch (changeType) {
-              case ChangeInfo.ADD:
-                xmlChangeSet.add(new XmlTagChildAddImpl(tag, (XmlTagChild)element));
-                break;
-              case ChangeInfo.REMOVED:
-                treeElement.putUserData(CharTable.CHAR_TABLE_KEY, table);
-                xmlChangeSet.add(new XmlTagChildRemovedImpl(tag, (XmlTagChild)element));
-                break;
-              case ChangeInfo.CONTENTS_CHANGED:
-                xmlChangeSet.add(new XmlTagChildChangedImpl(tag, (XmlTagChild)element));
-                break;
-              case ChangeInfo.REPLACE:
-                final PsiElement psi = ((ReplaceChangeInfo)changeByChild).getReplaced().getPsi();
-                if (psi instanceof XmlTagChild) {
-                  final XmlTagChild replaced = (XmlTagChild)psi;
-                  replaced.putUserData(CharTable.CHAR_TABLE_KEY, table);
-                  xmlChangeSet.add(new XmlTagChildRemovedImpl(tag, replaced));
-                  xmlChangeSet.add(new XmlTagChildAddImpl(tag, (XmlTagChild)element));
-                }
-                break;
-            }
-          }
-        }
-
-        @Override
-        public void visitXmlDocument(XmlDocument document) {
-          xmlChangeSet.clear();
-          xmlChangeSet.add(new XmlDocumentChangedImpl(document));
-        }
-
-        @Override
-        public void visitFile(PsiFile file) {
-          final XmlDocument document = ((XmlFile)file).getDocument();
-
-          if (document != null) {
-            xmlChangeSet.clear();
-            xmlChangeSet.add(new XmlDocumentChangedImpl(document));
-          }
-        }
-      });
-    }
-  }
-
-  private ASTNode[] shortenChange(ASTNode[] affectedChildren, TreeChangeEvent event) {
-    // TODO
-    return affectedChildren;
-  }
-}
diff --git a/xml/impl/src/com/intellij/pom/xml/impl/events/XmlElementChangedImpl.java b/xml/impl/src/com/intellij/pom/xml/impl/events/XmlElementChangedImpl.java
deleted file mode 100644
index 6c694ac..0000000
--- a/xml/impl/src/com/intellij/pom/xml/impl/events/XmlElementChangedImpl.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.
- */
-package com.intellij.pom.xml.impl.events;
-
-import com.intellij.pom.xml.events.XmlElementChanged;
-import com.intellij.psi.xml.XmlElement;
-
-public class XmlElementChangedImpl implements XmlElementChanged {
-  private final XmlElement myElement;
-
-  public XmlElementChangedImpl(XmlElement treeElement) {
-    myElement = treeElement;
-  }
-
-  public XmlElement getElement() {
-    return myElement;
-  }
-
-  public String toString() {
-    return "Xml element changed: " + myElement;
-  }
-}
diff --git a/xml/impl/src/com/intellij/pom/xml/impl/events/XmlTagChildChangedImpl.java b/xml/impl/src/com/intellij/pom/xml/impl/events/XmlTagChildChangedImpl.java
deleted file mode 100644
index 0550fcd..0000000
--- a/xml/impl/src/com/intellij/pom/xml/impl/events/XmlTagChildChangedImpl.java
+++ /dev/null
@@ -1,55 +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.pom.xml.impl.events;
-
-import com.intellij.pom.PomModel;
-import com.intellij.pom.event.PomModelEvent;
-import com.intellij.pom.xml.XmlAspect;
-import com.intellij.pom.xml.events.XmlTagChildChanged;
-import com.intellij.pom.xml.impl.XmlAspectChangeSetImpl;
-import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.psi.xml.XmlFile;
-import com.intellij.psi.xml.XmlTag;
-import com.intellij.psi.xml.XmlTagChild;
-
-public class XmlTagChildChangedImpl implements XmlTagChildChanged {
-  private final XmlTag myTag;
-  private final XmlTagChild myChild;
-  public XmlTagChildChangedImpl(XmlTag context, XmlTagChild treeElement) {
-    myTag = context;
-    myChild = treeElement;
-  }
-
-  public XmlTag getTag() {
-    return myTag;
-  }
-
-  public XmlTagChild getChild() {
-    return myChild;
-  }
-
-  public static PomModelEvent createXmlTagChildChanged(PomModel source, XmlTag context, XmlTagChild treeElement) {
-    final PomModelEvent event = new PomModelEvent(source);
-    final XmlAspectChangeSetImpl xmlAspectChangeSet = new XmlAspectChangeSetImpl(source, PsiTreeUtil.getParentOfType(context, XmlFile.class));
-    xmlAspectChangeSet.add(new XmlTagChildChangedImpl(context, treeElement));
-    event.registerChangeSet(source.getModelAspect(XmlAspect.class), xmlAspectChangeSet);
-    return event;
-  }
-  @SuppressWarnings({"HardCodedStringLiteral"})
-  public String toString() {
-    return "child changed in " + getTag().getName() + " child: " + myChild.toString();
-  }
-}
diff --git a/xml/impl/src/com/intellij/pom/xml/impl/events/XmlTagChildRemovedImpl.java b/xml/impl/src/com/intellij/pom/xml/impl/events/XmlTagChildRemovedImpl.java
deleted file mode 100644
index 63e9336..0000000
--- a/xml/impl/src/com/intellij/pom/xml/impl/events/XmlTagChildRemovedImpl.java
+++ /dev/null
@@ -1,42 +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.pom.xml.impl.events;
-
-import com.intellij.pom.xml.events.XmlTagChildRemoved;
-import com.intellij.psi.xml.XmlTag;
-import com.intellij.psi.xml.XmlTagChild;
-
-public class XmlTagChildRemovedImpl implements XmlTagChildRemoved {
-  private final XmlTag myTag;
-  private final XmlTagChild myChild;
-  public XmlTagChildRemovedImpl(XmlTag context, XmlTagChild treeElement) {
-    myTag = context;
-    myChild = treeElement;
-  }
-
-  public XmlTag getTag() {
-    return myTag;
-  }
-
-  public XmlTagChild getChild() {
-    return myChild;
-  }
-
-  @SuppressWarnings({"HardCodedStringLiteral"})
-  public String toString() {
-    return "child removed from " + getTag().getName() + " child: " + myChild.toString();
-  }
-}
diff --git a/xml/impl/src/com/intellij/psi/XmlElementFactoryImpl.java b/xml/impl/src/com/intellij/psi/XmlElementFactoryImpl.java
deleted file mode 100644
index 4f35400..0000000
--- a/xml/impl/src/com/intellij/psi/XmlElementFactoryImpl.java
+++ /dev/null
@@ -1,119 +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.psi;
-
-import com.intellij.ide.highlighter.HtmlFileType;
-import com.intellij.ide.highlighter.XHtmlFileType;
-import com.intellij.ide.highlighter.XmlFileType;
-import com.intellij.lang.ASTFactory;
-import com.intellij.lang.Language;
-import com.intellij.lang.xml.XMLLanguage;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.fileTypes.FileType;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.psi.xml.*;
-import com.intellij.util.IncorrectOperationException;
-import com.intellij.xml.util.XmlTagUtil;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Dmitry Avdeev
- */
-public class XmlElementFactoryImpl extends XmlElementFactory {
-
-  private final Project myProject;
-
-  public XmlElementFactoryImpl(Project project) {
-    myProject = project;
-  }
-
-  @Override
-  @NotNull
-  public XmlTag createTagFromText(@NotNull @NonNls CharSequence text, @NotNull Language language) throws IncorrectOperationException {
-    assert language instanceof XMLLanguage:"Tag can be created only for xml language";
-    FileType type = language.getAssociatedFileType();
-    if (type == null) type = StdFileTypes.XML;
-    final XmlDocument document = createXmlDocument(text, "dummy."+ type.getDefaultExtension(), type);
-    final XmlTag tag = document.getRootTag();
-    if (tag == null) throw new IncorrectOperationException("Incorrect tag text");
-    return tag;
-  }
-
-  @Override
-  @NotNull
-  public XmlTag createTagFromText(@NotNull CharSequence text) throws IncorrectOperationException {
-    return createTagFromText(text, StdFileTypes.XML.getLanguage());
-  }
-
-  @Override
-  @NotNull
-  public XmlAttribute createXmlAttribute(@NotNull String name, @NotNull String value) throws IncorrectOperationException {
-    final char quoteChar;
-    if (!value.contains("\"")) {
-      quoteChar = '"';
-    } else if (!value.contains("'")) {
-      quoteChar = '\'';
-    } else {
-      quoteChar = '"';
-      value = StringUtil.replace(value, "\"", "&quot;");
-    }
-    final XmlDocument document = createXmlDocument("<tag " + name + "=" + quoteChar + value + quoteChar + "/>", "dummy.xml",
-                                                   XmlFileType.INSTANCE);
-    XmlTag tag = document.getRootTag();
-    assert tag != null;
-    XmlAttribute[] attributes = tag.getAttributes();
-    LOG.assertTrue(attributes.length == 1, document.getText());
-    return attributes[0];
-  }
-
-  @Override
-  @NotNull
-  public XmlText createDisplayText(@NotNull String s) throws IncorrectOperationException {
-    final XmlTag tagFromText = createTagFromText("<a>" + XmlTagUtil.getCDATAQuote(s) + "</a>");
-    final XmlText[] textElements = tagFromText.getValue().getTextElements();
-    if (textElements.length == 0) return (XmlText)ASTFactory.composite(XmlElementType.XML_TEXT);
-    return textElements[0];
-  }
-
-  @Override
-  @NotNull
-  public XmlTag createXHTMLTagFromText(@NotNull String text) throws IncorrectOperationException {
-    final XmlDocument document = createXmlDocument(text, "dummy.xhtml", XHtmlFileType.INSTANCE);
-    final XmlTag tag = document.getRootTag();
-    assert tag != null;
-    return tag;
-  }
-
-  @Override
-  @NotNull
-  public XmlTag createHTMLTagFromText(@NotNull String text) throws IncorrectOperationException {
-    final XmlDocument document = createXmlDocument(text, "dummy.html", HtmlFileType.INSTANCE);
-    final XmlTag tag = document.getRootTag();
-    assert tag != null;
-    return tag;
-  }
-
-  private XmlDocument createXmlDocument(@NonNls final CharSequence text, @NonNls final String fileName, FileType fileType) {
-    final XmlDocument document = ((XmlFile)PsiFileFactory.getInstance(myProject).createFileFromText(fileName, fileType, text)).getDocument();
-    assert document != null;
-    return document;
-  }
-
-  private static final Logger LOG = Logger.getInstance(XmlElementFactoryImpl.class);
-}
diff --git a/xml/impl/src/com/intellij/psi/filters/TextContainFilter.java b/xml/impl/src/com/intellij/psi/filters/TextContainFilter.java
deleted file mode 100644
index 0a7ce9e..0000000
--- a/xml/impl/src/com/intellij/psi/filters/TextContainFilter.java
+++ /dev/null
@@ -1,54 +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.filters;
-
-import com.intellij.psi.PsiElement;
-
-/**
- * @author spleaner
- */
-public class TextContainFilter extends XmlTextFilter {
-  public TextContainFilter(String[] values){
-    super(values);
-  }
-
-  public TextContainFilter(String value1, String value2){
-    super(value1, value2);
-  }
-
-  public TextContainFilter(String value){
-    super(value);
-  }
-
-  public TextContainFilter(){}
-
-  public boolean isAcceptable(Object element, PsiElement context){
-    if(element != null) {
-      for (final String value : myValue) {
-        if (value == null) {
-          return true;
-        }
-        String elementValue = getTextByElement(element);
-        if (elementValue == null) return false;
-        if (elementValue.contains(value)) return true;
-      }
-    }
-
-    return false;
-  }
-
-
-}
diff --git a/xml/impl/src/com/intellij/psi/filters/TextStartFilter.java b/xml/impl/src/com/intellij/psi/filters/TextStartFilter.java
deleted file mode 100644
index f11d806..0000000
--- a/xml/impl/src/com/intellij/psi/filters/TextStartFilter.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.psi.filters;
-
-import com.intellij.psi.PsiElement;
-
-/**
- * Created by IntelliJ IDEA.
- * User: ik
- * Date: 27.08.2003
- * Time: 18:18:38
- * To change this template use Options | File Templates.
- */
-public class TextStartFilter extends XmlTextFilter{
-  public TextStartFilter(String[] values){
-    super(values);
-  }
-
-  public TextStartFilter(String value1, String value2){
-    super(value1, value2);
-  }
-
-  public TextStartFilter(String value){
-    super(value);
-  }
-
-  public TextStartFilter(){}
-
-  public boolean isAcceptable(Object element, PsiElement context){
-    if(element != null) {
-      for (final String value : myValue) {
-        if (value == null) {
-          return true;
-        }
-        String elementValue = getTextByElement(element);
-        if (elementValue == null) return false;
-        if (elementValue.startsWith(value)) return true;
-      }
-    }
-
-    return false;
-  }
-}
diff --git a/xml/impl/src/com/intellij/psi/filters/getters/HtmlAttributeValueGetter.java b/xml/impl/src/com/intellij/psi/filters/getters/HtmlAttributeValueGetter.java
index ce0e500..ac0ac57 100644
--- a/xml/impl/src/com/intellij/psi/filters/getters/HtmlAttributeValueGetter.java
+++ b/xml/impl/src/com/intellij/psi/filters/getters/HtmlAttributeValueGetter.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.
@@ -40,6 +40,7 @@
     myCaseSensitive = _caseSensitive;
   }
 
+  @Override
   @Nullable
   @NonNls
   protected String[] addSpecificCompletions(final XmlAttribute attribute) {
diff --git a/xml/impl/src/com/intellij/psi/filters/getters/XmlAttributeValueGetter.java b/xml/impl/src/com/intellij/psi/filters/getters/XmlAttributeValueGetter.java
index 929162b..dd2ce27 100644
--- a/xml/impl/src/com/intellij/psi/filters/getters/XmlAttributeValueGetter.java
+++ b/xml/impl/src/com/intellij/psi/filters/getters/XmlAttributeValueGetter.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.
@@ -37,6 +37,7 @@
 public class XmlAttributeValueGetter implements ContextGetter {
   public XmlAttributeValueGetter() {}
 
+  @Override
   public Object[] get(PsiElement context, CompletionContext completionContext) {
     return getApplicableAttributeVariants(context);
   }
diff --git a/xml/impl/src/com/intellij/psi/filters/position/RootTagFilter.java b/xml/impl/src/com/intellij/psi/filters/position/RootTagFilter.java
deleted file mode 100644
index ea39b3f..0000000
--- a/xml/impl/src/com/intellij/psi/filters/position/RootTagFilter.java
+++ /dev/null
@@ -1,47 +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.filters.position;
-
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.filters.ElementFilter;
-import com.intellij.psi.xml.XmlDocument;
-import com.intellij.psi.xml.XmlTag;
-
-/**
- * Created by IntelliJ IDEA.
- * User: ik
- * Date: 03.02.2003
- * Time: 18:29:13
- * To change this template use Options | File Templates.
- */
-public class RootTagFilter extends PositionElementFilter{
-  public RootTagFilter(ElementFilter filter){
-    setFilter(filter);
-  }
-
-  public RootTagFilter(){}
-  public boolean isAcceptable(Object element, PsiElement scope){
-    if (!(element instanceof XmlDocument)) return false;
-    final XmlTag rootTag = ((XmlDocument)element).getRootTag();
-    if(rootTag == null) return false;
-
-    return getFilter().isAcceptable(rootTag, (PsiElement)element);
-  }
-
-  public String toString(){
-    return "roottag(" + getFilter().toString() + ")";
-  }
-}
diff --git a/xml/impl/src/com/intellij/psi/formatter/xml/AbstractSyntheticBlock.java b/xml/impl/src/com/intellij/psi/formatter/xml/AbstractSyntheticBlock.java
index b95867f..39b5ae7 100644
--- a/xml/impl/src/com/intellij/psi/formatter/xml/AbstractSyntheticBlock.java
+++ b/xml/impl/src/com/intellij/psi/formatter/xml/AbstractSyntheticBlock.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -81,14 +81,17 @@
     return myEndTreeNode.getElementType() == XmlTokenType.XML_TAG_END;
   }
 
+  @Override
   public Wrap getWrap() {
     return null;
   }
 
+  @Override
   public Indent getIndent() {
     return myIndent;
   }
 
+  @Override
   public Alignment getAlignment() {
     return null;
   }
@@ -153,6 +156,7 @@
                          subBlocks.get(subBlocks.size() - 1).getTextRange().getEndOffset());
   }
 
+  @Override
   public boolean isIncomplete() {
     return getSubBlocks().get(getSubBlocks().size() - 1).isIncomplete();
   }
@@ -187,6 +191,7 @@
     return (myStartTreeNode == myEndTreeNode) && (myStartTreeNode instanceof OuterLanguageElement);
   }
 
+  @Override
   public boolean isLeaf() {
     return false;
   }
diff --git a/xml/impl/src/com/intellij/psi/formatter/xml/AbstractXmlBlock.java b/xml/impl/src/com/intellij/psi/formatter/xml/AbstractXmlBlock.java
index 1f8e2ef..6e1b899 100644
--- a/xml/impl/src/com/intellij/psi/formatter/xml/AbstractXmlBlock.java
+++ b/xml/impl/src/com/intellij/psi/formatter/xml/AbstractXmlBlock.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -43,7 +43,7 @@
 
 public abstract class AbstractXmlBlock extends AbstractBlock {
   protected XmlFormattingPolicy myXmlFormattingPolicy;
-  protected XmlInjectedLanguageBlockBuilder myInjectedBlockBuilder;
+  protected final XmlInjectedLanguageBlockBuilder myInjectedBlockBuilder;
   private final boolean myPreserveSpace;
 
   protected AbstractXmlBlock(final ASTNode node,
@@ -238,6 +238,7 @@
   private static XmlTag[] collectSubTags(final XmlElement node) {
     final List<XmlTag> result = new ArrayList<XmlTag>();
     node.processElements(new PsiElementProcessor() {
+      @Override
       public boolean execute(@NotNull final PsiElement element) {
         if (element instanceof XmlTag) {
           result.add((XmlTag)element);
@@ -292,6 +293,7 @@
     } else if (child.getElementType() == XmlElementType.XML_DOCTYPE) {
       result.add(
         new XmlBlock(child, wrap, alignment, myXmlFormattingPolicy, indent, null, isPreserveSpace()) {
+          @Override
           protected Wrap getDefaultWrap(final ASTNode node) {
             final IElementType type = node.getElementType();
             return type == XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN
@@ -406,6 +408,7 @@
     return leaf;
   }
 
+  @Override
   public boolean isLeaf() {
     return (isComment(myNode)) ||
            myNode.getElementType() == TokenType.WHITE_SPACE ||
diff --git a/xml/impl/src/com/intellij/psi/formatter/xml/AnotherLanguageBlockWrapper.java b/xml/impl/src/com/intellij/psi/formatter/xml/AnotherLanguageBlockWrapper.java
index d33a2aa..207f899 100644
--- a/xml/impl/src/com/intellij/psi/formatter/xml/AnotherLanguageBlockWrapper.java
+++ b/xml/impl/src/com/intellij/psi/formatter/xml/AnotherLanguageBlockWrapper.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.
@@ -41,36 +41,44 @@
     myIndent = indent;
   }
 
+  @Override
   public Indent getIndent() {
     return myIndent;
   }
 
+  @Override
   public boolean insertLineBreakBeforeTag() {
     return false;
   }
 
+  @Override
   public boolean removeLineBreakBeforeTag() {
     return false;
   }
 
+  @Override
   public boolean isTextElement() {
     return true;
   }
 
+  @Override
   protected List<Block> buildChildren() {
     return myInjectedBlock.getSubBlocks();
   }
 
+  @Override
   @NotNull
   public TextRange getTextRange() {
     return myInjectedBlock.getTextRange();
   }
 
+  @Override
   @Nullable
   public Spacing getSpacing(Block child1, @NotNull Block child2) {
     return myInjectedBlock.getSpacing(child1,  child2);
   }
 
+  @Override
   @NotNull
   public ChildAttributes getChildAttributes(final int newChildIndex) {
     return myInjectedBlock.getChildAttributes(newChildIndex);
diff --git a/xml/impl/src/com/intellij/psi/formatter/xml/HtmlPolicy.java b/xml/impl/src/com/intellij/psi/formatter/xml/HtmlPolicy.java
index d8a865e..57e6538 100644
--- a/xml/impl/src/com/intellij/psi/formatter/xml/HtmlPolicy.java
+++ b/xml/impl/src/com/intellij/psi/formatter/xml/HtmlPolicy.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -25,7 +25,6 @@
 import com.intellij.psi.impl.source.SourceTreeToPsiMap;
 import com.intellij.psi.impl.source.tree.LeafElement;
 import com.intellij.psi.xml.XmlAttribute;
-import com.intellij.psi.xml.XmlElementType;
 import com.intellij.psi.xml.XmlTag;
 import com.intellij.psi.xml.XmlTokenType;
 
@@ -41,6 +40,7 @@
     mySettings = settings;
   }
 
+  @Override
   public boolean indentChildrenOf(final XmlTag parentTag) {
     if (parentTag == null) {
       return true;
@@ -77,6 +77,7 @@
     return myDocumentModel.getLineNumber(textRange.getEndOffset()) - myDocumentModel.getLineNumber(textRange.getStartOffset());
   }
 
+  @Override
   public boolean insertLineBreakBeforeTag(final XmlTag xmlTag) {
     PsiElement prev = xmlTag.getPrevSibling();
     if (prev == null) return false;
@@ -116,6 +117,7 @@
     return true;
   }
 
+  @Override
   public boolean removeLineBreakBeforeTag(final XmlTag xmlTag) {
     return checkName(xmlTag, mySettings.HTML_ELEMENTS_TO_REMOVE_NEW_LINE_BEFORE);
   }
@@ -139,14 +141,17 @@
     return splits;
   }
 
+  @Override
   public boolean keepWhiteSpacesInsideTag(final XmlTag tag) {
     return checkName(tag, mySettings.HTML_KEEP_WHITESPACES_INSIDE) || "jsp:attribute".equals(tag.getName());
   }
 
+  @Override
   public WrapType getWrappingTypeForTagEnd(final XmlTag xmlTag) {
     return shouldBeWrapped(xmlTag) ? WrapType.ALWAYS : WrapType.NORMAL;
   }
 
+  @Override
   public WrapType getWrappingTypeForTagBegin(final XmlTag tag) {
     if (shouldBeWrapped(tag)) {
       return WrapType.ALWAYS;
@@ -166,8 +171,7 @@
 
   private boolean hasInlineContentOnly(final XmlTag tag) {
     final XmlTag[] tags = tag.getSubTags();
-    for (int i = 0; i < tags.length; i++) {
-      XmlTag xmlTag = tags[i];
+    for (XmlTag xmlTag : tags) {
       if (!isInlineTag(xmlTag)) return false;
       if (!hasInlineContentOnly(xmlTag)) return false;
     }
@@ -183,46 +187,57 @@
     return false;
   }
 
+  @Override
   public boolean isTextElement(XmlTag tag) {
     return isInlineTag(tag);
   }
 
+  @Override
   public int getTextWrap(final XmlTag tag) {
     return mySettings.HTML_TEXT_WRAP;
   }
 
+  @Override
   public int getAttributesWrap() {
     return mySettings.HTML_ATTRIBUTE_WRAP;
   }
 
+  @Override
   public boolean getShouldAlignAttributes() {
     return mySettings.HTML_ALIGN_ATTRIBUTES;
   }
 
+  @Override
   public boolean getShouldAlignText() {
     return mySettings.HTML_ALIGN_TEXT;
   }
 
+  @Override
   public boolean getShouldKeepWhiteSpaces() {
     return mySettings.HTML_KEEP_WHITESPACES;
   }
 
+  @Override
   public boolean getShouldAddSpaceAroundEqualityInAttribute() {
     return mySettings.HTML_SPACE_AROUND_EQUALITY_IN_ATTRINUTE;
   }
 
+  @Override
   public boolean getShouldAddSpaceAroundTagName() {
     return mySettings.HTML_SPACE_AFTER_TAG_NAME;
   }
 
+  @Override
   public int getKeepBlankLines() {
     return mySettings.HTML_KEEP_BLANK_LINES;
   }
 
+  @Override
   public boolean getShouldKeepLineBreaks() {
     return mySettings.HTML_KEEP_LINE_BREAKS;
   }
 
+  @Override
   public boolean getShouldKeepLineBreaksInText() {
     return mySettings.HTML_KEEP_LINE_BREAKS_IN_TEXT;
   }
@@ -237,14 +252,17 @@
     return XmlCodeStyleSettings.WS_AROUND_CDATA_PRESERVE;
   }
 
+  @Override
   public CodeStyleSettings getSettings() {
     return mySettings;
   }
 
+  @Override
   public boolean addSpaceIntoEmptyTag() {
     return mySettings.HTML_SPACE_INSIDE_EMPTY_TAG;
   }
 
+  @Override
   public boolean shouldSaveSpacesBetweenTagAndText() {
     return true;
   }
diff --git a/xml/impl/src/com/intellij/psi/formatter/xml/ReadOnlyBlock.java b/xml/impl/src/com/intellij/psi/formatter/xml/ReadOnlyBlock.java
index 7898f77..3f67ad0 100644
--- a/xml/impl/src/com/intellij/psi/formatter/xml/ReadOnlyBlock.java
+++ b/xml/impl/src/com/intellij/psi/formatter/xml/ReadOnlyBlock.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.
@@ -31,14 +31,17 @@
     super(node, null, null);
   }
 
+  @Override
   public Spacing getSpacing(Block child1, @NotNull Block child2) {
     return null;
   }
 
+  @Override
   public boolean isLeaf() {
     return true;
   }
 
+  @Override
   protected List<Block> buildChildren() {
     return EMPTY;
   }
diff --git a/xml/impl/src/com/intellij/psi/formatter/xml/SyntheticBlock.java b/xml/impl/src/com/intellij/psi/formatter/xml/SyntheticBlock.java
index 3a5ba30..159edca 100644
--- a/xml/impl/src/com/intellij/psi/formatter/xml/SyntheticBlock.java
+++ b/xml/impl/src/com/intellij/psi/formatter/xml/SyntheticBlock.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -39,16 +39,19 @@
     myChildIndent = childIndent;
   }
 
+  @Override
   @NotNull
   public TextRange getTextRange() {
     return calculateTextRange(mySubBlocks);
   }
 
+  @Override
   @NotNull
   public List<Block> getSubBlocks() {
     return mySubBlocks;
   }
 
+  @Override
   public Spacing getSpacing(Block child1, @NotNull Block child2) {
     if (child1 instanceof ReadOnlyBlock || child2 instanceof ReadOnlyBlock) {
       return Spacing.getReadOnlySpacing();
@@ -213,6 +216,7 @@
       ;
   }
 
+  @Override
   @NotNull
   public ChildAttributes getChildAttributes(final int newChildIndex) {
     if (isOuterLanguageBlock()) return ChildAttributes.DELEGATE_TO_NEXT_CHILD;
@@ -234,6 +238,7 @@
     return false;
   }
 
+  @Override
   public boolean isIncomplete() {
     return getSubBlocks().get(getSubBlocks().size() - 1).isIncomplete();
   }
diff --git a/xml/impl/src/com/intellij/psi/formatter/xml/XmlBlock.java b/xml/impl/src/com/intellij/psi/formatter/xml/XmlBlock.java
index b7f6c81..ff2b017 100644
--- a/xml/impl/src/com/intellij/psi/formatter/xml/XmlBlock.java
+++ b/xml/impl/src/com/intellij/psi/formatter/xml/XmlBlock.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -65,6 +65,7 @@
     myTextRange = textRange;
   }
 
+  @Override
   @NotNull
   public TextRange getTextRange() {
     if (myTextRange != null && !(isCDATAStart() || isCDATAEnd())) {
@@ -75,6 +76,7 @@
     }
   }
 
+  @Override
   protected List<Block> buildChildren() {
 
     //
@@ -237,6 +239,7 @@
     }
   }
 
+  @Override
   public Spacing getSpacing(Block child1, @NotNull Block child2) {
     if (!(child1 instanceof AbstractBlock) || !(child2 instanceof AbstractBlock)) {
       return null;
@@ -293,6 +296,7 @@
     }
   }
 
+  @Override
   public Indent getIndent() {
     if (myNode.getElementType() == XmlElementType.XML_PROLOG || myNode.getElementType() == XmlElementType.XML_DOCTYPE ||
         SourceTreeToPsiMap.treeElementToPsi(myNode) instanceof XmlDocument) {
@@ -301,14 +305,17 @@
     return myIndent;
   }
 
+  @Override
   public boolean insertLineBreakBeforeTag() {
     return false;
   }
 
+  @Override
   public boolean removeLineBreakBeforeTag() {
     return false;
   }
 
+  @Override
   public boolean isTextElement() {
     return myNode.getElementType() == XmlElementType.XML_TEXT || myNode.getElementType() == XmlTokenType.XML_DATA_CHARACTERS ||
            myNode.getElementType() == XmlTokenType.XML_CHAR_ENTITY_REF;
diff --git a/xml/impl/src/com/intellij/psi/formatter/xml/XmlPolicy.java b/xml/impl/src/com/intellij/psi/formatter/xml/XmlPolicy.java
index 22616ac..91cde78 100644
--- a/xml/impl/src/com/intellij/psi/formatter/xml/XmlPolicy.java
+++ b/xml/impl/src/com/intellij/psi/formatter/xml/XmlPolicy.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.
@@ -35,10 +35,12 @@
     myXmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
   }
 
+  @Override
   public boolean indentChildrenOf(final XmlTag parentTag) {
     return !(parentTag.getFirstChild() instanceof PsiErrorElement);
   }
 
+  @Override
   public boolean insertLineBreakBeforeTag(final XmlTag xmlTag) {
     return false;
   }
@@ -58,64 +60,79 @@
     return false;
   }
 
+  @Override
   public boolean removeLineBreakBeforeTag(final XmlTag xmlTag) {
     return false;
   }
 
+  @Override
   public WrapType getWrappingTypeForTagEnd(final XmlTag xmlTag) {
     return xmlTag.getSubTags().length > 0 ? WrapType.ALWAYS
            : WrapType.NORMAL;
   }
 
+  @Override
   public WrapType getWrappingTypeForTagBegin(final XmlTag tag) {
     final PsiElement element = tag.getNextSibling();
     if (element instanceof XmlText && !(element.getFirstChild() instanceof PsiWhiteSpace) && tag.getSubTags().length == 0) return WrapType.NORMAL;
     return WrapType.ALWAYS;
   }
 
+  @Override
   public boolean isTextElement(XmlTag tag) {
     return false;
   }
 
+  @Override
   public boolean keepWhiteSpacesInsideTag(final XmlTag tag) {
     return false;
   }
 
+  @Override
   public int getTextWrap(final XmlTag tag) {
     return myXmlSettings.XML_TEXT_WRAP;
   }
 
+  @Override
   public int getAttributesWrap() {
     return myXmlSettings.XML_ATTRIBUTE_WRAP;
   }
 
+  @Override
   public boolean getShouldAlignAttributes() {
     return myXmlSettings.XML_ALIGN_ATTRIBUTES;
   }
+  @Override
   public boolean getShouldAlignText() {
     return myXmlSettings.XML_ALIGN_TEXT;
   }
 
+  @Override
   public boolean getShouldKeepWhiteSpaces() {
     return myXmlSettings.XML_KEEP_WHITESPACES;
   }
 
+  @Override
   public boolean getShouldAddSpaceAroundEqualityInAttribute() {
     return myXmlSettings.XML_SPACE_AROUND_EQUALITY_IN_ATTRIBUTE;
   }
 
+  @Override
   public boolean getShouldAddSpaceAroundTagName() {
     return myXmlSettings.XML_SPACE_AFTER_TAG_NAME;
   }
 
+  @Override
   public int getKeepBlankLines() {
     return myXmlSettings.XML_KEEP_BLANK_LINES;
   }
 
+  @Override
   public boolean getShouldKeepLineBreaks() {
     return myXmlSettings.XML_KEEP_LINE_BREAKS;
   }
 
+  @Override
   public boolean getShouldKeepLineBreaksInText() {
     return myXmlSettings.XML_KEEP_LINE_BREAKS_IN_TEXT;
   }
@@ -130,14 +147,17 @@
     return myXmlSettings.XML_WHITE_SPACE_AROUND_CDATA;
   }
 
+  @Override
   public CodeStyleSettings getSettings() {
     return mySettings;
   }
 
+  @Override
   public boolean addSpaceIntoEmptyTag() {
     return myXmlSettings.XML_SPACE_INSIDE_EMPTY_TAG;
   }
 
+  @Override
   public boolean shouldSaveSpacesBetweenTagAndText() {
     return false;
   }
diff --git a/xml/impl/src/com/intellij/psi/formatter/xml/XmlTagBlock.java b/xml/impl/src/com/intellij/psi/formatter/xml/XmlTagBlock.java
index 5fcb7fb..3884692 100644
--- a/xml/impl/src/com/intellij/psi/formatter/xml/XmlTagBlock.java
+++ b/xml/impl/src/com/intellij/psi/formatter/xml/XmlTagBlock.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -50,6 +50,7 @@
     myIndent = indent;
   }
 
+  @Override
   protected List<Block> buildChildren() {
     ASTNode child = myNode.getFirstChildNode();
     final Wrap attrWrap = Wrap.createWrap(getWrapType(myXmlFormattingPolicy.getAttributesWrap()), false);
@@ -135,6 +136,7 @@
     return false;
   }
 
+  @Override
   @Nullable
   protected
   ASTNode processChild(List<Block> result, final ASTNode child, final Wrap wrap, final Alignment alignment, final Indent indent) {
@@ -161,6 +163,7 @@
            : Indent.getNoneIndent();
   }
 
+  @Override
   public Indent getIndent() {
     return myIndent;
   }
@@ -175,7 +178,7 @@
                                       final Alignment alignment
   ) {
     while (child != null) {
-      if (!XmlBlock.containsWhiteSpacesOnly(child) && child.getTextLength() > 0){
+      if (!AbstractXmlBlock.containsWhiteSpacesOnly(child) && child.getTextLength() > 0){
         final Indent indent = getChildrenIndent();
         child = processChild(list,child,  wrap, alignment, indent);
         if (child == null) return child;
@@ -204,6 +207,7 @@
     return createSyntheticBlock(localResult, null);
   }
 
+  @Override
   public Spacing getSpacing(Block child1, @NotNull Block child2) {
     if (isPreserveSpace()) return Spacing.getReadOnlySpacing();
     if(child1 instanceof AbstractSyntheticBlock && child2 instanceof AbstractSyntheticBlock) {
@@ -292,14 +296,17 @@
     }
   }
 
+  @Override
   public boolean insertLineBreakBeforeTag() {
     return myXmlFormattingPolicy.insertLineBreakBeforeTag(getTag());
   }
 
+  @Override
   public boolean removeLineBreakBeforeTag() {
     return myXmlFormattingPolicy.removeLineBreakBeforeTag(getTag());
   }
 
+  @Override
   public boolean isTextElement() {
     return myXmlFormattingPolicy.isTextElement(getTag());
   }
diff --git a/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/HtmlIdIndexer.java b/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/HtmlIdIndexer.java
index 2fe8b09..3686118 100644
--- a/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/HtmlIdIndexer.java
+++ b/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/HtmlIdIndexer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -22,6 +22,7 @@
 import com.intellij.psi.impl.cache.impl.id.LexerBasedIdIndexer;
 
 public class HtmlIdIndexer extends LexerBasedIdIndexer {
+  @Override
   public Lexer createLexer(final OccurrenceConsumer consumer) {
     return createIndexingLexer(consumer);
   }
diff --git a/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlFilterLexer.java b/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlFilterLexer.java
deleted file mode 100644
index 0fe0ed5..0000000
--- a/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlFilterLexer.java
+++ /dev/null
@@ -1,64 +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.psi.impl.cache.impl.idCache;
-
-import com.intellij.lang.Language;
-import com.intellij.lang.xml.XMLLanguage;
-import com.intellij.lexer.Lexer;
-import com.intellij.psi.impl.cache.impl.BaseFilterLexer;
-import com.intellij.psi.impl.cache.CacheUtil;
-import com.intellij.psi.impl.cache.impl.OccurrenceConsumer;
-import com.intellij.psi.search.UsageSearchContext;
-import com.intellij.psi.tree.IElementType;
-import com.intellij.psi.xml.XmlElementType;
-import com.intellij.psi.xml.XmlTokenType;
-
-public class XHtmlFilterLexer extends BaseFilterLexer {
-
-  public XHtmlFilterLexer(Lexer originalLexer, OccurrenceConsumer table) {
-    super(originalLexer, table);
-  }
-
-  public void advance() {
-    final IElementType tokenType = myDelegate.getTokenType();
-
-    if (tokenType == XmlTokenType.XML_COMMENT_CHARACTERS) {
-      scanWordsInToken(UsageSearchContext.IN_COMMENTS, false, false);
-      advanceTodoItemCountsInToken();
-    } else if (tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN ||
-        tokenType == XmlTokenType.XML_NAME ||
-        tokenType == XmlTokenType.XML_TAG_NAME
-       ) {
-      scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT | UsageSearchContext.IN_FOREIGN_LANGUAGES, tokenType ==
-                                                                                                   XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN,
-                       false);
-    } else if (tokenType.getLanguage() != XMLLanguage.INSTANCE &&
-      tokenType.getLanguage() != Language.ANY         
-    ) {
-      boolean inComments = CacheUtil.isInComments(tokenType);
-      scanWordsInToken((inComments)?UsageSearchContext.IN_COMMENTS:UsageSearchContext.IN_PLAIN_TEXT | UsageSearchContext.IN_FOREIGN_LANGUAGES, true,
-                       false);
-      
-      if (inComments) advanceTodoItemCountsInToken();
-    }
-    else if (!XmlFilterLexer.ourNoWordsTokenSet.contains(tokenType)) {
-      scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT, false, false);
-    }
-
-    myDelegate.advance();
-  }
-
-}
diff --git a/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlIdIndexer.java b/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlIdIndexer.java
deleted file mode 100644
index 4ae3e83..0000000
--- a/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlIdIndexer.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.psi.impl.cache.impl.idCache;
-
-import com.intellij.lexer.Lexer;
-import com.intellij.lexer.XHtmlHighlightingLexer;
-import com.intellij.psi.impl.cache.impl.OccurrenceConsumer;
-import com.intellij.psi.impl.cache.impl.id.LexerBasedIdIndexer;
-
-public class XHtmlIdIndexer extends LexerBasedIdIndexer {
-  public Lexer createLexer(final OccurrenceConsumer consumer) {
-    return createIndexingLexer(consumer);
-  }
-
-  static XHtmlFilterLexer createIndexingLexer(OccurrenceConsumer consumer) {
-    return new XHtmlFilterLexer(new XHtmlHighlightingLexer(), consumer);
-  }
-}
diff --git a/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlTodoIndexer.java b/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlTodoIndexer.java
deleted file mode 100644
index bd3458f..0000000
--- a/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlTodoIndexer.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.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;
-
-public class XHtmlTodoIndexer extends LexerBasedTodoIndexer {
-  @Override
-  public Lexer createLexer(OccurrenceConsumer consumer) {
-    return XHtmlIdIndexer.createIndexingLexer(consumer);
-  }
-}
diff --git a/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlTodoIndexer.java b/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlTodoIndexer.java
deleted file mode 100644
index 4847f3d..0000000
--- a/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlTodoIndexer.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.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;
-
-public class XmlTodoIndexer extends LexerBasedTodoIndexer {
-  @Override
-  public Lexer createLexer(OccurrenceConsumer consumer) {
-    return XmlIdIndexer.createIndexingLexer(consumer);
-  }
-}
diff --git a/xml/impl/src/com/intellij/psi/impl/source/html/TemplateHtmlScriptContentProvider.java b/xml/impl/src/com/intellij/psi/impl/source/html/TemplateHtmlScriptContentProvider.java
deleted file mode 100644
index 8f4e492..0000000
--- a/xml/impl/src/com/intellij/psi/impl/source/html/TemplateHtmlScriptContentProvider.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.intellij.psi.impl.source.html;
-
-import com.intellij.ide.highlighter.HtmlFileType;
-import com.intellij.lang.HtmlScriptContentProvider;
-import com.intellij.lexer.HtmlHighlightingLexer;
-import com.intellij.lexer.Lexer;
-import com.intellij.psi.tree.IElementType;
-import com.intellij.psi.xml.XmlElementType;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author Dennis.Ushakov
- */
-public class TemplateHtmlScriptContentProvider implements HtmlScriptContentProvider {
-  @Override
-  public IElementType getScriptElementType() {
-    return XmlElementType.HTML_EMBEDDED_CONTENT;
-  }
-
-  @Nullable
-  @Override
-  public Lexer getHighlightingLexer() {
-    return new HtmlHighlightingLexer(HtmlFileType.INSTANCE);
-  }
-}
diff --git a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/CreateXmlElementIntentionAction.java b/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/CreateXmlElementIntentionAction.java
index 6e93313..3193375 100644
--- a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/CreateXmlElementIntentionAction.java
+++ b/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/CreateXmlElementIntentionAction.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -52,16 +52,19 @@
     myDeclarationTagName = declarationTagName;
   }
 
+  @Override
   @NotNull
   public String getText() {
     return XmlBundle.message(myMessageKey, XmlUtil.findLocalNameByQualifiedName(myRef.getCanonicalText()));
   }
 
+  @Override
   @NotNull
   public String getFamilyName() {
     return XmlBundle.message("xml.create.xml.declaration.intention.type");
   }
 
+  @Override
   public boolean isAvailable(@NotNull final Project project, final Editor editor, final PsiFile file) {
     if (!myIsAvailableEvaluated) {
       final XmlTag tag = PsiTreeUtil.getParentOfType(myRef.getElement(), XmlTag.class);
@@ -80,6 +83,7 @@
     return myTargetFile != null;
   }
 
+  @Override
   public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
     if (!FileModificationService.getInstance().prepareFileForWrite(file)) return;
 
@@ -113,6 +117,7 @@
     template.setToReformat(true);
   }
 
+  @Override
   public boolean startInWriteAction() {
     return true;
   }
diff --git a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/DependentNSReference.java b/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/DependentNSReference.java
deleted file mode 100644
index feeb5bc..0000000
--- a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/DependentNSReference.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.intellij.psi.impl.source.resolve.reference.impl.providers;
-
-import com.intellij.javaee.ExternalResourceManager;
-import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.util.ArrayUtil;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-public class DependentNSReference extends BasicAttributeValueReference {
-  private final URLReference myReference;
-  private final boolean myForceFetchResultValid;
-
-  public DependentNSReference(final PsiElement element, TextRange range, URLReference ref) {
-    this(element, range, ref, false);
-  }
-
-  public DependentNSReference(final PsiElement element,
-                              TextRange range,
-                              URLReference ref,
-                              boolean valid) {
-    super(element, range);
-    myReference = ref;
-    myForceFetchResultValid = valid;
-  }
-
-  @Nullable
-  public PsiElement resolve() {
-    final String canonicalText = getCanonicalText();
-    final PsiFile file = ExternalResourceManager.getInstance().getResourceLocation(canonicalText, myElement.getContainingFile(), null);
-    if (file != null) return file;
-    return myReference.resolve();
-  }
-
-  @NotNull
-  public Object[] getVariants() {
-    return ArrayUtil.EMPTY_OBJECT_ARRAY;
-  }
-
-  public boolean isSoft() {
-    return false;
-  }
-
-  public boolean isForceFetchResultValid() {
-    return myForceFetchResultValid;
-  }
-}
diff --git a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/URIReferenceProvider.java b/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/URIReferenceProvider.java
deleted file mode 100644
index a86d759..0000000
--- a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/URIReferenceProvider.java
+++ /dev/null
@@ -1,110 +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.source.resolve.reference.impl.providers;
-
-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.psi.PsiReferenceProvider;
-import com.intellij.psi.filters.ElementFilter;
-import com.intellij.psi.xml.XmlAttribute;
-import com.intellij.util.ProcessingContext;
-import com.intellij.util.containers.ContainerUtil;
-import com.intellij.xml.util.XmlUtil;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-/**
- * @by Maxim.Mossienko
- */
-public class URIReferenceProvider extends PsiReferenceProvider {
-
-  public static final ElementFilter ELEMENT_FILTER = new ElementFilter() {
-    public boolean isAcceptable(Object element, PsiElement context) {
-      final PsiElement parent = context.getParent();
-      if (parent instanceof XmlAttribute) {
-        final XmlAttribute attribute = ((XmlAttribute)parent);
-        return attribute.isNamespaceDeclaration();
-      }
-      return false;
-    }
-
-    public boolean isClassAcceptable(Class hintClass) {
-      return true;
-    }
-  };
-  @NonNls
-  private static final String NAMESPACE_ATTR_NAME = "namespace";
-
-  @NotNull
-  public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull final ProcessingContext context) {
-    final String text = element.getText();
-    String s = StringUtil.stripQuotesAroundValue(text);
-    final PsiElement parent = element.getParent();
-
-    if (parent instanceof XmlAttribute &&
-        XmlUtil.SCHEMA_LOCATION_ATT.equals(((XmlAttribute)parent).getLocalName()) &&
-        XmlUtil.XML_SCHEMA_INSTANCE_URI.equals(((XmlAttribute)parent).getNamespace())) {
-      final List<PsiReference> refs = new ArrayList<PsiReference>(2);
-      final StringTokenizer tokenizer = new StringTokenizer(s);
-
-      while(tokenizer.hasMoreElements()) {
-        final String namespace = tokenizer.nextToken();
-        int offset = text.indexOf(namespace);
-        final URLReference urlReference = new URLReference(element, new TextRange(offset, offset + namespace.length()), true);
-        refs.add(urlReference);
-        if (!tokenizer.hasMoreElements()) break;
-        String url = tokenizer.nextToken();
-
-        offset = text.indexOf(url);
-        if (XmlUtil.isUrlText(url, element.getProject())) refs.add(new DependentNSReference(element, new TextRange(offset,offset + url.length()), urlReference));
-        else {
-          ContainerUtil.addAll(refs, new FileReferenceSet(url, element, offset, this, false).getAllReferences());
-        }
-      }
-
-      return refs.toArray(new PsiReference[refs.size()]);
-    }
-
-
-    if (XmlUtil.isUrlText(s, element.getProject()) ||
-        (parent instanceof XmlAttribute &&
-          ( ((XmlAttribute)parent).isNamespaceDeclaration() ||
-            NAMESPACE_ATTR_NAME.equals(((XmlAttribute)parent).getName())
-          )
-         )
-      ) {
-      if (!s.startsWith(XmlUtil.TAG_DIR_NS_PREFIX)) {
-        boolean namespaceSoftRef = parent instanceof XmlAttribute &&
-          NAMESPACE_ATTR_NAME.equals(((XmlAttribute)parent).getName()) &&
-          ((XmlAttribute)parent).getParent().getAttributeValue("schemaLocation") != null;
-        if (!namespaceSoftRef && parent instanceof XmlAttribute && ((XmlAttribute)parent).isNamespaceDeclaration()) {
-          namespaceSoftRef = parent.getContainingFile().getContext() != null;
-        }
-        return new URLReference[] { new URLReference(element, null, namespaceSoftRef)};
-      }
-    }
-
-    s = s.substring(XmlUtil.getPrefixLength(s));
-    return new FileReferenceSet(s,element,text.indexOf(s), this,true).getAllReferences();
-  }
-
-}
diff --git a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/XmlValueReference.java b/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/XmlValueReference.java
deleted file mode 100644
index 9bccd25..0000000
--- a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/XmlValueReference.java
+++ /dev/null
@@ -1,65 +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.source.resolve.reference.impl.providers;
-
-import com.intellij.psi.PsiReference;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.ElementManipulators;
-import com.intellij.psi.ElementManipulator;
-import com.intellij.psi.xml.XmlTag;
-import com.intellij.openapi.util.TextRange;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Dmitry Avdeev
-*/
-public abstract class XmlValueReference implements PsiReference {
-  protected XmlTag myTag;
-  protected TextRange myRange;
-
-  protected XmlValueReference(XmlTag tag) {
-    myTag = tag;
-    myRange = ElementManipulators.getValueTextRange(tag);
-  }
-
-  public PsiElement getElement() {
-    return myTag;
-  }
-
-  public TextRange getRangeInElement() {
-    return myRange;
-  }
-
-  @NotNull
-  public String getCanonicalText() {
-    return myRange.substring(myTag.getText());
-  }
-
-  protected void replaceContent(final String str) throws IncorrectOperationException {
-    final ElementManipulator<XmlTag> manipulator = ElementManipulators.getManipulator(myTag);
-    manipulator.handleContentChange(myTag, myRange, str);
-    myRange = manipulator.getRangeInElement(myTag);
-  }
-
-  public boolean isReferenceTo(PsiElement element) {
-    return myTag.getManager().areElementsEquivalent(element, resolve());
-  }
-
-  public boolean isSoft() {
-    return false;
-  }
-}
diff --git a/xml/impl/src/com/intellij/psi/impl/source/xml/behavior/EncodeEachSymbolPolicy.java b/xml/impl/src/com/intellij/psi/impl/source/xml/behavior/EncodeEachSymbolPolicy.java
deleted file mode 100644
index 64e9b28..0000000
--- a/xml/impl/src/com/intellij/psi/impl/source/xml/behavior/EncodeEachSymbolPolicy.java
+++ /dev/null
@@ -1,89 +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.psi.impl.source.xml.behavior;
-
-import com.intellij.lang.ASTFactory;
-import com.intellij.lang.ASTNode;
-import com.intellij.psi.impl.GeneratedMarkerVisitor;
-import com.intellij.psi.impl.source.DummyHolderFactory;
-import com.intellij.psi.impl.source.tree.FileElement;
-import com.intellij.psi.impl.source.tree.TreeElement;
-import com.intellij.psi.impl.source.tree.SharedImplUtil;
-import com.intellij.psi.xml.XmlTokenType;
-import com.intellij.psi.PsiElement;
-import com.intellij.util.CharTable;
-
-public class EncodeEachSymbolPolicy extends DefaultXmlPsiPolicy{
-  public ASTNode encodeXmlTextContents(String displayText, PsiElement text) {
-    if(!toCode(displayText)) return super.encodeXmlTextContents(displayText, text);
-    final FileElement dummyParent = DummyHolderFactory.createHolder(text.getManager(), null, SharedImplUtil.findCharTableByTree(text.getNode())).getTreeElement();
-    int sectionStartOffset = 0;
-    int offset = 0;
-    while (offset < displayText.length()) {
-      if (toCode(displayText.charAt(offset))) {
-        final String plainSection = displayText.substring(sectionStartOffset, offset);
-        if (!plainSection.isEmpty()) {
-          dummyParent.rawAddChildren((TreeElement)super.encodeXmlTextContents(plainSection, text));
-        }
-        dummyParent.rawAddChildren(createCharEntity(displayText.charAt(offset), dummyParent.getCharTable()));
-        sectionStartOffset = offset + 1;
-      }
-      offset++;
-    }
-    final String plainSection = displayText.substring(sectionStartOffset, offset);
-    if (!plainSection.isEmpty()) {
-      dummyParent.rawAddChildren((TreeElement)super.encodeXmlTextContents(plainSection, text));
-    }
-
-    dummyParent.acceptTree(new GeneratedMarkerVisitor());
-    return dummyParent.getFirstChildNode();
-  }
-
-  @SuppressWarnings({"HardCodedStringLiteral"})
-  private static TreeElement createCharEntity(char ch, CharTable charTable) {
-    switch (ch) {
-      case '<':
-        return ASTFactory.leaf(XmlTokenType.XML_CHAR_ENTITY_REF, "&lt;");
-      case '\'':
-        return ASTFactory.leaf(XmlTokenType.XML_CHAR_ENTITY_REF, "&apos;");
-      case '"':
-        return ASTFactory.leaf(XmlTokenType.XML_CHAR_ENTITY_REF, "&quot;");
-      case '>':
-        return ASTFactory.leaf(XmlTokenType.XML_CHAR_ENTITY_REF, "&gt;");
-      case '&':
-        return ASTFactory.leaf(XmlTokenType.XML_CHAR_ENTITY_REF, "&amp;");
-      case '\u00a0':
-        return ASTFactory.leaf(XmlTokenType.XML_CHAR_ENTITY_REF, "&nbsp;");
-
-      default:
-        final String charEncoding = "&#" + (int)ch + ";";
-        return ASTFactory.leaf(XmlTokenType.XML_CHAR_ENTITY_REF, charTable.intern(charEncoding));
-    }
-  }
-
-  private static boolean toCode(String str) {
-    for (int i = 0; i < str.length(); i++) {
-      final char ch = str.charAt(i);
-      if ( toCode(ch)) return true;
-    }
-    return false;
-  }
-
-  private static boolean toCode(final char ch) {
-    return "<&>\u00a0'\"".indexOf(ch) >= 0;
-  }
-
-}
diff --git a/xml/impl/src/com/intellij/refactoring/rename/RenameXmlAttributeProcessor.java b/xml/impl/src/com/intellij/refactoring/rename/RenameXmlAttributeProcessor.java
index 1f7885b..3876031 100644
--- a/xml/impl/src/com/intellij/refactoring/rename/RenameXmlAttributeProcessor.java
+++ b/xml/impl/src/com/intellij/refactoring/rename/RenameXmlAttributeProcessor.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.
@@ -35,10 +35,12 @@
 public class RenameXmlAttributeProcessor extends RenamePsiElementProcessor {
   private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.rename.RenameXmlAttributeProcessor");
 
+  @Override
   public boolean canProcessElement(@NotNull final PsiElement element) {
     return element instanceof XmlAttribute || element instanceof XmlAttributeValue;
   }
 
+  @Override
   public void renameElement(final PsiElement element,
                             final String newName,
                             final UsageInfo[] usages,
diff --git a/xml/impl/src/com/intellij/refactoring/util/XmlNonCodeSearchElementDescriptionProvider.java b/xml/impl/src/com/intellij/refactoring/util/XmlNonCodeSearchElementDescriptionProvider.java
index dac3df8..5b631b5 100644
--- a/xml/impl/src/com/intellij/refactoring/util/XmlNonCodeSearchElementDescriptionProvider.java
+++ b/xml/impl/src/com/intellij/refactoring/util/XmlNonCodeSearchElementDescriptionProvider.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.
@@ -21,13 +21,13 @@
 import com.intellij.psi.xml.XmlAttribute;
 import com.intellij.psi.xml.XmlAttributeValue;
 import com.intellij.psi.xml.XmlTag;
-import org.jetbrains.annotations.Nullable;
 import org.jetbrains.annotations.NotNull;
 
 /**
  * @author yole
  */
 public class XmlNonCodeSearchElementDescriptionProvider implements ElementDescriptionProvider {
+  @Override
   public String getElementDescription(@NotNull final PsiElement element, @NotNull final ElementDescriptionLocation location) {
     if (!(location instanceof NonCodeSearchDescriptionLocation)) return null;
     final NonCodeSearchDescriptionLocation ncdLocation = (NonCodeSearchDescriptionLocation)location;
diff --git a/xml/impl/src/com/intellij/vcsUtil/XmlVcsSelectionProvider.java b/xml/impl/src/com/intellij/vcsUtil/XmlVcsSelectionProvider.java
index 50b9279..b1094ba 100644
--- a/xml/impl/src/com/intellij/vcsUtil/XmlVcsSelectionProvider.java
+++ b/xml/impl/src/com/intellij/vcsUtil/XmlVcsSelectionProvider.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.
@@ -31,6 +31,7 @@
  * @author yole
  */
 public class XmlVcsSelectionProvider implements VcsSelectionProvider {
+  @Override
   public VcsSelection getSelection(VcsContext context) {
     final Editor editor = context.getEditor();
       if (editor == null) return null;
diff --git a/xml/impl/src/com/intellij/xml/DefaultXmlNamespaceHelper.java b/xml/impl/src/com/intellij/xml/DefaultXmlNamespaceHelper.java
index f0d62fc..73c7d6d 100644
--- a/xml/impl/src/com/intellij/xml/DefaultXmlNamespaceHelper.java
+++ b/xml/impl/src/com/intellij/xml/DefaultXmlNamespaceHelper.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -42,10 +42,12 @@
 public class DefaultXmlNamespaceHelper extends XmlNamespaceHelper {
   private static final Logger LOG = Logger.getInstance(DefaultXmlNamespaceHelper.class);
 
+  @Override
   protected boolean isAvailable(PsiFile file) {
     return true;
   }
 
+  @Override
   public void insertNamespaceDeclaration(@NotNull final XmlFile file,
                                          @Nullable final Editor editor,
                                          @NotNull final Set<String> possibleNamespaces,
@@ -160,6 +162,7 @@
     return location;
   }
 
+  @Override
   @NotNull
   public Set<String> guessUnboundNamespaces(@NotNull final PsiElement element, @NotNull XmlFile file) {
     if (!(element instanceof XmlTag)) {
@@ -216,6 +219,7 @@
     return possibleUris;
   }
 
+  @Override
   @NotNull
   public Set<String> getNamespacesByTagName(@NotNull final String tagName, @NotNull final XmlFile context) {
     final List<XmlSchemaProvider> providers = XmlSchemaProvider.getAvailableProviders(context);
diff --git a/xml/impl/src/com/intellij/xml/XmlChangeLocalityDetector.java b/xml/impl/src/com/intellij/xml/XmlChangeLocalityDetector.java
deleted file mode 100644
index fb65aa5..0000000
--- a/xml/impl/src/com/intellij/xml/XmlChangeLocalityDetector.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.xml;
-
-import com.intellij.codeInsight.daemon.ChangeLocalityDetector;
-import com.intellij.codeInspection.DefaultXmlSuppressionProvider;
-import com.intellij.lang.xml.XMLLanguage;
-import com.intellij.psi.PsiComment;
-import com.intellij.psi.PsiElement;
-import org.jetbrains.annotations.NotNull;
-
-public class XmlChangeLocalityDetector implements ChangeLocalityDetector {
-  @Override
-  public PsiElement getChangeHighlightingDirtyScopeFor(@NotNull PsiElement changedElement) {
-    // rehighlight everything when inspection suppress comment changed
-    if (changedElement.getLanguage() instanceof XMLLanguage
-        && changedElement instanceof PsiComment
-        && changedElement.getText().contains(DefaultXmlSuppressionProvider.SUPPRESS_MARK)) {
-      return changedElement.getContainingFile();
-    }
-    return null;
-  }
-}
diff --git a/xml/impl/src/com/intellij/xml/XmlFileTypeFactory.java b/xml/impl/src/com/intellij/xml/XmlFileTypeFactory.java
index fa5d933..3000402 100644
--- a/xml/impl/src/com/intellij/xml/XmlFileTypeFactory.java
+++ b/xml/impl/src/com/intellij/xml/XmlFileTypeFactory.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.
@@ -29,6 +29,7 @@
  * @author yole
  */
 public class XmlFileTypeFactory extends FileTypeFactory {
+  @Override
   public void createFileTypes(@NotNull final FileTypeConsumer consumer) {
     consumer.consume(HtmlFileType.INSTANCE, "html;htm;sht;shtm;shtml");
     consumer.consume(XHtmlFileType.INSTANCE, "xhtml");
diff --git a/xml/impl/src/com/intellij/xml/XmlPsiManager.java b/xml/impl/src/com/intellij/xml/XmlPsiManager.java
deleted file mode 100644
index 8492313..0000000
--- a/xml/impl/src/com/intellij/xml/XmlPsiManager.java
+++ /dev/null
@@ -1,57 +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.xml;
-
-import com.intellij.lang.xml.XMLLanguage;
-import com.intellij.openapi.components.AbstractProjectComponent;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFileSystemItem;
-import com.intellij.psi.impl.PsiManagerImpl;
-import com.intellij.psi.impl.PsiTreeChangePreprocessorBase;
-
-/**
- * Created by fedorkorotkov.
- */
-public class XmlPsiManager extends AbstractProjectComponent {
-
-  private final PsiManagerImpl myPsiManager;
-
-  protected XmlPsiManager(Project project, PsiManagerImpl psiManager) {
-    super(project);
-    myPsiManager = psiManager;
-  }
-
-  @Override
-  public void initComponent() {
-    super.initComponent();
-    new PsiTreeChangePreprocessorBase(myPsiManager) {
-      @Override
-      protected boolean isInsideCodeBlock(PsiElement element) {
-        if (element instanceof PsiFileSystemItem) {
-          return false;
-        }
-
-        if (element == null || element.getParent() == null) return true;
-
-        final boolean isXml = element.getLanguage() instanceof XMLLanguage;
-        // any xml element isn't inside a "code block"
-        // cause we display even attributes and tag values in structure view
-        return !isXml;
-      }
-    };
-  }
-}
diff --git a/xml/impl/src/com/intellij/xml/actions/validate/StdErrorReporter.java b/xml/impl/src/com/intellij/xml/actions/validate/StdErrorReporter.java
index eabb303..ac63a17 100644
--- a/xml/impl/src/com/intellij/xml/actions/validate/StdErrorReporter.java
+++ b/xml/impl/src/com/intellij/xml/actions/validate/StdErrorReporter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -50,11 +50,14 @@
     myErrorsView = new NewErrorTreeViewPanel(project, null, true, true, rerunAction);
   }
 
+  @Override
   public void startProcessing() {
     final Runnable task = new Runnable() {
+      @Override
       public void run() {
         try {
           ApplicationManager.getApplication().runReadAction(new Runnable() {
+            @Override
             public void run() {
               StdErrorReporter.super.startProcessing();
             }
@@ -62,10 +65,12 @@
 
           SwingUtilities.invokeLater(
             new Runnable() {
+              @Override
               public void run() {
                 if (!myErrorsDetected) {
                   SwingUtilities.invokeLater(
                     new Runnable() {
+                      @Override
                       public void run() {
                         removeCompileContents(null);
                         WindowManager.getInstance().getStatusBar(myProject).setInfo(
@@ -79,7 +84,7 @@
           );
         }
         finally {
-          boolean b = Thread.interrupted(); // reset interrupted
+          Thread.interrupted(); // reset interrupted
         }
       }
     };
@@ -96,6 +101,7 @@
     CommandProcessor commandProcessor = CommandProcessor.getInstance();
     commandProcessor.executeCommand(
         myProject, new Runnable() {
+          @Override
           public void run() {
             MessageView messageView = MessageView.SERVICE.getInstance(myProject);
             final Content content = ContentFactory.SERVICE.getInstance().createContent(myErrorsView.getComponent(), CONTENT_NAME, true);
@@ -127,6 +133,7 @@
     }
   }
 
+  @Override
   public void processError(final SAXParseException ex, final ValidateXmlActionHandler.ProblemType problemType) {
     if (LOG.isDebugEnabled()) {
       String error = myHandler.buildMessageString(ex);
@@ -138,6 +145,7 @@
     if (!ApplicationManager.getApplication().isUnitTestMode()) {
       SwingUtilities.invokeLater(
           new Runnable() {
+            @Override
             public void run() {
               final VirtualFile file = myHandler.getFile(ex.getPublicId(), ex.getSystemId());
               myErrorsView.addMessage(
@@ -163,6 +171,7 @@
       myMessageView = messageView;
     }
 
+    @Override
     public void contentRemoved(ContentManagerEvent event) {
       final Content eventContent = event.getContent();
       if (!eventContent.equals(myContent)) {
@@ -176,10 +185,13 @@
       eventContent.putUserData(KEY, null);
     }
 
+    @Override
     public void contentAdded(ContentManagerEvent event) {
     }
+    @Override
     public void contentRemoveQuery(ContentManagerEvent event) {
     }
+    @Override
     public void selectionChanged(ContentManagerEvent event) {
     }
   }
@@ -193,6 +205,7 @@
       myContentManager = contentManager;
     }
 
+    @Override
     public void contentRemoved(ContentManagerEvent event) {
       if (event.getContent() == myContent) {
         myErrorsView.stopProcess();
@@ -203,6 +216,7 @@
       }
     }
 
+    @Override
     public void contentRemoveQuery(ContentManagerEvent event) {
       if (event.getContent() == myContent) {
         if (!myErrorsView.isProcessStopped()) {
@@ -226,12 +240,14 @@
       myFuture = future;
     }
 
+    @Override
     public void stopProcess() {
       if (myFuture != null) {
         myFuture.cancel(true);
       }
     }
 
+    @Override
     public boolean isProcessStopped() {
       return myFuture != null && myFuture.isDone();
     }
diff --git a/xml/impl/src/com/intellij/xml/actions/validate/TestErrorReporter.java b/xml/impl/src/com/intellij/xml/actions/validate/TestErrorReporter.java
index 8906d33..6458f7a 100644
--- a/xml/impl/src/com/intellij/xml/actions/validate/TestErrorReporter.java
+++ b/xml/impl/src/com/intellij/xml/actions/validate/TestErrorReporter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -28,15 +28,18 @@
     super(handler);
   }
 
+  @Override
   public boolean isStopOnUndeclaredResource() {
     return true;
   }
 
+  @Override
   public boolean filterValidationException(final Exception ex) {
     if (ex instanceof XmlResourceResolver.IgnoredResourceException) throw (XmlResourceResolver.IgnoredResourceException)ex;
     return errors.add(ex.getMessage());
   }
 
+  @Override
   public void processError(SAXParseException ex, ValidateXmlActionHandler.ProblemType warning) {
     errors.add(myHandler.buildMessageString(ex));
   }
diff --git a/xml/impl/src/com/intellij/xml/actions/validate/ValidateXmlAction.java b/xml/impl/src/com/intellij/xml/actions/validate/ValidateXmlAction.java
index 8abbe22..ea26f45 100644
--- a/xml/impl/src/com/intellij/xml/actions/validate/ValidateXmlAction.java
+++ b/xml/impl/src/com/intellij/xml/actions/validate/ValidateXmlAction.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.
@@ -40,6 +40,7 @@
     handler.setErrorReporter(
       new StdErrorReporter(handler, file.getProject(),
         new Runnable() {
+          @Override
           public void run() {
             doRunAction(file);
           }
@@ -49,6 +50,7 @@
     return handler;
   }
 
+  @Override
   public void actionPerformed(AnActionEvent e) {
     final PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(e.getDataContext());
     if (psiFile != null) {
@@ -59,8 +61,10 @@
   private void doRunAction(final @NotNull PsiFile psiFile) {
 
     CommandProcessor.getInstance().executeCommand(psiFile.getProject(), new Runnable(){
+        @Override
         public void run(){
           final Runnable action = new Runnable() {
+            @Override
             public void run() {
               try {
                 psiFile.putUserData(runningValidationKey, "");
@@ -86,6 +90,7 @@
     return text != null ? text : "";
   }
 
+  @Override
   public void update(AnActionEvent event) {
     super.update(event);
 
diff --git a/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateInstanceDocumentFromSchemaAction.java b/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateInstanceDocumentFromSchemaAction.java
index be0b8bf..57f53d7 100644
--- a/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateInstanceDocumentFromSchemaAction.java
+++ b/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateInstanceDocumentFromSchemaAction.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.
@@ -20,7 +20,6 @@
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.fileEditor.FileEditorManager;
@@ -30,7 +29,7 @@
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiManager;
@@ -62,12 +61,14 @@
     }
   }
 
+  @Override
   public void actionPerformed(AnActionEvent e) {
     final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
     final VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(e.getDataContext());
 
     final GenerateInstanceDocumentFromSchemaDialog dialog = new GenerateInstanceDocumentFromSchemaDialog(project, file);
     dialog.setOkAction(new Runnable() {
+      @Override
       public void run() {
         doAction(project, dialog);
       }
@@ -82,7 +83,7 @@
     @NonNls List<String> parameters = new LinkedList<String>();
 
     final String url = dialog.getUrl().getText();
-    final VirtualFile relativeFile = VfsUtil.findRelativeFile(ExternalResourceManager.getInstance().getResourceLocation(url), null);
+    final VirtualFile relativeFile = VfsUtilCore.findRelativeFile(ExternalResourceManager.getInstance().getResourceLocation(url), null);
     final PsiFile file = PsiManager.getInstance(project).findFile(relativeFile);
     if (! (file instanceof XmlFile)) {
       Messages.showErrorDialog(project, "This is not XmlFile" + file == null ? "" : " (" + file.getFileType().getName() + ")", XmlBundle.message("error"));
@@ -121,6 +122,7 @@
         (XmlFile) file,
         new THashMap<String, String>(),
         new Xsd2InstanceUtils.SchemaReferenceProcessor() {
+          @Override
           public void processSchema(String schemaFileName, byte[] schemaContent) {
             try {
               final String fullFileName = tempDir.getPath() + File.separatorChar + schemaFileName;
@@ -169,6 +171,7 @@
 
       final File xmlFile = new File(xmlFileName);
       VirtualFile virtualFile = ApplicationManager.getApplication().runWriteAction(new Computable<VirtualFile>() {
+        @Override
         @Nullable
         public VirtualFile compute() {
           return LocalFileSystem.getInstance().refreshAndFindFileByIoFile(xmlFile);
diff --git a/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateInstanceDocumentFromSchemaDialog.java b/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateInstanceDocumentFromSchemaDialog.java
index 33d7561..ffc37a5 100644
--- a/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateInstanceDocumentFromSchemaDialog.java
+++ b/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateInstanceDocumentFromSchemaDialog.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.
@@ -20,7 +20,7 @@
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.ui.TextFieldWithBrowseButton;
-import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.PsiFile;
 import com.intellij.psi.PsiManager;
@@ -88,14 +88,17 @@
 
     if (component instanceof JTextField) {
       ((JTextField)component).getDocument().addDocumentListener(new DocumentListener() {
+        @Override
         public void insertUpdate(DocumentEvent e) {
           validateData();
         }
 
+        @Override
         public void removeUpdate(DocumentEvent e) {
           validateData();
         }
 
+        @Override
         public void changedUpdate(DocumentEvent e) {
           validateData();
         }
@@ -105,20 +108,24 @@
       JComboBox jComboBox = ((JComboBox)component);
 
       jComboBox.addActionListener(new ActionListener() {
+        @Override
         public void actionPerformed(ActionEvent e) {
           validateData();
         }
       });
 
       ((JTextField)jComboBox.getEditor().getEditorComponent()).getDocument().addDocumentListener(new DocumentListener() {
+        @Override
         public void insertUpdate(DocumentEvent e) {
           validateData();
         }
 
+        @Override
         public void removeUpdate(DocumentEvent e) {
           validateData();
         }
 
+        @Override
         public void changedUpdate(DocumentEvent e) {
           validateData();
         }
@@ -126,6 +133,7 @@
 
       if (jComboBox.isEditable()) {
         jComboBox.getEditor().getEditorComponent().addKeyListener(new KeyAdapter() {
+          @Override
           public void keyTyped(KeyEvent e) {
             validateData();
           }
@@ -203,7 +211,7 @@
   @Nullable
   private PsiFile findFile(String uri) {
     final VirtualFile file =
-      uri != null ? VfsUtil.findRelativeFile(ExternalResourceManager.getInstance().getResourceLocation(uri), null) : null;
+      uri != null ? VfsUtilCore.findRelativeFile(ExternalResourceManager.getInstance().getResourceLocation(uri), null) : null;
     return file != null ? PsiManager.getInstance(myProject).findFile(file) : null;
   }
 
@@ -264,6 +272,7 @@
     return status;
   }
 
+  @Override
   protected JComponent createCenterPanel() {
     return panel;
   }
@@ -292,6 +301,7 @@
     }
   }
 
+  @Override
   @NotNull
   protected String getHelpId() {
     return "webservices.GenerateInstanceDocumentFromSchema";
diff --git a/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateSchemaFromInstanceDocumentAction.java b/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateSchemaFromInstanceDocumentAction.java
index 76abf63..4a84ad7 100644
--- a/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateSchemaFromInstanceDocumentAction.java
+++ b/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateSchemaFromInstanceDocumentAction.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -16,18 +16,17 @@
 package com.intellij.xml.actions.xmlbeans;
 
 import com.intellij.javaee.ExternalResourceManager;
+import com.intellij.openapi.actionSystem.ActionPlaces;
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.ActionPlaces;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.fileEditor.FileEditorManager;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.Messages;
 import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.ArrayUtil;
 import com.intellij.xml.XmlBundle;
@@ -36,10 +35,10 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.HashMap;
 
 /**
  * @author Konstantin Bulenkov
@@ -67,12 +66,14 @@
     }
   }
 
+  @Override
   public void actionPerformed(AnActionEvent e) {
     final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
     final VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(e.getDataContext());
 
     final GenerateSchemaFromInstanceDocumentDialog dialog = new GenerateSchemaFromInstanceDocumentDialog(project, file);
     dialog.setOkAction(new Runnable() {
+      @Override
       public void run() {
         doAction(project, dialog);
       }
@@ -85,7 +86,7 @@
     FileDocumentManager.getInstance().saveAllDocuments();
 
     final String url = dialog.getUrl().getText();
-    final VirtualFile relativeFile = VfsUtil.findRelativeFile(ExternalResourceManager.getInstance().getResourceLocation(url), null);
+    final VirtualFile relativeFile = VfsUtilCore.findRelativeFile(ExternalResourceManager.getInstance().getResourceLocation(url), null);
     VirtualFile relativeFileDir;
     if (relativeFile == null) {
       Messages.showErrorDialog(project, XmlBundle.message("file.doesnt.exist", url), XmlBundle.message("error"));
@@ -129,6 +130,7 @@
     final VirtualFile xsdFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(xsd);
     if (xsdFile != null) {
         ApplicationManager.getApplication().runWriteAction(new Runnable() {
+          @Override
           public void run() {
             try {
               xsdFile.delete(null);
diff --git a/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateSchemaFromInstanceDocumentDialog.java b/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateSchemaFromInstanceDocumentDialog.java
index e57a753..351eb1a 100644
--- a/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateSchemaFromInstanceDocumentDialog.java
+++ b/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateSchemaFromInstanceDocumentDialog.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.
@@ -132,14 +132,17 @@
 
     if (component instanceof JTextField) {
       ((JTextField)component).getDocument().addDocumentListener(new DocumentListener() {
+        @Override
         public void insertUpdate(DocumentEvent e) {
           validateData();
         }
 
+        @Override
         public void removeUpdate(DocumentEvent e) {
           validateData();
         }
 
+        @Override
         public void changedUpdate(DocumentEvent e) {
           validateData();
         }
@@ -148,6 +151,7 @@
       JComboBox jComboBox = ((JComboBox) component);
 
       jComboBox.addActionListener(new ActionListener() {
+        @Override
         public void actionPerformed(ActionEvent e) {
           validateData();
         }
@@ -155,6 +159,7 @@
 
       if (jComboBox.isEditable()) {
         jComboBox.getEditor().getEditorComponent().addKeyListener(new KeyAdapter() {
+          @Override
           public void keyTyped(KeyEvent e) {
             validateData();
           }
@@ -179,6 +184,7 @@
     return status;
   }
 
+  @Override
   protected JComponent createCenterPanel() {
     return panel;
   }
@@ -217,6 +223,7 @@
     return null;
   }
 
+  @Override
   @NotNull
   protected String getHelpId() {
     return "webservices.GenerateSchemaFromInstanceDocument";
diff --git a/xml/impl/src/com/intellij/xml/actions/xmlbeans/UIUtils.java b/xml/impl/src/com/intellij/xml/actions/xmlbeans/UIUtils.java
index cdde9af..80df3ad 100644
--- a/xml/impl/src/com/intellij/xml/actions/xmlbeans/UIUtils.java
+++ b/xml/impl/src/com/intellij/xml/actions/xmlbeans/UIUtils.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.
@@ -23,6 +23,7 @@
 import com.intellij.openapi.util.SystemInfo;
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.xml.XmlBundle;
 
@@ -45,10 +46,12 @@
     wsdlUrl.getButton().setToolTipText(XmlBundle.message("browse.button.tooltip"));
     wsdlUrl.getButton().addActionListener(
       new ActionListener() {
+        @Override
         public void actionPerformed(ActionEvent actionEvent) {
           final FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, multipleFileSelection) {
             private final List<String> extensions = Arrays.asList(_extensions);
 
+            @Override
             public boolean isFileSelectable(VirtualFile virtualFile) {
               return extensions.contains(virtualFile.getExtension());
             }
@@ -64,7 +67,8 @@
           VirtualFile initialFile = myProject.getBaseDir();
           String selectedItem = wsdlUrl.getTextField().getText();
           if (selectedItem != null && selectedItem.startsWith(LocalFileSystem.PROTOCOL_PREFIX)) {
-            VirtualFile fileByPath = VfsUtil.findRelativeFile(ExternalResourceManager.getInstance().getResourceLocation(VfsUtil.fixURLforIDEA(selectedItem)), null);
+            VirtualFile fileByPath = VfsUtilCore
+              .findRelativeFile(ExternalResourceManager.getInstance().getResourceLocation(VfsUtil.fixURLforIDEA(selectedItem)), null);
             if (fileByPath != null) initialFile = fileByPath;
           }
 
@@ -79,6 +83,6 @@
   }
 
   public static String fixIDEAUrl(String url) {
-    return SystemInfo.isWindows ? VfsUtil.fixIDEAUrl(url) : url;
+    return SystemInfo.isWindows ? VfsUtilCore.fixIDEAUrl(url) : url;
   }
 }
diff --git a/xml/impl/src/com/intellij/xml/actions/xmlbeans/Xsd2InstanceUtils.java b/xml/impl/src/com/intellij/xml/actions/xmlbeans/Xsd2InstanceUtils.java
index c6c358e..9635449 100644
--- a/xml/impl/src/com/intellij/xml/actions/xmlbeans/Xsd2InstanceUtils.java
+++ b/xml/impl/src/com/intellij/xml/actions/xmlbeans/Xsd2InstanceUtils.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,18 +79,15 @@
 
         // Process Schema files
         List sdocs = new ArrayList();
-        for (int i = 0; i < schemaFiles.length; i++)
-        {
-            try
-            {
-                sdocs.add(XmlObject.Factory.parse(schemaFiles[i],
-                        (new XmlOptions()).setLoadLineNumbers().setLoadMessageDigest()));
-            }
-            catch (Exception e)
-            {
-                throw new IllegalArgumentException("Can not load schema file: " + schemaFiles[i] + ": " + e.getLocalizedMessage());
-            }
+      for (File schemaFile : schemaFiles) {
+        try {
+          sdocs.add(XmlObject.Factory.parse(schemaFile,
+                                            (new XmlOptions()).setLoadLineNumbers().setLoadMessageDigest()));
         }
+        catch (Exception e) {
+          throw new IllegalArgumentException("Can not load schema file: " + schemaFile + ": " + e.getLocalizedMessage());
+        }
+      }
 
         XmlObject[] schemas = (XmlObject[]) sdocs.toArray(new XmlObject[sdocs.size()]);
 
@@ -121,14 +118,12 @@
         }
         SchemaType[] globalElems = sts.documentTypes();
         SchemaType elem = null;
-        for (int i = 0; i < globalElems.length; i++)
-        {
-            if (rootName.equals(globalElems[i].getDocumentElementName().getLocalPart()))
-            {
-                elem = globalElems[i];
-                break;
-            }
+      for (SchemaType globalElem : globalElems) {
+        if (rootName.equals(globalElem.getDocumentElementName().getLocalPart())) {
+          elem = globalElem;
+          break;
         }
+      }
 
         if (elem == null) {
             throw new IllegalArgumentException("Could not find a global element with name \"" + rootName + "\"");
diff --git a/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsLoaderComponent.java b/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsLoaderComponent.java
index 9a3a113..aeff2ab 100644
--- a/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsLoaderComponent.java
+++ b/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsLoaderComponent.java
@@ -1,3 +1,18 @@
+/*
+ * 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.xml.breadcrumbs;
 
 import com.intellij.application.options.editor.WebEditorOptions;
@@ -24,12 +39,14 @@
     super(project);
   }
 
+  @Override
   @NonNls
   @NotNull
   public String getComponentName() {
     return "HtmlBreadcrumbsComponent";
   }
 
+  @Override
   public void initComponent() {
     myProject.getMessageBus().connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new MyFileEditorManagerListener());
   }
@@ -40,6 +57,7 @@
   }
 
   private static class MyFileEditorManagerListener extends FileEditorManagerAdapter {
+    @Override
     public void fileOpened(@NotNull final FileEditorManager source, @NotNull final VirtualFile file) {
       if (isEnabled() && isSuitable(source.getProject(), file)) {
         final FileEditor[] fileEditors = source.getEditors(file);
@@ -51,6 +69,7 @@
 
             Disposer.register(fileEditor, wrapper);
             Disposer.register(fileEditor, new Disposable() {
+              @Override
               public void dispose() {
                 source.removeTopComponent(fileEditor, c);
               }
diff --git a/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsPsiItem.java b/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsPsiItem.java
index f0c6c75..9257856 100644
--- a/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsPsiItem.java
+++ b/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsPsiItem.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.
@@ -35,10 +35,12 @@
     myPresentation = presentation;
   }
 
+  @Override
   public String getDisplayText() {
     return isValid() ? myProvider.getElementInfo(myElement) : "INVALID";
   }
 
+  @Override
   public String getTooltip() {
     final String s = isValid() ? myProvider.getElementTooltip(myElement) : "";
     return s == null ? "" : s;
diff --git a/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsXmlWrapper.java b/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsXmlWrapper.java
index 1b2fabd..bbee880 100644
--- a/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsXmlWrapper.java
+++ b/xml/impl/src/com/intellij/xml/breadcrumbs/BreadcrumbsXmlWrapper.java
@@ -86,10 +86,12 @@
 
     final FileStatusManager manager = FileStatusManager.getInstance(project);
     manager.addFileStatusListener(new FileStatusListener() {
+      @Override
       public void fileStatusesChanged() {
         updateCrumbs();
       }
 
+      @Override
       public void fileStatusChanged(@NotNull final VirtualFile virtualFile) {
       }
     }, this);
@@ -105,6 +107,7 @@
     myInfoProvider = findInfoProvider(findViewProvider(myFile, myProject));
 
     final CaretListener caretListener = new CaretAdapter() {
+      @Override
       public void caretPositionChanged(final CaretEvent e) {
         if (myUserCaretChange) {
           queueUpdate(editor);
@@ -116,6 +119,7 @@
 
     editor.getCaretModel().addCaretListener(caretListener);
     Disposer.register(this, new Disposable() {
+      @Override
       public void dispose() {
         editor.getCaretModel().removeCaretListener(caretListener);
       }
@@ -163,6 +167,7 @@
     myComponent.setFont(editorFont.deriveFont(Font.PLAIN, editorFont.getSize2D()));
 
     final ComponentAdapter resizeListener = new ComponentAdapter() {
+      @Override
       public void componentResized(final ComponentEvent e) {
         queueUpdate(editor);
       }
@@ -170,6 +175,7 @@
 
     myComponent.addComponentListener(resizeListener);
     Disposer.register(this, new Disposable() {
+      @Override
       public void dispose() {
         myComponent.removeComponentListener(resizeListener);
       }
@@ -299,6 +305,7 @@
     if (file == null || !file.isValid()) return null;
 
     PriorityQueue<PsiElement> leafs = new PriorityQueue<PsiElement>(3, new Comparator<PsiElement>() {
+      @Override
       public int compare(final PsiElement o1, final PsiElement o2) {
         return o2.getTextRange().getStartOffset() - o1.getTextRange().getStartOffset();
       }
@@ -365,6 +372,7 @@
     return myWrapperPanel;
   }
 
+  @Override
   public void itemSelected(@NotNull final BreadcrumbsPsiItem item, final int modifiers) {
     final PsiElement psiElement = item.getPsiElement();
     moveEditorCaretTo(psiElement);
@@ -380,6 +388,7 @@
     return editor.getUserData(BREADCRUMBS_COMPONENT_KEY);
   }
 
+  @Override
   public void dispose() {
     myEditor.putUserData(BREADCRUMBS_COMPONENT_KEY, null);
     myEditor = null;
@@ -409,10 +418,12 @@
       myEditor = editor;
     }
 
+    @Override
     public void run() {
       myBreadcrumbsComponent.updateCrumbs(myEditor.getCaretModel().getLogicalPosition());
     }
 
+    @Override
     public boolean canEat(final Update update) {
       return true;
     }
diff --git a/xml/impl/src/com/intellij/xml/breadcrumbs/XmlLanguageBreadcrumbsInfoProvider.java b/xml/impl/src/com/intellij/xml/breadcrumbs/XmlLanguageBreadcrumbsInfoProvider.java
index 9f736ee..43470c2 100644
--- a/xml/impl/src/com/intellij/xml/breadcrumbs/XmlLanguageBreadcrumbsInfoProvider.java
+++ b/xml/impl/src/com/intellij/xml/breadcrumbs/XmlLanguageBreadcrumbsInfoProvider.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.
@@ -39,18 +39,21 @@
   @NonNls private static final String CLASS_ATTRIBUTE_NAME = "class";
   @NonNls private static final String ID_ATTRIBUTE_NAME = "id";
 
+  @Override
   public boolean acceptElement(@NotNull final PsiElement e) {
     return e instanceof XmlTag && e.isValid();
   }
 
+  @Override
   public Language[] getLanguages() {
     return new Language[]{XMLLanguage.INSTANCE, XHTMLLanguage.INSTANCE, HTMLLanguage.INSTANCE};
   }
 
+  @Override
   @NotNull
   public String getElementInfo(@NotNull final PsiElement e) {
     final XmlTag tag = (XmlTag)e;
-    final StringBuffer sb = new StringBuffer();
+    final StringBuilder sb = new StringBuilder();
 
     sb.append(tag.getName());
 
@@ -74,10 +77,11 @@
     return sb.toString();
   }
 
+  @Override
   @Nullable
   public String getElementTooltip(@NotNull final PsiElement e) {
     final XmlTag tag = (XmlTag)e;
-    final StringBuffer result = new StringBuffer("&lt;");
+    final StringBuilder result = new StringBuilder("&lt;");
     result.append(tag.getName());
     final XmlAttribute[] attributes = tag.getAttributes();
     for (final XmlAttribute each : attributes) {
diff --git a/xml/impl/src/com/intellij/xml/config/ConfigFilesTreeBuilder.java b/xml/impl/src/com/intellij/xml/config/ConfigFilesTreeBuilder.java
index e50fcc6..55f2f41 100644
--- a/xml/impl/src/com/intellij/xml/config/ConfigFilesTreeBuilder.java
+++ b/xml/impl/src/com/intellij/xml/config/ConfigFilesTreeBuilder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -90,6 +90,7 @@
     final HashSet<PsiFile> psiFiles = new HashSet<PsiFile>();
     final List<Module> modules = new ArrayList<Module>(files.keySet());
     Collections.sort(modules, new Comparator<Module>() {
+      @Override
       public int compare(final Module o1, final Module o2) {
         return o1.getName().compareTo(o2.getName());
       }
@@ -158,6 +159,7 @@
   }
 
   private static final Comparator<PsiFile> FILE_COMPARATOR = new Comparator<PsiFile>() {
+    @Override
     public int compare(final PsiFile o1, final PsiFile o2) {
       return o1.getName().compareTo(o2.getName());
     }
@@ -210,6 +212,7 @@
 
   public static void installSearch(JTree tree) {
     new TreeSpeedSearch(tree, new Convertor<TreePath, String>() {
+      @Override
       public String convert(final TreePath treePath) {
         final Object object = ((DefaultMutableTreeNode)treePath.getLastPathComponent()).getUserObject();
         if (object instanceof Module) {
diff --git a/xml/impl/src/com/intellij/xml/impl/XmlBraceMatcher.java b/xml/impl/src/com/intellij/xml/impl/XmlBraceMatcher.java
index 866be5f..6ae3068 100644
--- a/xml/impl/src/com/intellij/xml/impl/XmlBraceMatcher.java
+++ b/xml/impl/src/com/intellij/xml/impl/XmlBraceMatcher.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.
@@ -55,6 +55,7 @@
     PAIRING_TOKENS.put(XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER, XmlTokenType.XML_ATTRIBUTE_VALUE_END_DELIMITER);
   }
 
+  @Override
   public int getBraceTokenGroupId(IElementType tokenType) {
     final Language l = tokenType.getLanguage();
     PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(l);
@@ -77,6 +78,7 @@
     }
   }
 
+  @Override
   public boolean isLBraceToken(HighlighterIterator iterator, CharSequence fileText, FileType fileType) {
     final IElementType tokenType = iterator.getTokenType();
     PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(tokenType.getLanguage());
@@ -91,6 +93,7 @@
            tokenType == XmlTokenType.XML_CDATA_START;
   }
 
+  @Override
   public boolean isRBraceToken(HighlighterIterator iterator, CharSequence fileText, FileType fileType) {
     final IElementType tokenType = iterator.getTokenType();
     PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(tokenType.getLanguage());
@@ -129,6 +132,7 @@
     return fileType == StdFileTypes.HTML;
   }
 
+  @Override
   public boolean isPairBraces(IElementType tokenType1, IElementType tokenType2) {
     PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(tokenType1.getLanguage());
     if (matcher != null) {
@@ -143,6 +147,7 @@
     return keys != null && keys.contains(tokenType2);
   }
 
+  @Override
   public boolean isStructuralBrace(HighlighterIterator iterator,CharSequence text, FileType fileType) {
     IElementType tokenType = iterator.getTokenType();
 
@@ -167,10 +172,12 @@
            tokenType == XmlTokenType.XML_TAG_END && isFileTypeWithSingleHtmlTags(fileType) && isEndOfSingleHtmlTag(text, iterator);
   }
 
+  @Override
   public boolean isPairedBracesAllowedBeforeType(@NotNull final IElementType lbraceType, @Nullable final IElementType contextType) {
     return true;
   }
 
+  @Override
   public boolean isStrictTagMatching(final FileType fileType, final int braceGroupId) {
     switch(braceGroupId){
       case XML_TAG_TOKEN_GROUP:
@@ -187,6 +194,7 @@
            fileType == StdFileTypes.XHTML;
   }
 
+  @Override
   public boolean areTagsCaseSensitive(final FileType fileType, final int braceGroupId) {
     switch(braceGroupId){
       case XML_TAG_TOKEN_GROUP:
@@ -221,6 +229,7 @@
     return tagName != null && HtmlUtil.isSingleHtmlTag(tagName);
   }
 
+  @Override
   public String getTagName(CharSequence fileText, HighlighterIterator iterator) {
     final IElementType tokenType = iterator.getTokenType();
     String name = null;
@@ -274,6 +283,7 @@
     return tokenType1 == TokenType.WHITE_SPACE;
   }
 
+  @Override
   public IElementType getOppositeBraceTokenType(@NotNull final IElementType type) {
     PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(type.getLanguage());
     if (matcher != null) {
@@ -286,6 +296,7 @@
     return null;
   }
 
+  @Override
   public int getCodeConstructStart(final PsiFile file, int openingBraceOffset) {
     return openingBraceOffset;
   }
diff --git a/xml/impl/src/com/intellij/xml/impl/schema/SchemaDefinitionsSearch.java b/xml/impl/src/com/intellij/xml/impl/schema/SchemaDefinitionsSearch.java
index 6811ca9..b3cc34f 100644
--- a/xml/impl/src/com/intellij/xml/impl/schema/SchemaDefinitionsSearch.java
+++ b/xml/impl/src/com/intellij/xml/impl/schema/SchemaDefinitionsSearch.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.
@@ -17,7 +17,7 @@
 
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleUtil;
+import com.intellij.openapi.module.ModuleUtilCore;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.Computable;
@@ -65,7 +65,7 @@
         if (infos != null && ! infos.isEmpty()) {
           final XmlFile file = XmlUtil.getContainingFile(xml);
           final Project project = file.getProject();
-          final Module module = ModuleUtil.findModuleForPsiElement(queryParameters);
+          final Module module = ModuleUtilCore.findModuleForPsiElement(queryParameters);
           //if (module == null) return false;
 
           final VirtualFile vf = file.getVirtualFile();
diff --git a/xml/impl/src/com/intellij/xml/index/SchemaTypeInfo.java b/xml/impl/src/com/intellij/xml/index/SchemaTypeInfo.java
deleted file mode 100644
index 9d857a0..0000000
--- a/xml/impl/src/com/intellij/xml/index/SchemaTypeInfo.java
+++ /dev/null
@@ -1,74 +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.xml.index;
-
-/**
- * Created with IntelliJ IDEA.
- * User: Irina.Chernushina
- * Date: 7/4/12
- * Time: 7:14 PM
- */
-public class SchemaTypeInfo implements Comparable<SchemaTypeInfo> {
-  private final String myTagName;
-  private final String myNamespaceUri;
-//  private final String myFileUrl;
-  private final boolean myIsTypeName; // false -> enclosing element name
-
-  public SchemaTypeInfo(String tagName, final boolean isTypeName, String namespace) {
-    myNamespaceUri = namespace;
-    myTagName = tagName;
-    myIsTypeName = isTypeName;
-  }
-
-  public String getTagName() {
-    return myTagName;
-  }
-
-  public String getNamespaceUri() {
-    return myNamespaceUri;
-  }
-
-  public boolean isIsTypeName() {
-    return myIsTypeName;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    if (o == null || getClass() != o.getClass()) return false;
-
-    SchemaTypeInfo info = (SchemaTypeInfo)o;
-
-    if (myIsTypeName != info.myIsTypeName) return false;
-    if (myNamespaceUri != null ? !myNamespaceUri.equals(info.myNamespaceUri) : info.myNamespaceUri != null) return false;
-    if (!myTagName.equals(info.myTagName)) return false;
-
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    int result = myTagName.hashCode();
-    result = 31 * result + (myNamespaceUri != null ? myNamespaceUri.hashCode() : 0);
-    result = 31 * result + (myIsTypeName ? 1 : 0);
-    return result;
-  }
-
-  @Override
-  public int compareTo(SchemaTypeInfo o) {
-    return myTagName.compareTo(o.getTagName());
-  }
-}
diff --git a/xml/impl/src/com/intellij/xml/index/SchemaTypeInheritanceIndex.java b/xml/impl/src/com/intellij/xml/index/SchemaTypeInheritanceIndex.java
deleted file mode 100644
index fb74cd1..0000000
--- a/xml/impl/src/com/intellij/xml/index/SchemaTypeInheritanceIndex.java
+++ /dev/null
@@ -1,180 +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.xml.index;
-
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Pair;
-import com.intellij.openapi.vfs.VfsUtil;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.util.PairConvertor;
-import com.intellij.util.containers.EncoderDecoder;
-import com.intellij.util.containers.MultiMap;
-import com.intellij.util.containers.hash.HashMap;
-import com.intellij.util.indexing.DataIndexer;
-import com.intellij.util.indexing.FileBasedIndex;
-import com.intellij.util.indexing.FileContent;
-import com.intellij.util.indexing.ID;
-import com.intellij.util.io.DataExternalizer;
-import com.intellij.util.text.CharArrayUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Created with IntelliJ IDEA.
- * User: Irina.Chernushina
- * Date: 7/4/12
- * Time: 6:29 PM
- *
- * map: tag name->file url
- */
-public class SchemaTypeInheritanceIndex extends XmlIndex<Set<SchemaTypeInfo>> {
-  private static final ID<String, Set<SchemaTypeInfo>> NAME = ID.create("SchemaTypeInheritance");
-  private static final Logger LOG = Logger.getInstance("#com.intellij.xml.index.SchemaTypeInheritanceIndex");
-
-  private static List<Set<SchemaTypeInfo>> getDirectChildrenOfType(final Project project,
-                                                                  final String ns,
-                                                                  final String name) {
-    GlobalSearchScope filter = createFilter(project);
-    final List<Set<SchemaTypeInfo>>
-      list = FileBasedIndex.getInstance().getValues(NAME, NsPlusTag.INSTANCE.encode(Pair.create(ns, name)), filter);
-    return list;
-  }
-
-  public static PairConvertor<String, String, List<Set<SchemaTypeInfo>>> getWorker(final Project project, final VirtualFile currentFile) {
-    return new MyWorker(currentFile, project);
-  }
-
-  private static class MyWorker implements PairConvertor<String, String, List<Set<SchemaTypeInfo>>> {
-    private final Project myProject;
-    private final VirtualFile myCurrentFile;
-    private final GlobalSearchScope myFilter;
-    private final boolean myShouldParseCurrent;
-    private MultiMap<SchemaTypeInfo,SchemaTypeInfo> myMap;
-
-    private MyWorker(VirtualFile currentFile, Project project) {
-      myCurrentFile = currentFile;
-      myProject = project;
-
-      myFilter = createFilter(project);
-      myShouldParseCurrent = (myCurrentFile != null && ! myFilter.contains(myCurrentFile));
-    }
-
-    @Override
-    public List<Set<SchemaTypeInfo>> convert(String ns, String name) {
-      List<Set<SchemaTypeInfo>> type = getDirectChildrenOfType(myProject, ns, name);
-      if (myShouldParseCurrent) {
-        if (myMap == null) {
-          try {
-            myMap = XsdComplexTypeInfoBuilder.parse(CharArrayUtil.readerFromCharSequence(VfsUtil.loadText(myCurrentFile)));
-            type.add(new HashSet<SchemaTypeInfo>(myMap.get(new SchemaTypeInfo(name, true, ns))));
-          }
-          catch (IOException e) {
-            LOG.info(e);
-          }
-        }
-      }
-      return type;
-    }
-  }
-
-  @Override
-  public boolean dependsOnFileContent() {
-    return true;
-  }
-
-  @Override
-  public int getVersion() {
-    return 0;
-  }
-
-  @NotNull
-  @Override
-  public ID<String, Set<SchemaTypeInfo>> getName() {
-    return NAME;
-  }
-
-  @NotNull
-  @Override
-  public DataIndexer<String, Set<SchemaTypeInfo>, FileContent> getIndexer() {
-    return new DataIndexer<String, Set<SchemaTypeInfo>, FileContent>() {
-      @NotNull
-      @Override
-      public Map<String, Set<SchemaTypeInfo>> map(@NotNull FileContent inputData) {
-        final Map<String, Set<SchemaTypeInfo>> map = new HashMap<String, Set<SchemaTypeInfo>>();
-        final MultiMap<SchemaTypeInfo,SchemaTypeInfo> multiMap =
-          XsdComplexTypeInfoBuilder.parse(CharArrayUtil.readerFromCharSequence(inputData.getContentAsText()));
-        for (SchemaTypeInfo key : multiMap.keySet()) {
-          map.put(NsPlusTag.INSTANCE.encode(Pair.create(key.getNamespaceUri(), key.getTagName())), new HashSet<SchemaTypeInfo>(multiMap.get(key)));
-        }
-        return map;
-      }
-    };
-  }
-
-  @NotNull
-  @Override
-  public DataExternalizer<Set<SchemaTypeInfo>> getValueExternalizer() {
-    return new DataExternalizer<Set<SchemaTypeInfo>>() {
-      @Override
-      public void save(@NotNull DataOutput out, Set<SchemaTypeInfo> value) throws IOException {
-        out.writeInt(value.size());
-        for (SchemaTypeInfo key : value) {
-          out.writeUTF(key.getNamespaceUri());
-          out.writeUTF(key.getTagName());
-          out.writeBoolean(key.isIsTypeName());
-        }
-      }
-
-      @Override
-      public Set<SchemaTypeInfo> read(@NotNull DataInput in) throws IOException {
-        final Set<SchemaTypeInfo> set = new HashSet<SchemaTypeInfo>();
-        final int size = in.readInt();
-        for (int i = 0; i < size; i++) {
-          final String nsUri = in.readUTF();
-          final String tagName = in.readUTF();
-          final boolean isType = in.readBoolean();
-          set.add(new SchemaTypeInfo(tagName, isType, nsUri));
-        }
-        return set;
-      }
-    };
-  }
-
-  private static class NsPlusTag implements EncoderDecoder<Pair<String, String>, String> {
-    private final static NsPlusTag INSTANCE = new NsPlusTag();
-    private final static char ourSeparator = ':';
-
-    @Override
-    public String encode(Pair<String, String> pair) {
-      return pair.getFirst() + ourSeparator + pair.getSecond();
-    }
-
-    @Override
-    public Pair<String, String> decode(String s) {
-      final int i = s.indexOf(ourSeparator);
-      return i <= 0 ? Pair.create("", s) : Pair.create(s.substring(0, i), s.substring(i + 1));
-    }
-  }
-}
diff --git a/xml/impl/src/com/intellij/xml/index/XsdComplexTypeInfoBuilder.java b/xml/impl/src/com/intellij/xml/index/XsdComplexTypeInfoBuilder.java
deleted file mode 100644
index 75b8dd3..0000000
--- a/xml/impl/src/com/intellij/xml/index/XsdComplexTypeInfoBuilder.java
+++ /dev/null
@@ -1,225 +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.xml.index;
-
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.util.containers.MultiMap;
-import com.intellij.util.containers.hash.HashMap;
-import com.intellij.util.xml.NanoXmlUtil;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.Map;
-
-/**
- * Created with IntelliJ IDEA.
- * User: Irina.Chernushina
- * Date: 7/4/12
- * Time: 6:37 PM
- */
-public class XsdComplexTypeInfoBuilder extends NanoXmlUtil.IXMLBuilderAdapter {
-  private final static String SIGN = "";
-  public static final String HTTP_WWW_W3_ORG_2001_XMLSCHEMA = "http://www.w3.org/2001/XMLSchema";
-  // base type -> inherited types
-  private final MultiMap<SchemaTypeInfo, SchemaTypeInfo> myMap;
-  private NameSpaceHelper myNameSpaceHelper;
-  private static final Logger LOG = Logger.getInstance("#com.intellij.xml.index.XsdComplexTypeInfoBuilder");
-
-  public void setNameSpaceHelper(NameSpaceHelper nameSpaceHelper) {
-    myNameSpaceHelper = nameSpaceHelper;
-  }
-
-  public static MultiMap<SchemaTypeInfo, SchemaTypeInfo> parse(final InputStream is) {
-    return parse(new InputStreamReader(is));
-  }
-
-  public static MultiMap<SchemaTypeInfo, SchemaTypeInfo> parse(final Reader reader) {
-    try {
-      final XsdComplexTypeInfoBuilder builder = new XsdComplexTypeInfoBuilder();
-      final NameSpaceHelper helper = new NameSpaceHelper();
-      builder.setNameSpaceHelper(helper);
-      NanoXmlUtil.parse(reader, builder, helper);
-      final MultiMap<SchemaTypeInfo,SchemaTypeInfo> map = builder.getMap();
-      return map;
-    } finally {
-      try {
-        if (reader != null) {
-          reader.close();
-        }
-      }
-      catch (IOException e) {
-        // can never happen
-      }
-    }
-  }
-
-  private XsdComplexTypeInfoBuilder() {
-    myMap = new MultiMap<SchemaTypeInfo, SchemaTypeInfo>();
-  }
-
-  public MultiMap<SchemaTypeInfo, SchemaTypeInfo> getMap() {
-    return myMap;
-  }
-
-  // todo work with substitution groups also!
-
-  private String myCurrentElementName;
-  private String myCurrentElementNsName;
-  private String myCurrentComplexTypeName;
-  private String myCurrentComplexTypeNsName;
-  private String myCurrentSimpleTypeName;
-  private String myCurrentSimpleTypeNsName;
-
-  private boolean myInsideSchema;
-  private boolean myInsideRestriction;
-  private boolean myInsideExtension;
-  private boolean myInsideContent;
-
-  @Override
-  public void startElement(String name, String nsPrefix, String nsURI, String systemID, int lineNr) throws Exception {
-    if (! HTTP_WWW_W3_ORG_2001_XMLSCHEMA.equals(nsURI)) return;
-    myInsideSchema = false;
-    if ("schema".equals(name)) {
-      myInsideSchema = true;
-    } else if ("complexType".equals(name)) {
-      myCurrentComplexTypeName = SIGN;
-      myCurrentComplexTypeNsName = nsURI;
-    } else if ("simpleType".equals(name)) {
-      myCurrentSimpleTypeName = SIGN;
-      myCurrentSimpleTypeNsName = nsURI;
-    } else if ("element".equals(name)) {
-      myCurrentElementNsName = nsURI;
-      myCurrentElementName = SIGN;
-    } else if ("restriction".equals(name)) {
-      myInsideRestriction = true;
-    } else if ("extension".equals(name)) {
-      myInsideExtension = true;
-    } else if ("simpleContent".equals(name) || "complexContent".equals(name)) {
-      myInsideContent = true;
-    }
-  }
-
-  @Override
-  public void endElement(String name, String nsPrefix, String nsURI) throws Exception {
-    if (! HTTP_WWW_W3_ORG_2001_XMLSCHEMA.equals(nsURI)) return;
-    if ("schema".equals(name)) {
-      myInsideSchema = false;
-    } else if ("complexType".equals(name)) {
-      myCurrentComplexTypeName = null;
-      myCurrentComplexTypeNsName = null;
-    } else if ("simpleType".equals(name)) {
-      myCurrentSimpleTypeName = null;
-      myCurrentSimpleTypeNsName = null;
-    } else if ("element".equals(name)) {
-      myCurrentElementNsName = null;
-      myCurrentElementName = null;
-    } else if ("restriction".equals(name)) {
-      myInsideRestriction = false;
-    } else if ("extension".equals(name)) {
-      myInsideExtension = false;
-    } else if ("simpleContent".equals(name) || "complexContent".equals(name)) {
-      myInsideContent = false;
-    }
-  }
-
-  @Override
-  public void addAttribute(String key, String nsPrefix, String nsURI, String value, String type) throws Exception {
-    if (! StringUtil.isEmptyOrSpaces(nsURI) && ! HTTP_WWW_W3_ORG_2001_XMLSCHEMA.equals(nsURI)) return;
-    if ("base".equals(key)) {
-      if (myCurrentComplexTypeName != null && myInsideContent && (myInsideExtension || myInsideRestriction)) {
-        putTypeDataToMap(nsURI, value, myCurrentComplexTypeName, myCurrentComplexTypeNsName);
-      } else if (myCurrentSimpleTypeName != null && myInsideRestriction) {
-        putTypeDataToMap(nsURI, value, myCurrentSimpleTypeName, myCurrentSimpleTypeNsName);
-      }
-    } else if (myInsideSchema) {
-    } else if ("name".equals(key) || "ref".equals(key)) {
-      if (SIGN.equals(myCurrentElementName) && ! myInsideContent && ! myInsideExtension && ! myInsideRestriction && ! myInsideSchema &&
-        myCurrentComplexTypeName == null && myCurrentSimpleTypeName == null) {
-        myCurrentElementName = value;
-      } else if (SIGN.equals(myCurrentComplexTypeName) && ! myInsideContent && ! myInsideExtension && ! myInsideRestriction && ! myInsideSchema &&
-              myCurrentSimpleTypeName == null) {
-        myCurrentComplexTypeName = value;
-      } else if (SIGN.equals(myCurrentSimpleTypeName) && ! myInsideContent && ! myInsideExtension && ! myInsideRestriction && ! myInsideSchema &&
-                 myCurrentComplexTypeName == null) {
-        myCurrentSimpleTypeName = value;
-      }
-    }
-  }
-
-  private void putTypeDataToMap(String nsURI, String value, final String typeName, final String typeNamespace) {
-    /*final int separatorIdx = value.indexOf(':');
-    final String ns = separatorIdx <= 0 ? "" : new String(value.substring(0, separatorIdx));
-    final String element = separatorIdx <= 0 ? value : new String(value.substring(separatorIdx + 1));
-    String nsUri = myNameSpaceHelper.getNamespaces().get(ns);
-    nsUri = (nsUri == null ? ns : nsURI);*/
-
-    final boolean isAnonymous = SIGN.equals(typeName);
-    if (isAnonymous && myCurrentElementName != null) {
-      myMap.putValue(createSchemaTypeInfo(value, true), createSchemaTypeInfo(myCurrentElementName, false));
-    } else {
-      myMap.putValue(createSchemaTypeInfo(value, true), createSchemaTypeInfo(typeName, true));
-      //myMap.putValue(new SchemaTypeInfo(element, true, nsURI), new SchemaTypeInfo(typeName, true, typeNamespace));
-    }
-  }
-
-  private SchemaTypeInfo createSchemaTypeInfo(final String value, final boolean isType) {
-    final int separatorIdx = value.indexOf(':');
-    final String ns = separatorIdx <= 0 ? "" : new String(value.substring(0, separatorIdx));
-    final String element = separatorIdx <= 0 ? value : new String(value.substring(separatorIdx + 1));
-    String nsUri = myNameSpaceHelper.getNamespaces().get(ns);
-    nsUri = nsUri == null ? ns : nsUri;
-    return new SchemaTypeInfo(element, isType, nsUri);
-  }
-
-  private static class NameSpaceHelper extends NanoXmlUtil.EmptyValidator {
-    public static final String XMLNS = "xmlns";
-    public static final String XMLNS_ = "xmlns:";
-    private boolean myInSchema;
-    private final Map<String, String> myNamespaces;
-
-    private NameSpaceHelper() {
-      myNamespaces = new HashMap<String, String>();
-    }
-
-    @Override
-    public void attributeAdded(String key, String value, String systemId, int lineNr) {
-      super.attributeAdded(key, value, systemId, lineNr);
-      if (myInSchema) {
-        if (key.startsWith(XMLNS)) {
-          if (key.length() == XMLNS.length()) {
-            myNamespaces.put("", value);
-          } else if (key.startsWith(XMLNS_)) {
-            final String prefix = new String(key.substring(XMLNS_.length()));
-            myNamespaces.put(prefix, value);
-          }
-        }
-      }
-    }
-
-    @Override
-    public void elementStarted(String name, String systemId, int lineNr) {
-      super.elementStarted(name, systemId, lineNr);
-      myInSchema = "schema".equals(name) || name.endsWith(":schema");
-    }
-
-    public Map<String, String> getNamespaces() {
-      return myNamespaces;
-    }
-  }
-}
diff --git a/xml/impl/src/com/intellij/xml/index/XsdTagNameBuilder.java b/xml/impl/src/com/intellij/xml/index/XsdTagNameBuilder.java
deleted file mode 100644
index 1754fbd..0000000
--- a/xml/impl/src/com/intellij/xml/index/XsdTagNameBuilder.java
+++ /dev/null
@@ -1,74 +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.xml.index;
-
-import com.intellij.util.xml.NanoXmlUtil;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.Collection;
-
-/**
- * @author Dmitry Avdeev
- */
-public class XsdTagNameBuilder extends NanoXmlUtil.IXMLBuilderAdapter {
-
-  @Nullable
-  public static Collection<String> computeTagNames(final InputStream is) {
-    return computeTagNames(new InputStreamReader(is));
-  }
-
-  @Nullable
-  public static Collection<String> computeTagNames(final Reader reader) {
-    try {
-      final XsdTagNameBuilder builder = new XsdTagNameBuilder();
-      NanoXmlUtil.parse(reader, builder);
-      return builder.myTagNames;
-    }
-    finally {
-      try {
-        if (reader != null) {
-          reader.close();
-        }
-      }
-      catch (IOException e) {
-        // can never happen
-      }
-    }
-  }
-
-  private final Collection<String> myTagNames = new ArrayList<String>();
-  private boolean myElementStarted;
-
-  public void startElement(@NonNls final String name, @NonNls final String nsPrefix, @NonNls final String nsURI, final String systemID, final int lineNr)
-      throws Exception {
-
-    myElementStarted = nsPrefix != null && nsURI.equals("http://www.w3.org/2001/XMLSchema") && name.equals("element");
-  }
-
-  public void addAttribute(@NonNls final String key, final String nsPrefix, final String nsURI, final String value, final String type)
-      throws Exception {
-    if (myElementStarted && key.equals("name")) {
-      myTagNames.add(value);
-      myElementStarted = false;
-    }
-  }
-}
diff --git a/xml/impl/src/com/intellij/xml/refactoring/XmlTagInplaceRenamer.java b/xml/impl/src/com/intellij/xml/refactoring/XmlTagInplaceRenamer.java
index 828c7fa..83004f9 100644
--- a/xml/impl/src/com/intellij/xml/refactoring/XmlTagInplaceRenamer.java
+++ b/xml/impl/src/com/intellij/xml/refactoring/XmlTagInplaceRenamer.java
@@ -91,22 +91,27 @@
       myHighlighters = new ArrayList<RangeHighlighter>();
 
       CommandProcessor.getInstance().executeCommand(project, new Runnable() {
+        @Override
         public void run() {
           ApplicationManager.getApplication().runWriteAction(new Runnable() {
+            @Override
             public void run() {
               final int offset = myEditor.getCaretModel().getOffset();
               myEditor.getCaretModel().moveToOffset(tag.getTextOffset());
 
               final Template t = buildTemplate(tag, pair);
               TemplateManager.getInstance(project).startTemplate(myEditor, t, new TemplateEditingAdapter() {
+                @Override
                 public void templateFinished(final Template template, boolean brokenOff) {
                   finish();
                 }
 
+                @Override
                 public void templateCancelled(final Template template) {
                   finish();
                 }
               }, new PairProcessor<String, String>() {
+                @Override
                 public boolean process(final String variableName, final String value) {
                   return value.length() == 0 || value.charAt(value.length() - 1) != ' ';
                 }
@@ -162,10 +167,12 @@
     final ASTNode other = pair.second;
 
     builder.replaceElement(selected.getPsi(), PRIMARY_VARIABLE_NAME, new EmptyExpression() {
+      @Override
       public Result calculateQuickResult(final ExpressionContext context) {
         return new TextResult(selected.getText());
       }
 
+      @Override
       public Result calculateResult(final ExpressionContext context) {
         return new TextResult(selected.getText());
       }
diff --git a/xml/impl/src/com/intellij/xml/refactoring/XmlTagRenameDialog.java b/xml/impl/src/com/intellij/xml/refactoring/XmlTagRenameDialog.java
index e1e6465..80d2b82 100644
--- a/xml/impl/src/com/intellij/xml/refactoring/XmlTagRenameDialog.java
+++ b/xml/impl/src/com/intellij/xml/refactoring/XmlTagRenameDialog.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.
@@ -82,11 +82,13 @@
     validateButtons();
   }
 
+  @Override
   protected void dispose() {
     myNameSuggestionsField.removeDataChangedListener(myNameChangedListener);
     super.dispose();
   }
 
+  @Override
   protected boolean hasHelpAction() {
     return false;
   }
@@ -104,6 +106,7 @@
   private void createNewNameComponent() {
     myNameSuggestionsField = new NameSuggestionsField(new String[] { myTag.getName() }, myProject, FileTypes.PLAIN_TEXT, myEditor);
     myNameChangedListener = new NameSuggestionsField.DataChanged() {
+      @Override
       public void dataChanged() {
         validateButtons();
       }
@@ -111,6 +114,7 @@
     myNameSuggestionsField.addDataChangedListener(myNameChangedListener);
 
     myNameSuggestionsField.getComponent().registerKeyboardAction(new ActionListener() {
+      @Override
       public void actionPerformed(ActionEvent e) {
         completeVariable(myNameSuggestionsField.getEditor());
       }
@@ -129,12 +133,15 @@
     }
   }
 
+  @Override
   protected void doAction() {
     LOG.assertTrue(myElement.isValid());
 
     CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
+      @Override
       public void run() {
         ApplicationManager.getApplication().runWriteAction(new Runnable() {
+          @Override
           public void run() {
             try {
               myTag.setName(getNewName());
@@ -150,15 +157,18 @@
     close(DialogWrapper.OK_EXIT_CODE);
   }
 
+  @Override
   @Nullable
   protected JComponent createCenterPanel() {
     return null;
   }
 
+  @Override
   public JComponent getPreferredFocusedComponent() {
     return myNameSuggestionsField.getFocusableComponent();
   }
 
+  @Override
   protected JComponent createNorthPanel() {
     final JPanel panel = new JPanel();
     panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
@@ -172,6 +182,7 @@
     return panel;
   }
 
+  @Override
   protected void doHelpAction() {
     HelpManager.getInstance().invokeHelp(myHelpID);
   }
@@ -180,12 +191,14 @@
     return myNameSuggestionsField.getEnteredName().trim();
   }
 
+  @Override
   protected void validateButtons() {
     super.validateButtons();
 
     getPreviewAction().setEnabled(false);
   }
 
+  @Override
   protected boolean areButtonsValid() {
     final String newName = getNewName();
     return !StringUtil.containsAnyChar(newName, "\t ;*'\"\\/,()^&<>={}"); // RenameUtil.isValidName(myProject, myTag, newName); // IDEADEV-34531
diff --git a/xml/impl/src/com/intellij/xml/refactoring/XmlTagRenameHandler.java b/xml/impl/src/com/intellij/xml/refactoring/XmlTagRenameHandler.java
index d913b72..a4a51b9 100644
--- a/xml/impl/src/com/intellij/xml/refactoring/XmlTagRenameHandler.java
+++ b/xml/impl/src/com/intellij/xml/refactoring/XmlTagRenameHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -49,6 +49,7 @@
   private static final Logger LOG = Logger.getInstance("#com.intellij.xml.refactoring.XmlTagRenameHandler");
 
 
+  @Override
   public boolean isAvailableOnDataContext(final DataContext dataContext) {
     final PsiElement element = getElement(dataContext);
     if (element == null || PsiElementRenameHandler.isVetoed(element)) return false;
@@ -70,6 +71,7 @@
     return isDeclarationOutOfProjectOrAbsent(element.getProject(), dataContext);
   }
 
+  @Override
   public boolean isRenaming(final DataContext dataContext) {
     return isAvailableOnDataContext(dataContext);
   }
@@ -142,6 +144,7 @@
     }
   }
 
+  @Override
   public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file, @Nullable final DataContext dataContext) {
     if (!isRenaming(dataContext)) {
       return;
@@ -153,6 +156,7 @@
     invoke(editor, element, dataContext);
   }
 
+  @Override
   public void invoke(@NotNull final Project project, @NotNull final PsiElement[] elements, @Nullable final DataContext dataContext) {
     PsiElement element = elements.length == 1 ? elements[0] : null;
     if (element == null) {
diff --git a/xml/impl/src/com/intellij/xml/util/ColorIconCache.java b/xml/impl/src/com/intellij/xml/util/ColorIconCache.java
deleted file mode 100644
index c0f01ad..0000000
--- a/xml/impl/src/com/intellij/xml/util/ColorIconCache.java
+++ /dev/null
@@ -1,103 +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.xml.util;
-
-import com.intellij.util.containers.HashMap;
-import com.intellij.util.containers.SoftFactoryMap;
-import com.intellij.util.ui.EmptyIcon;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-import java.awt.*;
-import java.util.Map;
-
-/**
- * @author spleaner
- */
-public class ColorIconCache {
-  private static final ColorIconCache INSTANCE = new ColorIconCache();
-  private static final SoftFactoryMap<Color, Map<Integer, Icon>> ourCache = new SoftFactoryMap<Color, Map<Integer, Icon>>() {
-    @Override
-    protected Map<Integer, Icon> create(Color key) {
-      return new HashMap<Integer, Icon>();
-    }
-  };
-
-  private ColorIconCache() {
-  }
-
-  public static ColorIconCache getIconCache() {
-    return INSTANCE;
-  }
-
-  public Icon getIcon(@NotNull final Color color, final int size) {
-    Icon icon = ourCache.get(color).get(size);
-    if (icon == null) {
-      icon = new ColorIcon(size, color);
-      ourCache.get(color).put(size, icon);
-    }
-
-    return icon;
-  }
-
-  public static class ColorIcon extends EmptyIcon {
-    private Color myColor;
-    private Color[] myColours;
-
-    public ColorIcon(final int size, final Color color) {
-      super(size);
-      myColor = color;
-    }
-
-    public ColorIcon(final int size, final Color[] colours) {
-      super(size);
-      myColours = colours;
-    }
-
-    @Override
-    public void paintIcon(final Component component, final Graphics g, final int i, final int j) {
-      final int iconWidth = getIconWidth();
-      final int iconHeight = getIconHeight();
-      if (myColor != null) {
-        g.setColor(myColor);
-        g.fillRect(i, j, iconWidth, iconHeight);
-      }
-      else if (myColours != null) {
-        final Color top = myColours[0];
-        g.setColor(top);
-        g.fillRect(i, j, iconWidth, 2);
-
-        final Color right = myColours[1];
-        g.setColor(right);
-        g.fillRect(i + iconWidth / 2, j + 2, iconWidth / 2, iconHeight / 2);
-
-        final Color bottom = myColours[2];
-        g.setColor(bottom);
-        g.fillRect(i, j + iconHeight - 2, iconWidth, 2);
-
-        final Color left = myColours[3];
-        g.setColor(left);
-        g.fillRect(i, j + 2, iconWidth / 2, iconHeight / 2);
-      }
-
-      final Composite old = ((Graphics2D)g).getComposite();
-      ((Graphics2D)g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.1f));
-      g.setColor(Color.BLACK);
-      g.drawRect(i, j, iconWidth-1, iconHeight-1);
-      ((Graphics2D)g).setComposite(old);
-    }
-  }
-}
diff --git a/xml/impl/src/com/intellij/xml/util/ColorSampleLookupValue.java b/xml/impl/src/com/intellij/xml/util/ColorSampleLookupValue.java
index 07f316d..7b383dd 100644
--- a/xml/impl/src/com/intellij/xml/util/ColorSampleLookupValue.java
+++ b/xml/impl/src/com/intellij/xml/util/ColorSampleLookupValue.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -52,6 +52,7 @@
     myIsStandard = isStandard;
   }
 
+  @Override
   public String getPresentation() {
     return myName != null ? myName : myValue;
   }
@@ -64,6 +65,7 @@
     return myIsStandard;
   }
 
+  @Override
   public Icon getIcon(int flags) {
     if (myColor == null) {
       if (myValue.startsWith("#")) {
@@ -83,6 +85,7 @@
     return null;
   }
 
+  @Override
   public boolean handleUserSelection(LookupItem item, Project project) {
     if (!myIsStandard) {
       item.setLookupString(myValue);
@@ -135,16 +138,19 @@
     return ourColors;
   }
 
+  @Override
   @Nullable
   public String getTypeHint() {
     return myValue != null && myValue.charAt(0) == '#' ? myValue : null;
   }
 
+  @Override
   @Nullable
   public Color getColorHint() {
     return null;
   }
 
+  @Override
   public boolean isBold() {
     return false;
   }
@@ -153,6 +159,7 @@
     return myName;
   }
 
+  @Override
   public int getPriority() {
     return myName == null || Character.isLowerCase(myName.charAt(0)) ? HIGHER : NORMAL;
   }
diff --git a/xml/impl/src/com/intellij/xml/util/HtmlFileNSInfoProvider.java b/xml/impl/src/com/intellij/xml/util/HtmlFileNSInfoProvider.java
deleted file mode 100644
index e9da057..0000000
--- a/xml/impl/src/com/intellij/xml/util/HtmlFileNSInfoProvider.java
+++ /dev/null
@@ -1,39 +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.xml.util;
-
-import com.intellij.ide.highlighter.HtmlFileType;
-import com.intellij.ide.highlighter.XHtmlFileType;
-import com.intellij.psi.xml.XmlFile;
-import com.intellij.psi.xml.XmlFileNSInfoProvider;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author yole
- */
-public class HtmlFileNSInfoProvider implements XmlFileNSInfoProvider {
-  @Nullable
-  @Override
-  public String[][] getDefaultNamespaces(@NotNull XmlFile file) {
-    return null;
-  }
-
-  @Override
-  public boolean overrideNamespaceFromDocType(@NotNull XmlFile file) {
-    return file.getFileType() == HtmlFileType.INSTANCE || file.getFileType() == XHtmlFileType.INSTANCE;
-  }
-}
diff --git a/xml/impl/src/com/intellij/xml/util/XmlIconProvider.java b/xml/impl/src/com/intellij/xml/util/XmlIconProvider.java
deleted file mode 100644
index e12801d..0000000
--- a/xml/impl/src/com/intellij/xml/util/XmlIconProvider.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.xml.util;
-
-import com.intellij.icons.AllIcons;
-import com.intellij.ide.IconProvider;
-import com.intellij.openapi.project.DumbAware;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.impl.ElementBase;
-import com.intellij.psi.xml.XmlFile;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.*;
-
-/**
- * @author peter
- */
-public class XmlIconProvider extends IconProvider implements DumbAware {
-  @NonNls private static final String XSD_FILE_EXTENSION = "xsd";
-  @NonNls private static final String WSDL_FILE_EXTENSION = "wsdl";
-
-  @Nullable
-  public Icon getIcon(@NotNull final PsiElement element, final int _flags) {
-    if (element instanceof XmlFile) {
-      final VirtualFile vf = ((XmlFile)element).getVirtualFile();
-      if (vf != null) {
-        final String extension = vf.getExtension();
-        
-        if (XSD_FILE_EXTENSION.equals(extension)) {
-          return ElementBase.createLayeredIcon(element, AllIcons.FileTypes.XsdFile, ElementBase.transformFlags(element, _flags));
-        }
-        if (WSDL_FILE_EXTENSION.equals(extension)) {
-          return ElementBase.createLayeredIcon(element, AllIcons.FileTypes.WsdlFile, ElementBase.transformFlags(element, _flags));
-        }
-      }
-    }
-    return null;
-  }
-
-}
diff --git a/xml/impl/src/com/intellij/xml/util/XmlPrefixReferenceProvider.java b/xml/impl/src/com/intellij/xml/util/XmlPrefixReferenceProvider.java
deleted file mode 100644
index a740db0..0000000
--- a/xml/impl/src/com/intellij/xml/util/XmlPrefixReferenceProvider.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.intellij.xml.util;
-
-import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiReference;
-import com.intellij.psi.PsiReferenceProvider;
-import com.intellij.psi.impl.source.xml.SchemaPrefixReference;
-import com.intellij.psi.xml.XmlAttribute;
-import com.intellij.psi.xml.XmlAttributeValue;
-import com.intellij.psi.xml.XmlTag;
-import com.intellij.util.ProcessingContext;
-import com.intellij.xml.XmlAttributeDescriptor;
-import com.intellij.xml.impl.schema.XmlAttributeDescriptorImpl;
-import com.intellij.xml.impl.schema.XmlNSDescriptorImpl;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Dmitry Avdeev
- */
-public class XmlPrefixReferenceProvider extends PsiReferenceProvider {
-
-  @NotNull
-  @Override
-  public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
-    XmlAttributeValue attributeValue = (XmlAttributeValue)element;
-    String value = attributeValue.getValue();
-    if (value == null) return PsiReference.EMPTY_ARRAY;
-    int i = value.indexOf(':');
-    if (i <= 0) return PsiReference.EMPTY_ARRAY;
-    PsiElement parent = attributeValue.getParent();
-    if (parent instanceof XmlAttribute && !XmlNSDescriptorImpl.checkSchemaNamespace(((XmlAttribute)parent).getParent())) {
-      XmlAttributeDescriptor descriptor = ((XmlAttribute)parent).getDescriptor();
-      if (descriptor instanceof XmlAttributeDescriptorImpl) {
-        String type = ((XmlAttributeDescriptorImpl)descriptor).getType();
-        if (type != null && type.endsWith(":QName")) {
-          String prefix = XmlUtil.findPrefixByQualifiedName(type);
-          String ns = ((XmlTag)descriptor.getDeclaration()).getNamespaceByPrefix(prefix);
-          if (XmlNSDescriptorImpl.checkSchemaNamespace(ns)) {
-            return new PsiReference[] {
-              new SchemaPrefixReference(attributeValue, TextRange.from(1, i), value.substring(0, i), null)
-            };
-          }
-        }
-      }
-    }
-    return PsiReference.EMPTY_ARRAY;
-  }
-}
diff --git a/xml/impl/src/com/intellij/xml/util/XmlReferenceContributor.java b/xml/impl/src/com/intellij/xml/util/XmlReferenceContributor.java
index fa04ab0..7e5977a 100644
--- a/xml/impl/src/com/intellij/xml/util/XmlReferenceContributor.java
+++ b/xml/impl/src/com/intellij/xml/util/XmlReferenceContributor.java
@@ -1,3 +1,18 @@
+/*
+ * 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.xml.util;
 
 import com.intellij.codeInsight.daemon.impl.analysis.encoding.XmlEncodingReferenceProvider;
@@ -23,6 +38,7 @@
  * @author peter
  */
 public class XmlReferenceContributor extends PsiReferenceContributor {
+  @Override
   public void registerReferenceProviders(final PsiReferenceRegistrar registrar) {
 
     final IdReferenceProvider idReferenceProvider = new IdReferenceProvider();
diff --git a/xml/impl/src/com/intellij/xml/util/documentation/HtmlDocumentationProvider.java b/xml/impl/src/com/intellij/xml/util/documentation/HtmlDocumentationProvider.java
index 3f26003..11fb4a7 100644
--- a/xml/impl/src/com/intellij/xml/util/documentation/HtmlDocumentationProvider.java
+++ b/xml/impl/src/com/intellij/xml/util/documentation/HtmlDocumentationProvider.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.
@@ -52,6 +52,7 @@
     ourStyleProvider = documentationProvider;
   }
 
+  @Override
   @Nullable
   public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) {
     if (element instanceof SchemaPrefix) {
@@ -60,6 +61,7 @@
     return null;
   }
 
+  @Override
   public List<String> getUrlFor(PsiElement element, PsiElement originalElement) {
     String result = getUrlForHtml(element, PsiTreeUtil.getParentOfType(originalElement,XmlTag.class,false));
 
@@ -148,6 +150,7 @@
     return attributeDescriptor;
   }
 
+  @Override
   public String generateDoc(PsiElement element, PsiElement originalElement) {
     final XmlTag tag = PsiTreeUtil.getParentOfType(originalElement, XmlTag.class, false);
     String result = generateDocForHtml(element, false, tag, originalElement);
@@ -222,15 +225,15 @@
     }
 
     char dtdId = descriptor.getDtd();
-    boolean deprecated = dtdId == HtmlTagDescriptor.LOOSE_DTD;
+    boolean deprecated = dtdId == EntityDescriptor.LOOSE_DTD;
     if (deprecated) {
       buf.append(XmlBundle.message("xml.javadoc.deprecated.message", deprecated)).append(BR);
     }
 
-    if (dtdId == HtmlTagDescriptor.LOOSE_DTD) {
+    if (dtdId == EntityDescriptor.LOOSE_DTD) {
       buf.append(XmlBundle.message("xml.javadoc.defined.in.loose.dtd.message"));
     }
-    else if (dtdId == HtmlTagDescriptor.FRAME_DTD) {
+    else if (dtdId == EntityDescriptor.FRAME_DTD) {
       buf.append(XmlBundle.message("xml.javadoc.defined.in.frameset.dtd.message"));
     }
     else {
@@ -248,6 +251,7 @@
     return buf.toString();
   }
 
+  @Override
   public PsiElement getDocumentationElementForLookupItem(PsiManager psiManager, Object object, PsiElement element) {
     PsiElement result = createNavigationElementHTML(psiManager, object.toString(),element);
 
@@ -263,6 +267,7 @@
     return result;
   }
 
+  @Override
   public PsiElement getDocumentationElementForLink(PsiManager psiManager, String link, PsiElement context) {
     PsiElement result = createNavigationElementHTML(psiManager, link, context);
 
diff --git a/xml/impl/src/com/intellij/xml/util/documentation/XHtmlDocumentationProvider.java b/xml/impl/src/com/intellij/xml/util/documentation/XHtmlDocumentationProvider.java
index f03f8d7..70ee74f 100644
--- a/xml/impl/src/com/intellij/xml/util/documentation/XHtmlDocumentationProvider.java
+++ b/xml/impl/src/com/intellij/xml/util/documentation/XHtmlDocumentationProvider.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.
@@ -25,10 +25,12 @@
  */
 public class XHtmlDocumentationProvider extends HtmlDocumentationProvider {
 
+  @Override
   protected String generateDocForHtml(PsiElement element, boolean ommitHtmlSpecifics, XmlTag context, PsiElement originalElement) {
     return super.generateDocForHtml(element, true, context, originalElement);
   }
 
+  @Override
   protected XmlTag findTagContext(PsiElement context) {
     XmlTag tagBeforeWhiteSpace = findTagBeforeWhiteSpace(context);
     if (tagBeforeWhiteSpace != null) return tagBeforeWhiteSpace;
@@ -50,6 +52,7 @@
     return null;
   }
 
+  @Override
   protected boolean isAttributeContext(PsiElement context) {
     if (findTagBeforeWhiteSpace(context) != null) return false;
 
diff --git a/xml/impl/src/com/intellij/xml/util/documentation/XmlDocumentationProvider.java b/xml/impl/src/com/intellij/xml/util/documentation/XmlDocumentationProvider.java
index b464d56..2d6b70e 100644
--- a/xml/impl/src/com/intellij/xml/util/documentation/XmlDocumentationProvider.java
+++ b/xml/impl/src/com/intellij/xml/util/documentation/XmlDocumentationProvider.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.
@@ -56,6 +56,7 @@
   @NonNls private static final String BASE_SITEPOINT_URL = "http://reference.sitepoint.com/html/";
 
 
+  @Override
   @Nullable
   public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) {
     if (element instanceof SchemaPrefix) {
@@ -64,6 +65,7 @@
     return null;
   }
 
+  @Override
   public List<String> getUrlFor(PsiElement element, PsiElement originalElement) {
     if (element instanceof XmlTag) {
       XmlTag tag = (XmlTag)element;
@@ -84,6 +86,7 @@
     return null;
   }
 
+  @Override
   public String generateDoc(PsiElement element, final PsiElement originalElement) {
     if (element instanceof XmlElementDecl) {
       PsiElement curElement = findPreviousComment(element);
@@ -176,6 +179,7 @@
     final Ref<XmlTag> enumerationTag = new Ref<XmlTag>();
 
     Processor<XmlTag> processor = new Processor<XmlTag>() {
+      @Override
       public boolean process(XmlTag xmlTag) {
         if (text.equals(xmlTag.getAttributeValue(XmlUtil.VALUE_ATTR_NAME))) {
           enumerationTag.set(xmlTag);
@@ -331,6 +335,7 @@
     return builder.toString();
   }
 
+  @Override
   public PsiElement getDocumentationElementForLookupItem(final PsiManager psiManager, Object object, PsiElement element) {
 
     if (object instanceof XmlExtension.TagInfo) {
@@ -370,7 +375,7 @@
 
       if (object == null) return null;
       try {
-        @NonNls StringBuffer tagText = new StringBuffer(object.toString());
+        @NonNls StringBuilder tagText = new StringBuilder(object.toString());
         String namespacePrefix = XmlUtil.findPrefixByQualifiedName(object.toString());
         String namespace = xmlTag.getNamespaceByPrefix(namespacePrefix);
 
@@ -450,6 +455,7 @@
       XmlUtil.processXmlElements(
         xmlFile,
         new PsiElementProcessor() {
+          @Override
           public boolean execute(@NotNull final PsiElement element) {
             if (element instanceof XmlEntityDecl) {
               final XmlEntityDecl entityDecl = (XmlEntityDecl)element;
@@ -475,6 +481,7 @@
     return null;
   }
 
+  @Override
   public PsiElement getDocumentationElementForLink(final PsiManager psiManager, String link, PsiElement context) {
     return null;
   }
@@ -487,6 +494,7 @@
     private @NonNls static final String CDATA_PREFIX = "<![CDATA[";
     private @NonNls static final String CDATA_SUFFIX = "]]>";
 
+    @Override
     public boolean execute(@NotNull PsiElement element) {
       if (element instanceof XmlTag &&
           ((XmlTag)element).getLocalName().equals(DOCUMENTATION_ELEMENT_LOCAL_NAME)
diff --git a/xml/openapi/src/com/intellij/xml/breadcrumbs/BreadcrumbsComponent.java b/xml/openapi/src/com/intellij/xml/breadcrumbs/BreadcrumbsComponent.java
index 9e3b5ae..9cb5708 100644
--- a/xml/openapi/src/com/intellij/xml/breadcrumbs/BreadcrumbsComponent.java
+++ b/xml/openapi/src/com/intellij/xml/breadcrumbs/BreadcrumbsComponent.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.
@@ -54,7 +54,7 @@
     addMouseListener(myMouseListener);
     addMouseMotionListener(myMouseListener);
 
-    setToolTipText(new String());
+    setToolTipText("");
   }
 
   public void setItems(@Nullable final List<T> itemsList) {
@@ -74,6 +74,7 @@
     myListeners.remove(listener);
   }
 
+  @Override
   public String getToolTipText(final MouseEvent event) {
     final Crumb c = getCrumb(event.getPoint());
     if (c != null) {
@@ -145,6 +146,7 @@
     repaint();
   }
 
+  @Override
   public void paint(final Graphics g) {
     final Graphics2D g2 = ((Graphics2D)g);
     final Dimension d = getSize();
@@ -335,19 +337,23 @@
     return totalWidth;
   }
 
+  @Override
   public Dimension getMinimumSize() {
     return getPreferredSize();
   }
 
+  @Override
   public Dimension getPreferredSize() {
     final Graphics2D g2 = (Graphics2D)getGraphics();
     return new Dimension(Integer.MAX_VALUE, g2 != null ? DEFAULT_PAINTER.getSize("DUMMY", g2.getFontMetrics(), Integer.MAX_VALUE).height + 1 : 1);
   }
 
+  @Override
   public Dimension getMaximumSize() {
     return getPreferredSize();
   }
 
+  @Override
   public void dispose() {
     removeMouseListener(myMouseListener);
     removeMouseMotionListener(myMouseListener);
@@ -419,10 +425,12 @@
       myBreadcrumbs = line;
     }
 
+    @Override
     public void mouseDragged(final MouseEvent e) {
       // nothing
     }
 
+    @Override
     public void mouseMoved(final MouseEvent e) {
       final Crumb crumb = myBreadcrumbs.getCrumb(e.getPoint());
       if (crumb != myHoveredCrumb) {
@@ -431,14 +439,17 @@
       }
     }
 
+    @Override
     public void mouseExited(final MouseEvent e) {
       mouseMoved(e);
     }
 
+    @Override
     public void mouseEntered(final MouseEvent e) {
       mouseMoved(e);
     }
 
+    @Override
     public void mouseClicked(final MouseEvent e) {
       final Crumb crumb = myBreadcrumbs.getCrumb(e.getPoint());
       if (crumb != null) {
@@ -448,9 +459,9 @@
   }
 
   private static class Crumb<T extends BreadcrumbsItem> {
-    private String myString;
+    private final String myString;
     private int myOffset = -1;
-    private int myWidth;
+    private final int myWidth;
     private T myItem;
     private BreadcrumbsComponent myLine;
     private boolean mySelected;
@@ -552,6 +563,7 @@
       myLine = line;
     }
 
+    @Override
     public void performAction(final int modifiers) {
       if (myForward) {
         myLine.nextPage();
@@ -567,10 +579,12 @@
       super(null, width);
     }
 
+    @Override
     public void paint(@NotNull final Graphics2D g2, @NotNull final Painter painter, final int height, final int pageOffset) {
       // does nothing
     }
 
+    @Override
     public void performAction(final int modifiers) {
       // does nothing
     }
@@ -632,6 +646,7 @@
       return DEFAULT_BG_COLOR;
     }
 
+    @Override
     @Nullable
     Color getBackgroundColor(@NotNull final Crumb c) {
       final BreadcrumbsItem item = c.getItem();
@@ -644,6 +659,7 @@
       return getBackgroundColor(c.isSelected(), c.isHovered(), c.isLight(), c instanceof NavigationCrumb);
     }
 
+    @Override
     @Nullable
     Color getForegroundColor(@NotNull final Crumb c) {
       if (c.isLight() && !c.isHovered() && !(c instanceof NavigationCrumb)) {
@@ -653,6 +669,7 @@
       return super.getForegroundColor(c);
     }
 
+    @Override
     @Nullable
     Color getBorderColor(@NotNull final Crumb c) {
       return (c.isLight() && !c.isHovered() && !(c instanceof NavigationCrumb)) ? LIGHT_BORDER_COLOR : DEFAULT_BORDER_COLOR;
@@ -687,6 +704,7 @@
       super(s);
     }
 
+    @Override
     public void paint(@NotNull final Crumb c, @NotNull final Graphics2D g2, final int height, final int pageOffset) {
       final PainterSettings s = getSettings();
       final Font oldFont = g2.getFont();
@@ -720,7 +738,7 @@
       String string = c.getString();
       if (fm.stringWidth(string) > width) {
         final int dotsWidth = fm.stringWidth("...");
-        final StringBuffer sb = new StringBuffer();
+        final StringBuilder sb = new StringBuilder();
         int length = 0;
         for (int i = 0; i < string.length(); i++) {
           final int charWidth = fm.charWidth(string.charAt(i));
@@ -741,6 +759,7 @@
       g2.setFont(oldFont);
     }
 
+    @Override
     @NotNull
     Dimension getSize(@NotNull @NonNls final String s, @NotNull final FontMetrics fm, final int maxWidth) {
       final int width = fm.stringWidth(s) + (ROUND_VALUE * 2);
diff --git a/xml/relaxng/src/org/intellij/html/RelaxedHtmlFromRngElementDescriptor.java b/xml/relaxng/src/org/intellij/html/RelaxedHtmlFromRngElementDescriptor.java
index 6abb420..08ada22 100644
--- a/xml/relaxng/src/org/intellij/html/RelaxedHtmlFromRngElementDescriptor.java
+++ b/xml/relaxng/src/org/intellij/html/RelaxedHtmlFromRngElementDescriptor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -33,6 +33,7 @@
     myDelegate = delegate;
   }
 
+  @Override
   public XmlElementDescriptor getElementDescriptor(XmlTag childTag, XmlTag contextTag) {
     XmlElementDescriptor elementDescriptor = myDelegate.getElementDescriptor(childTag, contextTag);
 
@@ -53,6 +54,7 @@
     return myDelegate.getDefaultName();
   }
 
+  @Override
   public XmlElementDescriptor[] getElementsDescriptors(final XmlTag context) {
     return ArrayUtil.mergeArrays(
       myDelegate.getElementsDescriptors(context),
@@ -60,6 +62,7 @@
     );
   }
 
+  @Override
   public XmlAttributeDescriptor[] getAttributesDescriptors(final XmlTag context) {
     return RelaxedHtmlFromSchemaElementDescriptor.addAttrDescriptorsForFacelets(context, myDelegate.getAttributesDescriptors(context));
   }
@@ -89,6 +92,7 @@
     return null;
   }
 
+  @Override
   public XmlAttributeDescriptor getAttributeDescriptor(String attributeName, final XmlTag context) {
     final XmlAttributeDescriptor descriptor = myDelegate.getAttributeDescriptor(attributeName.toLowerCase(), context);
     if (descriptor != null) return descriptor;
diff --git a/xml/relaxng/src/org/intellij/html/RelaxedHtmlFromRngNSDescriptor.java b/xml/relaxng/src/org/intellij/html/RelaxedHtmlFromRngNSDescriptor.java
index 984f50d..7ceb911 100644
--- a/xml/relaxng/src/org/intellij/html/RelaxedHtmlFromRngNSDescriptor.java
+++ b/xml/relaxng/src/org/intellij/html/RelaxedHtmlFromRngNSDescriptor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -34,6 +34,7 @@
 public class RelaxedHtmlFromRngNSDescriptor extends RngNsDescriptor implements RelaxedHtmlNSDescriptor {
   private static final Logger LOG = Logger.getInstance("#org.intellij.html.RelaxedHtmlFromRngNSDescriptor");
 
+  @Override
   public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) {
     XmlElementDescriptor elementDescriptor = super.getElementDescriptor(tag);
 
@@ -61,6 +62,7 @@
     return new RelaxedHtmlFromRngElementDescriptor(descriptor);
   }
 
+  @Override
   @NotNull
   public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable final XmlDocument doc) {
     return ArrayUtil.mergeArrays(super.getRootElementsDescriptors(doc), HtmlUtil.getCustomTagDescriptors(doc));
diff --git a/xml/relaxng/src/org/intellij/html/RngHtml5MetaDataContributor.java b/xml/relaxng/src/org/intellij/html/RngHtml5MetaDataContributor.java
index 5bdfd43..a367deb 100644
--- a/xml/relaxng/src/org/intellij/html/RngHtml5MetaDataContributor.java
+++ b/xml/relaxng/src/org/intellij/html/RngHtml5MetaDataContributor.java
@@ -48,10 +48,12 @@
       super(namespaces);
     }
 
+    @Override
     public boolean isClassAcceptable(Class hintClass) {
       return ReflectionUtil.isAssignable(RncDocument.class, hintClass);
     }
 
+    @Override
     public boolean isAcceptable(Object element, PsiElement context) {
       if (!(element instanceof RncDocument)) {
         return false;
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/ApplicationLoader.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/ApplicationLoader.java
index 8b812f3..ea44c0c 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/ApplicationLoader.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/ApplicationLoader.java
@@ -51,12 +51,14 @@
   private static final String VALIDATE_XML = "ValidateXml";
   public static final String RNG_NAMESPACE = "http://relaxng.org/ns/structure/1.0";
 
+  @Override
   @NonNls
   @NotNull
   public String getComponentName() {
     return "Relax-NG";
   }
 
+  @Override
   public void initComponent() {
     registerMetaData();
 
@@ -84,6 +86,7 @@
             RngNsDescriptor.class);
 
     registrar.registerMetaData(new ElementFilter() {
+      @Override
       public boolean isAcceptable(Object element, PsiElement context) {
         if (element instanceof XmlTag) {
           final XmlTag tag = (XmlTag)element;
@@ -93,12 +96,14 @@
         return false;
       }
 
+      @Override
       public boolean isClassAcceptable(Class hintClass) {
         return XmlTag.class.isAssignableFrom(hintClass);
       }
     }, RngDefineMetaData.class);
   }
 
+  @Override
   public void disposeComponent() {
   }
 
@@ -110,6 +115,7 @@
   }
 
   public static class ResourceProvider implements StandardResourceProvider {
+    @Override
     public void registerResources(ResourceRegistrar registrar) {
       registrar.addStdResource(RNG_NAMESPACE, "/resources/relaxng.rng", getClass());
       registrar.addIgnoredResource("http://relaxng.org/ns/compatibility/annotations/1.0");
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/GotoSymbolContributor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/GotoSymbolContributor.java
index 48e001b..7fac083 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/GotoSymbolContributor.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/GotoSymbolContributor.java
@@ -32,11 +32,13 @@
 */
 public class GotoSymbolContributor implements ChooseByNameContributor {
 
+  @Override
   @NotNull
   public NavigationItem[] getItemsByName(String name, String pattern, Project project, boolean includeNonProjectItems) {
     return RelaxSymbolIndex.getSymbolsByName(name, project, includeNonProjectItems);
   }
 
+  @Override
   @NotNull
   public String[] getNames(Project project, boolean includeNonProjectItems) {
     final Collection<String> names = RelaxSymbolIndex.getSymbolNames(project);
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/RelaxNGReferenceContributor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/RelaxNGReferenceContributor.java
index 216271f..c9317dd 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/RelaxNGReferenceContributor.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/RelaxNGReferenceContributor.java
@@ -1,14 +1,27 @@
+/*
+ * 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 org.intellij.plugins.relaxNG;
 
 import com.intellij.patterns.XmlNamedElementPattern;
 import com.intellij.psi.PsiReferenceContributor;
 import com.intellij.psi.PsiReferenceRegistrar;
 import com.intellij.psi.filters.position.PatternFilter;
-import com.intellij.psi.xml.XmlTag;
 import com.intellij.xml.util.XmlUtil;
 import org.intellij.plugins.relaxNG.references.PrefixReferenceProvider;
 
-import static com.intellij.patterns.StandardPatterns.string;
 import static com.intellij.patterns.XmlPatterns.*;
 
 /**
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/RngDocumentationProvider.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/RngDocumentationProvider.java
index de71f0d..fe15a25 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/RngDocumentationProvider.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/RngDocumentationProvider.java
@@ -50,6 +50,7 @@
   @NonNls
   private static final String COMPATIBILITY_ANNOTATIONS_1_0 = "http://relaxng.org/ns/compatibility/annotations/1.0";
 
+  @Override
   @Nullable
   public String generateDoc(PsiElement element, @Nullable PsiElement originalElement) {
     final XmlElement c = PsiTreeUtil.getParentOfType(originalElement, XmlTag.class, XmlAttribute.class);
@@ -133,21 +134,25 @@
     return null;
   }
 
+  @Override
   @Nullable
   public PsiElement getDocumentationElementForLink(PsiManager psiManager, String link, PsiElement context) {
     return null;
   }
 
+  @Override
   @Nullable
   public PsiElement getDocumentationElementForLookupItem(PsiManager psiManager, Object object, PsiElement element) {
     return null;
   }
 
+  @Override
   @Nullable
   public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) {
     return null;
   }
 
+  @Override
   public List<String> getUrlFor(PsiElement element, PsiElement originalElement) {
     return null;
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/RngDomFileDescription.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/RngDomFileDescription.java
index 7e1e2a2..236b03d 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/RngDomFileDescription.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/RngDomFileDescription.java
@@ -1,3 +1,18 @@
+/*
+ * 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 org.intellij.plugins.relaxNG;
 
 import com.intellij.util.xml.DomFileDescription;
@@ -14,10 +29,12 @@
     registerNamespacePolicy("RELAX-NG", ApplicationLoader.RNG_NAMESPACE);
   }
 
+  @Override
   public boolean isAutomaticHighlightingEnabled() {
     return true;
   }
 
+  @Override
   public DomElementsAnnotator createAnnotator() {
     return new ModelAnnotator();
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncCompletionData.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncCompletionData.java
index c837393..9b2053d 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncCompletionData.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncCompletionData.java
@@ -52,10 +52,12 @@
 
     final CompletionVariant variant = new CompletionVariant(new AndFilter(
             new ElementFilter() {
+              @Override
               public boolean isAcceptable(Object element, PsiElement context) {
                 return true;
               }
 
+              @Override
               public boolean isClassAcceptable(Class hintClass) {
                 return PsiElement.class.isAssignableFrom(hintClass);
               }
@@ -97,8 +99,10 @@
     private static final String[] PATTERN_KEYWORDS = new String[]{ "attribute", "element", "grammar",
             "notAllowed", "text", "empty", "external", "parent", "list", "mixed" };
 
+    @Override
     public Object[] get(PsiElement context, CompletionContext completionContext) {
       return ContainerUtil.map2Array(doGetKeywords(context), LookupElement.class, new Function<String, LookupElement>() {
+        @Override
         public LookupElement fun(String s) {
           return TailTypeDecorator.withTail(LookupElementBuilder.create(s).bold(), TailType.SPACE);
         }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncElementTypeEx.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncElementTypeEx.java
index 76274c5..6f3af07 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncElementTypeEx.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncElementTypeEx.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -39,6 +39,7 @@
     }
   }
 
+  @Override
   @NotNull
   public final C fun(ASTNode node) {
     try {
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncElementTypes.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncElementTypes.java
index 7454d69..95a6b22 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncElementTypes.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncElementTypes.java
@@ -17,7 +17,6 @@
 package org.intellij.plugins.relaxNG.compact;
 
 import com.intellij.psi.tree.IElementType;
-import com.intellij.psi.tree.IFileElementType;
 import org.intellij.plugins.relaxNG.compact.psi.*;
 import org.intellij.plugins.relaxNG.compact.psi.impl.*;
 
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncFileType.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncFileType.java
index 4e5a501..eb7e763 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncFileType.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncFileType.java
@@ -41,23 +41,27 @@
     super(RngCompactLanguage.INSTANCE);
   }
 
+  @Override
   @NotNull
   @NonNls
   public String getName() {
     return "RNG Compact";
   }
 
+  @Override
   @NotNull
   public String getDescription() {
     return "RELAX NG Compact Syntax";
   }
 
+  @Override
   @NotNull
   @NonNls
   public String getDefaultExtension() {
     return "rnc";
   }
 
+  @Override
   @Nullable
   public Icon getIcon() {
     return AllIcons.FileTypes.Text;
@@ -68,6 +72,7 @@
   }
 
   public static class Factory extends FileTypeFactory {
+    @Override
     public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
       fileTypeConsumer.consume(INSTANCE, RNC_EXT);
     }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncHighlighter.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncHighlighter.java
index f73aa00..fb1fccc 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncHighlighter.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncHighlighter.java
@@ -35,6 +35,7 @@
  * Date: 04.08.2007
  */
 public class RncHighlighter extends SyntaxHighlighterBase {
+  @Override
   @NotNull
   public Lexer getHighlightingLexer() {
     return new CompactSyntaxLexerAdapter();
@@ -69,6 +70,7 @@
     ourMap1.put(RncTokenTypes.ILLEGAL_CHAR, HighlighterColors.BAD_CHARACTER);
   }
 
+  @Override
   @NotNull
   public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
     return pack(ourMap1.get(tokenType));
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncParserDefinition.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncParserDefinition.java
index 431b40e..3d16fa2 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncParserDefinition.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncParserDefinition.java
@@ -45,34 +45,41 @@
   public static final IFileElementType FILE_ELEMENT_TYPE = new IFileElementType(RngCompactLanguage.INSTANCE);
   private static final TokenSet myCommentTypes = TokenSet.orSet(RncTokenTypes.COMMENTS, RncTokenTypes.DOC_TOKENS);
 
+  @Override
   @NotNull
   public Lexer createLexer(Project project) {
     return new CompactSyntaxLexerAdapter();
   }
 
+  @Override
   public PsiParser createParser(Project project) {
     return new RncParser();
   }
 
+  @Override
   public IFileElementType getFileNodeType() {
     return FILE_ELEMENT_TYPE;
   }
 
+  @Override
   @NotNull
   public TokenSet getWhitespaceTokens() {
     return TokenSet.create(TokenType.WHITE_SPACE);
   }
 
+  @Override
   @NotNull
   public TokenSet getCommentTokens() {
     return myCommentTypes;
   }
 
+  @Override
   @NotNull
   public TokenSet getStringLiteralElements() {
     return TokenSet.create(RncTokenTypes.LITERAL);
   }
 
+  @Override
   @NotNull
   @SuppressWarnings({ "unchecked" })
   public PsiElement createElement(ASTNode node) {
@@ -85,10 +92,12 @@
     return new MyRncElement(node);
   }
 
+  @Override
   public PsiFile createFile(FileViewProvider viewProvider) {
     return new RncFileImpl(viewProvider);
   }
 
+  @Override
   public SpaceRequirements spaceExistanceTypeBetweenTokens(ASTNode left, ASTNode right) {
     return SpaceRequirements.MAY;
   }
@@ -98,6 +107,7 @@
       super(node);
     }
 
+    @Override
     public void accept(@NotNull RncElementVisitor visitor) {
       visitor.visitElement(this);
     }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncTokenTypes.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncTokenTypes.java
index dd3fb64..b1faabd 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncTokenTypes.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncTokenTypes.java
@@ -79,6 +79,7 @@
     assert !ourTokenTypes.isEmpty();
     final Ref<IElementType> ref = new Ref<IElementType>();
     ourTokenTypes.forEachValue(new TObjectProcedure<IElementType>() {
+      @Override
       public boolean execute(IElementType iElementType) {
         if (iElementType.toString().equals(name)) {
           ref.set(iElementType);
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/folding/RncFoldingBuilder.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/folding/RncFoldingBuilder.java
index 94ddafe..457f64a 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/folding/RncFoldingBuilder.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/folding/RncFoldingBuilder.java
@@ -41,6 +41,7 @@
  * Date: 10.08.2007
  */
 public class RncFoldingBuilder implements FoldingBuilder {
+  @Override
   @NotNull
   public FoldingDescriptor[] buildFoldRegions(@NotNull ASTNode node, @NotNull Document document) {
 
@@ -52,6 +53,7 @@
             : FoldingDescriptor.EMPTY;
   }
 
+  @Override
   public String getPlaceholderText(@NotNull ASTNode node) {
     final IElementType type = node.getElementType();
     if (type == RncTokenTypes.LBRACE) {
@@ -79,6 +81,7 @@
     return RncTokenTypes.COMMENTS.contains(type) || RncTokenTypes.DOC_TOKENS.contains(type);
   }
 
+  @Override
   public boolean isCollapsedByDefault(@NotNull ASTNode node) {
     return isCommentLike(node.getElementType()) && CodeFoldingSettings.getInstance().COLLAPSE_DOC_COMMENTS;
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/formatting/RncBlock.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/formatting/RncBlock.java
index 5b466ed..025a5c4 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/formatting/RncBlock.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/formatting/RncBlock.java
@@ -40,11 +40,13 @@
     myNode = element;
   }
 
+  @Override
   @NotNull
   public TextRange getTextRange() {
     return myNode.getTextRange();
   }
 
+  @Override
   @NotNull
   public List<Block> getSubBlocks() {
     final List<Block> list = new ArrayList<Block>();
@@ -58,12 +60,14 @@
     return list;
   }
 
+  @Override
   @Nullable
   public Wrap getWrap() {
     // TODO
     return null;
   }
 
+  @Override
   @Nullable
   public Indent getIndent() {
     if (isTopLevel()) {
@@ -82,12 +86,14 @@
             parent instanceof RncGrammar && parent.getParent() instanceof RncDocument;
   }
 
+  @Override
   @Nullable
   public Alignment getAlignment() {
     // TODO
     return null;
   }
 
+  @Override
   @Nullable
   public Spacing getSpacing(Block child1, @NotNull Block child2) {
     if (child1 == null) {
@@ -113,16 +119,19 @@
     return Spacing.createSpacing(0, Integer.MAX_VALUE, 1, true, 100);
   }
 
+  @Override
   @NotNull
   public ChildAttributes getChildAttributes(int newChildIndex) {
     return new ChildAttributes(null, null);
   }
 
+  @Override
   public boolean isIncomplete() {
     // TODO
     return false;
   }
 
+  @Override
   public boolean isLeaf() {
     // TODO
     return false;
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/formatting/RncFormattingModelBuilder.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/formatting/RncFormattingModelBuilder.java
index 1861127..e7e4fa8 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/formatting/RncFormattingModelBuilder.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/formatting/RncFormattingModelBuilder.java
@@ -27,11 +27,13 @@
 import org.jetbrains.annotations.NotNull;
 
 public class RncFormattingModelBuilder implements FormattingModelBuilder {
+  @Override
   @NotNull
   public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) {
     return FormattingModelProvider.createFormattingModelForPsiFile(element.getContainingFile(), new RncBlock(element.getNode()), settings);
   }
 
+  @Override
   public TextRange getRangeAffectingIndent(PsiFile file, int offset, ASTNode elementAtOffset) {
     // TODO
     return null;
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/lexer/CompactSyntaxLexerAdapter.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/lexer/CompactSyntaxLexerAdapter.java
index b6911cc..f967b43 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/lexer/CompactSyntaxLexerAdapter.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/lexer/CompactSyntaxLexerAdapter.java
@@ -71,6 +71,7 @@
   private int myEndOffset;
   private TIntIntHashMap myLengthMap;
 
+  @Override
   public void advance() {
     try {
       myCurrentToken = nextToken();
@@ -137,10 +138,12 @@
     return myBuffer;
   }
 
+  @Override
   public int getBufferEnd() {
     return myEndOffset;
   }
 
+  @Override
   public int getState() {
     try {
       return (Integer)myStateField.get(myLexer);
@@ -149,14 +152,17 @@
     }
   }
 
+  @Override
   public int getTokenEnd() {
     return myCurrentEnd;
   }
 
+  @Override
   public int getTokenStart() {
     return myCurrentToken == null ? 0 : myCurrentOffset;
   }
 
+  @Override
   @Nullable
   public IElementType getTokenType() {
     if (myCurrentToken == null) {
@@ -174,6 +180,7 @@
     init(startOffset, endOffset, reader, initialState);
   }
 
+  @Override
   @SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
   public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
     myBuffer = buffer;
@@ -250,9 +257,11 @@
       myCurPos = startOffset;
     }
 
+    @Override
     public void close() {
     }
 
+    @Override
     public int read(char[] cbuf, int off, int len) {
       if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) > cbuf.length) || ((off + len) < 0)) {
         throw new IndexOutOfBoundsException();
@@ -278,6 +287,7 @@
       return charsToCopy;
     }
 
+    @Override
     public int read() {
       if (myCurPos >= myEndOffset) return -1;
       return myText.charAt(myCurPos++);
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/PatternParsing.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/PatternParsing.java
index 7fff0c3..68b8dc2 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/PatternParsing.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/PatternParsing.java
@@ -56,6 +56,7 @@
     parseTopLevel();
   }
 
+  @Override
   protected boolean parsePattern() {
     PsiBuilder.Marker marker = myBuilder.mark();
     if (!parseQuantifiedPattern()) {
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/RncParser.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/RncParser.java
index 799b9eb..331e186 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/RncParser.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/RncParser.java
@@ -30,6 +30,7 @@
 */
 public class RncParser implements PsiParser {
 
+  @Override
   @NotNull
   public ASTNode parse(IElementType root, PsiBuilder builder) {
     final PsiBuilder.Marker fileMarker = builder.mark();
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncDefine.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncDefine.java
index b1c3120..929307d 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncDefine.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncDefine.java
@@ -26,6 +26,7 @@
  * Date: 13.08.2007
  */
 public interface RncDefine extends RncPattern, PsiNamedElement, Define<RncPattern, RncElement> {
+  @Override
   @Nullable
   RncPattern getPattern();
 }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncGrammar.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncGrammar.java
index 55f5650..fe3ae17 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncGrammar.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncGrammar.java
@@ -25,6 +25,7 @@
  * Date: 13.08.2007
  */
 public interface RncGrammar extends RncElement, Grammar<RncPattern, RncElement> {
+  @Override
   @Nullable
   RncPattern getStart();
 }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncInclude.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncInclude.java
index f4736a1..97bfc74 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncInclude.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncInclude.java
@@ -25,6 +25,7 @@
  * Date: 11.08.2007
  */
 public interface RncInclude extends RncFileReference, Include<RncElement, RncDefine> {
+  @Override
   @NotNull
   RncDefine[] getOverrides();
 }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncRef.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncRef.java
index 6cb9d83..5fc1ef8 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncRef.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncRef.java
@@ -25,9 +25,11 @@
  * Date: 11.08.2007
  */
 public interface RncRef extends RncPattern, Ref<RncDefine, RncElement> {
+  @Override
   @Nullable
   RncDefine getPattern();
 
+  @Override
   @Nullable
   String getReferencedName();
 }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/PatternReference.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/PatternReference.java
index b32f7a7..cffc06c 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/PatternReference.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/PatternReference.java
@@ -58,6 +58,7 @@
     super(ref);
   }
 
+  @Override
   public TextRange getRangeInElement() {
     final ASTNode node = findNameNode();
     if (node == null) return TextRange.from(0, 0);
@@ -71,12 +72,14 @@
     return node.findChildByType(RncTokenTypes.IDENTIFIERS);
   }
 
+  @Override
   @Nullable
   public PsiElement resolve() {
     final ResolveResult[] results = multiResolve(false);
     return results.length == 1 ? results[0].getElement() : null;
   }
 
+  @Override
   @NotNull
   public ResolveResult[] multiResolve(boolean incompleteCode) {
     final RncGrammar scope = getScope();
@@ -90,13 +93,16 @@
     return ContainerUtil.map2Array(set, ResolveResult.class, this);
   }
 
+  @Override
   public ResolveResult fun(Define rncDefine) {
     final PsiElement element = rncDefine.getPsiElement();
     return element != null ? new PsiElementResolveResult(element) : new ResolveResult() {
+      @Override
       @Nullable
       public PsiElement getElement() {
         return null;
       }
+      @Override
       public boolean isValidResult() {
         return false;
       }
@@ -108,12 +114,14 @@
     return PsiTreeUtil.getParentOfType(myElement, RncGrammar.class, true, PsiFile.class);
   }
 
+  @Override
   @NotNull
   public String getCanonicalText() {
     final ASTNode node = findNameNode();
     return node != null ? EscapeUtil.unescapeText(node) : "";
   }
 
+  @Override
   public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
     final ASTNode newNode = RenameUtil.createIdentifierNode(getElement().getManager(), newElementName);
 
@@ -122,10 +130,12 @@
     return getElement();
   }
 
+  @Override
   public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
     throw new UnsupportedOperationException();
   }
 
+  @Override
   @NotNull
   public Object[] getVariants() {
     final RncGrammar scope = getScope();
@@ -137,16 +147,19 @@
     if (map == null || map.size() == 0) return ArrayUtil.EMPTY_OBJECT_ARRAY;
 
     return ContainerUtil.mapNotNull(map.values(), new Function<Set<Define>, Object>() {
+      @Override
       public Object fun(Set<Define> defines) {
         return defines.size() == 0 ? null : defines.iterator().next().getPsiElement();
       }
     }).toArray();
   }
 
+  @Override
   public boolean isSoft() {
     return false;
   }
 
+  @Override
   @NotNull
   public String getUnresolvedMessagePattern() {
     return "Unresolved pattern reference ''{0}''";
@@ -174,6 +187,7 @@
       return "Create Pattern '" + myReference.getCanonicalText() + "'";
     }
 
+    @Override
     @NotNull
     public String getFamilyName() {
       return "Create Pattern";
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncAnnotationImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncAnnotationImpl.java
index 986763c..c1bfabc 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncAnnotationImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncAnnotationImpl.java
@@ -34,14 +34,17 @@
     super(node);
   }
 
+  @Override
   public void accept(@NotNull RncElementVisitor visitor) {
     visitor.visitAnnotation(this);
   }
 
+  @Override
   public IElementType getTokenType() {
     return getNode().getElementType();
   }
 
+  @Override
   @Nullable
   public RncName getNameElement() {
     return findChildByClass(RncName.class);
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDeclImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDeclImpl.java
index e7f3868..89694bd 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDeclImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDeclImpl.java
@@ -37,11 +37,13 @@
     super(node);
   }
 
+  @Override
   public String getPrefix() {
     final ASTNode ns = findIdentifierNode();
     return ns != null ? EscapeUtil.unescapeText(ns) : null;
   }
 
+  @Override
   public String getDeclaredNamespace() {
     final ASTNode ns = getNode().findChildByType(RncTokenTypes.LITERAL);
     return ns != null ? EscapeUtil.parseLiteralValue(ns) : null;
@@ -74,6 +76,7 @@
     return s != null ? s : "";
   }
 
+  @Override
   public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException {
     final ASTNode node = findIdentifierNode();
     if (node == null) return this;
@@ -81,6 +84,7 @@
     return this;
   }
 
+  @Override
   public void accept(@NotNull RncElementVisitor visitor) {
     visitor.visitElement(this);
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDefineImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDefineImpl.java
index eca9001..b365b32 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDefineImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDefineImpl.java
@@ -51,10 +51,12 @@
     super(node);
   }
 
+  @Override
   public void accept(@NotNull RncElementVisitor visitor) {
     visitor.visitDefine(this);
   }
 
+  @Override
   public void accept(Visitor visitor) {
     visitor.visitDefine(this);
   }
@@ -65,6 +67,7 @@
     return EscapeUtil.unescapeText(node);
   }
 
+  @Override
   public PsiElement getNameElement() {
     return getNameNode().getPsi();
   }
@@ -76,25 +79,30 @@
     return node;
   }
 
+  @Override
   public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException {
     final ASTNode node = getNameNode();
     node.getTreeParent().replaceChild(node, RenameUtil.createIdentifierNode(getManager(), name));
     return this;
   }
 
+  @Override
   @Nullable
   public RncPattern getPattern() {
     return findChildByClass(RncPattern.class);
   }
 
+  @Override
   public PsiReference getReference() {
     if (getParent() instanceof RncInclude) {
       final TextRange range = TextRange.from(0, getNameNode().getTextLength());
       return new PsiReferenceBase<RncDefine>(this, range, true) {
+        @Override
         public PsiElement resolve() {
           return RncDefineImpl.this;
         }
 
+        @Override
         @NotNull
         public Object[] getVariants() {
           final RncInclude parent = (RncInclude)getParent();
@@ -118,6 +126,7 @@
     return super.getReference();
   }
 
+  @Override
   @Nullable
   public Icon getIcon(int flags) {
     return AllIcons.Nodes.Property;
@@ -127,6 +136,7 @@
     return true;
   }
 
+  @Override
   @Nullable
   public PsiMetaData getMetaData() {
     return new MyMetaData();
@@ -137,32 +147,39 @@
       return false;
     }*/
 
+    @Override
     @Nullable
     public Icon getIcon() {
       return RncDefineImpl.this.getIcon(0);
     }
 
+    @Override
     public String getTypeName() {
       return "Pattern Definition";
     }
 
+    @Override
     public PsiElement getDeclaration() {
       return RncDefineImpl.this;
     }
 
+    @Override
     @NonNls
     public String getName(PsiElement context) {
       return RncDefineImpl.this.getName();
     }
 
+    @Override
     @NonNls
     public String getName() {
       return RncDefineImpl.this.getName();
     }
 
+    @Override
     public void init(PsiElement element) {
     }
 
+    @Override
     public Object[] getDependences() {
       return ArrayUtil.EMPTY_OBJECT_ARRAY;
     }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDivImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDivImpl.java
index 2568918..15ce79f 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDivImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDivImpl.java
@@ -31,6 +31,7 @@
     super(node);
   }
 
+  @Override
   public void accept(@NotNull RncElementVisitor visitor) {
     visitor.visitDiv(this);
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDocument.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDocument.java
index ea54963..1c91dab 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDocument.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDocument.java
@@ -35,27 +35,33 @@
     super(node);
   }
 
+  @Override
   public XmlNSDescriptor getDefaultNSDescriptor(String namespace, boolean strict) {
     return null;
   }
 
+  @Override
   public XmlProlog getProlog() {
     return null;
   }
 
+  @Override
   @Nullable
   public XmlTag getRootTag() {
     return null;
   }
 
+  @Override
   public XmlNSDescriptor getRootTagNSDescriptor() {
     return null;
   }
 
+  @Override
   public boolean processElements(PsiElementProcessor processor, PsiElement place) {
     return false;
   }
 
+  @Override
   @Nullable
   public PsiMetaData getMetaData() {
     return MetaRegistry.getMeta(this);
@@ -75,6 +81,7 @@
     return super.findChildrenByClass(aClass);
   }
 
+  @Override
   public void accept(@NotNull RncElementVisitor visitor) {
     visitor.visitElement(this);
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncElementImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncElementImpl.java
index 7c1819c..9c7e14d 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncElementImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncElementImpl.java
@@ -91,6 +91,7 @@
     }
   }
 
+  @Override
   public final void accept(@NotNull PsiElementVisitor visitor) {
     if (visitor instanceof RncElementVisitor) {
       accept((RncElementVisitor)visitor);
@@ -116,10 +117,12 @@
 
   public abstract void accept(@NotNull RncElementVisitor visitor);
 
+  @Override
   public void accept(Visitor visitor) {
     visitor.visitElement(this);
   }
 
+  @Override
   public void acceptChildren(Visitor visitor) {
     final PsiElement[] elements = getChildren();
     //noinspection ForLoopReplaceableByForEach
@@ -131,6 +134,7 @@
     }
   }
 
+  @Override
   public RncElement getPsiElement() {
     return this;
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncExternalRefImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncExternalRefImpl.java
index 51ec6ad..b43b0fa 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncExternalRefImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncExternalRefImpl.java
@@ -31,6 +31,7 @@
     super(node);
   }
 
+  @Override
   public void accept(@NotNull RncElementVisitor visitor) {
     visitor.visitExternalRef(this);
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncFileImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncFileImpl.java
index 497c74f..0bc22c5 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncFileImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncFileImpl.java
@@ -51,11 +51,13 @@
     super(viewProvider, RngCompactLanguage.INSTANCE);
   }
 
+  @Override
   @NotNull
   public FileType getFileType() {
     return RncFileType.getInstance();
   }
 
+  @Override
   @NotNull
   public XmlDocument getDocument() {
     // this needs to be a seperate child element because of com.intellij.util.xml.impl.ExternalChangeProcessor.visitDocumentChanged()
@@ -108,10 +110,12 @@
     return getDocument().addBefore(element, anchor);
   }
 
+  @Override
   public boolean processElements(PsiElementProcessor processor, PsiElement place) {
     return false;
   }
 
+  @Override
   public GlobalSearchScope getFileResolveScope() {
     return ProjectScope.getAllScope(getProject());
   }
@@ -126,10 +130,12 @@
     return getClass().getSimpleName() + ":" + getName();
   }
 
+  @Override
   public RncDecl[] getDeclarations() {
     return ((RncDocument)getDocument()).findChildrenByClass(RncDecl.class);
   }
 
+  @Override
   public RncGrammar getGrammar() {
     final XmlDocument document = getDocument();
     return ((RncDocument)document).getGrammar();
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncFileReferenceImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncFileReferenceImpl.java
index f5c3419..c2a3242 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncFileReferenceImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncFileReferenceImpl.java
@@ -60,6 +60,7 @@
     return FileReferenceUtil.restrict(set, FileReferenceUtil.byType(RncFileType.getInstance()));
   }
 
+  @Override
   public RncFile getReferencedFile() {
     final String href = getFileReference();
     if (href != null) {
@@ -71,6 +72,7 @@
     return null;
   }
 
+  @Override
   @Nullable
   public String getFileReference() {
     final ASTNode element = getNode().findChildByType(RncTokenTypes.LITERAL);
@@ -79,6 +81,7 @@
     return s.substring(1, s.length() - 1);
   }
 
+  @Override
   public TextRange getReferenceRange() {
     final ASTNode literal = getNode().findChildByType(RncTokenTypes.LITERAL);
     if (literal == null) return TextRange.from(0, 0);
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncGrammarImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncGrammarImpl.java
index ab0987f..6055bba 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncGrammarImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncGrammarImpl.java
@@ -36,14 +36,17 @@
     super(node);
   }
 
+  @Override
   public void accept(@NotNull RncElementVisitor visitor) {
     visitor.visitGrammar(this);
   }
 
+  @Override
   public void accept(Visitor visitor) {
     visitor.visitGrammar(this);
   }
 
+  @Override
   public RncPattern getStart() {
     final ASTNode node = getNode().findChildByType(RncElementTypes.START);
     return node != null ? (RncPattern)node.getPsi() : null;
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncIncludeImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncIncludeImpl.java
index 7c967bb..0e7b9de 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncIncludeImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncIncludeImpl.java
@@ -47,6 +47,7 @@
     return super.processDeclarations(processor, substitutor, lastParent, place);
   }
 
+  @Override
   public void accept(@NotNull RncElementVisitor visitor) {
     visitor.visitInclude(this);
   }
@@ -56,10 +57,12 @@
     visitor.visitInclude(this);
   }
 
+  @Override
   public PsiFile getInclude() {
     return getReferencedFile();
   }
 
+  @Override
   @NotNull
   public RncDefine[] getOverrides() {
     // TODO: DIVs?
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncNsDeclImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncNsDeclImpl.java
index 4de51d4..dfcee26 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncNsDeclImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncNsDeclImpl.java
@@ -30,6 +30,7 @@
     super(node);
   }
 
+  @Override
   public boolean isDefault() {
     return getNode().findChildByType(RncTokenTypes.KEYWORD_DEFAULT) != null;
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncRefImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncRefImpl.java
index c190240..743f9df 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncRefImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncRefImpl.java
@@ -36,6 +36,7 @@
     super(node);
   }
 
+  @Override
   @Nullable
   public RncDefine getPattern() {
     final PsiReference ref = getReference();
@@ -43,6 +44,7 @@
     return ref instanceof PatternReference ? (RncDefine)ref.resolve() : null;
   }
 
+  @Override
   public String getReferencedName() {
     final ASTNode node = findNameNode();
     assert node != null;
@@ -58,6 +60,7 @@
     visitor.visitRef(this);
   }
 
+  @Override
   public void accept(Visitor visitor) {
     visitor.visitRef(this);
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/util/PsiFunction.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/util/PsiFunction.java
index ce3a96a..2abee84 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/util/PsiFunction.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/util/PsiFunction.java
@@ -29,6 +29,7 @@
 public final class PsiFunction implements NotNullFunction<ASTNode, PsiElement> {
   public static final PsiFunction INSTANCE = new PsiFunction();
 
+  @Override
   @NotNull
   public PsiElement fun(ASTNode astNode) {
     return astNode.getPsi();
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/util/RenameUtil.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/util/RenameUtil.java
index 5261d48..38ae3ed 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/util/RenameUtil.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/util/RenameUtil.java
@@ -39,7 +39,7 @@
  */
 public class RenameUtil {
 
-  private static Set<String> ourRncKeywords = new HashSet<String>();
+  private static final Set<String> ourRncKeywords = new HashSet<String>();
 
   static {
     Collections.addAll(ourRncKeywords, "attribute", "default", "datatypes", "div", "element", "empty", "external",
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceConfigImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceConfigImpl.java
index d36c4b7..09b30b4 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceConfigImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceConfigImpl.java
@@ -67,17 +67,20 @@
     return null;
   }
 
+  @Override
   @Nullable
   public String getMapping(@NotNull PsiFile file) {
     final VirtualFilePointer pointer = getMappedPointer(file);
     return pointer != null ? pointer.getUrl() : null;
   }
 
+  @Override
   public VirtualFile getMappedFile(@NotNull PsiFile file) {
     final VirtualFilePointer url = getMappedPointer(file);
     return url != null ? url.getFile() : null;
   }
 
+  @Override
   public void setMapping(@NotNull PsiFile file, String location) {
     final VirtualFile virtualFile = file.getVirtualFile();
     assert virtualFile != null;
@@ -102,24 +105,30 @@
     }
   }
 
+  @Override
   public void initComponent() {
   }
 
+  @Override
   public void disposeComponent() {
   }
 
+  @Override
   @NotNull
   public String getComponentName() {
     return "RELAX-NG.NoNamespaceConfig";
   }
 
+  @Override
   public void projectOpened() {
   }
 
+  @Override
   public void projectClosed() {
     reset();
   }
 
+  @Override
   public Mappings getState() {
     final HashMap<String, String> map = new HashMap<String, String>();
     for (Map.Entry<VirtualFilePointer, VirtualFilePointer> entry : myMappings.entrySet()) {
@@ -128,6 +137,7 @@
     return new Mappings(map);
   }
 
+  @Override
   public void loadState(Mappings state) {
     reset();
 
@@ -157,6 +167,7 @@
   }
 
   public static class HectorProvider implements HectorComponentPanelsProvider {
+    @Override
     @Nullable
     public HectorComponentPanel createConfigurable(@NotNull PsiFile file) {
       if (file instanceof XmlFile) {
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceConfigPanel.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceConfigPanel.java
index 690dac4..aaa0c9e 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceConfigPanel.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceConfigPanel.java
@@ -57,6 +57,7 @@
     myMapping = myConfig.getMapping(file);
 
     final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, false, false, false) {
+      @Override
       public boolean isFileSelectable(VirtualFile file) {
         final boolean b = super.isFileSelectable(file);
         if (b) {
@@ -81,6 +82,7 @@
     final ComponentWithBrowseButton.BrowseFolderActionListener<JTextField> actionListener =
             new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>("Select Schema", "Select a RELAX-NG file to associate with the document",
                     mySchemaFile, project, descriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) {
+              @Override
               public void actionPerformed(ActionEvent e) {
                 myDialogOpen = true;
                 try {
@@ -94,20 +96,24 @@
     mySchemaFile.addActionListener(actionListener);
   }
 
+  @Override
   public boolean canClose() {
     return super.canClose() && !myDialogOpen;
   }
 
+  @Override
   public JComponent createComponent() {
     return myRoot;
   }
 
+  @Override
   public boolean isModified() {
     final String s = mySchemaFile.getText();
     final String m = myMapping != null ? myMapping : "";
     return !s.equals(m);
   }
 
+  @Override
   public void apply() throws ConfigurationException {
     final String s = getMapping();
     if (s != null) {
@@ -122,10 +128,12 @@
     return s.length() > 0 ? VfsUtil.pathToUrl(s.replace(File.separatorChar, '/')) : null;
   }
 
+  @Override
   public void reset() {
     mySchemaFile.setText(myMapping != null ? VfsUtil.urlToPath(myMapping).replace('/', File.separatorChar) : "");
   }
 
+  @Override
   public void disposeUIResources() {
     // doesn't help - updating the validation needs a hard modification
 //    DaemonCodeAnalyzer.getInstance(myFile.getProject()).restart();
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceSchemaProvider.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceSchemaProvider.java
index db4054a..46cad56 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceSchemaProvider.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceSchemaProvider.java
@@ -34,6 +34,7 @@
 * Date: 22.11.2007
 */
 public class NoNamespaceSchemaProvider extends XmlSchemaProvider {
+  @Override
   @Nullable
   public XmlFile getSchema(@NotNull @NonNls String url, @Nullable Module module, @NotNull PsiFile baseFile) {
     if ("".equals(url)) {
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedDtdOptions.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedDtdOptions.java
index 9e72a15..1ce9d5f 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedDtdOptions.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedDtdOptions.java
@@ -76,6 +76,7 @@
 
   public AdvancedDtdOptions() {
     myInlineAttlistCheckBox.addItemListener(new ItemListener() {
+      @Override
       public void itemStateChanged(ItemEvent e) {
         if (e.getStateChange() == ItemEvent.SELECTED) {
           myAttlistDefine.setEnabled(false);
@@ -89,6 +90,7 @@
 
     final DefaultActionGroup group = new DefaultActionGroup();
     group.add(new AnAction(null, "Remove Entry", AllIcons.General.Remove) {
+      @Override
       public void update(AnActionEvent e) {
         if (myNamespaceMap.getModel().getRowCount() == 0 || myNamespaceMap.getSelectedRow() == -1) {
           e.getPresentation().setEnabled(false);
@@ -97,6 +99,7 @@
         }
       }
 
+      @Override
       public void actionPerformed(AnActionEvent e) {
         ((NamespaceMapModel)myNamespaceMap.getModel()).removeRow(myNamespaceMap.getSelectedRow());
       }
@@ -106,10 +109,12 @@
     myToolbar.add(toolbar.getComponent());
   }
 
+  @Override
   public JComponent getRoot() {
     return myRoot;
   }
 
+  @Override
   public Map<String, ?> getOptions() {
     final HashMap<String, Object> map = new LinkedHashMap<String, Object>();
 
@@ -147,6 +152,7 @@
     }
   }
 
+  @Override
   public void setOptions(Map<String, ?> inputOptions) {
     if (inputOptions.containsKey(COLON_REPLACEMENT)) {
       myColonReplacement.setText((String)inputOptions.get(COLON_REPLACEMENT));
@@ -189,6 +195,7 @@
 
     final HashMap<String, Object> map = new LinkedHashMap<String, Object>();
     file.accept(new PsiRecursiveElementVisitor() {
+      @Override
       public void visitElement(PsiElement element) {
         if (element instanceof XmlElementDecl) {
           final String s = ((XmlElementDecl)element).getName();
@@ -217,26 +224,32 @@
   private static class NamespaceMapModel extends AbstractTableModel {
     private final List<String[]> myList = new ArrayList<String[]>();
 
+    @Override
     public String getColumnName(int column) {
       return column == 0 ? "Prefix" : "URI";
     }
 
+    @Override
     public int getRowCount() {
       return myList.size();
     }
 
+    @Override
     public int getColumnCount() {
       return 2;
     }
 
+    @Override
     public boolean isCellEditable(int rowIndex, int columnIndex) {
       return columnIndex == 1;
     }
 
+    @Override
     public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
       myList.get(rowIndex)[columnIndex] = (String)aValue;
     }
 
+    @Override
     public Object getValueAt(int rowIndex, int columnIndex) {
       return myList.get(rowIndex)[columnIndex];
     }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedOptionsDialog.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedOptionsDialog.java
index 9f6da66..4a669af 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedOptionsDialog.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedOptionsDialog.java
@@ -50,6 +50,7 @@
     init();
   }
 
+  @Override
   @Nullable
   protected JComponent createCenterPanel() {
     JComponent root;
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedXsdOptions.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedXsdOptions.java
index d29c7b2..ead97c9 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedXsdOptions.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedXsdOptions.java
@@ -42,10 +42,12 @@
   private ComboBox myAnyProcessContents;
   private ComboBox myAnyAttributeProcessContents;
 
+  @Override
   public JComponent getRoot() {
     return myRoot;
   }
 
+  @Override
   public Map<String, ?> getOptions() {
     final Map<String, Object> strings = new HashMap<String, Object>();
     if (myDisableAbstractElements.isSelected()) {
@@ -56,6 +58,7 @@
     return strings;
   }
 
+  @Override
   public void setOptions(Map<String, ?> inputOptions) {
     myDisableAbstractElements.setSelected(inputOptions.get(DISABLE_ABSTRACT_ELEMENTS) == Boolean.TRUE);
     final Object o = inputOptions.get(ANY_PROCESS_CONTENTS);
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaAction.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaAction.java
index 7aa3b2b..ff71ae0 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaAction.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaAction.java
@@ -19,7 +19,6 @@
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.fileTypes.StdFileTypes;
 import com.intellij.openapi.project.Project;
@@ -43,6 +42,7 @@
 */
 public class ConvertSchemaAction extends AnAction {
 
+  @Override
   public void update(AnActionEvent e) {
     final VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
     final Project project = e.getData(CommonDataKeys.PROJECT);
@@ -93,6 +93,7 @@
     return null;
   }
 
+  @Override
   public void actionPerformed(AnActionEvent e) {
     final VirtualFile file = e.getData(CommonDataKeys.VIRTUAL_FILE);
     final Project project = e.getData(CommonDataKeys.PROJECT);
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaDialog.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaDialog.java
index b61f00b..d7f4b54 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaDialog.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaDialog.java
@@ -45,6 +45,7 @@
     mySettings.addPropertyChangeListener(ConvertSchemaSettingsImpl.OUTPUT_PATH, this);
 
     myAdvancedAction = new AbstractAction("Advanced...") {
+      @Override
       public void actionPerformed(ActionEvent e) {
         mySettings.showAdvancedSettings();
       }
@@ -69,6 +70,7 @@
     return mySettings.getPreferredFocusedComponent();
   }
 
+  @Override
   @Nullable
   protected JComponent createCenterPanel() {
     return mySettings.getRoot();
@@ -78,6 +80,7 @@
     return mySettings;
   }
 
+  @Override
   public void propertyChange(PropertyChangeEvent evt) {
     if (ConvertSchemaSettingsImpl.OUTPUT_TYPE.equals(evt.getPropertyName())) {
       myAdvancedAction.setEnabled(mySettings.hasAdvancedSettings());
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaSettingsImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaSettingsImpl.java
index 893c1ad..56fe4c9 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaSettingsImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaSettingsImpl.java
@@ -144,6 +144,7 @@
 
     final JTextField tf = myOutputDestination.getTextField();
     tf.getDocument().addDocumentListener(new DocumentAdapter() {
+      @Override
       protected void textChanged(DocumentEvent e) {
         myPropertyChangeSupport.firePropertyChange(OUTPUT_PATH, null, getOutputDestination());
       }
@@ -151,6 +152,7 @@
     tf.setText(firstFile.getParent().getPath().replace('/', File.separatorChar));
 
     final ItemListener listener = new ItemListener() {
+      @Override
       public void itemStateChanged(ItemEvent e) {
         if (e.getStateChange() == ItemEvent.SELECTED) {
           final SchemaType type = getOutputType();
@@ -169,6 +171,7 @@
     }
   }
 
+  @Override
   @NotNull
   public SchemaType getOutputType() {
     if (myOutputRng.isSelected()) {
@@ -183,10 +186,12 @@
     }
   }
 
+  @Override
   public String getOutputEncoding() {
     return (String)myEncoding.getSelectedItem();
   }
 
+  @Override
   public int getIndent() {
     return parseInt(myIndent.getText().trim());
   }
@@ -199,14 +204,17 @@
     }
   }
 
+  @Override
   public int getLineLength() {
     return parseInt(myLineLength.getText());
   }
   
+  @Override
   public String getOutputDestination() {
     return myOutputDestination.getText();
   }
 
+  @Override
   public void addAdvancedSettings(List<String> inputParams, List<String> outputParams) {
     setParams(myInputOptions, inputParams);
 
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/IdeaDriver.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/IdeaDriver.java
index 46e5f97..a0b8cad 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/IdeaDriver.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/IdeaDriver.java
@@ -133,8 +133,9 @@
                 length > 0 ? length : DEFAULT_LINE_LENGTH, 
                 indent > 0 ? indent : DEFAULT_INDENT)
         {
+          @Override
           public Stream open(String sourceUri, String encoding) throws IOException {
-            final String s = super.reference(null, sourceUri);
+            final String s = reference(null, sourceUri);
             final File file = new File(outputFile.getParentFile(), s);
             if (file.exists()) {
               final String msg = "The file '" + file.getAbsolutePath() + "' already exists. Overwrite it?";
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/inspections/RngDomInspection.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/inspections/RngDomInspection.java
index e85067d..4426b40 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/inspections/RngDomInspection.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/inspections/RngDomInspection.java
@@ -44,18 +44,21 @@
     return true;
   }
 
+  @Override
   @Nls
   @NotNull
   public String getGroupDisplayName() {
     return BaseInspection.getRngGroupDisplayName();
   }
 
+  @Override
   @Nls
   @NotNull
   public String getDisplayName() {
     return "Unresolved References";
   }
 
+  @Override
   @NonNls
   @NotNull
   public String getShortName() {
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/inspections/UnusedDefineInspection.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/inspections/UnusedDefineInspection.java
index b6d4eea..addcb96 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/inspections/UnusedDefineInspection.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/inspections/UnusedDefineInspection.java
@@ -57,22 +57,26 @@
  * Date: 26.07.2007
  */
 public class UnusedDefineInspection extends BaseInspection {
+  @Override
   public boolean isEnabledByDefault() {
     return false;
   }
 
+  @Override
   @Nls
   @NotNull
   public String getDisplayName() {
     return "Unused Define";
   }
 
+  @Override
   @NonNls
   @NotNull
   public String getShortName() {
     return "UnusedDefine";
   }
 
+  @Override
   @NotNull
   public RncElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {
     return new MyElementVisitor(holder);
@@ -92,6 +96,7 @@
       myHolder = holder;
     }
 
+    @Override
     protected void superVisitElement(PsiElement element) {
       element.accept(myXmlVisitor);
     }
@@ -205,16 +210,19 @@
         myTag = tag;
       }
 
+      @Override
       @NotNull
       public String getName() {
         return "Remove Define";
       }
 
+      @Override
       @NotNull
       public String getFamilyName() {
         return getName();
       }
 
+      @Override
       public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
         try {
           if (myTag.isValid()) {
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/CommonAnnotationHolder.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/CommonAnnotationHolder.java
index 408bd1e..c797125 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/CommonAnnotationHolder.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/CommonAnnotationHolder.java
@@ -42,6 +42,7 @@
       myHolder = holder;
     }
 
+    @Override
     public Annotation createAnnotation(DomElement element, @NotNull HighlightSeverity severity, String message) {
       final Annotation annotation = myHolder.createAnnotation(element, severity, message);
       annotation.setTooltip(message);  // no tooltip by default??
@@ -56,6 +57,7 @@
       myHolder = holder;
     }
 
+    @Override
     public Annotation createAnnotation(T element, @NotNull HighlightSeverity severity, String message) {
       if (severity == HighlightSeverity.ERROR) {
         return myHolder.createErrorAnnotation(element, message);
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/ModelAnnotator.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/ModelAnnotator.java
index 51c9fcd..5efdcb4 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/ModelAnnotator.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/ModelAnnotator.java
@@ -50,12 +50,14 @@
 */
 public final class ModelAnnotator implements Annotator, DomElementsAnnotator {
 
+  @Override
   public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder holder) {
     if (psiElement instanceof CommonElement) {
       ((CommonElement)psiElement).accept(new MyAnnotator<PsiElement>(CommonAnnotationHolder.create(holder)));
     }
   }
 
+  @Override
   public void annotate(DomElement element, DomElementAnnotationHolder holder) {
     if (element instanceof RngDomElement) {
       ((RngDomElement)element).accept(new MyAnnotator<DomElement>(CommonAnnotationHolder.create(holder)));
@@ -69,6 +71,7 @@
       myHolder = holder;
     }
 
+    @Override
     public void visitDefine(final Define define) {
       final PsiElement element = define.getPsiElement();
       if (element != null) {
@@ -78,6 +81,7 @@
         final OverriddenDefineSearcher searcher = new OverriddenDefineSearcher(define, xmlFile, result);
 
         final PsiElementProcessor.FindElement<XmlFile> processor = new PsiElementProcessor.FindElement<XmlFile>() {
+          @Override
           public boolean execute(@NotNull XmlFile file) {
             final Grammar grammar = GrammarFactory.getGrammar(file);
             if (grammar == null) return true;
@@ -102,6 +106,7 @@
       a.setGutterIconRenderer(renderer);
     }
 
+    @Override
     public void visitInclude(Include inc) {
       final Define[] overrides = inc.getOverrides();
       for (Define define : overrides) {
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverriddenDefineRenderer.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverriddenDefineRenderer.java
index 3812731..c83575d 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverriddenDefineRenderer.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverriddenDefineRenderer.java
@@ -43,14 +43,17 @@
     myDefine = define;
   }
 
+  @Override
   @NotNull
   public Icon getIcon() {
     return AllIcons.Gutter.OverridenMethod;
   }
 
+  @Override
   @Nullable
   public AnAction getClickAction() {
     return new AnAction() {
+      @Override
       public void actionPerformed(AnActionEvent e) {
         final PsiElement element = myDefine.getPsiElement();
         if (element == null || !element.isValid()) return;
@@ -75,10 +78,12 @@
     };
   }
 
+  @Override
   public boolean isNavigateAction() {
     return true;
   }
 
+  @Override
   @Nullable
   public String getTooltipText() {
     return "Is overridden";
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverriddenDefineSearcher.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverriddenDefineSearcher.java
index a69cbc0..9364b10 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverriddenDefineSearcher.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverriddenDefineSearcher.java
@@ -1,3 +1,18 @@
+/*
+ * 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 org.intellij.plugins.relaxNG.model.annotation;
 
 import com.intellij.psi.xml.XmlFile;
@@ -25,6 +40,7 @@
     myDefine = define;
   }
 
+  @Override
   public void visitInclude(Include inc) {
     myIncludes.add(inc.getInclude() == myLocalFile ? 1 : 0);
     try {
@@ -34,10 +50,12 @@
     }
   }
 
+  @Override
   public void visitDiv(Div ref) {
     ref.acceptChildren(this);
   }
 
+  @Override
   public void visitDefine(Define d) {
     if (myIncludes.size() > 0 && myIncludes.get(myIncludes.size() - 1) == 1) {
       if (d.getName().equals(myDefine.getName())) {
@@ -47,6 +65,7 @@
     d.acceptChildren(this);
   }
 
+  @Override
   public void visitGrammar(Grammar pattern) {
     pattern.acceptChildren(this);
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverridingDefineRenderer.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverridingDefineRenderer.java
index 3e8c525..0e9ad1c 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverridingDefineRenderer.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverridingDefineRenderer.java
@@ -46,26 +46,31 @@
     myMessage = message;
   }
 
+  @Override
   @NotNull
   public Icon getIcon() {
     return AllIcons.Gutter.OverridingMethod;
   }
 
+  @Override
   public boolean isNavigateAction() {
     return true;
   }
 
+  @Override
   @Nullable
   public AnAction getClickAction() {
     return new MyClickAction();
   }
 
+  @Override
   @Nullable
   public String getTooltipText() {
     return myMessage;
   }
 
   private class MyClickAction extends AnAction {
+    @Override
     public void actionPerformed(AnActionEvent e) {
       doClickAction(e, mySet, "Go to overridden define");
     }
@@ -78,6 +83,7 @@
     } else {
       final Define[] array = set.toArray(new Define[set.size()]);
       NavigationUtil.getPsiElementPopup(ContainerUtil.map(array, new Function<Define, PsiElement>() {
+        @Override
         public PsiElement fun(Define define) {
           return define.getPsiElement();
         }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/AttributeFinder.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/AttributeFinder.java
index 88dbf60..32830be 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/AttributeFinder.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/AttributeFinder.java
@@ -46,6 +46,7 @@
     myQname = qname;
   }
 
+  @Override
   public Void onElement(DElementPattern p) {
     depth++;
     try {
@@ -59,6 +60,7 @@
     }
   }
 
+  @Override
   public Void onAttribute(DAttributePattern p) {
     assert depth > 0;
 
@@ -70,6 +72,7 @@
     return null;
   }
 
+  @Override
   public Void onValue(DValuePattern p) {
     if (myLastAttr != null) {
       myAttributes.get(myLastAttr).first.put(p.getValue(), p.getType());
@@ -77,6 +80,7 @@
     return super.onValue(p);
   }
 
+  @Override
   public Void onOptional(DOptionalPattern p) {
     optional++;
     try {
@@ -86,6 +90,7 @@
     }
   }
 
+  @Override
   public Void onZeroOrMore(DZeroOrMorePattern p) {
     optional++;
     try {
@@ -95,6 +100,7 @@
     }
   }
 
+  @Override
   public Void onChoice(DChoicePattern p) {
     optional++;
     try {
@@ -104,6 +110,7 @@
     }
   }
 
+  @Override
   public Void onData(DDataPattern p) {
     if (depth == 1 && myLastAttr != null) {
       myAttributes.get(myLastAttr).first.put(null, p.getType());
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/ChildElementFinder.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/ChildElementFinder.java
index c472e35..91f2903 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/ChildElementFinder.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/ChildElementFinder.java
@@ -34,6 +34,7 @@
     myTargetDepth = targetDepth;
   }
 
+  @Override
   public Void onRef(DRefPattern p) {
     if (myDepth < myTargetDepth || myTargetDepth == -1) {
       return super.onRef(p);
@@ -41,6 +42,7 @@
     return null;
   }
 
+  @Override
   public Void onElement(DElementPattern p) {
     myDepth++;
     try {
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/CompositeDescriptor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/CompositeDescriptor.java
index 153374e..6f5af11 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/CompositeDescriptor.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/CompositeDescriptor.java
@@ -38,6 +38,7 @@
     myPatterns = patterns.toArray(new DElementPattern[patterns.size()]);
   }
 
+  @Override
   protected XmlElementDescriptor findElementDescriptor(XmlTag childTag) {
     final List<DElementPattern> patterns = new ArrayList<DElementPattern>();
     for (DElementPattern pattern : myPatterns) {
@@ -58,6 +59,7 @@
     return NULL;
   }
 
+  @Override
   public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) {
     final List<XmlElementDescriptor> descriptors = new ArrayList<XmlElementDescriptor>(Arrays.asList(super.getElementsDescriptors(context)));
     for (DElementPattern pattern : myPatterns) {
@@ -67,12 +69,14 @@
     return descriptors.toArray(new XmlElementDescriptor[descriptors.size()]);
   }
 
+  @Override
   protected XmlAttributeDescriptor getAttributeDescriptor(String namespace, String localName) {
     final QName qname = new QName(namespace, localName);
 
     return computeAttributeDescriptor(AttributeFinder.find(qname, myPatterns));
   }
 
+  @Override
   protected XmlAttributeDescriptor[] collectAttributeDescriptors(@Nullable XmlTag context) {
     final QName qName = null;
     final DPattern[] patterns;
@@ -80,6 +84,7 @@
       patterns = myPatterns;
     } else {
       final List<DElementPattern> p = ContainerUtil.findAll(myPatterns, new Condition<DElementPattern>() {
+        @Override
         public boolean value(DElementPattern pattern) {
           return pattern.getName().contains(qName);
         }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/NamedPatternFilter.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/NamedPatternFilter.java
index 30ee914..032d8f8 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/NamedPatternFilter.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/NamedPatternFilter.java
@@ -22,6 +22,7 @@
 final class NamedPatternFilter implements Condition<DXmlTokenPattern> {
   public static final NamedPatternFilter INSTANCE = new NamedPatternFilter();
 
+  @Override
   public boolean value(DXmlTokenPattern pattern) {
     return pattern.getName().listNames().size() > 0;
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RecursionSaveWalker.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RecursionSaveWalker.java
index 2f6b7cc..b497e0a 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RecursionSaveWalker.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RecursionSaveWalker.java
@@ -19,7 +19,6 @@
 import com.intellij.util.SpinAllocator;
 import com.intellij.util.containers.ContainerUtil;
 import gnu.trove.THashSet;
-import gnu.trove.TObjectHashingStrategy;
 import org.kohsuke.rngom.digested.*;
 
 /*
@@ -45,6 +44,7 @@
     return null;
   }
 
+  @Override
   public Void onRef(DRefPattern p) {
     if (myVisited.add(p)) {
       try {
@@ -56,6 +56,7 @@
     return null;
   }
 
+  @Override
   protected Void onUnary(DUnaryPattern p) {
     if (myVisited.add(p)) {
       try {
@@ -81,12 +82,14 @@
 
   private static final SpinAllocator<THashSet<DPattern>> ourAllocator = new SpinAllocator<THashSet<DPattern>>(
           new SpinAllocator.ICreator<THashSet<DPattern>>() {
+            @Override
             @SuppressWarnings({ "unchecked" })
             public THashSet<DPattern> createInstance() {
               return ContainerUtil.<DPattern>newIdentityTroveSet(256);
             }
           },
           new SpinAllocator.IDisposer<THashSet<DPattern>>() {
+            @Override
             public void disposeInstance(THashSet<DPattern> instance) {
               instance.clear();
             }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngElementDescriptor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngElementDescriptor.java
index 43cc0bf..5472ce3 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngElementDescriptor.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngElementDescriptor.java
@@ -62,15 +62,18 @@
     myElementPattern = pattern;
   }
 
+  @Override
   public String getQualifiedName() {
     final QName qName = getQName();
     return qName != null ? format(qName, "") : "#unknown";
   }
 
+  @Override
   public String getDefaultName() {
     return getName();
   }
 
+  @Override
   public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) {
     if (context == null) {
       return EMPTY_ARRAY;
@@ -101,8 +104,10 @@
     return getElementDescriptor(childTag, null);
   }
 
+  @Override
   public final XmlElementDescriptor getElementDescriptor(final XmlTag childTag, XmlTag contextTag) {
     final XmlElementDescriptor value = getCachedValue(childTag, this, DESCR_KEY, new ParameterizedCachedValueProvider<XmlElementDescriptor, RngElementDescriptor>() {
+      @Override
       public CachedValueProvider.Result<XmlElementDescriptor> compute(RngElementDescriptor p) {
         final XmlElementDescriptor descriptor = p.findElementDescriptor(childTag);
         return CachedValueProvider.Result.create(descriptor, p.getDependences(), childTag);
@@ -111,9 +116,11 @@
     return value == NULL ? null : value;
   }
 
+  @Override
   public final XmlAttributeDescriptor[] getAttributesDescriptors(@Nullable final XmlTag context) {
     if (context != null) {
       return getCachedValue(context, this, ATTRS_KEY, new ParameterizedCachedValueProvider<XmlAttributeDescriptor[], RngElementDescriptor>() {
+        @Override
         public CachedValueProvider.Result<XmlAttributeDescriptor[]> compute(RngElementDescriptor p) {
           final XmlAttributeDescriptor[] value = p.collectAttributeDescriptors(context);
           return CachedValueProvider.Result.create(value, p.getDependences(), context);
@@ -155,10 +162,12 @@
     return result.toArray(new RngXmlAttributeDescriptor[result.size()]);
   }
 
+  @Override
   public final XmlAttributeDescriptor getAttributeDescriptor(String attributeName, @Nullable XmlTag context) {
     return getAttributeDescriptor("", attributeName);
   }
 
+  @Override
   public final XmlAttributeDescriptor getAttributeDescriptor(XmlAttribute attribute) {
     return getAttributeDescriptor(attribute.getNamespace(), attribute.getLocalName());
   }
@@ -189,6 +198,7 @@
     }
   }
 
+  @Override
   public XmlNSDescriptor getNSDescriptor() {
     return myNsDescriptor;
   }
@@ -199,6 +209,7 @@
   }
 
   // is this actually used anywhere?
+  @Override
   public int getContentType() {
     final DPattern child = myElementPattern.getChild();
     if (child instanceof DEmptyPattern) {
@@ -217,6 +228,7 @@
     return null;
   }
 
+  @Override
   public PsiElement getDeclaration() {
     final SmartPsiElementPointer<? extends PsiElement> declaration = myDeclaration;
     if (declaration != null) {
@@ -287,6 +299,7 @@
     return PsiTreeUtil.getParentOfType(at, XmlTag.class);
   }
 
+  @Override
   @NonNls
   public String getName(PsiElement context) {
     final QName qName = getQName();
@@ -298,6 +311,7 @@
     return format(qName, prefix != null ? prefix : qName.getPrefix());
   }
 
+  @Override
   @NonNls
   public String getName() {
     final QName qName = getQName();
@@ -321,6 +335,7 @@
     return iterator.next();
   }
 
+  @Override
   public void init(PsiElement element) {
 
   }
@@ -340,6 +355,7 @@
     return myElementPattern.hashCode();
   }
 
+  @Override
   public Object[] getDependences() {
     if (myDeclaration != null) {
       return ArrayUtil.append(myNsDescriptor.getDependences(), myDeclaration.getElement());
@@ -351,30 +367,37 @@
   private static class MyNameClassVisitor implements NameClassVisitor<Integer> {
     public static final MyNameClassVisitor INSTANCE = new MyNameClassVisitor();
 
+    @Override
     public Integer visitAnyName() {
       return CONTENT_TYPE_ANY;
     }
 
+    @Override
     public Integer visitAnyNameExcept(NameClass nc) {
       return CONTENT_TYPE_ANY;
     }
 
+    @Override
     public Integer visitChoice(NameClass nc1, NameClass nc2) {
       return CONTENT_TYPE_CHILDREN;
     }
 
+    @Override
     public Integer visitName(QName name) {
       return CONTENT_TYPE_CHILDREN;
     }
 
+    @Override
     public Integer visitNsName(String ns) {
       return CONTENT_TYPE_CHILDREN;
     }
 
+    @Override
     public Integer visitNsNameExcept(String ns, NameClass nc) {
       return CONTENT_TYPE_CHILDREN;
     }
 
+    @Override
     public Integer visitNull() {
       return CONTENT_TYPE_EMPTY;
     }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngNsDescriptor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngNsDescriptor.java
index 2bed77f..93744a9 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngNsDescriptor.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngNsDescriptor.java
@@ -70,6 +70,7 @@
   private DPattern myPattern;
   private PsiManager myManager;
 
+  @Override
   @Nullable
   public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) {
     if (myPattern == null) {
@@ -107,6 +108,7 @@
   private XmlElementDescriptor findRootDescriptor(final XmlTag tag) {
     return CachedValuesManager.getManager(tag.getProject())
         .getParameterizedCachedValue(tag, ROOT_KEY, new ParameterizedCachedValueProvider<XmlElementDescriptor, RngNsDescriptor>() {
+          @Override
           public CachedValueProvider.Result<XmlElementDescriptor> compute(RngNsDescriptor o) {
             final XmlElementDescriptor descr = o.findRootDescriptorInner(tag);
             if (descr != null) {
@@ -151,6 +153,7 @@
       }
     }
     final List<DElementPattern> patterns = ContainerUtil.findAll(list, new Condition<DElementPattern>() {
+      @Override
       public boolean value(DElementPattern pattern) {
         final NameClass nameClass = pattern.getName();
         return nameClass.contains(qName);
@@ -168,6 +171,7 @@
     }
   }
 
+  @Override
   @NotNull
   public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable XmlDocument document) {
     if (myPattern == null) {
@@ -210,15 +214,18 @@
     return descriptor;
   }
 
+  @Override
   @NotNull
   public XmlFile getDescriptorFile() {
     return myFile;
   }
 
+  @Override
   public boolean isHierarhyEnabled() {
     return false;
   }
 
+  @Override
   public synchronized PsiElement getDeclaration() {
     if (!myElement.isValid() || !myFile.isValid()) {
       if (myUrl != null) {
@@ -234,16 +241,19 @@
     return myFile.isValid() ? myFile.getDocument() : null;
   }
 
+  @Override
   @NonNls
   public String getName(PsiElement context) {
     return getName();
   }
 
+  @Override
   @NonNls
   public String getName() {
     return getDescriptorFile().getName();
   }
 
+  @Override
   public Object[] getDependences() {
     if (myPattern != null) {
       if (DumbService.isDumb(myElement.getProject())) {
@@ -261,6 +271,7 @@
     return new Object[]{ ModificationTracker.EVER_CHANGED };
   }
 
+  @Override
   public synchronized void init(PsiElement element) {
     myElement = element;
     myFile = element instanceof XmlFile ? (XmlFile)element : (XmlFile)element.getContainingFile();
@@ -274,6 +285,7 @@
     myPattern = RngParser.getCachedPattern(getDescriptorFile(), RngParser.DEFAULT_HANDLER);
   }
 
+  @Override
   public void validate(@NotNull PsiElement context, @NotNull final ValidationHost host) {
     final XmlDocument doc = PsiTreeUtil.getContextOfType(context, XmlDocument.class, false);
     if (doc == null) {
@@ -290,12 +302,14 @@
   }
 
   //@Override
+  @Override
   public XmlElementDescriptor getElementDescriptor(String localName, String namespace) {
     final QName qName = new QName(namespace, localName);
     CachedValue<XmlElementDescriptor> cachedValue = myDescriptorsMap.get(qName);
     if (cachedValue == null) {
       cachedValue =
         CachedValuesManager.getManager(myElement.getProject()).createCachedValue(new CachedValueProvider<XmlElementDescriptor>() {
+          @Override
           public Result<XmlElementDescriptor> compute() {
             final XmlElementDescriptor descriptor = findRootDescriptorInner(qName);
             return descriptor != null
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngXmlAttributeDescriptor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngXmlAttributeDescriptor.java
index b05794e..85dd71a 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngXmlAttributeDescriptor.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngXmlAttributeDescriptor.java
@@ -44,10 +44,12 @@
   private static final QName UNKNOWN = new QName("", "#unknown");
 
   private static final TObjectHashingStrategy<Locator> HASHING_STRATEGY = new TObjectHashingStrategy<Locator>() {
+    @Override
     public int computeHashCode(Locator o) {
       final String s = o.getSystemId();
       return o.getLineNumber() * 31 + o.getColumnNumber() * 23 + (s != null ? s.hashCode() * 11 : 0);
     }
+    @Override
     public boolean equals(Locator o, Locator o1) {
       if ((o.getLineNumber() == o1.getLineNumber() && o.getColumnNumber() == o1.getColumnNumber())) {
         if (Comparing.equal(o.getSystemId(), o1.getSystemId())) {
@@ -93,31 +95,38 @@
     return new RngXmlAttributeDescriptor(myElementDescriptor, name, values, myOptional || d.myOptional, locations.toArray(new Locator[locations.size()]));
   }
 
+  @Override
   public boolean isRequired() {
     return !myOptional;
   }
 
+  @Override
   public boolean isFixed() {
     return isEnumerated() && myValues.size() == 1;
   }
 
+  @Override
   public boolean hasIdType() {
     return myValues.values().contains("ID");
   }
 
+  @Override
   public boolean hasIdRefType() {
     return myValues.values().contains("IDREF");
   }
 
+  @Override
   @Nullable
   public String getDefaultValue() {
     return isEnumerated() ? myValues.keySet().iterator().next() : null;
   }
 
+  @Override
   public boolean isEnumerated() {
     return myValues.size() > 0 && myValues.get(null) == null;
   }
 
+  @Override
   public String[] getEnumeratedValues() {
     if (myValues.size() > 0) {
       final Map<String, String> copy;
@@ -133,6 +142,7 @@
     }
   }
 
+  @Override
   public PsiElement getDeclaration() {
     final Iterator<Locator> it = myDeclarations.iterator();
     if (!it.hasNext()) return null;
@@ -142,6 +152,7 @@
 
   public Collection<PsiElement> getDeclarations() {
     return ContainerUtil.map2List(myDeclarations, new Function<Locator, PsiElement>() {
+      @Override
       public PsiElement fun(Locator locator) {
         return myElementDescriptor.getDeclaration(locator);
       }
@@ -171,15 +182,18 @@
     return myName.getLocalPart();
   }
 
+  @Override
   @NonNls
   public String getName() {
     return myName.getLocalPart();
   }
 
+  @Override
   public void init(PsiElement element) {
 
   }
 
+  @Override
   public Object[] getDependences() {
     return myElementDescriptor.getDependences();
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/DefinitionResolver.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/DefinitionResolver.java
index afbbcc0..ee11a5f 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/DefinitionResolver.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/DefinitionResolver.java
@@ -103,20 +103,25 @@
     ContainerUtil.getOrCreate(myDefines.get(), def.getName(), this).add(def);
   }
 
+  @Override
   public void visitPattern(Pattern pattern) {
   }
 
+  @Override
   public void visitGrammar(Grammar pattern) {
   }
 
+  @Override
   public void visitRef(Ref ref) {
   }
 
 
+  @Override
   public Set<Define> create() {
     return new THashSet<Define>();
   }
 
+  @Override
   public Result<Map<String, Set<Define>>> compute() {
     try {
       myScope.acceptChildren(this);
@@ -193,6 +198,7 @@
       myValue = value;
     }
 
+    @Override
     public boolean execute(@NotNull XmlFile element) {
       final Grammar g = GrammarFactory.getGrammar(element);
       if (g != null) {
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/RelaxIncludeIndex.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/RelaxIncludeIndex.java
index ab9beda..6cbc2e1 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/RelaxIncludeIndex.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/RelaxIncludeIndex.java
@@ -1,3 +1,18 @@
+/*
+ * 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 org.intellij.plugins.relaxNG.model.resolve;
 
 import com.intellij.ide.highlighter.XmlFileType;
@@ -48,6 +63,7 @@
     Project project = file.getProject();
     final PsiManager psiManager = PsiManager.getInstance(project);
     final PsiFile[] psiFiles = ContainerUtil.map2Array(files, PsiFile.class, new NullableFunction<VirtualFile, PsiFile>() {
+      @Override
       public PsiFile fun(VirtualFile file) {
         return psiManager.findFile(file);
       }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AddValueCondition.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AddValueCondition.java
index 739b0e5..ed8d8cd 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AddValueCondition.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AddValueCondition.java
@@ -35,6 +35,7 @@
     return new AddValueCondition<T>(key);
   }
 
+  @Override
   public boolean accepts(@NotNull T value, ProcessingContext context) {
     context.get(myKey).add(value);
     return true;
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AttributeValueCondition.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AttributeValueCondition.java
index b1ce0d3..059159d 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AttributeValueCondition.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AttributeValueCondition.java
@@ -29,6 +29,7 @@
     myRef = ref;
   }
 
+  @Override
   public boolean accepts(@NotNull XmlAttributeValue value, ProcessingContext context) {
     return myRef.equals(value.getValue());
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AttributeValueFunction.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AttributeValueFunction.java
index fd5468e..7d06d00 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AttributeValueFunction.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AttributeValueFunction.java
@@ -23,6 +23,7 @@
 import java.util.Set;
 
 class AttributeValueFunction implements Function<XmlAttributeValue, String> {
+  @Override
   public String fun(XmlAttributeValue value) {
     return value.getValue();
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/IdRefProvider.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/IdRefProvider.java
index d3857c7..ade3ec5 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/IdRefProvider.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/IdRefProvider.java
@@ -44,6 +44,7 @@
   public static final HasIdRefTypeCondition HAS_ID_REF_TYPE = new HasIdRefTypeCondition();
   public static final HasIdTypeCondition HAS_ID_TYPE = new HasIdTypeCondition();
 
+  @Override
   @NotNull
   public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
     final XmlAttributeValue value = (XmlAttributeValue)element;
@@ -73,15 +74,18 @@
       myCondition = new AttributeValueCondition(element.getValue());
     }
 
+    @Override
     public PsiElement resolve() {
       final ProcessingContext context = new ProcessingContext();
       final ResolvingVisitor visitor = new ResolvingVisitor(PATTERN.with(myCondition).save(TARGET), context) {
+        @Override
         public void visitXmlTag(XmlTag tag) {
           super.visitXmlTag(tag);
           if (shouldContinue()) {
             visitSubTags(tag);
           }
         }
+        @Override
         protected boolean shouldContinue() {
           return context.get(TARGET) == null;
         }
@@ -99,12 +103,14 @@
       }
     }
 
+    @Override
     @NotNull
     public Object[] getVariants() {
       final ProcessingContext context = new ProcessingContext();
       context.put(VARIANTS, new HashSet<XmlAttributeValue>());
 
       final ResolvingVisitor visitor = new ResolvingVisitor(PATTERN.with(AddValueCondition.create(VARIANTS)), context) {
+        @Override
         public void visitXmlTag(XmlTag tag) {
           super.visitXmlTag(tag);
           visitSubTags(tag);
@@ -132,6 +138,7 @@
       super("IdType");
     }
 
+    @Override
     public boolean accepts(@NotNull XmlAttributeValue xmlAttributeValue, ProcessingContext context) {
       return hasIdType(xmlAttributeValue);
     }
@@ -142,6 +149,7 @@
       super("IdRef");
     }
 
+    @Override
     public boolean accepts(@NotNull XmlAttributeValue xmlAttributeValue,  ProcessingContext context) {
       return hasIdRefType(xmlAttributeValue);
     }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/ResolvingVisitor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/ResolvingVisitor.java
index 116ea24..0d9676b 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/ResolvingVisitor.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/ResolvingVisitor.java
@@ -48,6 +48,7 @@
     myProcessingContext.put(VISITED_KEY, new THashSet<XmlFile>());
   }
 
+  @Override
   public void visitXmlDocument(@Nullable XmlDocument document) {
     if (document != null) {
       final XmlTag rootTag = document.getRootTag();
@@ -61,6 +62,7 @@
     myIncludePattern = includePattern;
   }
 
+  @Override
   public void visitXmlAttribute(XmlAttribute attribute) {
     if (myIncludePattern != null && myIncludePattern.accepts(attribute, myProcessingContext)) {
       final String value = attribute.getValue();
@@ -79,6 +81,7 @@
     myPattern.accepts(attribute.getValueElement(), myProcessingContext);
   }
 
+  @Override
   @SuppressWarnings({ "ForLoopReplaceableByForEach" })
   public void visitXmlTag(XmlTag tag) {
     visitAttributes(tag);
@@ -115,6 +118,7 @@
     rootTag.processElements(this, attribute);
   }
 
+  @Override
   public boolean execute(@NotNull PsiElement element) {
     element.accept(this);
     return shouldContinue();
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/MessageViewHelper.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/MessageViewHelper.java
index 6344c1d..a180cec 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/MessageViewHelper.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/MessageViewHelper.java
@@ -102,6 +102,7 @@
     final VirtualFile file1 = file;
     ApplicationManager.getApplication().invokeLater(
       new Runnable() {
+        @Override
         public void run() {
           myErrorsView.addMessage(
             warning ? MessageCategory.WARNING : MessageCategory.ERROR,
@@ -137,6 +138,7 @@
   private void openMessageViewImpl() {
     CommandProcessor commandProcessor = CommandProcessor.getInstance();
     commandProcessor.executeCommand(myProject, new Runnable() {
+      @Override
       public void run() {
         MessageView messageView = MessageView.SERVICE.getInstance(myProject);
         Content content = ContentFactory.SERVICE.getInstance().createContent(myErrorsView.getComponent(), myContentName, true);
@@ -155,9 +157,11 @@
   private static class MyProcessController implements NewErrorTreeViewPanel.ProcessController {
     public static final MyProcessController INSTANCE = new MyProcessController();
 
+    @Override
     public void stopProcess() {
     }
 
+    @Override
     public boolean isProcessStopped() {
       return true;
     }
@@ -175,6 +179,7 @@
       myErrorsView = errorsView;
     }
 
+    @Override
     public void contentRemoved(ContentManagerEvent event) {
       if (event.getContent() == myContent) {
         if (myErrorsView.canControlProcess()) {
@@ -188,6 +193,7 @@
       }
     }
 
+    @Override
     public void contentRemoveQuery(ContentManagerEvent event) {
       if (event.getContent() == myContent) {
         if (myErrorsView != null && myErrorsView.canControlProcess() && !myErrorsView.isProcessStopped()) {
@@ -215,6 +221,7 @@
       myKey = key;
     }
 
+    @Override
     public void contentRemoved(ContentManagerEvent event) {
       final Content eventContent = event.getContent();
       if (!eventContent.equals(myContent)) {
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/Psi2SaxAdapter.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/Psi2SaxAdapter.java
index c95a455..7db07c0 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/Psi2SaxAdapter.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/Psi2SaxAdapter.java
@@ -45,6 +45,7 @@
     myHandler = handler;
   }
 
+  @Override
   public void visitXmlElement(XmlElement element) {
     if (element instanceof XmlEntityRef) {
       XmlUtil.processXmlElements(element, this, false, true);
@@ -52,6 +53,7 @@
     super.visitXmlElement(element);
   }
 
+  @Override
   public void visitXmlToken(XmlToken token) {
     if (token.getTokenType() == XmlTokenType.XML_DATA_CHARACTERS) {
       handleText(token, token.getText());
@@ -67,11 +69,13 @@
     }
   }
 
+  @Override
   public boolean execute(@NotNull PsiElement element) {
     element.accept(this);
     return true;
   }
 
+  @Override
   public void visitXmlDocument(XmlDocument document) {
     try {
       myHandler.startDocument();
@@ -85,6 +89,7 @@
     }
   }
 
+  @Override
   public void visitXmlTag(XmlTag tag) {
     try {
       setLocation(tag);
@@ -127,6 +132,7 @@
     }
   }
 
+  @Override
   public void visitXmlText(XmlText text) {
     handleText(text, text.getValue());
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/RngParser.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/RngParser.java
index 6f9a5c7..ba93ee6 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/RngParser.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/RngParser.java
@@ -104,6 +104,7 @@
   static final Key<CachedValue<DPattern>> PATTERN_KEY = Key.create("PATTERN");
 
   public static final DefaultHandler DEFAULT_HANDLER = new DefaultHandler() {
+    @Override
     public void error(SAXParseException e) throws SAXException {
       LOG.info("e.getMessage() = " + e.getMessage() + " [" + e.getSystemId() + "]");
       LOG.info(e);
@@ -116,6 +117,7 @@
     final CachedValuesManager mgr = CachedValuesManager.getManager(descriptorFile.getProject());
 
     return mgr.getCachedValue(descriptorFile, PATTERN_KEY, new CachedValueProvider<DPattern>() {
+      @Override
       public Result<DPattern> compute() {
         return Result.create(parsePattern(descriptorFile, eh, false), descriptorFile);
       }
@@ -150,6 +152,7 @@
 
     if (file.getFileType() == RncFileType.getInstance()) {
       return new CompactParseable(source, eh) {
+        @Override
         public ParsedPattern parseInclude(String uri, SchemaBuilder schemaBuilder, IncludedGrammar g, String inheritedNs)
                 throws BuildException, IllegalSchemaException
         {
@@ -158,6 +161,7 @@
       };
     } else {
       return new SAXParseable(source, eh) {
+        @Override
         public ParsedPattern parseInclude(String uri, SchemaBuilder schemaBuilder, IncludedGrammar g, String inheritedNs)
                 throws BuildException, IllegalSchemaException
         {
@@ -204,6 +208,7 @@
     CachedValue<Schema> value = descriptorFile.getUserData(SCHEMA_KEY);
     if (value == null) {
       final CachedValueProvider<Schema> provider = new CachedValueProvider<Schema>() {
+        @Override
         public Result<Schema> compute() {
           final InputSource inputSource = makeInputSource(descriptorFile);
 
@@ -246,6 +251,7 @@
       myDescriptorFile = descriptorFile;
     }
 
+    @Override
     protected com.thaiopensource.relaxng.parse.Parseable createParseable(XMLReaderCreator xmlReaderCreator, InputSource inputSource, ErrorHandler errorHandler) {
       if (myDescriptorFile.getFileType() == RncFileType.getInstance()) {
         return new com.thaiopensource.relaxng.parse.compact.CompactParseable(inputSource, errorHandler);
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/RngSchemaValidator.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/RngSchemaValidator.java
index fe052df..758dea8 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/RngSchemaValidator.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/RngSchemaValidator.java
@@ -27,6 +27,7 @@
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.VirtualFileManager;
 import com.intellij.psi.*;
@@ -114,8 +115,8 @@
   }
 
   static class MyValidationMessageConsumer  {
-    List<Pair<PsiElement, String >> errors = new ArrayList<Pair<PsiElement, String>>();
-    List<Pair<PsiElement, String >> warnings = new ArrayList<Pair<PsiElement, String>>();
+    final List<Pair<PsiElement, String >> errors = new ArrayList<Pair<PsiElement, String>>();
+    final List<Pair<PsiElement, String >> warnings = new ArrayList<Pair<PsiElement, String>>();
     ValidationMessageConsumer error() {
       return new ValidationMessageConsumer() {
         @Override
@@ -204,7 +205,7 @@
       return VfsUtil.findFileByURL(new URL(systemId));
     } catch (Exception e) {
       LOG.warn("Failed to build file from uri <" + systemId + ">", e);
-      return VirtualFileManager.getInstance().findFileByUrl(VfsUtil.fixURLforIDEA(systemId));
+      return VirtualFileManager.getInstance().findFileByUrl(VfsUtilCore.fixURLforIDEA(systemId));
     }
   }
 
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/ValidateAction.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/ValidateAction.java
index f45b89c..6ad5e2f 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/ValidateAction.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/ValidateAction.java
@@ -20,8 +20,6 @@
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.LangDataKeys;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
@@ -73,12 +71,14 @@
     setEnabledInModalContext(origAction.isEnabledInModalContext());
   }
 
+  @Override
   public void actionPerformed(AnActionEvent e) {
     if (!actionPerformedImpl(e)) {
       myOrigAction.actionPerformed(e);
     }
   }
 
+  @Override
   public final void update(AnActionEvent e) {
     super.update(e);
     myOrigAction.update(e);
@@ -125,14 +125,17 @@
     final MessageViewHelper helper = new MessageViewHelper(project, CONTENT_NAME, KEY);
 
     helper.openMessageView(new Runnable() {
+      @Override
       public void run() {
         doRun(project, instanceFile, schemaFile);
       }
     });
 
     final Future<?> future = ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
+      @Override
       public void run() {
         ApplicationManager.getApplication().runReadAction(new Runnable() {
+          @Override
           public void run() {
             final MessageViewHelper.ErrorHandler eh = helper.new ErrorHandler();
 
@@ -145,10 +148,12 @@
 
             SwingUtilities.invokeLater(
               new Runnable() {
+                  @Override
                   public void run() {
                     if (!eh.hadErrorOrWarning()) {
                       SwingUtilities.invokeLater(
                           new Runnable() {
+                            @Override
                             public void run() {
                               helper.close();
                               WindowManager.getInstance().getStatusBar(project).setInfo("No errors detected");
@@ -165,10 +170,12 @@
     });
 
     helper.setProcessController(new NewErrorTreeViewPanel.ProcessController() {
+      @Override
       public void stopProcess() {
         future.cancel(true);
       }
 
+      @Override
       public boolean isProcessStopped() {
         return future.isDone();
       }
@@ -229,22 +236,27 @@
     return null;
   }
 
+  @Override
   public boolean displayTextInToolbar() {
     return myOrigAction.displayTextInToolbar();
   }
 
+  @Override
   public void setDefaultIcon(boolean b) {
     myOrigAction.setDefaultIcon(b);
   }
 
+  @Override
   public boolean isDefaultIcon() {
     return myOrigAction.isDefaultIcon();
   }
 
+  @Override
   public void setInjectedContext(boolean worksInInjected) {
     myOrigAction.setInjectedContext(worksInInjected);
   }
 
+  @Override
   public boolean isInInjectedContext() {
     return myOrigAction.isInInjectedContext();
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/Combine.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/Combine.java
index f544c06..1555037 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/Combine.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/Combine.java
@@ -32,6 +32,7 @@
     this.value = value;
   }
 
+  @Override
   public String getValue() {
     return value;
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/RngDomVisitor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/RngDomVisitor.java
index 2ee37fc..e4a9277 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/RngDomVisitor.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/RngDomVisitor.java
@@ -25,6 +25,7 @@
  * Date: 18.08.2007
  */
 public class RngDomVisitor implements DomElementVisitor {
+  @Override
   public void visitDomElement(DomElement element) {
   }
 
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/CreatePatternFix.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/CreatePatternFix.java
index 661e341..e0c6bc6 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/CreatePatternFix.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/CreatePatternFix.java
@@ -47,21 +47,25 @@
     myReference = reference;
   }
 
+  @Override
   @NotNull
   public String getText() {
     return "Create Pattern '" + myReference.getCanonicalText() + "'";
   }
 
+  @Override
   @NotNull
   public String getFamilyName() {
     return "Create Pattern";
   }
 
+  @Override
   @NotNull
   public String getName() {
     return getText();
   }
 
+  @Override
   public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
     if (!isAvailable()) {
       return;
@@ -73,6 +77,7 @@
     }
   }
 
+  @Override
   public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
     return isAvailable();
   }
@@ -91,6 +96,7 @@
     }
   }
 
+  @Override
   public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
     doFix();
   }
@@ -120,6 +126,7 @@
     root.add(defineTag);
   }
 
+  @Override
   public boolean startInWriteAction() {
     return true;
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/DefinitionReference.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/DefinitionReference.java
index 9ac61eb..e424583 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/DefinitionReference.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/DefinitionReference.java
@@ -67,6 +67,7 @@
     return true;
   }
 
+  @Override
   @NotNull
   public ResolveResult[] multiResolve(boolean incompleteCode) {
     final RngGrammar scope = getScope();
@@ -92,12 +93,14 @@
     return scope;
   }
 
+  @Override
   public ResolveResult fun(Define define) {
     final XmlElement xmlElement = (XmlElement)define.getPsiElement();
     assert xmlElement != null;
     return new PsiElementResolveResult(xmlElement);
   }
 
+  @Override
   @NotNull
   public Object[] getVariants() {
     final RngGrammar scope = getScope();
@@ -109,6 +112,7 @@
     if (map == null || map.size() == 0) return ArrayUtil.EMPTY_OBJECT_ARRAY;
 
     return ContainerUtil.mapNotNull(map.values(), new Function<Set<Define>, Object>() {
+      @Override
       public Object fun(Set<Define> defines) {
         final Define define = defines.iterator().next();
         if (defines.size() == 0) {
@@ -130,6 +134,7 @@
     }).toArray();
   }
 
+  @Override
   public LocalQuickFix[] getQuickFixes() {
     final XmlTag tag = PsiTreeUtil.getParentOfType(getElement(), XmlTag.class);
     assert tag != null;
@@ -140,6 +145,7 @@
     return LocalQuickFix.EMPTY_ARRAY;
   }
 
+  @Override
   @NotNull
   public String getUnresolvedMessagePattern() {
     return "Unresolved pattern reference ''{0}''";
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDefineImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDefineImpl.java
index bb51bab..1d096e3 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDefineImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDefineImpl.java
@@ -27,6 +27,7 @@
  * Date: 19.08.2007
  */
 public abstract class RngDefineImpl extends RngDomElementBase implements RngDefine {
+  @Override
   public void setName(String name) {
     final GenericAttributeValue<String> value = getNameAttr();
     if (value.getStringValue() != null) {
@@ -34,18 +35,22 @@
     }
   }
 
+  @Override
   public String getName() {
     return getNameAttr().getValue();
   }
 
+  @Override
   public PsiElement getNameElement() {
     return getNameAttr().getXmlAttributeValue();
   }
 
+  @Override
   public Pattern getPattern() {
     return getPatternFrom(this);
   }
 
+  @Override
   public void accept(Visitor visitor) {
     visitor.visitDefine(this);
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDefineMetaData.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDefineMetaData.java
index 92d0c3d..6c3cd28 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDefineMetaData.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDefineMetaData.java
@@ -33,6 +33,7 @@
  */
 public class RngDefineMetaData extends DomMetaData<RngDefine> {
 
+  @Override
   @Nullable
   protected GenericDomValue getNameElement(final RngDefine element) {
     final GenericAttributeValue<String> id = element.getNameAttr();
@@ -42,14 +43,17 @@
     return null;
   }
 
+  @Override
   public void setName(final String name) throws IncorrectOperationException {
     getElement().setName(name);
   }
 
+  @Override
   public Icon getIcon() {
     return AllIcons.Nodes.Property;
   }
 
+  @Override
   public String getTypeName() {
     return "Pattern Definition";
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDomElementBase.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDomElementBase.java
index 731c15d..ec3f077 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDomElementBase.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDomElementBase.java
@@ -33,10 +33,12 @@
  * Date: 31.08.2007
  */
 public abstract class RngDomElementBase implements RngDomElement, Pattern<XmlElement> {
+  @Override
   public XmlElement getPsiElement() {
     return getXmlElement();
   }
 
+  @Override
   public void accept(Visitor visitor) {
     if (this instanceof Div) {
       visitor.visitDiv((Div)this); // TODO fix me
@@ -45,8 +47,10 @@
     }
   }
 
+  @Override
   public void acceptChildren(final Visitor visitor) {
     acceptChildren(new DomElementVisitor() {
+      @Override
       public void visitDomElement(DomElement element) {
         if (element instanceof CommonElement) {
           ((CommonElement)element).accept(visitor);
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngGrammarImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngGrammarImpl.java
index b7c45ed..3820ed4 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngGrammarImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngGrammarImpl.java
@@ -30,6 +30,7 @@
     visitor.visitGrammar(this);
   }
 
+  @Override
   public Pattern getStart() {
     return getPatternFrom(getStartElement());
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngHrefConverter.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngHrefConverter.java
index d641300..da5acf3 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngHrefConverter.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngHrefConverter.java
@@ -33,6 +33,7 @@
  * Date: 18.08.2007
  */
 public class RngHrefConverter extends Converter<XmlFile> implements CustomReferenceConverter<XmlFile> {
+  @Override
   public XmlFile fromString(@Nullable @NonNls String s, ConvertContext context) {
     if (s != null) {
       final GenericAttributeValue<XmlFile> element = (GenericAttributeValue<XmlFile>)context.getInvocationElement();
@@ -47,10 +48,12 @@
     return null;
   }
 
+  @Override
   public String toString(@Nullable XmlFile psiFile, ConvertContext context) {
     return psiFile == null ? null : psiFile.getName();
   }
 
+  @Override
   @NotNull
   public PsiReference[] createReferences(GenericDomValue<XmlFile> genericDomValue, PsiElement element, ConvertContext context) {
     final String s = genericDomValue.getStringValue();
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngIncludeImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngIncludeImpl.java
index 1dddea3..ea339f4 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngIncludeImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngIncludeImpl.java
@@ -35,10 +35,12 @@
     visitor.visitInclude(this);
   }
 
+  @Override
   public PsiFile getInclude() {
     return getIncludedFile().getValue();
   }
 
+  @Override
   @NotNull
   public RngDefine[] getOverrides() {
     // TODO: include stuff inside DIVs - fix when this is actually used
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngRefImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngRefImpl.java
index b5afb61..2a0f59c 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngRefImpl.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngRefImpl.java
@@ -35,6 +35,7 @@
     visitor.visitRef(this);
   }
 
+  @Override
   public Define getPattern() {
     final XmlAttributeValue value = getName().getXmlAttributeValue();
     if (value == null) return null;
@@ -59,6 +60,7 @@
     return getParentOfType(RngGrammar.class, true);
   }
 
+  @Override
   public String getReferencedName() {
     return getName().getValue();
   }
diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngReferenceConverter.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngReferenceConverter.java
index 02a4af1..cadef4d 100644
--- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngReferenceConverter.java
+++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngReferenceConverter.java
@@ -41,6 +41,7 @@
  * Date: 18.08.2007
  */
 public class RngReferenceConverter implements CustomReferenceConverter {
+  @Override
   @NotNull
   public PsiReference[] createReferences(GenericDomValue genericDomValue, PsiElement element, ConvertContext context) {
     final GenericAttributeValue<String> e = (GenericAttributeValue<String>)genericDomValue;
@@ -53,6 +54,7 @@
 
       return new PsiReference[]{
               new PsiReferenceBase<XmlAttributeValue>(value, true) {
+                @Override
                 public PsiElement resolve() {
 //                  final XmlTag tag = PsiTreeUtil.getParentOfType(value, XmlTag.class);
 //                  final XmlTag include = getAncestorTag(tag, "include", ProjectLoader.RNG_NAMESPACE);
@@ -64,6 +66,7 @@
                   return myElement.getParent().getParent();
                 }
 
+                @Override
                 @NotNull
                 public Object[] getVariants() {
                   final RngInclude include = e.getParentOfType(RngInclude.class, true);
diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/AbstractIndexTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/AbstractIndexTest.java
index eb70d76..6f22edf 100644
--- a/xml/relaxng/test/org/intellij/plugins/relaxNG/AbstractIndexTest.java
+++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/AbstractIndexTest.java
@@ -27,6 +27,7 @@
 */
 public abstract class AbstractIndexTest extends HighlightingTestBase {
 
+  @Override
   protected final CodeInsightTestFixture createFixture(@NotNull IdeaTestFixtureFactory factory) {
     return createContentFixture(factory);
   }
diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/AbstractParsingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/AbstractParsingTest.java
index 6492f49..77251f7 100644
--- a/xml/relaxng/test/org/intellij/plugins/relaxNG/AbstractParsingTest.java
+++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/AbstractParsingTest.java
@@ -30,6 +30,7 @@
     super("psi/" + s, "rnc", new RncParserDefinition());
   }
 
+  @Override
   protected String getTestDataPath() {
     return PlatformTestUtil.getCommunityPath() + "/xml/relaxng/testData/parsing";
   }
diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/AttributeCompletionTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/AttributeCompletionTest.java
index 77386a3..e39ee3c 100644
--- a/xml/relaxng/test/org/intellij/plugins/relaxNG/AttributeCompletionTest.java
+++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/AttributeCompletionTest.java
@@ -25,6 +25,7 @@
 */
 @CopyFile("*.rng")
 public class AttributeCompletionTest extends HighlightingTestBase {
+  @Override
   public String getTestDataPath() {
     return "completion";
   }
diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/ElementCompletionTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/ElementCompletionTest.java
index fd8ea31..7dbbf62 100644
--- a/xml/relaxng/test/org/intellij/plugins/relaxNG/ElementCompletionTest.java
+++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/ElementCompletionTest.java
@@ -26,6 +26,7 @@
 */
 @CopyFile("element-completion.rng")
 public class ElementCompletionTest extends HighlightingTestBase {
+  @Override
   public String getTestDataPath() {
     return "completion";
   }
diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/ExternalRncParsingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/ExternalRncParsingTest.java
index c1928b8..22d0fa9 100644
--- a/xml/relaxng/test/org/intellij/plugins/relaxNG/ExternalRncParsingTest.java
+++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/ExternalRncParsingTest.java
@@ -22,6 +22,7 @@
 * Date: 07.08.2007
 */
 public class ExternalRncParsingTest extends HighlightingTestBase {
+  @Override
   public String getTestDataPath() {
     return "parsing";
   }
diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java
index 53558fe..2b6f0b3 100644
--- a/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java
+++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java
@@ -151,7 +151,7 @@
     doCustomHighlighting(name, true, true);
   }
 
-  protected void doCustomHighlighting(String name, final boolean checkWeakWarnings, final Boolean includeExternalToolPass) throws Throwable {
+  protected void doCustomHighlighting(String name, final boolean checkWeakWarnings, final Boolean includeExternalToolPass) {
     myTestFixture.configureByFile(name);
 
     doCustomHighlighting(checkWeakWarnings, includeExternalToolPass);
@@ -188,11 +188,11 @@
     return CodeInsightTestFixtureImpl.instantiateAndRun(myTestFixture.getFile(), editor, ignore, false);
   }
 
-  protected void doTestCompletion(String name, String ext) throws Throwable {
+  protected void doTestCompletion(String name, String ext) {
     myTestFixture.testCompletion(name + "." + ext, name + "_after." + ext);
   }
 
-  protected void doTestCompletion(String before, String... variants) throws Throwable {
+  protected void doTestCompletion(String before, String... variants) {
     myTestFixture.testCompletionVariants(before, variants);
   }
 
@@ -200,12 +200,12 @@
     doTestCompletion(before, "xml");
   }
 
-  protected void doTestRename(String name, String ext, String newName) throws Throwable {
+  protected void doTestRename(String name, String ext, String newName) {
     myTestFixture.testRename(name + "." + ext, name + "_after." + ext, newName);
   }
 
   @SuppressWarnings({ "deprecation", "unchecked" })
-  protected void doTestQuickFix(String file, String ext) throws Throwable {
+  protected void doTestQuickFix(String file, String ext) {
     final PsiReference psiReference = myTestFixture.getReferenceAtCaretPositionWithAssertion(file + "." + ext);
     assertNull("Reference", psiReference.resolve());
     assertTrue(psiReference.getClass().getName() + " is not a QuickFixProvider", psiReference instanceof LocalQuickFixProvider);
diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncCompletionTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncCompletionTest.java
index fe552d0..d0e2e99 100644
--- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncCompletionTest.java
+++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncCompletionTest.java
@@ -31,6 +31,7 @@
     CamelHumpMatcher.forceStartMatching(getTestRootDisposable());
   }
 
+  @Override
   public String getTestDataPath() {
     return "completion/rnc";
   }
diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncExternalHighlightingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncExternalHighlightingTest.java
index da70d9f..8f9146a 100644
--- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncExternalHighlightingTest.java
+++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncExternalHighlightingTest.java
@@ -25,10 +25,12 @@
  */
 public class RncExternalHighlightingTest extends HighlightingTestBase {
 
+  @Override
   public String getTestDataPath() {
     return "highlighting/rnc";
   }
 
+  @Override
   protected void init() {
 //    new ProjectLoader(myTestFixture.getProject()).initComponent();
 //    ExternalResourceManager.getInstance().addResource("http://relaxng.org/ns/structure/1.0", new File("highlighting/relaxng.rng").getAbsolutePath());
diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncHighlightingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncHighlightingTest.java
index f28b086..801dbfd 100644
--- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncHighlightingTest.java
+++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncHighlightingTest.java
@@ -25,6 +25,7 @@
  */
 public class RncHighlightingTest extends HighlightingTestBase {
 
+  @Override
   public String getTestDataPath() {
     return "highlighting/rnc";
   }
diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncIndexHighlightingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncIndexHighlightingTest.java
index 97b6219..dd59236 100644
--- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncIndexHighlightingTest.java
+++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncIndexHighlightingTest.java
@@ -26,6 +26,7 @@
 @CopyFile("*.rnc")
 public class RncIndexHighlightingTest extends AbstractIndexTest {
 
+  @Override
   public String getTestDataPath() {
     return "highlighting/rnc";
   }
diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncRenameTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncRenameTest.java
index e8c789e..4ef44f8 100644
--- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncRenameTest.java
+++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncRenameTest.java
@@ -36,10 +36,12 @@
  */
 public class RncRenameTest extends HighlightingTestBase {
 
+  @Override
   protected CodeInsightTestFixture createFixture(@NotNull IdeaTestFixtureFactory factory) {
     return createContentFixture(factory);
   }
 
+  @Override
   public String getTestDataPath() {
     return "rename/rnc";
   }
@@ -79,6 +81,7 @@
     assertNotNull(file);
 
     new WriteCommandAction.Simple(project) {
+      @Override
       protected void run() throws Throwable {
         myTestFixture.configureByFile("rename-in-include.rnc");
         final RenameRefactoring refactoring = factory.createRename(file, "rename-after.rnc");
diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngCompletionTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngCompletionTest.java
index 82a6744..4f1a7d2 100644
--- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngCompletionTest.java
+++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngCompletionTest.java
@@ -25,6 +25,7 @@
  * Date: 22.08.2007
  */
 public class RngCompletionTest extends HighlightingTestBase {
+  @Override
   public String getTestDataPath() {
     return "completion/rng";
   }
diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngHighlightingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngHighlightingTest.java
index aa44eca..aab32bd 100644
--- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngHighlightingTest.java
+++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngHighlightingTest.java
@@ -29,6 +29,7 @@
  */
 public class RngHighlightingTest extends HighlightingTestBase {
 
+  @Override
   public String getTestDataPath() {
     return "highlighting/rng";
   }
diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngIndexHighlightingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngIndexHighlightingTest.java
index 0b89884..f70595c 100644
--- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngIndexHighlightingTest.java
+++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngIndexHighlightingTest.java
@@ -26,6 +26,7 @@
 @CopyFile("*.rng")
 public class RngIndexHighlightingTest extends AbstractIndexTest {
 
+  @Override
   public String getTestDataPath() {
     return "highlighting/rng";
   }
diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngRenameTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngRenameTest.java
index 4923b8c..6025008 100644
--- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngRenameTest.java
+++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngRenameTest.java
@@ -26,10 +26,12 @@
  * Date: 22.08.2007
  */
 public class RngRenameTest extends HighlightingTestBase {
+  @Override
   protected CodeInsightTestFixture createFixture(@NotNull IdeaTestFixtureFactory factory) {
     return createContentFixture(factory);
   }
 
+  @Override
   public String getTestDataPath() {
     return "rename/rng";
   }
diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java
index 261ca4e..59f5bae 100644
--- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java
+++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java
@@ -30,15 +30,18 @@
  */
 public class RngXmlHighlightingTest extends HighlightingTestBase {
 
+  @Override
   public String getTestDataPath() {
     return "highlighting";
   }
 
+  @Override
   protected void init() {
     super.init();
     FileTypeManager.getInstance().registerFileType(StdFileTypes.XML, "fo");
 
     ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      @Override
       public void run() {
         final ExternalResourceManagerEx m = ExternalResourceManagerEx.getInstanceEx();
         ExternalResourceManagerExImpl
diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlValidationTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlValidationTest.java
index 1472e0a..06bff38 100644
--- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlValidationTest.java
+++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlValidationTest.java
@@ -83,9 +83,11 @@
     doExternalToolHighlighting(name);
   }
 
+  @Override
   protected void init() {
     super.init();
     ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      @Override
       public void run() {
         final ExternalResourceManager mgr = ExternalResourceManager.getInstance();
         mgr.addResource("urn:test:simple.rng", toAbsolutePath("validation/simple.rng"));
@@ -95,6 +97,7 @@
     });
   }
 
+  @Override
   public String getTestDataPath() {
     return "validation";
   }
diff --git a/xml/tests/src/com/intellij/codeInsight/XmlBuilderTest.java b/xml/tests/src/com/intellij/codeInsight/XmlBuilderTest.java
index b735141..70b0263 100644
--- a/xml/tests/src/com/intellij/codeInsight/XmlBuilderTest.java
+++ b/xml/tests/src/com/intellij/codeInsight/XmlBuilderTest.java
@@ -1,4 +1,20 @@
 /*
+ * 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 max
  */
 package com.intellij.codeInsight;
@@ -249,7 +265,7 @@
     );
   }
 
-  private static void doTest(String xml, String expectedEventSequence, final XmlBuilder.ProcessingOrder tagsAndAttributes) throws Exception {
+  private static void doTest(String xml, String expectedEventSequence, final XmlBuilder.ProcessingOrder tagsAndAttributes) {
     final TestXmlBuilder builder = new TestXmlBuilder(tagsAndAttributes);
     new XmlBuilderDriver(xml).build(builder);
     assertEquals(expectedEventSequence, builder.getResult());
diff --git a/xml/tests/src/com/intellij/codeInsight/XmlDocumentationTest.java b/xml/tests/src/com/intellij/codeInsight/XmlDocumentationTest.java
index 5e4d8c4..5d77aa2 100644
--- a/xml/tests/src/com/intellij/codeInsight/XmlDocumentationTest.java
+++ b/xml/tests/src/com/intellij/codeInsight/XmlDocumentationTest.java
@@ -128,7 +128,7 @@
     PsiElement element;
     final PsiFile psiFile;
 
-    DocumentationTestContext(String... fileNames) throws Exception {
+    DocumentationTestContext(String... fileNames) {
       copyAdditionalFiles(fileNames);
       psiFile = myFixture.configureByFile(fileNames[0]);
       originalElement = psiFile.findElementAt(myFixture.getEditor().getCaretModel().getOffset());
diff --git a/xml/tests/src/com/intellij/codeInsight/XmlDtdTest.java b/xml/tests/src/com/intellij/codeInsight/XmlDtdTest.java
index e4c1da5..72b67db 100644
--- a/xml/tests/src/com/intellij/codeInsight/XmlDtdTest.java
+++ b/xml/tests/src/com/intellij/codeInsight/XmlDtdTest.java
@@ -323,7 +323,7 @@
     assertEquals("date", elements[0].getName());
   }
 
-  private static XmlNSDescriptor createDescriptor(String dtdText) throws Exception {
+  private static XmlNSDescriptor createDescriptor(String dtdText) {
     PsiFile dtdFile = createLightFile("test.dtd", dtdText);
 
     XmlNSDescriptorImpl descriptor = new XmlNSDescriptorImpl();
@@ -331,7 +331,7 @@
     return descriptor;
   }
 
-  private static XmlTag tag(String tagName) throws Exception {
+  private static XmlTag tag(String tagName) {
     XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("tag.xml", StdFileTypes.XML, "<" + tagName + "/>");
     return file.getDocument().getRootTag();
   }
diff --git a/xml/tests/src/com/intellij/codeInsight/XmlEventsTest.java b/xml/tests/src/com/intellij/codeInsight/XmlEventsTest.java
index 0e2090f..049cc14 100644
--- a/xml/tests/src/com/intellij/codeInsight/XmlEventsTest.java
+++ b/xml/tests/src/com/intellij/codeInsight/XmlEventsTest.java
@@ -66,7 +66,9 @@
     final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText("<a>aaa</a>");
     final XmlTag otherTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<a/>");
     final XmlText xmlText = tagFromText.getValue().getTextElements()[0];
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         xmlText.insertAtOffset(otherTag, 2);
       }
     });
@@ -78,7 +80,9 @@
     final Listener listener = addPomListener();
     final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText("<a>aaa</a>");
     final XmlText xmlText = tagFromText.getValue().getTextElements()[0];
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         xmlText.insertText("bb", 2);
       }
     });
@@ -89,7 +93,9 @@
   public void test4() throws Exception{
     final Listener listener = addPomListener();
     final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText("<a>a </a>");
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         tagFromText.addAfter(tagFromText.getValue().getTextElements()[0], tagFromText.getValue().getTextElements()[0]);
       }
     });
@@ -100,7 +106,9 @@
   public void test5() throws Exception{
     final Listener listener = addPomListener();
     final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText("<a>aaa</a>");
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         tagFromText.delete();
       }
     });
@@ -156,7 +164,9 @@
     final XmlTag tag = XmlElementFactory.getInstance(getProject()).createTagFromText(text);
     final XmlAttribute attribute = tag.getAttribute("name", null);
     assert attribute != null;
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         attribute.setValue("new");
       }
     });
@@ -173,7 +183,9 @@
     final PsiFileImpl containingFile = (PsiFileImpl)tagFromText.getContainingFile();
     final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(getProject());
     final Document document = documentManager.getDocument(containingFile);
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
             document.insertString(positionToInsert, stringToInsert);
             documentManager.commitDocument(document);
           }
diff --git a/xml/tests/src/com/intellij/codeInsight/XmlInsightTest.java b/xml/tests/src/com/intellij/codeInsight/XmlInsightTest.java
index 01d46ca..675a424 100644
--- a/xml/tests/src/com/intellij/codeInsight/XmlInsightTest.java
+++ b/xml/tests/src/com/intellij/codeInsight/XmlInsightTest.java
@@ -143,11 +143,11 @@
     assertTrue(attributes[1].isRequired());
   }
 
-  private static XmlFile createFile(String text) throws Exception {
+  private static XmlFile createFile(String text) {
     return (XmlFile)createFile("test.xml", text);
   }
 
-  private static XmlNSDescriptor createDescriptor(XmlFile file) throws Exception{
+  private static XmlNSDescriptor createDescriptor(XmlFile file) {
     return file.getDocument().getRootTagNSDescriptor();
   }
 
diff --git a/xml/tests/src/com/intellij/codeInsight/XmlPerformanceTest.java b/xml/tests/src/com/intellij/codeInsight/XmlPerformanceTest.java
index fc5fec2..089daa9 100644
--- a/xml/tests/src/com/intellij/codeInsight/XmlPerformanceTest.java
+++ b/xml/tests/src/com/intellij/codeInsight/XmlPerformanceTest.java
@@ -1,5 +1,17 @@
 /*
- * Copyright (c) 2000-2006 JetBrains s.r.o. All Rights Reserved.
+ * 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.
  */
 
 /*
@@ -59,7 +71,7 @@
     return ourTestsWithFolding.contains(getTestName(false));
   }
 
-  private void doIndentTest(int time) throws Exception {
+  private void doIndentTest(int time) {
     configureByFile(getBasePath() + getTestName(false)+".xml");
     doHighlighting();
     myEditor.getSelectionModel().setSelection(0,myEditor.getDocument().getTextLength());
diff --git a/xml/tests/src/com/intellij/codeInsight/XmlSchemaTest.java b/xml/tests/src/com/intellij/codeInsight/XmlSchemaTest.java
index fc9fe64..9100b11 100644
--- a/xml/tests/src/com/intellij/codeInsight/XmlSchemaTest.java
+++ b/xml/tests/src/com/intellij/codeInsight/XmlSchemaTest.java
@@ -1,3 +1,18 @@
+/*
+ * 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.codeInsight;
 
 import com.intellij.psi.PsiFile;
@@ -749,7 +764,7 @@
     assertNull(attribute);
   }
 
-  private static XmlNSDescriptor createDescriptor(@NonNls String dtdText) throws Exception {
+  private static XmlNSDescriptor createDescriptor(@NonNls String dtdText) {
     PsiFile dtdFile = createFile("test.xml", dtdText);
 
     return new XmlNSDescriptorImpl((XmlFile)dtdFile);
diff --git a/xml/tests/src/com/intellij/codeInsight/XmlTagTest.java b/xml/tests/src/com/intellij/codeInsight/XmlTagTest.java
index 19385dd..5c4d053 100644
--- a/xml/tests/src/com/intellij/codeInsight/XmlTagTest.java
+++ b/xml/tests/src/com/intellij/codeInsight/XmlTagTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -99,7 +99,9 @@
   public void testDeleteTag() throws Throwable {
     XmlTag aTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<a><b/> </a>");
     final XmlTag bTag = aTag.findFirstSubTag("b");
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         bTag.delete();
       }
     });
@@ -110,7 +112,9 @@
   public void testReplaceTag() throws Throwable {
     final XmlTag aTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<a><b/></a>");
     final XmlTag bTag = aTag.findFirstSubTag("b");
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         PsiElement cTag = bTag.replace(XmlElementFactory.getInstance(getProject()).createTagFromText("<c/>"));
         assertEquals(1, aTag.getSubTags().length);
         assertEquals(cTag, aTag.getSubTags()[0]);
@@ -123,7 +127,9 @@
     final XmlTag aTag = elementFactory.createTagFromText("<a>1</a>");
     final XmlText displayText = elementFactory.createDisplayText("2");
 
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         final PsiElement psiElement = aTag.addAfter(displayText, aTag.getValue().getChildren()[0]);
         assertEquals(psiElement.getContainingFile(), aTag.getContainingFile());
       }
@@ -131,7 +137,9 @@
   }
 
   public void testWhitespaceInsideTag() throws Exception {
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         XmlElementFactory.getInstance(getProject()).createTagFromText("<p/>").getValue().setText("\n");
       }
     });
@@ -141,7 +149,9 @@
     XmlFile xhtmlFile = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("dummy.xhtml", "<html/>");
     final XmlTag rootTag = xhtmlFile.getDocument().getRootTag();
 
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         rootTag.setAttribute("foo", "bar");
       }
     });
@@ -153,7 +163,9 @@
 
   public void testSetAttribute() throws Exception {
     final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html/>");
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         rootTag.setAttribute("foo", "bar");
       }
     });
@@ -167,7 +179,9 @@
   public void testSetAttributeWithQuotes() throws Exception {
     final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html/>");
     final String value = "a \"b\" c";
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         rootTag.setAttribute("foo", value);
       }
     });
@@ -181,7 +195,9 @@
   public void testSetAttributeWithQuotes2() throws Exception {
     final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html/>");
     final String value = "'a \"b\" c'";
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         rootTag.setAttribute("foo", value);
       }
     });
@@ -211,7 +227,9 @@
 
   public void testSetAttributeWithNamespaces() throws Exception {
     final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<ns:tag xmlns:ns=\"xxx\"/>");
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         rootTag.setAttribute("foo", "", "bar");
       }
     });
@@ -225,7 +243,9 @@
   public void testTextEdit1() throws Exception {
     final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html>aaa</html>");
     final XmlText xmlText = rootTag.getValue().getTextElements()[0];
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         xmlText.removeText(0, 3);
       }
     });
@@ -235,7 +255,9 @@
 
   public void testTextEdit2() throws Exception {
     final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html>a&lt;a</html>");
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         rootTag.getValue().getTextElements()[0].removeText(0, 3);
       }
     });
@@ -246,7 +268,9 @@
   public void testTextEdit3() throws Exception {
     final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html>a&lt;a</html>");
     final XmlText xmlText = rootTag.getValue().getTextElements()[0];
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         xmlText.removeText(1, 2);
       }
     });
@@ -258,7 +282,9 @@
   public void testTextEdit4() throws Exception {
     final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html>aaa</html>");
     final XmlText xmlText = rootTag.getValue().getTextElements()[0];
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         xmlText.removeText(1, 2);
       }
     });
@@ -293,7 +319,9 @@
   public void testTextEdit6() throws Exception {
     final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html>a<b>1</b>c</html>");
     final XmlTag xmlTag = rootTag.findFirstSubTag("b");
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         xmlTag.delete();
       }
     });
@@ -303,7 +331,9 @@
 
   public void testBrace() throws Exception {
    final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText("<a/>");
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         tagFromText.getValue().setText("<");
       }
     });
@@ -406,7 +436,9 @@
     final XmlTagChild child = tag.getValue().getChildren()[0];
     assertTrue(child instanceof XmlText && child.getText().equals("234"));
 
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         assertNotNull(tag.getParent().addBefore(child, tag));
         tag.delete();
       }
@@ -424,7 +456,9 @@
     final XmlTagChild child = tag.getValue().getChildren()[0];
     assertTrue(child instanceof XmlText && child.getText().equals("234"));
 
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         assertNotNull(tag.getParent().addBefore(child, tag));
         tag.delete();
       }
@@ -437,7 +471,9 @@
 
   public void testDisplayText() throws Throwable {
     final XmlTag tag = XmlElementFactory.getInstance(getProject()).createTagFromText("  <foo/>");
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         tag.add(XmlElementFactory.getInstance(getProject()).createDisplayText("aaa\nbbb"));
       }
     });
@@ -453,7 +489,9 @@
     final XmlTagChild[] tagElements = tagB.getValue().getChildren();
     final PsiElement parent = tagB.getParent();
 
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         PsiElement first = parent.addBefore(tagElements[0], tagB);
         assertNotNull(first);
       }
@@ -507,7 +545,9 @@
     final XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject())
       .createFileFromText("test.xml", "<a>\n    <a>\n <b>\n     hasgdgasjdgasdg    asgdjhasgd</b>\n </a>\n</a>");
     final XmlTag tagB = file.getDocument().getRootTag();
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         tagB.getSubTags()[0].getSubTags()[0].delete();
       }
     });
@@ -598,7 +638,7 @@
             final XmlText xmlText = (XmlText)children[0];
             assertEquals(text, xmlText.getText());
             xmlText.removeText(i, j);
-            final StringBuffer expected = new StringBuffer(text);
+            final StringBuilder expected = new StringBuilder(text);
             expected.delete(i, j);
             assertEquals(expected.toString(), xmlText.getValue());
           }
@@ -618,7 +658,7 @@
           final XmlText xmlText = (XmlText)children[0];
           assertEquals(text, xmlText.getValue());
           xmlText.insertText(textToInsert, i);
-          final StringBuffer expected = new StringBuffer(text);
+          final StringBuilder expected = new StringBuilder(text);
           expected.insert(i, textToInsert);
           assertEquals(expected.toString(), xmlText.getValue());
         }
@@ -653,7 +693,7 @@
     doTestEscapedInsertion("_x_y_z_", "a");
   }
 
-  public static void notestEscapedDeletion() throws Throwable {
+  public static void notestEscapedDeletion() {
     doTestEscapedDeletion("&");
     doTestEscapedDeletion("&&");
     doTestEscapedDeletion(" &&");
@@ -686,7 +726,7 @@
       final XmlText xmlText = (XmlText)children[0];
       assertEquals(tagText, xmlText.getText());
       xmlText.insertText(textToInsert, i);
-      final StringBuffer expectedDisplay = new StringBuffer(text.replace('_', '\u00a0'));
+      final StringBuilder expectedDisplay = new StringBuilder(text.replace('_', '\u00a0'));
       expectedDisplay.insert(i, textToInsert);
       assertEquals(expectedDisplay.toString(), xmlText.getValue());
 
@@ -708,7 +748,7 @@
             final XmlText xmlText = (XmlText)children[0];
             assertEquals(tagText, xmlText.getText());
             xmlText.removeText(i, j);
-            final StringBuffer expectedDisplay = new StringBuffer(text.replace('_', ' '));
+            final StringBuilder expectedDisplay = new StringBuilder(text.replace('_', ' '));
             expectedDisplay.delete(i, j);
             assertEquals(expectedDisplay.toString(), xmlText.getValue());
 
diff --git a/xml/tests/src/com/intellij/codeInsight/XmlTagWriteTest.java b/xml/tests/src/com/intellij/codeInsight/XmlTagWriteTest.java
index 89cc126..39c77f1 100644
--- a/xml/tests/src/com/intellij/codeInsight/XmlTagWriteTest.java
+++ b/xml/tests/src/com/intellij/codeInsight/XmlTagWriteTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -48,7 +48,9 @@
 
   public void test2() throws IncorrectOperationException {
     final XmlTag xmlTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<tag1></tag1>");
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         xmlTag.add(xmlTag.createChildTag("tag2", XmlUtil.EMPTY_URI, null, false));
       }
     });
diff --git a/xml/tests/src/com/intellij/codeInsight/XmlTestUtil.java b/xml/tests/src/com/intellij/codeInsight/XmlTestUtil.java
index 75aa882..1fd17df 100644
--- a/xml/tests/src/com/intellij/codeInsight/XmlTestUtil.java
+++ b/xml/tests/src/com/intellij/codeInsight/XmlTestUtil.java
@@ -1,3 +1,18 @@
+/*
+ * 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.codeInsight;
 
 import com.intellij.openapi.project.Project;
@@ -8,12 +23,12 @@
 
 public class XmlTestUtil {
 
-  public static XmlTag tag(@NonNls String tagName, Project project) throws Exception {
+  public static XmlTag tag(@NonNls String tagName, Project project) {
     XmlFile file = (XmlFile)PsiFileFactory.getInstance(project).createFileFromText("tag.xml", "<" + tagName + "/>");
     return file.getDocument().getRootTag();
   }
 
-  public static XmlTag tag(@NonNls String tagName, @NonNls String namespace, Project project) throws Exception {
+  public static XmlTag tag(@NonNls String tagName, @NonNls String namespace, Project project) {
     XmlFile file = (XmlFile)PsiFileFactory.getInstance(project)
       .createFileFromText("tag.xml", "<" + tagName + " xmlns=\"" + namespace + "\"/>");
     return file.getDocument().getRootTag();
diff --git a/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java b/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java
index 05eb6a3..2b6b36c 100644
--- a/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java
+++ b/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java
@@ -1,3 +1,18 @@
+/*
+ * 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.codeInsight.completion;
 
 import com.intellij.codeInsight.CodeInsightSettings;
@@ -17,6 +32,7 @@
 import com.intellij.psi.statistics.impl.StatisticsManagerImpl;
 import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
 import com.intellij.xml.util.XmlUtil;
+import org.jetbrains.annotations.NotNull;
 
 import java.util.List;
 
@@ -67,7 +83,7 @@
   protected void runTest() throws Throwable {
     new WriteCommandAction(getProject()) {
       @Override
-      protected void run(Result result) throws Throwable {
+      protected void run(@NotNull Result result) throws Throwable {
         XmlCompletionTest.super.runTest();
       }
     }.execute();
@@ -200,7 +216,7 @@
     myFixture.type(c);
   }
 
-  private void doCompletionTest(final String ext, final String url, final String location) throws Exception {
+  private void doCompletionTest(final String ext, final String url, final String location) {
     final String testName = getTestName(false);
     addResource(url, location);
 
@@ -411,7 +427,7 @@
     basicDoTest("");
   }
 
-  private void basicDoTest(String ext) throws Exception {
+  private void basicDoTest(String ext) {
     final String testName = getTestName(false) + ext;
     configureByFile(testName + ".xml");
     checkResultByFile(testName + "_after.xml");
@@ -518,7 +534,7 @@
     checkResultByFile(testName + "_after.xml");
   }
 
-  public void _testIDEADEV_32773() throws Exception {
+  public void _testIDEADEV_32773() {
     final String testName = getTestName(false);
 
     configureByFiles(testName + ".xml",
@@ -686,5 +702,15 @@
     myFixture.testCompletionVariants("tagValue/completeEnum.xml", "none", "standard");
     myFixture.testCompletionVariants("tagValue/completeBoolean.xml", "false", "true");
   }
+
+  public void testInheritedAttribute() throws Exception {
+    myFixture.configureByFiles("InheritedAttr/test.xsd", "InheritedAttr/library.xsd");
+    myFixture.testCompletionVariants("InheritedAttr/test.xml", "buz",
+    "library:boo",
+    "xml:base",
+    "xml:id",
+    "xml:lang",
+    "xml:space");
+  }
 }
 
diff --git a/xml/tests/src/com/intellij/codeInsight/completion/XmlTypedHandlersTest.java b/xml/tests/src/com/intellij/codeInsight/completion/XmlTypedHandlersTest.java
index a4f6c2a..41e64aa 100644
--- a/xml/tests/src/com/intellij/codeInsight/completion/XmlTypedHandlersTest.java
+++ b/xml/tests/src/com/intellij/codeInsight/completion/XmlTypedHandlersTest.java
@@ -95,6 +95,16 @@
     }
   }
 
+  public void testFooBar() throws Exception {
+    doTest("<foo>\n" +
+           "  <bar<caret></bar>\n" +
+           "</foo>",
+           '>',
+           "<foo>\n" +
+           "  <bar></bar>\n" +
+           "</foo>");
+  }
+
   private void doTest(String text, char c, String result) {
     myFixture.configureByText(XmlFileType.INSTANCE, text);
     myFixture.type(c);
diff --git a/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java b/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java
index 7b9cc14..7bfe266 100644
--- a/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java
+++ b/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -548,7 +548,9 @@
       final XmlAttribute attribute = t.getAttribute("name", null);
       final XmlAttributeValue valueElement = attribute.getValueElement();
       final PsiReference nameReference = valueElement.getReferences()[0];
-      WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+      WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+        @Override
+        public void run() {
           nameReference.handleElementRename("zzz");
         }
       });
@@ -561,7 +563,9 @@
 
   public void testExternalValidatorOnValidXmlWithNamespacesNotSetup() throws Exception {
     final ExternalResourceManagerEx instanceEx = ExternalResourceManagerEx.getInstanceEx();
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         instanceEx.addIgnoredResource("http://xml.apache.org/axis/wsdd2/");
         instanceEx.addIgnoredResource("http://xml.apache.org/axis/wsdd2/providers/java");
         instanceEx.addIgnoredResource("http://soapinterop.org/xsd2");
@@ -575,14 +579,18 @@
   public void testExternalValidatorOnValidXmlWithNamespacesNotSetup2() throws Exception {
     final ExternalResourceManagerEx instanceEx = ExternalResourceManagerEx.getInstanceEx();
     try {
-      WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+      WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+        @Override
+        public void run() {
           instanceEx.addIgnoredResource("");
         }
       });
 
       doTest(getFullRelativeTestName(".xml"), true, false);
     } finally {
-      WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+      WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+        @Override
+        public void run() {
           instanceEx.removeIgnoredResource("");
         }
       });
@@ -1057,7 +1065,9 @@
   }
 
   public void testIgnoredNamespaceHighlighting() throws Exception {
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         ExternalResourceManagerEx.getInstanceEx().addIgnoredResource("http://ignored/uri");
       }
     });
@@ -1234,6 +1244,7 @@
 
     final String text = myEditor.getDocument().getText();
     WriteCommandAction.runWriteCommandAction(null, new Runnable() {
+      @Override
       public void run() {
         myEditor.getSelectionModel().setSelection(0, myEditor.getDocument().getTextLength());
       }
@@ -1409,7 +1420,9 @@
     final Editor schemaEditor = allEditors[0] == myEditor ? allEditors[1]:allEditors[0];
     final String text = schemaEditor.getDocument().getText();
     final String newText = text.replaceAll("xsd","xs");
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         schemaEditor.getDocument().replaceString(0, text.length(), newText);
       }
     });
@@ -1550,7 +1563,6 @@
     );
   }
 
-  @HighlightingFlags(HighlightingFlag.SkipExternalValidation)
   public void testDocBook5() throws Exception {
     doTestWithLocations(
       new String[][] {
@@ -1567,7 +1579,9 @@
     Collection<HighlightInfo> infos = filterInfos(doHighlighting());
     assertEquals(2, infos.size());
 
-    WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() {
+    WriteCommandAction.runWriteCommandAction(null, new Runnable(){
+      @Override
+      public void run() {
         EditorModificationUtil.deleteSelectedText(myEditor);
       }
     });
@@ -1577,6 +1591,7 @@
     assertEquals(11, infos.size());
 
     WriteCommandAction.runWriteCommandAction(null, new Runnable() {
+      @Override
       public void run() {
         EditorModificationUtil.insertStringAtCaret(myEditor, "<");
       }
@@ -2050,6 +2065,11 @@
     assertTrue(resolve instanceof XmlTag);
   }
 
+  public void testQualifiedAttributeReference() throws Exception {
+    configureByFiles(null, BASE_PATH + "qualified.xml", BASE_PATH + "qualified.xsd");
+    doDoTest(true, false);
+  }
+
   @Override
   protected void setUp() throws Exception {
     super.setUp();
diff --git a/xml/tests/src/com/intellij/codeInsight/daemon/quickFix/ExtractExternalResourceLinksTest.java b/xml/tests/src/com/intellij/codeInsight/daemon/quickFix/ExtractExternalResourceLinksTest.java
index 96f752a..a3d4cbd 100644
--- a/xml/tests/src/com/intellij/codeInsight/daemon/quickFix/ExtractExternalResourceLinksTest.java
+++ b/xml/tests/src/com/intellij/codeInsight/daemon/quickFix/ExtractExternalResourceLinksTest.java
@@ -1,3 +1,18 @@
+/*
+ * 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.codeInsight.daemon.quickFix;
 
 import com.intellij.codeInsight.daemon.impl.quickfix.FetchExtResourceAction;
@@ -78,7 +93,7 @@
     doExtractionOfEmbeddedFiles(new String[] {shortFileName}, new String[][] {expectedFileNames} );
   }
 
-  private void doExtractionOfEmbeddedFiles(String[] shortFileName,String[][] expectedFileNames) throws Exception {
+  private void doExtractionOfEmbeddedFiles(String[] shortFileName,String[][] expectedFileNames) {
     final List<VirtualFile> files = new ArrayList<VirtualFile>(shortFileName.length);
     for(String s: shortFileName) {
       if (FileUtilRt.getExtension(s).length() < 3) {
diff --git a/xml/tests/src/com/intellij/html/MicrodataCompletionTest.java b/xml/tests/src/com/intellij/html/MicrodataCompletionTest.java
index 9a0c19e..a253430 100644
--- a/xml/tests/src/com/intellij/html/MicrodataCompletionTest.java
+++ b/xml/tests/src/com/intellij/html/MicrodataCompletionTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -54,7 +54,7 @@
     }
   }
 
-  private void configureAndComplete(String text, String[] items) throws Exception {
+  private void configureAndComplete(String text, String[] items) {
     myFixture.configureByText(StdFileTypes.HTML, text);
     myFixture.complete(CompletionType.BASIC);
   }
diff --git a/xml/tests/src/com/intellij/xml/XMLCatalogManagerTest.java b/xml/tests/src/com/intellij/xml/XMLCatalogManagerTest.java
index e2091af..8db30d1 100644
--- a/xml/tests/src/com/intellij/xml/XMLCatalogManagerTest.java
+++ b/xml/tests/src/com/intellij/xml/XMLCatalogManagerTest.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.
@@ -79,7 +79,7 @@
     assertFalse(new XMLCatalogConfigurable().isModified());
   }
 
-  private XMLCatalogManager getManager() throws IOException {
+  private XMLCatalogManager getManager() {
     return new XMLCatalogManager(getTestDataPath() + "catalog.properties");
   }
 
diff --git a/xml/tests/src/com/intellij/xml/XmlFoldingTest.java b/xml/tests/src/com/intellij/xml/XmlFoldingTest.java
index c6f76e3..76cb6f3 100644
--- a/xml/tests/src/com/intellij/xml/XmlFoldingTest.java
+++ b/xml/tests/src/com/intellij/xml/XmlFoldingTest.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.
@@ -43,7 +43,7 @@
     doTest(".html");
   }
 
-  private void doTest(String extension) throws Throwable {
+  private void doTest(String extension) {
     myFixture.testFolding(getTestDataPath() + getTestName(true) + extension);
   }
 
diff --git a/xml/tests/src/com/intellij/xml/XmlNamespacesTest.java b/xml/tests/src/com/intellij/xml/XmlNamespacesTest.java
index 5e0932b..c38ce07 100644
--- a/xml/tests/src/com/intellij/xml/XmlNamespacesTest.java
+++ b/xml/tests/src/com/intellij/xml/XmlNamespacesTest.java
@@ -1,3 +1,18 @@
+/*
+ * 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.xml;
 
 import com.intellij.codeInsight.actions.OptimizeImportsProcessor;
@@ -224,7 +239,7 @@
     doUnusedDeclarationTest(text, after, name, true);
   }
 
-  private void doUnusedDeclarationTest(String text, String after, String name, boolean testOptimizeImports) throws Exception {
+  private void doUnusedDeclarationTest(String text, String after, String name, boolean testOptimizeImports) {
     myFixture.configureByText("a.xml", text);
     myFixture.testHighlighting();
     IntentionAction action = myFixture.getAvailableIntention(name);
diff --git a/xml/tests/src/com/intellij/xml/XmlSchemaPrefixTest.java b/xml/tests/src/com/intellij/xml/XmlSchemaPrefixTest.java
index feae6f6..74aefe8 100644
--- a/xml/tests/src/com/intellij/xml/XmlSchemaPrefixTest.java
+++ b/xml/tests/src/com/intellij/xml/XmlSchemaPrefixTest.java
@@ -1,3 +1,18 @@
+/*
+ * 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.xml;
 
 import com.intellij.testFramework.fixtures.CodeInsightFixtureTestCase;
@@ -24,7 +39,7 @@
     doRename("xsd");
   }
 
-  private void doRename(String newValue) throws Exception {
+  private void doRename(String newValue) {
     final String name = getTestName(true);
     CodeInsightTestUtil.doInlineRenameTest(new SchemaPrefixRenameHandler(), name, "xml", newValue, myFixture);
   }
diff --git a/xml/tests/src/com/intellij/xml/XmlSmartCompletionTest.java b/xml/tests/src/com/intellij/xml/XmlSmartCompletionTest.java
index 4a01392..21f0496 100644
--- a/xml/tests/src/com/intellij/xml/XmlSmartCompletionTest.java
+++ b/xml/tests/src/com/intellij/xml/XmlSmartCompletionTest.java
@@ -1,9 +1,24 @@
+/*
+ * 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.xml;
 
 import com.intellij.codeInsight.CodeInsightSettings;
 import com.intellij.codeInsight.completion.CompletionType;
 import com.intellij.codeInsight.lookup.LookupElement;
-import com.intellij.javaee.ExternalResourceManagerImpl;
+import com.intellij.javaee.ExternalResourceManagerExImpl;
 import com.intellij.testFramework.IdeaTestCase;
 import com.intellij.testFramework.PlatformTestUtil;
 import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
@@ -101,8 +116,8 @@
   @Override
   public void setUp() throws Exception {
     super.setUp();
-    ExternalResourceManagerImpl.registerResourceTemporarily("http://java.sun.com/j2ee/dtds/web-app_2_3.dtd",
-                                                            getTestDataPath() + "/web-app_2_3.dtd", getTestRootDisposable());
+    ExternalResourceManagerExImpl.registerResourceTemporarily("http://java.sun.com/j2ee/dtds/web-app_2_3.dtd",
+                                                              getTestDataPath() + "/web-app_2_3.dtd", getTestRootDisposable());
   }
 
   @Override
diff --git a/xml/tests/src/com/intellij/xml/actions/GenerateXmlTagTest.java b/xml/tests/src/com/intellij/xml/actions/GenerateXmlTagTest.java
index fca9d69..8e401a9 100644
--- a/xml/tests/src/com/intellij/xml/actions/GenerateXmlTagTest.java
+++ b/xml/tests/src/com/intellij/xml/actions/GenerateXmlTagTest.java
@@ -1,6 +1,21 @@
+/*
+ * 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.xml.actions;
 
-import com.intellij.javaee.ExternalResourceManagerImpl;
+import com.intellij.javaee.ExternalResourceManagerExImpl;
 import com.intellij.testFramework.IdeaTestCase;
 import com.intellij.testFramework.PlatformTestUtil;
 import com.intellij.testFramework.fixtures.CodeInsightTestUtil;
@@ -68,8 +83,8 @@
   @Override
   public void setUp() throws Exception {
     super.setUp();
-    ExternalResourceManagerImpl.registerResourceTemporarily("http://java.sun.com/j2ee/dtds/web-app_2_3.dtd",
-                                                            getTestDataPath() + "/web-app_2_3.dtd", getTestRootDisposable());
+    ExternalResourceManagerExImpl.registerResourceTemporarily("http://java.sun.com/j2ee/dtds/web-app_2_3.dtd",
+                                                              getTestDataPath() + "/web-app_2_3.dtd", getTestRootDisposable());
   }
 
   @Override
diff --git a/xml/tests/src/com/intellij/xml/actions/SplitTagActionTest.java b/xml/tests/src/com/intellij/xml/actions/SplitTagActionTest.java
index 205c03f..f4fdf29 100644
--- a/xml/tests/src/com/intellij/xml/actions/SplitTagActionTest.java
+++ b/xml/tests/src/com/intellij/xml/actions/SplitTagActionTest.java
@@ -1,3 +1,18 @@
+/*
+ * 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.xml.actions;
 
 import com.intellij.codeInsight.daemon.LightIntentionActionTestCase;
@@ -20,6 +35,7 @@
     return "";
   }
 
+  @Override
   @NotNull
   protected String getTestDataPath() {
     return PlatformTestUtil.getCommunityPath() + "/xml/tests/testData/intentions/splitTag";
diff --git a/xml/tests/testData/completion/InheritedAttr/library.xsd b/xml/tests/testData/completion/InheritedAttr/library.xsd
new file mode 100644
index 0000000..6381dd0
--- /dev/null
+++ b/xml/tests/testData/completion/InheritedAttr/library.xsd
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema attributeFormDefault="unqualified"
+           elementFormDefault="qualified"
+           targetNamespace="http://library"
+           xmlns:library="http://library"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="bar" type='library:barType'/>
+  <xs:complexType name="barType">
+    <xs:attribute type='xs:string' name="buz"/>
+    <xs:anyAttribute namespace="##any"/>
+  </xs:complexType>
+    <xs:attribute type='xs:string' name="boo"/>
+</xs:schema>
\ No newline at end of file
diff --git a/xml/tests/testData/completion/InheritedAttr/test.xml b/xml/tests/testData/completion/InheritedAttr/test.xml
new file mode 100644
index 0000000..dfa5afa
--- /dev/null
+++ b/xml/tests/testData/completion/InheritedAttr/test.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<test:foo xmlns:test="http://test"
+          xmlns:library="http://library"
+          <caret>/>
\ No newline at end of file
diff --git a/xml/tests/testData/completion/InheritedAttr/test.xsd b/xml/tests/testData/completion/InheritedAttr/test.xsd
new file mode 100644
index 0000000..bb9e982
--- /dev/null
+++ b/xml/tests/testData/completion/InheritedAttr/test.xsd
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema attributeFormDefault="unqualified"
+           elementFormDefault="qualified"
+           targetNamespace="http://test"
+           xmlns:local="http://test"
+           xmlns:library="http://library"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:import namespace="http://library"/>
+  <xs:element name="foo" type='local:fooType'/>
+  <xs:complexType name="fooType">
+    <xs:complexContent>
+      <xs:extension base='library:barType'/>
+    </xs:complexContent>
+  </xs:complexType>
+</xs:schema>
\ No newline at end of file
diff --git a/xml/tests/testData/xml/DocBook5.xml b/xml/tests/testData/xml/DocBook5.xml
index d00d146..79fb3cb 100644
--- a/xml/tests/testData/xml/DocBook5.xml
+++ b/xml/tests/testData/xml/DocBook5.xml
@@ -1,13 +1,16 @@
-<book lang="de"
+<book xml:lang="de"
       xmlns="http://docbook.org/ns/docbook"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:xlink="http://www.w3.org/1999/xlink"
       xsi:schemaLocation="http://docbook.org/ns/docbook http://www.docbook.org/xml/5.0/xsd/docbook.xsd
                           http://www.w3.org/1999/xlink http://www.w3.org/1999/xlink.xsd">
 
+  <chapter>
     <title>
         <link xlink:href="http://www.web.de">linklabel</link>
 
     </title>
+    <para> Hi there </para>
+  </chapter>
 
 </book>
\ No newline at end of file
diff --git a/xml/tests/testData/xml/qualified.xml b/xml/tests/testData/xml/qualified.xml
new file mode 100644
index 0000000..ce8e205
--- /dev/null
+++ b/xml/tests/testData/xml/qualified.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<exercise xmlns="http://www.vibrogym.com/schema">
+
+     <name xml:lang="en">test</name>
+</exercise>
\ No newline at end of file
diff --git a/xml/tests/testData/xml/qualified.xsd b/xml/tests/testData/xml/qualified.xsd
new file mode 100644
index 0000000..c35920b
--- /dev/null
+++ b/xml/tests/testData/xml/qualified.xsd
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns="http://www.vibrogym.com/schema"
+        xmlns:xs="http://www.w3.org/2001/XMLSchema"
+        targetNamespace="http://www.vibrogym.com/schema"
+        elementFormDefault="qualified" >
+
+    <xs:import schemaLocation="http://www.w3.org/2001/xml.xsd"
+               namespace="http://www.w3.org/XML/1998/namespace"/>
+
+    <xs:complexType name="localizedNameType">
+        <xs:simpleContent>
+            <xs:extension base="xs:string">
+                <xs:attribute ref="xml:lang" use="required"/>
+            </xs:extension>
+        </xs:simpleContent>
+    </xs:complexType>
+
+    <xs:element name="exercise">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="name"
+                            type="localizedNameType"
+                            minOccurs="1"
+                            maxOccurs="unbounded"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>
\ No newline at end of file
diff --git a/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlErrorQuickFixProvider.java b/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlErrorQuickFixProvider.java
new file mode 100644
index 0000000..9f3b33d
--- /dev/null
+++ b/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlErrorQuickFixProvider.java
@@ -0,0 +1,77 @@
+/*
+ * 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.codeInsight.daemon.impl.analysis;
+
+import com.intellij.codeInsight.FileModificationService;
+import com.intellij.codeInsight.daemon.XmlErrorMessages;
+import com.intellij.codeInsight.daemon.impl.HighlightInfo;
+import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixAction;
+import com.intellij.codeInsight.intention.IntentionAction;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiErrorElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.xml.XmlTag;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+
+public class XmlErrorQuickFixProvider implements ErrorQuickFixProvider {
+  @NonNls private static final String AMP_ENTITY = "&amp;";
+
+  @Override
+  public void registerErrorQuickFix(@NotNull final PsiErrorElement element, @NotNull final HighlightInfo highlightInfo) {
+    if (PsiTreeUtil.getParentOfType(element, XmlTag.class) != null) {
+      registerXmlErrorQuickFix(element,highlightInfo);
+    }
+  }
+
+  private static void registerXmlErrorQuickFix(final PsiErrorElement element, final HighlightInfo highlightInfo) {
+    final String text = element.getErrorDescription();
+    if (text != null && text.startsWith(XmlErrorMessages.message("unescaped.ampersand"))) {
+      QuickFixAction.registerQuickFixAction(highlightInfo, new IntentionAction() {
+        @Override
+        @NotNull
+        public String getText() {
+          return XmlErrorMessages.message("escape.ampersand.quickfix");
+        }
+
+        @Override
+        @NotNull
+        public String getFamilyName() {
+          return getText();
+        }
+
+        @Override
+        public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
+          return true;
+        }
+
+        @Override
+        public void invoke(@NotNull Project project, Editor editor, PsiFile file) {
+          if (!FileModificationService.getInstance().prepareFileForWrite(file)) return;
+          final int textOffset = element.getTextOffset();
+          editor.getDocument().replaceString(textOffset,textOffset + 1,AMP_ENTITY);
+        }
+
+        @Override
+        public boolean startInWriteAction() {
+          return true;
+        }
+      });
+    }
+  }
+}
diff --git a/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlNsPrefixAnnotator.java b/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlNsPrefixAnnotator.java
new file mode 100644
index 0000000..c9e83b4
--- /dev/null
+++ b/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlNsPrefixAnnotator.java
@@ -0,0 +1,49 @@
+/*
+ * 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.codeInsight.daemon.impl.analysis;
+
+import com.intellij.lang.annotation.AnnotationHolder;
+import com.intellij.lang.annotation.Annotator;
+import com.intellij.openapi.editor.XmlHighlighterColors;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.impl.source.xml.SchemaPrefixReference;
+import com.intellij.psi.xml.XmlAttribute;
+import com.intellij.psi.xml.XmlTag;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+/**
+ * @author Dmitry Avdeev
+ *         Date: 25.10.13
+ */
+public class XmlNsPrefixAnnotator implements Annotator {
+  @Override
+  public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
+    if (element instanceof XmlTag || element instanceof XmlAttribute) {
+      List<SchemaPrefixReference> references = ContainerUtil.findAll(element.getReferences(), SchemaPrefixReference.class);
+      for (SchemaPrefixReference reference : references) {
+        TextRange rangeInElement = reference.getRangeInElement();
+        if (!rangeInElement.isEmpty()) {
+          TextRange range = rangeInElement.shiftRight(element.getTextRange().getStartOffset());
+          holder.createInfoAnnotation(range, null).setTextAttributes(XmlHighlighterColors.XML_NS_PREFIX);
+        }
+      }
+    }
+  }
+}
diff --git a/xml/xml-analysis-impl/src/com/intellij/codeInspection/EmptyXmlQuickFixFactory.java b/xml/xml-analysis-impl/src/com/intellij/codeInspection/EmptyXmlQuickFixFactory.java
new file mode 100644
index 0000000..ce56f39
--- /dev/null
+++ b/xml/xml-analysis-impl/src/com/intellij/codeInspection/EmptyXmlQuickFixFactory.java
@@ -0,0 +1,41 @@
+/*
+ * 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.codeInspection;
+
+import com.intellij.codeInsight.intention.QuickFixes;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.xml.XmlTag;
+import com.intellij.psi.xml.XmlToken;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public class EmptyXmlQuickFixFactory extends XmlQuickFixFactory {
+  @NotNull
+  @Override
+  public LocalQuickFixAndIntentionActionOnPsiElement insertRequiredAttributeFix(@NotNull XmlTag tag,
+                                                                                @NotNull String attrName,
+                                                                                @NotNull String... values) {
+    return QuickFixes.EMPTY_FIX;
+  }
+
+  @NotNull
+  @Override
+  public LocalQuickFix createNSDeclarationIntentionFix(@NotNull PsiElement element,
+                                                       @NotNull String namespacePrefix,
+                                                       @Nullable XmlToken token) {
+    return QuickFixes.EMPTY_ACTION;
+  }
+}
diff --git a/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/XmlWrongClosingTagNameInspection.java b/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/XmlWrongClosingTagNameInspection.java
index b1b5501..7ecdf14 100644
--- a/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/XmlWrongClosingTagNameInspection.java
+++ b/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/XmlWrongClosingTagNameInspection.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -154,8 +154,8 @@
     while (current != null) {
       final IElementType elementType = prev.getElementType();
 
-      if ((elementType == XmlElementType.XML_NAME || elementType == XmlElementType.XML_TAG_NAME) &&
-          current.getElementType() == XmlElementType.XML_END_TAG_START) {
+      if ((elementType == XmlTokenType.XML_NAME || elementType == XmlTokenType.XML_TAG_NAME) &&
+          current.getElementType() == XmlTokenType.XML_END_TAG_START) {
         return (XmlToken)prev.getPsi();
       }
 
diff --git a/xml/xml-analysis-impl/src/com/intellij/lang/xml/XMLExternalAnnotator.java b/xml/xml-analysis-impl/src/com/intellij/lang/xml/XMLExternalAnnotator.java
new file mode 100644
index 0000000..82731a0
--- /dev/null
+++ b/xml/xml-analysis-impl/src/com/intellij/lang/xml/XMLExternalAnnotator.java
@@ -0,0 +1,143 @@
+/*
+ * 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.xml;
+
+import com.intellij.codeInsight.daemon.Validator;
+import com.intellij.codeInsight.intention.IntentionAction;
+import com.intellij.lang.annotation.Annotation;
+import com.intellij.lang.annotation.AnnotationHolder;
+import com.intellij.lang.annotation.ExternalAnnotator;
+import com.intellij.openapi.util.Trinity;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.xml.XmlDocument;
+import com.intellij.psi.xml.XmlFile;
+import com.intellij.psi.xml.XmlTag;
+import com.intellij.psi.xml.XmlToken;
+import com.intellij.xml.XmlNSDescriptor;
+import com.intellij.xml.util.XmlTagUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author ven
+ */
+public class XMLExternalAnnotator extends ExternalAnnotator<XMLExternalAnnotator.MyHost, XMLExternalAnnotator.MyHost> {
+  @Nullable
+  @Override
+  public MyHost collectInformation(@NotNull PsiFile file) {
+    if (!(file instanceof XmlFile)) return null;
+    final XmlDocument document = ((XmlFile)file).getDocument();
+    if (document == null) return null;
+    XmlTag rootTag = document.getRootTag();
+    XmlNSDescriptor nsDescriptor = rootTag == null ? null : rootTag.getNSDescriptor(rootTag.getNamespace(), false);
+
+    if (nsDescriptor instanceof Validator) {
+      //noinspection unchecked
+      MyHost host = new MyHost();
+      ((Validator<XmlDocument>)nsDescriptor).validate(document, host);
+      return host;
+    }
+    return null;
+  }
+
+  @Nullable
+  @Override
+  public MyHost doAnnotate(MyHost collectedInfo) {
+    return collectedInfo;
+  }
+
+  @Override
+  public void apply(@NotNull PsiFile file, MyHost annotationResult, @NotNull AnnotationHolder holder) {
+    annotationResult.apply(holder);
+  }
+
+  private static void appendFixes(final Annotation annotation, final IntentionAction... actions) {
+    if (actions != null) {
+      for (IntentionAction action : actions) annotation.registerFix(action);
+    }
+  }
+
+  static class MyHost implements Validator.ValidationHost {
+    private final List<Trinity<PsiElement, String, ErrorType>> messages = new ArrayList<Trinity<PsiElement, String, ErrorType>>();
+
+    @Override
+    public void addMessage(PsiElement context, String message, int type) {
+      throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void addMessage(PsiElement context, String message, @NotNull ErrorType type) {
+      messages.add(Trinity.create(context, message, type));
+    }
+
+    void apply (AnnotationHolder holder) {
+      for (Trinity<PsiElement, String, ErrorType> message : messages) {
+        addMessageWithFixes(message.first, message.second, message.third, holder);
+      }
+    }
+  }
+  
+  
+  public static void addMessageWithFixes(final PsiElement context,
+                                         final String message,
+                                         @NotNull final Validator.ValidationHost.ErrorType type,
+                                         AnnotationHolder myHolder,
+                                         @NotNull final IntentionAction... fixes) {
+    if (message != null && !message.isEmpty()) {
+      if (context instanceof XmlTag) {
+        addMessagesForTag((XmlTag)context, message, type, myHolder, fixes);
+      }
+      else {
+        if (type == Validator.ValidationHost.ErrorType.ERROR) {
+          appendFixes(myHolder.createErrorAnnotation(context, message), fixes);
+        }
+        else {
+          appendFixes(myHolder.createWarningAnnotation(context, message), fixes);
+        }
+      }
+    }
+  }
+
+  private static void addMessagesForTag(XmlTag tag, String message, Validator.ValidationHost.ErrorType type, AnnotationHolder myHolder, IntentionAction... actions) {
+    XmlToken childByRole = XmlTagUtil.getStartTagNameElement(tag);
+
+    addMessagesForTreeChild(childByRole, type, message, myHolder, actions);
+
+    childByRole = XmlTagUtil.getEndTagNameElement(tag);
+    addMessagesForTreeChild(childByRole, type, message, myHolder, actions);
+  }
+
+  private static void addMessagesForTreeChild(final XmlToken childByRole,
+                                              final Validator.ValidationHost.ErrorType type,
+                                              final String message,
+                                              AnnotationHolder myHolder, IntentionAction... actions) {
+    if (childByRole != null) {
+      Annotation annotation;
+      if (type == Validator.ValidationHost.ErrorType.ERROR) {
+        annotation = myHolder.createErrorAnnotation(childByRole, message);
+      }
+      else {
+        annotation = myHolder.createWarningAnnotation(childByRole, message);
+      }
+
+      appendFixes(annotation, actions);
+    }
+  }
+}
diff --git a/xml/xml-analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/IdRefReference.java b/xml/xml-analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/IdRefReference.java
index 601b6e3..27d23f8 100644
--- a/xml/xml-analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/IdRefReference.java
+++ b/xml/xml-analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/IdRefReference.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -185,7 +185,7 @@
   public PsiElement resolve() {
     final PsiElement[] result = new PsiElement[1];
     process(new PsiElementProcessor<PsiElement>() {
-      String canonicalText = getCanonicalText();
+      final String canonicalText = getCanonicalText();
 
       @Override
       public boolean execute(@NotNull final PsiElement element) {
diff --git a/xml/xml-psi-api/src/com/intellij/codeInspection/XmlSuppressionProvider.java b/xml/xml-psi-api/src/com/intellij/codeInspection/XmlSuppressionProvider.java
index f6be5cd..de68c7a 100644
--- a/xml/xml-psi-api/src/com/intellij/codeInspection/XmlSuppressionProvider.java
+++ b/xml/xml-psi-api/src/com/intellij/codeInspection/XmlSuppressionProvider.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.
@@ -27,7 +27,7 @@
  */
 public abstract class XmlSuppressionProvider {
 
-  public static ExtensionPointName<XmlSuppressionProvider> EP_NAME = new ExtensionPointName<XmlSuppressionProvider>("com.intellij.xml.xmlSuppressionProvider");
+  public static final ExtensionPointName<XmlSuppressionProvider> EP_NAME = new ExtensionPointName<XmlSuppressionProvider>("com.intellij.xml.xmlSuppressionProvider");
 
   public static boolean isSuppressed(@NotNull PsiElement element, @NotNull String inspectionId) {
     for (XmlSuppressionProvider provider : Extensions.getExtensions(EP_NAME)) {
diff --git a/xml/xml-psi-api/src/com/intellij/patterns/XmlAttributeValuePattern.java b/xml/xml-psi-api/src/com/intellij/patterns/XmlAttributeValuePattern.java
index 8cfd471..aef8564 100644
--- a/xml/xml-psi-api/src/com/intellij/patterns/XmlAttributeValuePattern.java
+++ b/xml/xml-psi-api/src/com/intellij/patterns/XmlAttributeValuePattern.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.
@@ -27,6 +27,7 @@
  */
 public class XmlAttributeValuePattern extends XmlElementPattern<XmlAttributeValue,XmlAttributeValuePattern>{
   private static final InitialPatternCondition<XmlAttributeValue> CONDITION = new InitialPatternCondition<XmlAttributeValue>(XmlAttributeValue.class) {
+    @Override
     public boolean accepts(@Nullable final Object o, final ProcessingContext context) {
       return o instanceof XmlAttributeValue;
     }
@@ -54,6 +55,7 @@
 
   public XmlAttributeValuePattern withLocalName(ElementPattern<String> namePattern) {
     return with(new PsiNamePatternCondition<XmlAttributeValue>("withLocalName", namePattern) {
+      @Override
       public String getPropertyValue(@NotNull final Object o) {
         if (o instanceof XmlAttributeValue) {
           final XmlAttributeValue value = (XmlAttributeValue)o;
diff --git a/xml/xml-psi-api/src/com/intellij/patterns/XmlElementPattern.java b/xml/xml-psi-api/src/com/intellij/patterns/XmlElementPattern.java
index 611bb40..f8ae6f2 100644
--- a/xml/xml-psi-api/src/com/intellij/patterns/XmlElementPattern.java
+++ b/xml/xml-psi-api/src/com/intellij/patterns/XmlElementPattern.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.
@@ -37,6 +37,7 @@
   public static class Capture extends XmlElementPattern<XmlElement, Capture> {
     protected Capture() {
       super(new InitialPatternCondition<XmlElement>(XmlElement.class) {
+        @Override
         public boolean accepts(@Nullable final Object o, final ProcessingContext context) {
           return o instanceof XmlElement;
         }
@@ -47,6 +48,7 @@
   public static class XmlTextPattern extends XmlElementPattern<XmlText, XmlTextPattern> {
     public XmlTextPattern() {
       super(new InitialPatternCondition<XmlText>(XmlText.class) {
+        @Override
         public boolean accepts(@Nullable final Object o, final ProcessingContext context) {
           return o instanceof XmlText;
         }
@@ -57,6 +59,7 @@
   public static class XmlEntityRefPattern extends XmlElementPattern<XmlEntityRef, XmlEntityRefPattern> {
     public XmlEntityRefPattern() {
       super(new InitialPatternCondition<XmlEntityRef>(XmlEntityRef.class) {
+        @Override
         public boolean accepts(@Nullable final Object o, final ProcessingContext context) {
           return o instanceof XmlEntityRef;
         }
diff --git a/xml/xml-psi-api/src/com/intellij/patterns/XmlFilePattern.java b/xml/xml-psi-api/src/com/intellij/patterns/XmlFilePattern.java
index 200fa32..1a273fb 100644
--- a/xml/xml-psi-api/src/com/intellij/patterns/XmlFilePattern.java
+++ b/xml/xml-psi-api/src/com/intellij/patterns/XmlFilePattern.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.
@@ -36,6 +36,7 @@
 
   public Self withRootTag(final ElementPattern<XmlTag> rootTag) {
     return with(new PatternCondition<XmlFile>("withRootTag") {
+      @Override
       public boolean accepts(@NotNull final XmlFile xmlFile, final ProcessingContext context) {
         XmlDocument document = xmlFile.getDocument();
         return document != null && rootTag.getCondition().accepts(document.getRootTag(), context);
diff --git a/xml/xml-psi-api/src/com/intellij/patterns/XmlNamedElementPattern.java b/xml/xml-psi-api/src/com/intellij/patterns/XmlNamedElementPattern.java
index 2bc0188..c5064cd 100644
--- a/xml/xml-psi-api/src/com/intellij/patterns/XmlNamedElementPattern.java
+++ b/xml/xml-psi-api/src/com/intellij/patterns/XmlNamedElementPattern.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.
@@ -46,6 +46,7 @@
 
   public Self withLocalName(final ElementPattern<String> localName) {
     return with(new PsiNamePatternCondition<T>("withLocalName", localName) {
+      @Override
       public String getPropertyValue(@NotNull final Object o) {
         return o instanceof XmlElement ? getLocalName((T)o) : null;
       }
@@ -74,16 +75,19 @@
   public static class XmlAttributePattern extends XmlNamedElementPattern<XmlAttribute, XmlAttributePattern> {
     protected XmlAttributePattern() {
       super(new InitialPatternCondition<XmlAttribute>(XmlAttribute.class) {
+        @Override
         public boolean accepts(@Nullable final Object o, final ProcessingContext context) {
           return o instanceof XmlAttribute;
         }
       });
     }
 
+    @Override
     protected String getLocalName(XmlAttribute xmlAttribute) {
       return xmlAttribute.getLocalName();
     }
 
+    @Override
     protected String getNamespace(XmlAttribute xmlAttribute) {
       return xmlAttribute.getNamespace();
     }
diff --git a/xml/xml-psi-api/src/com/intellij/patterns/XmlTagPattern.java b/xml/xml-psi-api/src/com/intellij/patterns/XmlTagPattern.java
index 5be06fa..c1d4bad 100644
--- a/xml/xml-psi-api/src/com/intellij/patterns/XmlTagPattern.java
+++ b/xml/xml-psi-api/src/com/intellij/patterns/XmlTagPattern.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.
@@ -32,6 +32,7 @@
 public class XmlTagPattern<Self extends XmlTagPattern<Self>> extends XmlNamedElementPattern<XmlTag, Self> {
   protected XmlTagPattern() {
     super(new InitialPatternCondition<XmlTag>(XmlTag.class) {
+      @Override
       public boolean accepts(@Nullable final Object o, final ProcessingContext context) {
         return o instanceof XmlTag;
       }
@@ -42,16 +43,19 @@
     super(condition);
   }
 
+  @Override
   protected String getLocalName(XmlTag tag) {
     return tag.getLocalName();
   }
 
+  @Override
   protected String getNamespace(XmlTag tag) {
     return tag.getNamespace();
   }
 
   public Self withAttributeValue(@NotNull @NonNls final String attributeName, @NotNull final String attributeValue) {
     return with(new PatternCondition<XmlTag>("withAttributeValue") {
+      @Override
       public boolean accepts(@NotNull final XmlTag xmlTag, final ProcessingContext context) {
         return Comparing.equal(xmlTag.getAttributeValue(attributeName), attributeValue);
       }
@@ -60,6 +64,7 @@
 
   public Self withAnyAttribute(@NotNull @NonNls final String... attributeNames) {
     return with(new PatternCondition<XmlTag>("withAnyAttribute") {
+      @Override
       public boolean accepts(@NotNull final XmlTag xmlTag, final ProcessingContext context) {
         for (String attributeName : attributeNames) {
           if (xmlTag.getAttribute(attributeName) != null) {
@@ -73,6 +78,7 @@
 
   public Self withDescriptor(@NotNull final ElementPattern<? extends PsiMetaData> metaDataPattern) {
     return with(new PatternCondition<XmlTag>("withDescriptor") {
+      @Override
       public boolean accepts(@NotNull final XmlTag xmlTag, final ProcessingContext context) {
         return metaDataPattern.accepts(xmlTag.getDescriptor());
       }
@@ -81,6 +87,7 @@
 
   public Self isFirstSubtag(@NotNull final ElementPattern pattern) {
     return with(new PatternCondition<XmlTag>("isFirstSubtag") {
+      @Override
       public boolean accepts(@NotNull final XmlTag xmlTag, final ProcessingContext context) {
         final XmlTag parent = xmlTag.getParentTag();
         return parent != null &&
@@ -95,6 +102,7 @@
 
   public Self withSubTags(@NotNull final ElementPattern<? extends Collection<XmlTag>> pattern) {
     return with(new PatternCondition<XmlTag>("withSubTags") {
+      @Override
       public boolean accepts(@NotNull final XmlTag xmlTag, final ProcessingContext context) {
         return pattern.getCondition().accepts(Arrays.asList(xmlTag.getSubTags()), context);
       }
diff --git a/xml/xml-psi-api/src/com/intellij/pom/xml/XmlChangeSet.java b/xml/xml-psi-api/src/com/intellij/pom/xml/XmlChangeSet.java
index 4ea4835..9e9a8d7 100644
--- a/xml/xml-psi-api/src/com/intellij/pom/xml/XmlChangeSet.java
+++ b/xml/xml-psi-api/src/com/intellij/pom/xml/XmlChangeSet.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.
@@ -26,6 +26,7 @@
 public interface XmlChangeSet extends PomChangeSet {
   List<XmlChange> getChanges();
 
+  @Override
   @NotNull
   PomModelAspect getAspect();
 
diff --git a/xml/xml-psi-api/src/com/intellij/psi/XmlRecursiveElementVisitor.java b/xml/xml-psi-api/src/com/intellij/psi/XmlRecursiveElementVisitor.java
index 6c99c53..cb63266 100644
--- a/xml/xml-psi-api/src/com/intellij/psi/XmlRecursiveElementVisitor.java
+++ b/xml/xml-psi-api/src/com/intellij/psi/XmlRecursiveElementVisitor.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.
@@ -32,6 +32,7 @@
     myVisitAllFileRoots = visitAllFileRoots;
   }
 
+  @Override
   public void visitElement(final PsiElement element) {
     element.acceptChildren(this);
   }
diff --git a/xml/xml-psi-api/src/com/intellij/psi/filters/position/NamespaceFilter.java b/xml/xml-psi-api/src/com/intellij/psi/filters/position/NamespaceFilter.java
index 88aba07..82bafa6 100644
--- a/xml/xml-psi-api/src/com/intellij/psi/filters/position/NamespaceFilter.java
+++ b/xml/xml-psi-api/src/com/intellij/psi/filters/position/NamespaceFilter.java
@@ -29,10 +29,12 @@
     myNamespaces = namespaces;
   }
 
+  @Override
   public boolean isClassAcceptable(Class hintClass){
     return ReflectionUtil.isAssignable(XmlTag.class, hintClass) || ReflectionUtil.isAssignable(XmlDocument.class, hintClass);
   }
 
+  @Override
   public boolean isAcceptable(Object element, PsiElement context){
     if(element instanceof XmlTag){
       final XmlTag psiElement = (XmlTag)element;
diff --git a/xml/xml-psi-api/src/com/intellij/psi/xml/XmlElementDecl.java b/xml/xml-psi-api/src/com/intellij/psi/xml/XmlElementDecl.java
index d18b990..7105f87 100644
--- a/xml/xml-psi-api/src/com/intellij/psi/xml/XmlElementDecl.java
+++ b/xml/xml-psi-api/src/com/intellij/psi/xml/XmlElementDecl.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.
@@ -25,6 +25,7 @@
  */
 public interface XmlElementDecl extends XmlElement, PsiMetaOwner, PsiNameIdentifierOwner {
   XmlElement getNameElement();
+  @Override
   @Nullable String getName();
   XmlElementContentSpec getContentSpecElement();
 }
diff --git a/xml/xml-psi-api/src/com/intellij/psi/xml/XmlEntityDecl.java b/xml/xml-psi-api/src/com/intellij/psi/xml/XmlEntityDecl.java
index 268b41c..9901e61 100644
--- a/xml/xml-psi-api/src/com/intellij/psi/xml/XmlEntityDecl.java
+++ b/xml/xml-psi-api/src/com/intellij/psi/xml/XmlEntityDecl.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.
@@ -28,6 +28,7 @@
     ENUMERATED_TYPE, ATTR_VALUE
   }
 
+  @Override
   String getName();
   PsiElement getNameElement();
   XmlAttributeValue getValueElement();
diff --git a/xml/xml-psi-api/src/com/intellij/xml/XmlSchemaProvider.java b/xml/xml-psi-api/src/com/intellij/xml/XmlSchemaProvider.java
index 25e4f1d..622894d 100644
--- a/xml/xml-psi-api/src/com/intellij/xml/XmlSchemaProvider.java
+++ b/xml/xml-psi-api/src/com/intellij/xml/XmlSchemaProvider.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.
@@ -83,6 +83,7 @@
 
   public static List<XmlSchemaProvider> getAvailableProviders(@NotNull final XmlFile file) {
     return ContainerUtil.findAll(Extensions.getExtensions(EP_NAME), new Condition<XmlSchemaProvider>() {
+      @Override
       public boolean value(XmlSchemaProvider xmlSchemaProvider) {
         return xmlSchemaProvider.isAvailable(file);
       }
diff --git a/xml/xml-psi-api/src/com/intellij/xml/util/XmlTagUtil.java b/xml/xml-psi-api/src/com/intellij/xml/util/XmlTagUtil.java
index 4850c98..b5b086b 100644
--- a/xml/xml-psi-api/src/com/intellij/xml/util/XmlTagUtil.java
+++ b/xml/xml-psi-api/src/com/intellij/xml/util/XmlTagUtil.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.
@@ -42,12 +42,12 @@
 
   static {
     ourCharacterEntities = new HashMap<String, Character>();
-    ourCharacterEntities.put("lt", new Character('<'));
-    ourCharacterEntities.put("gt", new Character('>'));
-    ourCharacterEntities.put("apos", new Character('\''));
-    ourCharacterEntities.put("quot", new Character('\"'));
-    ourCharacterEntities.put("nbsp", new Character('\u00a0'));
-    ourCharacterEntities.put("amp", new Character('&'));
+    ourCharacterEntities.put("lt", '<');
+    ourCharacterEntities.put("gt", '>');
+    ourCharacterEntities.put("apos", '\'');
+    ourCharacterEntities.put("quot", '\"');
+    ourCharacterEntities.put("nbsp", '\u00a0');
+    ourCharacterEntities.put("amp", '&');
   }
 
   /**
diff --git a/xml/xml-psi-impl/src/com/intellij/application/options/editor/XmlFoldingSettings.java b/xml/xml-psi-impl/src/com/intellij/application/options/editor/XmlFoldingSettings.java
new file mode 100644
index 0000000..ada94b1
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/application/options/editor/XmlFoldingSettings.java
@@ -0,0 +1,84 @@
+/*
+ * 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.application.options.editor;
+
+import com.intellij.lang.XmlCodeFoldingSettings;
+import com.intellij.openapi.application.PathManager;
+import com.intellij.openapi.components.*;
+import com.intellij.util.xmlb.XmlSerializerUtil;
+import com.intellij.xml.XmlBundle;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.File;
+
+
+@State(
+  name="XmlFoldingSettings",
+  storages= {
+    @Storage(
+      file = StoragePathMacros.APP_CONFIG + "/editor.codeinsight.xml"
+    )}
+)
+public class XmlFoldingSettings implements XmlCodeFoldingSettings, PersistentStateComponent<XmlFoldingSettings>, ExportableComponent {
+
+  public static XmlFoldingSettings getInstance() {
+    return ServiceManager.getService(XmlFoldingSettings.class);
+  }
+
+  @Override
+  public boolean isCollapseXmlTags() {
+    return COLLAPSE_XML_TAGS;
+  }
+
+  public void setCollapseXmlTags(boolean value) {
+    COLLAPSE_XML_TAGS = value;
+  }
+
+  @Override
+  public boolean isCollapseHtmlStyleAttribute() {
+    return COLLAPSE_HTML_STYLE_ATTRIBUTE;
+  }
+
+  public void setCollapseHtmlStyleAttribute(boolean value) {
+    this.COLLAPSE_HTML_STYLE_ATTRIBUTE = value;
+  }
+
+  @SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_XML_TAGS = false;
+  @SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_HTML_STYLE_ATTRIBUTE = true;
+
+  @Override
+  @NotNull
+  public File[] getExportFiles() {
+    return new File[]{PathManager.getOptionsFile("editor.codeinsight")};
+  }
+
+  @Override
+  @NotNull
+  public String getPresentableName() {
+    return XmlBundle.message("xml.folding.settings");
+  }
+
+  @Override
+  public XmlFoldingSettings getState() {
+    return this;
+  }
+
+  @Override
+  public void loadState(final XmlFoldingSettings state) {
+    XmlSerializerUtil.copyBean(state, this);
+  }
+}
\ No newline at end of file
diff --git a/xml/xml-psi-impl/src/com/intellij/codeInsight/highlighting/XmlReadWriteAccessDetector.java b/xml/xml-psi-impl/src/com/intellij/codeInsight/highlighting/XmlReadWriteAccessDetector.java
new file mode 100644
index 0000000..4a1d918
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/codeInsight/highlighting/XmlReadWriteAccessDetector.java
@@ -0,0 +1,57 @@
+/*
+ * 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.codeInsight.highlighting;
+
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiReference;
+import com.intellij.psi.xml.XmlAttributeValue;
+import com.intellij.psi.xml.XmlComment;
+import com.intellij.psi.xml.XmlElementDecl;
+import com.intellij.psi.xml.XmlTag;
+
+/**
+ * @author yole
+ */
+public class XmlReadWriteAccessDetector extends ReadWriteAccessDetector {
+  @Override
+  public boolean isReadWriteAccessible(final PsiElement element) {
+    return element instanceof XmlAttributeValue ||
+        element instanceof XmlTag ||
+        element instanceof XmlElementDecl ||
+        element instanceof XmlComment; // e.g. <!--@elvariable name="xxx" type="yyy"-->
+  }
+
+  @Override
+  public boolean isDeclarationWriteAccess(final PsiElement element) {
+    return false;
+  }
+
+  @Override
+  public Access getReferenceAccess(final PsiElement referencedElement, final PsiReference reference) {
+    PsiElement refElement = reference.getElement();
+    return refElement instanceof XmlAttributeValue &&
+           (!(referencedElement instanceof XmlTag) || refElement.getParent().getParent() == referencedElement) ||
+            refElement instanceof XmlElementDecl ||
+            refElement instanceof XmlComment   // e.g. <!--@elvariable name="xxx" type="yyy"-->
+           ? Access.Write : Access.Read;
+
+  }
+
+  @Override
+  public Access getExpressionAccess(final PsiElement expression) {
+    return expression instanceof XmlAttributeValue ? Access.Write : Access.Read;
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/html/impl/RelaxedHtmlFromSchemaElementDescriptor.java b/xml/xml-psi-impl/src/com/intellij/html/impl/RelaxedHtmlFromSchemaElementDescriptor.java
index 52a1920..4f6f0d1 100644
--- a/xml/xml-psi-impl/src/com/intellij/html/impl/RelaxedHtmlFromSchemaElementDescriptor.java
+++ b/xml/xml-psi-impl/src/com/intellij/html/impl/RelaxedHtmlFromSchemaElementDescriptor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -35,6 +35,7 @@
     super(tag);
   }
 
+  @Override
   public XmlElementDescriptor getElementDescriptor(XmlTag childTag, XmlTag contextTag) {
     XmlElementDescriptor elementDescriptor = super.getElementDescriptor(childTag, contextTag);
 
@@ -45,6 +46,7 @@
     return elementDescriptor;
   }
 
+  @Override
   public XmlElementDescriptor[] getElementsDescriptors(final XmlTag context) {
     return ArrayUtil.mergeArrays(
       super.getElementsDescriptors(context),
@@ -64,6 +66,7 @@
     return null;
   }
 
+  @Override
   public XmlAttributeDescriptor[] getAttributesDescriptors(final XmlTag context) {
     return addAttrDescriptorsForFacelets(context, super.getAttributesDescriptors(context));
   }
@@ -84,6 +87,7 @@
     return getAttributeDescriptor(attribute.getName(), attribute.getParent());
   }
 
+  @Override
   public XmlAttributeDescriptor getAttributeDescriptor(String attributeName, final XmlTag context) {
     final XmlAttributeDescriptor descriptor = super.getAttributeDescriptor(attributeName.toLowerCase(), context);
     if (descriptor != null) return descriptor;
@@ -105,6 +109,7 @@
     return null;
   }
 
+  @Override
   public boolean allowElementsFromNamespace(final String namespace, final XmlTag context) {
     return true;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/html/impl/RelaxedHtmlFromSchemaNSDescriptor.java b/xml/xml-psi-impl/src/com/intellij/html/impl/RelaxedHtmlFromSchemaNSDescriptor.java
index 06a9bc97..0703377 100644
--- a/xml/xml-psi-impl/src/com/intellij/html/impl/RelaxedHtmlFromSchemaNSDescriptor.java
+++ b/xml/xml-psi-impl/src/com/intellij/html/impl/RelaxedHtmlFromSchemaNSDescriptor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -28,6 +28,7 @@
 import org.jetbrains.annotations.Nullable;
 
 public class RelaxedHtmlFromSchemaNSDescriptor extends XmlNSDescriptorImpl implements RelaxedHtmlNSDescriptor {
+  @Override
   public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) {
     XmlElementDescriptor elementDescriptor = super.getElementDescriptor(tag);
 
@@ -43,10 +44,12 @@
     return elementDescriptor;
   }
 
+  @Override
   protected XmlElementDescriptor createElementDescriptor(final XmlTag tag) {
     return new RelaxedHtmlFromSchemaElementDescriptor(tag);
   }
 
+  @Override
   @NotNull
   public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable final XmlDocument doc) {
     return ArrayUtil.mergeArrays(super.getRootElementsDescriptors(doc), HtmlUtil.getCustomTagDescriptors(doc));
diff --git a/xml/xml-psi-impl/src/com/intellij/html/impl/util/MicrodataUtil.java b/xml/xml-psi-impl/src/com/intellij/html/impl/util/MicrodataUtil.java
new file mode 100644
index 0000000..bfdcca2
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/html/impl/util/MicrodataUtil.java
@@ -0,0 +1,207 @@
+/*
+ * 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.html.impl.util;
+
+import com.intellij.openapi.util.Key;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiReference;
+import com.intellij.psi.XmlRecursiveElementVisitor;
+import com.intellij.psi.impl.source.resolve.reference.impl.providers.DependentNSReference;
+import com.intellij.psi.impl.source.resolve.reference.impl.providers.URLReference;
+import com.intellij.psi.xml.XmlAttribute;
+import com.intellij.psi.xml.XmlAttributeValue;
+import com.intellij.psi.xml.XmlFile;
+import com.intellij.psi.xml.XmlTag;
+import com.intellij.util.PairFunction;
+import com.intellij.util.text.StringTokenizer;
+import com.intellij.xml.util.HtmlUtil;
+import gnu.trove.THashMap;
+import gnu.trove.THashSet;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.*;
+
+/**
+ * @author: Fedor.Korotkov
+ */
+public class MicrodataUtil {
+  public static final Key<List<String>> ITEM_PROP_KEYS = Key.create("microdata.prop");
+  public static final String ITEM_REF = "itemref";
+  public static final String ITEM_SCOPE = "itemscope";
+  public static final String ITEM_TYPE = "itemtype";
+  public static final String ITEM_PROP = "itemprop";
+  public static final String ITEM_ID = "itemid";
+
+  public static boolean hasScopeTag(@Nullable XmlTag tag) {
+    return findScopeTag(tag) != null;
+  }
+
+  @Nullable
+  public static XmlTag findScopeTag(@Nullable XmlTag context) {
+    Map<String, XmlTag> id2tag = findScopesWithItemRef(context != null ? context.getContainingFile() : null);
+    XmlTag tag = context;
+    while (tag != null) {
+      if (tag != context && tag.getAttribute(ITEM_SCOPE) != null) return tag;
+      final String id = getStripedAttributeValue(tag, "id");
+      if (id != null && id2tag.containsKey(id)) return id2tag.get(id);
+      tag = tag.getParentTag();
+    }
+    return null;
+  }
+
+  private static Map<String, XmlTag> findScopesWithItemRef(@Nullable PsiFile file) {
+    if (!(file instanceof XmlFile)) return Collections.emptyMap();
+    final Map<String, XmlTag> result = new THashMap<String, XmlTag>();
+    file.accept(new XmlRecursiveElementVisitor() {
+      @Override
+      public void visitXmlTag(final XmlTag tag) {
+        super.visitXmlTag(tag);
+        XmlAttribute refAttr = tag.getAttribute(ITEM_REF);
+        if (refAttr != null && tag.getAttribute(ITEM_SCOPE) != null) {
+          getReferencesForAttributeValue(refAttr.getValueElement(), new PairFunction<String, Integer, PsiReference>() {
+            @Nullable
+            @Override
+            public PsiReference fun(String t, Integer v) {
+              result.put(t, tag);
+              return null;
+            }
+          });
+        }
+      }
+    });
+    return result;
+  }
+
+  public static List<String> extractProperties(PsiFile file, String type) {
+    final VirtualFile virtualFile = file.getVirtualFile();
+    List<String> result = virtualFile != null ? virtualFile.getUserData(ITEM_PROP_KEYS) : null;
+    if (virtualFile != null && result == null) {
+      result = collectNames(file, type);
+      virtualFile.putUserData(ITEM_PROP_KEYS, result);
+    }
+    return result;
+  }
+
+  private static List<String> collectNames(PsiFile file, String type) {
+    if (file instanceof XmlFile) {
+      final CollectNamesVisitor collectNamesVisitor = getVisitorByType(type);
+      file.accept(collectNamesVisitor);
+      return collectNamesVisitor.getValues();
+    }
+    return Collections.emptyList();
+  }
+
+  private static CollectNamesVisitor getVisitorByType(String type) {
+    if (type.contains("schema.org")) {
+      return new CollectNamesFromSchemaOrgVisitor();
+    }
+    return new CollectNamesByMicrodataVisitor(type);
+  }
+
+  public static PsiReference[] getUrlReferencesForAttributeValue(final XmlAttributeValue element) {
+    return getReferencesForAttributeValue(element, new PairFunction<String, Integer, PsiReference>() {
+      @Nullable
+      @Override
+      public PsiReference fun(String token, Integer offset) {
+        if (HtmlUtil.hasHtmlPrefix(token)) {
+          final TextRange range = TextRange.from(offset, token.length());
+          final URLReference urlReference = new URLReference(element, range, true);
+          return new DependentNSReference(element, range, urlReference, true);
+        }
+        return null;
+      }
+    });
+  }
+
+  public static PsiReference[] getReferencesForAttributeValue(@Nullable XmlAttributeValue element,
+                                                              PairFunction<String, Integer, PsiReference> refFun) {
+    if (element == null) {
+      return PsiReference.EMPTY_ARRAY;
+    }
+    String text = element.getText();
+    String urls = StringUtil.stripQuotesAroundValue(text);
+    StringTokenizer tokenizer = new StringTokenizer(urls);
+    List<PsiReference> result = new ArrayList<PsiReference>();
+    while (tokenizer.hasMoreTokens()) {
+      String token = tokenizer.nextToken();
+      int index = text.indexOf(token);
+      PsiReference ref = refFun.fun(token, index);
+      if (ref != null) {
+        result.add(ref);
+      }
+    }
+    return result.toArray(new PsiReference[result.size()]);
+  }
+
+  @Nullable
+  public static String getStripedAttributeValue(@Nullable XmlTag tag, @Nls String attributeName) {
+    String value = tag != null ? tag.getAttributeValue(attributeName) : null;
+    return value != null ? StringUtil.stripQuotesAroundValue(value) : null;
+  }
+
+  private static class CollectNamesVisitor extends XmlRecursiveElementVisitor {
+    protected final Set<String> myValues = new THashSet<String>();
+
+    public List<String> getValues() {
+      return new ArrayList<String>(myValues);
+    }
+  }
+
+  public static class CollectNamesByMicrodataVisitor extends CollectNamesVisitor {
+    protected final String myType;
+    private boolean myCollecting = false;
+
+    public CollectNamesByMicrodataVisitor(String type) {
+      myType = type;
+    }
+
+    @Override
+    public void visitXmlTag(XmlTag tag) {
+      String value = getStripedAttributeValue(tag, ITEM_ID);
+      final boolean isTypeTag = myType.equalsIgnoreCase(value);
+      if (isTypeTag) {
+        myCollecting = true;
+      }
+
+      if (myCollecting && "name".equalsIgnoreCase(getStripedAttributeValue(tag, ITEM_PROP))) {
+        myValues.add(tag.getValue().getTrimmedText());
+      }
+
+      super.visitXmlTag(tag);
+
+      if (isTypeTag) {
+        myCollecting = false;
+      }
+    }
+  }
+
+  public static class CollectNamesFromSchemaOrgVisitor extends CollectNamesVisitor {
+    @Override
+    public void visitXmlTag(XmlTag tag) {
+      super.visitXmlTag(tag);
+      if ("prop-nam".equalsIgnoreCase(getStripedAttributeValue(tag, "class"))) {
+        final String code = tag.getSubTagText("code");
+        if (code != null) {
+          myValues.add(code);
+        }
+      }
+    }
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileHighlighter.java b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileHighlighter.java
index 9f8510b..715c068 100644
--- a/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileHighlighter.java
+++ b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileHighlighter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -93,7 +93,7 @@
     return SyntaxHighlighterBase.pack(XmlHighlighterColors.HTML_CODE, pack(keys1.get(tokenType), keys2.get(tokenType)));
   }
 
-  public static final void registerEmbeddedTokenAttributes(Map<IElementType, TextAttributesKey> _keys1,
+  public static void registerEmbeddedTokenAttributes(Map<IElementType, TextAttributesKey> _keys1,
                                                            Map<IElementType, TextAttributesKey> _keys2) {
     if (_keys1 != null) {
       for (Iterator<IElementType> iterator = _keys1.keySet().iterator(); iterator.hasNext();) {
diff --git a/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlFileHighlighter.java b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlFileHighlighter.java
index 6c515a1..e34dd98 100644
--- a/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlFileHighlighter.java
+++ b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlFileHighlighter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -28,7 +28,6 @@
 import org.jetbrains.annotations.NotNull;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 public class XmlFileHighlighter extends SyntaxHighlighterBase {
@@ -118,7 +117,7 @@
     keys2.put(XmlTokenType.XML_ENTITY_REF_TOKEN, XmlHighlighterColors.XML_ENTITY_REFERENCE);
   }
 
-  private boolean myIsDtd;
+  private final boolean myIsDtd;
   private boolean myIsXHtml;
 
   public XmlFileHighlighter() {
@@ -152,19 +151,17 @@
     return pack(keys1.get(tokenType), keys2.get(tokenType));
   }
 
-  public static final void registerEmbeddedTokenAttributes(Map<IElementType, TextAttributesKey> _keys1,
+  public static void registerEmbeddedTokenAttributes(Map<IElementType, TextAttributesKey> _keys1,
                                                            Map<IElementType, TextAttributesKey> _keys2) {
     if (_keys1!=null) {
-      for (Iterator<IElementType> iterator = _keys1.keySet().iterator(); iterator.hasNext();) {
-        IElementType iElementType = iterator.next();
-        keys1.put(iElementType,_keys1.get(iElementType));
+      for (IElementType iElementType : _keys1.keySet()) {
+        keys1.put(iElementType, _keys1.get(iElementType));
       }
     }
 
     if (_keys2!=null) {
-      for (Iterator<IElementType> iterator = _keys2.keySet().iterator(); iterator.hasNext();) {
-        IElementType iElementType = iterator.next();
-        keys2.put(iElementType,_keys2.get(iElementType));
+      for (IElementType iElementType : _keys2.keySet()) {
+        keys2.put(iElementType, _keys2.get(iElementType));
       }
     }
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/javaee/ExternalResourceManagerExImpl.java b/xml/xml-psi-impl/src/com/intellij/javaee/ExternalResourceManagerExImpl.java
index 8cf8701..38f96f0 100644
--- a/xml/xml-psi-impl/src/com/intellij/javaee/ExternalResourceManagerExImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/javaee/ExternalResourceManagerExImpl.java
@@ -1,10 +1,25 @@
+/*
+ * 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.javaee;
 
 import com.intellij.application.options.PathMacrosImpl;
 import com.intellij.application.options.ReplacePathToMacroMap;
 import com.intellij.openapi.Disposable;
 import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.components.ExpandMacroToPathMap;
+import com.intellij.openapi.components.*;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.fileTypes.FileType;
@@ -30,6 +45,8 @@
 import java.net.URL;
 import java.util.*;
 
+@State(name = "ExternalResourceManagerImpl",
+       storages = {@Storage( file = StoragePathMacros.APP_CONFIG + "/other.xml")})
 public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx {
   static final Logger LOG = Logger.getInstance("#com.intellij.j2ee.openapi.impl.ExternalResourceManagerImpl");
 
@@ -84,10 +101,11 @@
   @NonNls private static final String HTML_DEFAULT_DOCTYPE_ELEMENT = "default-html-doctype";
   private static final String DEFAULT_VERSION = null;
 
-  public ExternalResourceManagerExImpl(PathMacrosImpl pathMacros) {
+  public ExternalResourceManagerExImpl(@NotNull PathMacrosImpl pathMacros) {
     myPathMacros = pathMacros;
   }
 
+  @Override
   public boolean isStandardResource(VirtualFile file) {
     VirtualFile parent = file.getParent();
     return parent != null && parent.getName().equals("standardSchemas");
@@ -116,10 +134,12 @@
     return map;
   }
 
+  @Override
   public String getResourceLocation(String url) {
     return getResourceLocation(url, DEFAULT_VERSION);
   }
 
+  @Override
   public String getResourceLocation(@NonNls String url, String version) {
     String result = getUserResource(url, version);
     if (result == null) {
@@ -163,6 +183,7 @@
     return map != null ? map.get(url) : null;
   }
 
+  @Override
   public String getResourceLocation(@NonNls String url, @NotNull Project project) {
     String location = getProjectResources(project).getResourceLocation(url);
     return location == null || location.equals(url) ? getResourceLocation(url) : location;
@@ -173,6 +194,7 @@
     return location == null || location.equals(url) ? getResourceLocation(url, version) : location;
   }
 
+  @Override
   @Nullable
   public PsiFile getResourceLocation(@NotNull @NonNls final String url, @NotNull final PsiFile baseFile, final String version) {
     final XmlFile schema = XmlSchemaProvider.findSchema(url, baseFile);
@@ -183,10 +205,12 @@
     return XmlUtil.findXmlFile(baseFile, location);
   }
 
+  @Override
   public String[] getResourceUrls(FileType fileType, final boolean includeStandard) {
     return getResourceUrls(fileType, DEFAULT_VERSION, includeStandard);
   }
 
+  @Override
   public String[] getResourceUrls(@Nullable final FileType fileType, @NonNls final String version, final boolean includeStandard) {
     final List<String> result = new LinkedList<String>();
     addResourcesFromMap(result, version, myResources);
@@ -210,6 +234,7 @@
   public static void addTestResource(final String url, final String location, Disposable parentDisposable) {
     final ExternalResourceManagerExImpl instance = (ExternalResourceManagerExImpl)getInstance();
     ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      @Override
       public void run() {
         instance.addResource(url, location);
       }
@@ -218,6 +243,7 @@
       @Override
       public void dispose() {
         ApplicationManager.getApplication().runWriteAction(new Runnable() {
+          @Override
           public void run() {
             instance.removeResource(url);
           }
@@ -225,10 +251,12 @@
       }
     });
   }
+  @Override
   public void addResource(String url, String location) {
     addResource(url, DEFAULT_VERSION, location);
   }
 
+  @Override
   public void addResource(@NonNls String url, @NonNls String version, @NonNls String location) {
     ApplicationManager.getApplication().assertWriteAccessAllowed();
     addSilently(url, version, location);
@@ -243,10 +271,12 @@
     myModificationCount++;
   }
 
+  @Override
   public void removeResource(String url) {
     removeResource(url, DEFAULT_VERSION);
   }
 
+  @Override
   public void removeResource(String url, String version) {
     ApplicationManager.getApplication().assertWriteAccessAllowed();
     Map<String, String> map = getMap(myResources, version, false);
@@ -270,6 +300,7 @@
     getProjectResources(project).addResource(url, location);
   }
 
+  @Override
   public String[] getAvailableUrls() {
     Set<String> urls = new HashSet<String>();
     for (Map<String, String> map : myResources.values()) {
@@ -283,11 +314,13 @@
     return getProjectResources(project).getAvailableUrls();
   }
 
+  @Override
   public void clearAllResources() {
     myResources.clear();
     myIgnoredResources.clear();
   }
 
+  @Override
   public void clearAllResources(Project project) {
     ApplicationManager.getApplication().assertWriteAccessAllowed();
     clearAllResources();
@@ -296,6 +329,7 @@
     fireExternalResourceChanged();
   }
 
+  @Override
   public void addIgnoredResource(String url) {
     ApplicationManager.getApplication().assertWriteAccessAllowed();
     addIgnoredSilently(url);
@@ -307,6 +341,7 @@
     myModificationCount++;
   }
 
+  @Override
   public void removeIgnoredResource(String url) {
     ApplicationManager.getApplication().assertWriteAccessAllowed();
     if (myIgnoredResources.remove(url)) {
@@ -315,6 +350,7 @@
     }
   }
 
+  @Override
   public boolean isIgnoredResource(String url) {
     myStdResources.getValue();  // ensure ignored resources are loaded
     return myIgnoredResources.contains(url) || isImplicitNamespaceDescriptor(url);
@@ -328,11 +364,13 @@
     return false;
   }
 
+  @Override
   public String[] getIgnoredResources() {
     myStdResources.getValue();  // ensure ignored resources are loaded
     return ArrayUtil.toStringArray(myIgnoredResources);
   }
 
+  @Override
   public long getModificationCount() {
     return myModificationCount;
   }
@@ -342,7 +380,7 @@
     return getProjectResources(project).getModificationCount();
   }
 
-  public void readExternal(Element element) throws InvalidDataException {
+  public void readExternal(Element element) {
     final ExpandMacroToPathMap macroExpands = new ExpandMacroToPathMap();
     myPathMacros.addMacroExpands(macroExpands);
     macroExpands.substitute(element, SystemInfo.isFileSystemCaseSensitive);
@@ -372,7 +410,7 @@
     }
   }
 
-  public void writeExternal(Element element) throws WriteExternalException {
+  public void writeExternal(Element element) {
     final String[] urls = getAvailableUrls();
     for (String url : urls) {
       if (url == null) continue;
@@ -408,10 +446,12 @@
     macroReplacements.substitute(element, SystemInfo.isFileSystemCaseSensitive);
   }
 
+  @Override
   public void addExternalResourceListener(ExternalResourceListener listener) {
     myListeners.add(listener);
   }
 
+  @Override
   public void removeExternalResourceListener(ExternalResourceListener listener) {
     myListeners.remove(listener);
   }
@@ -427,8 +467,10 @@
   }
 
 
-  protected ExternalResourceManagerExImpl getProjectResources(Project project) {
-    return this;
+  private static final NotNullLazyKey<ExternalResourceManagerExImpl, Project> INSTANCE_CACHE = ServiceManager.createLazyKey(ExternalResourceManagerExImpl.class);
+
+  private ExternalResourceManagerExImpl getProjectResources(Project project) {
+    return INSTANCE_CACHE.getValue(project);
   }
 
   @Override
@@ -486,6 +528,7 @@
   @TestOnly
   public static void registerResourceTemporarily(final String url, final String location, Disposable disposable) {
     ApplicationManager.getApplication().runWriteAction(new Runnable() {
+      @Override
       public void run() {
         getInstance().addResource(url, location);
       }
@@ -495,6 +538,7 @@
       @Override
       public void dispose() {
         ApplicationManager.getApplication().runWriteAction(new Runnable() {
+          @Override
           public void run() {
             getInstance().removeResource(url);
           }
diff --git a/xml/xml-psi-impl/src/com/intellij/javaee/InternalResourceProvider.java b/xml/xml-psi-impl/src/com/intellij/javaee/InternalResourceProvider.java
index d9755ad..673540e 100644
--- a/xml/xml-psi-impl/src/com/intellij/javaee/InternalResourceProvider.java
+++ b/xml/xml-psi-impl/src/com/intellij/javaee/InternalResourceProvider.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.
@@ -23,6 +23,7 @@
  */
 public class InternalResourceProvider implements StandardResourceProvider{
 
+  @Override
   public void registerResources(ResourceRegistrar registrar) {
     ResourceRegistrarImpl impl = (ResourceRegistrarImpl)registrar;
     
diff --git a/xml/xml-psi-impl/src/com/intellij/javaee/ProjectResources.java b/xml/xml-psi-impl/src/com/intellij/javaee/ProjectResources.java
new file mode 100644
index 0000000..9160909
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/javaee/ProjectResources.java
@@ -0,0 +1,57 @@
+/*
+ * 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.javaee;
+
+import com.intellij.application.options.PathMacrosImpl;
+import com.intellij.openapi.components.PersistentStateComponent;
+import com.intellij.openapi.components.State;
+import com.intellij.openapi.components.Storage;
+import com.intellij.openapi.components.StoragePathMacros;
+import com.intellij.openapi.util.JDOMExternalizable;
+import com.intellij.openapi.util.JDOMExternalizableAdapter;
+import org.jdom.Element;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collections;
+import java.util.Map;
+
+/**
+* @author Dmitry Avdeev
+*/
+@State(name = "ProjectResources", storages = {@Storage( file = StoragePathMacros.PROJECT_FILE)})
+public class ProjectResources extends ExternalResourceManagerExImpl implements PersistentStateComponent<Element>, JDOMExternalizable {
+  private final JDOMExternalizableAdapter myAdapter;
+
+  public ProjectResources(@NotNull PathMacrosImpl pathMacros) {
+    super(pathMacros);
+    myAdapter = new JDOMExternalizableAdapter(this, "ProjectResources");
+  }
+
+  @Override
+  protected Map<String, Map<String, Resource>> computeStdResources() {
+    return Collections.emptyMap();   
+  }
+
+  @Override
+  public Element getState() {
+    return myAdapter.getState();
+  }
+
+  @Override
+  public void loadState(Element state) {
+    myAdapter.loadState(state);
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/javaee/ResourceRegistrarImpl.java b/xml/xml-psi-impl/src/com/intellij/javaee/ResourceRegistrarImpl.java
index 103bd12..a0fa579 100644
--- a/xml/xml-psi-impl/src/com/intellij/javaee/ResourceRegistrarImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/javaee/ResourceRegistrarImpl.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.
@@ -32,10 +32,12 @@
   private final Map<String, Map<String, ExternalResourceManagerExImpl.Resource>> myResources = new HashMap<String, Map<String, ExternalResourceManagerExImpl.Resource>>();
   private final List<String> myIgnored = new ArrayList<String>();
 
+  @Override
   public void addStdResource(@NonNls String resource, @NonNls String fileName) {
     addStdResource(resource, null, fileName, getClass());
   }
 
+  @Override
   public void addStdResource(@NonNls String resource, @NonNls String fileName, Class klass) {
     addStdResource(resource, null, fileName, klass);
   }
@@ -43,13 +45,16 @@
   public void addStdResource(@NonNls String resource, @NonNls String version, @NonNls String fileName, @Nullable Class klass, @Nullable ClassLoader classLoader) {
     final Map<String, ExternalResourceManagerExImpl.Resource> map = ExternalResourceManagerExImpl.getMap(myResources, version, true);
     assert map != null;
+    resource = new String(resource); // enforce copying; todo remove after final migration to JDK 1.7
     map.put(resource, new ExternalResourceManagerExImpl.Resource(fileName, klass, classLoader));
   }
 
+  @Override
   public void addStdResource(@NonNls String resource, @Nullable @NonNls String version, @NonNls String fileName, Class klass) {
     addStdResource(resource, version, fileName, klass, null);
   }
 
+  @Override
   public void addIgnoredResource(@NonNls String url) {
     myIgnored.add(url);
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/javaee/XMLCatalogManager.java b/xml/xml-psi-impl/src/com/intellij/javaee/XMLCatalogManager.java
index c9eacea..d3d7d39 100644
--- a/xml/xml-psi-impl/src/com/intellij/javaee/XMLCatalogManager.java
+++ b/xml/xml-psi-impl/src/com/intellij/javaee/XMLCatalogManager.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.
@@ -37,8 +37,8 @@
 
   private final static Logger LOG = Logger.getInstance(XMLCatalogManager.class);
 
-  private static Field ourResources;
-  private static Field ourPropertyFileUri;
+  private static final Field ourResources;
+  private static final Field ourPropertyFileUri;
 
   static {
     try {
@@ -48,7 +48,7 @@
       ourPropertyFileUri.setAccessible(true);
     }
     catch (NoSuchFieldException e) {
-      LOG.error(e);
+      throw new RuntimeException(e);
     }
   }
 
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/XmlCodeFoldingBuilder.java b/xml/xml-psi-impl/src/com/intellij/lang/XmlCodeFoldingBuilder.java
index 959f3a4..db2fd34 100644
--- a/xml/xml-psi-impl/src/com/intellij/lang/XmlCodeFoldingBuilder.java
+++ b/xml/xml-psi-impl/src/com/intellij/lang/XmlCodeFoldingBuilder.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.
@@ -46,6 +46,7 @@
   private static final int MIN_TEXT_RANGE_LENGTH = 3;
   private static final String STYLE_ATTRIBUTE = "style";
 
+  @Override
   @NotNull
   public FoldingDescriptor[] buildFoldRegions(@NotNull ASTNode node, @NotNull Document document) {
     final PsiElement psiElement = node.getPsi();
@@ -217,6 +218,7 @@
     return false;
   }
 
+  @Override
   public String getPlaceholderText(@NotNull ASTNode node) {
     final PsiElement psi = node.getPsi();
     if (psi instanceof XmlTag ||
@@ -227,6 +229,7 @@
     return null;
   }
 
+  @Override
   public boolean isCollapsedByDefault(@NotNull ASTNode node) {
     final PsiElement psi = node.getPsi();
     final XmlCodeFoldingSettings foldingSettings = getFoldingSettings();
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/dtd/DTDParserDefinition.java b/xml/xml-psi-impl/src/com/intellij/lang/dtd/DTDParserDefinition.java
index 541aa16..8197314 100644
--- a/xml/xml-psi-impl/src/com/intellij/lang/dtd/DTDParserDefinition.java
+++ b/xml/xml-psi-impl/src/com/intellij/lang/dtd/DTDParserDefinition.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.
@@ -37,10 +37,12 @@
  * @author max
  */
 public class DTDParserDefinition extends XMLParserDefinition {
+  @Override
   public SpaceRequirements spaceExistanceTypeBetweenTokens(ASTNode left, ASTNode right) {
     return LanguageUtil.canStickTokensTogetherByLexer(left, right, new DtdLexer(false));
   }
 
+  @Override
   public PsiFile createFile(FileViewProvider viewProvider) {
     return new XmlFileImpl(viewProvider, XmlElementType.DTD_FILE);
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/dtd/DtdSyntaxHighlighterFactory.java b/xml/xml-psi-impl/src/com/intellij/lang/dtd/DtdSyntaxHighlighterFactory.java
index 8095517..c57c77a 100644
--- a/xml/xml-psi-impl/src/com/intellij/lang/dtd/DtdSyntaxHighlighterFactory.java
+++ b/xml/xml-psi-impl/src/com/intellij/lang/dtd/DtdSyntaxHighlighterFactory.java
@@ -1,3 +1,18 @@
+/*
+ * 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.dtd;
 
 import com.intellij.ide.highlighter.XmlFileHighlighter;
@@ -6,6 +21,7 @@
 import org.jetbrains.annotations.NotNull;
 
 public class DtdSyntaxHighlighterFactory extends SingleLazyInstanceSyntaxHighlighterFactory {
+  @Override
   @NotNull
   protected SyntaxHighlighter createHighlighter() {
     return new XmlFileHighlighter(true);
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/html/HTMLParser.java b/xml/xml-psi-impl/src/com/intellij/lang/html/HTMLParser.java
index db0c3e2..89bb48e 100644
--- a/xml/xml-psi-impl/src/com/intellij/lang/html/HTMLParser.java
+++ b/xml/xml-psi-impl/src/com/intellij/lang/html/HTMLParser.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.
@@ -28,6 +28,7 @@
 
 public class HTMLParser implements PsiParser {
 
+  @Override
   @NotNull
   public ASTNode parse(final IElementType root, final PsiBuilder builder) {
     parseWithoutBuildingTree(root, builder);
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/html/HTMLParserDefinition.java b/xml/xml-psi-impl/src/com/intellij/lang/html/HTMLParserDefinition.java
index 0e3dc66..8690f87 100644
--- a/xml/xml-psi-impl/src/com/intellij/lang/html/HTMLParserDefinition.java
+++ b/xml/xml-psi-impl/src/com/intellij/lang/html/HTMLParserDefinition.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.
@@ -38,35 +38,42 @@
  * @author max
  */
 public class HTMLParserDefinition implements ParserDefinition {
+  @Override
   @NotNull
   public Lexer createLexer(Project project) {
     return new HtmlLexer();
   }
 
+  @Override
   public IFileElementType getFileNodeType() {
     return XmlElementType.HTML_FILE;
   }
 
+  @Override
   @NotNull
   public TokenSet getWhitespaceTokens() {
     return XmlTokenType.WHITESPACES;
   }
 
+  @Override
   @NotNull
   public TokenSet getCommentTokens() {
     return XmlTokenType.COMMENTS;
   }
 
+  @Override
   @NotNull
   public TokenSet getStringLiteralElements() {
     return TokenSet.EMPTY;
   }
 
+  @Override
   @NotNull
   public PsiParser createParser(final Project project) {
     return new HTMLParser();
   }
 
+  @Override
   @NotNull
   public PsiElement createElement(ASTNode node) {
     if (node.getElementType() == XmlElementType.HTML_EMBEDDED_CONTENT) {
@@ -75,10 +82,12 @@
     return PsiUtilCore.NULL_PSI_ELEMENT;
   }
 
+  @Override
   public PsiFile createFile(FileViewProvider viewProvider) {
     return new HtmlFileImpl(viewProvider);
   }
 
+  @Override
   public SpaceRequirements spaceExistanceTypeBetweenTokens(ASTNode left, ASTNode right) {
     final Lexer lexer = createLexer(left.getPsi().getProject());
     return XMLParserDefinition.canStickTokensTogetherByLexerInXml(left, right, lexer, 0);
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/html/HtmlSyntaxHighlighterFactory.java b/xml/xml-psi-impl/src/com/intellij/lang/html/HtmlSyntaxHighlighterFactory.java
index 25c4913..23b2f55 100644
--- a/xml/xml-psi-impl/src/com/intellij/lang/html/HtmlSyntaxHighlighterFactory.java
+++ b/xml/xml-psi-impl/src/com/intellij/lang/html/HtmlSyntaxHighlighterFactory.java
@@ -1,3 +1,18 @@
+/*
+ * 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.html;
 
 import com.intellij.ide.highlighter.HtmlFileHighlighter;
@@ -6,6 +21,7 @@
 import org.jetbrains.annotations.NotNull;
 
 public class HtmlSyntaxHighlighterFactory extends SingleLazyInstanceSyntaxHighlighterFactory {
+  @Override
   @NotNull
   protected SyntaxHighlighter createHighlighter() {
     return new HtmlFileHighlighter();
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/xhtml/XHTMLParserDefinition.java b/xml/xml-psi-impl/src/com/intellij/lang/xhtml/XHTMLParserDefinition.java
index 93b34c0..098d58b 100644
--- a/xml/xml-psi-impl/src/com/intellij/lang/xhtml/XHTMLParserDefinition.java
+++ b/xml/xml-psi-impl/src/com/intellij/lang/xhtml/XHTMLParserDefinition.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.
@@ -31,16 +31,19 @@
  */
 public class XHTMLParserDefinition extends XMLParserDefinition {
 
+  @Override
   @NotNull
   public Lexer createLexer(Project project) {
     return new XHtmlLexer();
   }
 
+  @Override
   public SpaceRequirements spaceExistanceTypeBetweenTokens(ASTNode left, ASTNode right) {
     final Lexer lexer = createLexer(left.getPsi().getProject());
     return canStickTokensTogetherByLexerInXml(left, right, lexer, 0);
   }
 
+  @Override
   public PsiFile createFile(FileViewProvider viewProvider) {
     return new XmlFileImpl(viewProvider, XmlElementType.XHTML_FILE);
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/xhtml/XhtmlSyntaxHighlighterFactory.java b/xml/xml-psi-impl/src/com/intellij/lang/xhtml/XhtmlSyntaxHighlighterFactory.java
index 108fed2..6f09db4 100644
--- a/xml/xml-psi-impl/src/com/intellij/lang/xhtml/XhtmlSyntaxHighlighterFactory.java
+++ b/xml/xml-psi-impl/src/com/intellij/lang/xhtml/XhtmlSyntaxHighlighterFactory.java
@@ -1,3 +1,18 @@
+/*
+ * 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.xhtml;
 
 import com.intellij.ide.highlighter.XmlFileHighlighter;
@@ -6,6 +21,7 @@
 import org.jetbrains.annotations.NotNull;
 
 public class XhtmlSyntaxHighlighterFactory extends SingleLazyInstanceSyntaxHighlighterFactory {
+  @Override
   @NotNull
   protected SyntaxHighlighter createHighlighter() {
     return new XmlFileHighlighter(false, true);
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/xml/XMLParserDefinition.java b/xml/xml-psi-impl/src/com/intellij/lang/xml/XMLParserDefinition.java
index a25df77..b37cc35 100644
--- a/xml/xml-psi-impl/src/com/intellij/lang/xml/XMLParserDefinition.java
+++ b/xml/xml-psi-impl/src/com/intellij/lang/xml/XMLParserDefinition.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.
@@ -37,44 +37,53 @@
  * @author max
  */
 public class XMLParserDefinition implements ParserDefinition {
+  @Override
   @NotNull
   public Lexer createLexer(Project project) {
     return new XmlLexer();
   }
 
+  @Override
   public IFileElementType getFileNodeType() {
     return XmlElementType.XML_FILE;
   }
 
+  @Override
   @NotNull
   public TokenSet getWhitespaceTokens() {
     return XmlTokenType.WHITESPACES;
   }
 
+  @Override
   @NotNull
   public TokenSet getCommentTokens() {
     return XmlTokenType.COMMENTS;
   }
 
+  @Override
   @NotNull
   public TokenSet getStringLiteralElements() {
     return TokenSet.EMPTY;
   }
 
+  @Override
   @NotNull
   public PsiParser createParser(final Project project) {
     return new XmlParser();
   }
 
+  @Override
   @NotNull
   public PsiElement createElement(ASTNode node) {
     return PsiUtilCore.NULL_PSI_ELEMENT;
   }
 
+  @Override
   public PsiFile createFile(FileViewProvider viewProvider) {
     return new XmlFileImpl(viewProvider, XmlElementType.XML_FILE);
   }
 
+  @Override
   public SpaceRequirements spaceExistanceTypeBetweenTokens(ASTNode left, ASTNode right) {
     final Lexer lexer = createLexer(left.getPsi().getProject());
     return canStickTokensTogetherByLexerInXml(left, right, lexer, 0);
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlCommenter.java b/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlCommenter.java
new file mode 100644
index 0000000..461c586
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlCommenter.java
@@ -0,0 +1,49 @@
+/*
+ * 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.xml;
+
+import com.intellij.lang.Commenter;
+
+/**
+ * @author max
+ */
+public class XmlCommenter implements Commenter {
+
+  @Override
+  public String getLineCommentPrefix() {
+    return null;
+  }
+
+  @Override
+  public String getBlockCommentPrefix() {
+    return "<!--";
+  }
+
+  @Override
+  public String getBlockCommentSuffix() {
+    return "-->";
+  }
+
+  @Override
+  public String getCommentedBlockCommentPrefix() {
+    return "&lt;!&ndash;";
+  }
+
+  @Override
+  public String getCommentedBlockCommentSuffix() {
+    return "&ndash;&gt;";
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlFindUsagesProvider.java b/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlFindUsagesProvider.java
new file mode 100644
index 0000000..a771d61
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlFindUsagesProvider.java
@@ -0,0 +1,120 @@
+/*
+ * 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.xml;
+
+import com.intellij.lang.LangBundle;
+import com.intellij.lang.cacheBuilder.WordsScanner;
+import com.intellij.lang.findUsages.DescriptiveNameUtil;
+import com.intellij.lang.findUsages.FindUsagesProvider;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiNamedElement;
+import com.intellij.psi.meta.PsiMetaData;
+import com.intellij.psi.xml.*;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author ven
+ */
+public class XmlFindUsagesProvider implements FindUsagesProvider {
+  @Override
+  public boolean canFindUsagesFor(@NotNull PsiElement element) {
+    return element instanceof XmlElementDecl ||
+           element instanceof XmlAttributeDecl ||
+           element instanceof XmlEntityDecl ||
+           element instanceof XmlTag ||
+           element instanceof XmlAttributeValue ||
+           element instanceof PsiFile ||
+           element instanceof XmlComment;
+  }
+
+  @Override
+  @NotNull
+  public String getType(@NotNull PsiElement element) {
+    if (element instanceof XmlTag) {
+      final PsiMetaData metaData = ((XmlTag)element).getMetaData();
+      if (metaData != null && metaData.getDeclaration() instanceof XmlTag) {
+        return ((XmlTag)metaData.getDeclaration()).getName();
+      }
+      return LangBundle.message("xml.terms.xml.tag");
+    }
+    if (element instanceof XmlElementDecl) {
+      return LangBundle.message("xml.terms.tag");
+    }
+    else if (element instanceof XmlAttributeDecl) {
+      return LangBundle.message("xml.terms.attribute");
+    }
+    else if (element instanceof XmlAttributeValue) {
+      return LangBundle.message("xml.terms.attribute.value");
+    }
+    else if (element instanceof XmlEntityDecl) {
+      return LangBundle.message("xml.terms.entity");
+    }
+    else if (element instanceof XmlAttribute) {
+      return LangBundle.message("xml.terms.attribute");
+    } else if (element instanceof XmlComment) {
+      return LangBundle.message("xml.terms.variable");
+    }
+    throw new IllegalArgumentException("Cannot get type for " + element);
+  }
+
+  @Override
+  public String getHelpId(@NotNull PsiElement element) {
+    return com.intellij.lang.HelpID.FIND_OTHER_USAGES;
+  }
+
+  @Override
+  @NotNull
+  public String getDescriptiveName(@NotNull PsiElement element) {
+    if (element instanceof XmlTag) {
+      return ((XmlTag)element).getName();
+    }
+
+    if (element instanceof XmlAttributeValue) {
+      return ((XmlAttributeValue)element).getValue();
+    }
+
+    if (element instanceof PsiNamedElement) {
+      return ((PsiNamedElement)element).getName();
+    }
+    return element.getText();
+  }
+
+  @Override
+  @NotNull
+  public String getNodeText(@NotNull PsiElement element, boolean useFullName) {
+    if (element instanceof XmlTag) {
+      final XmlTag xmlTag = (XmlTag)element;
+      final PsiMetaData metaData = xmlTag.getMetaData();
+      final String name = metaData != null ? DescriptiveNameUtil.getMetaDataName(metaData) : xmlTag.getName();
+
+      String presentableName = metaData == null ? "<" + name + ">" : name;
+      return presentableName+" of file "+xmlTag.getContainingFile().getName();
+    }
+    if (element instanceof XmlAttributeValue) {
+      return ((XmlAttributeValue)element).getValue();
+    }
+    if (element instanceof PsiNamedElement) {
+      return ((PsiNamedElement)element).getName();
+    }
+    return element.getText();
+  }
+
+  @Override
+  public WordsScanner getWordsScanner() {
+    return null;
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlFoldingBuilder.java b/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlFoldingBuilder.java
new file mode 100644
index 0000000..fa8e93e
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlFoldingBuilder.java
@@ -0,0 +1,30 @@
+/*
+ * 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.xml;
+
+import com.intellij.application.options.editor.XmlFoldingSettings;
+import com.intellij.lang.XmlCodeFoldingBuilder;
+import com.intellij.lang.XmlCodeFoldingSettings;
+
+/**
+ * @author Maxim.Mossienko
+ */
+public class XmlFoldingBuilder extends XmlCodeFoldingBuilder {
+  @Override
+  protected XmlCodeFoldingSettings getFoldingSettings() {
+    return XmlFoldingSettings.getInstance();
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlSyntaxHighlighterFactory.java b/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlSyntaxHighlighterFactory.java
index 152b2bb..cd5b675 100644
--- a/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlSyntaxHighlighterFactory.java
+++ b/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlSyntaxHighlighterFactory.java
@@ -1,3 +1,18 @@
+/*
+ * 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.xml;
 
 import com.intellij.ide.highlighter.XmlFileHighlighter;
@@ -6,6 +21,7 @@
 import org.jetbrains.annotations.NotNull;
 
 public class XmlSyntaxHighlighterFactory extends SingleLazyInstanceSyntaxHighlighterFactory {
+  @Override
   @NotNull
   protected SyntaxHighlighter createHighlighter() {
     return new XmlFileHighlighter();
diff --git a/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlTemplateTreePatcher.java b/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlTemplateTreePatcher.java
index 0669461..7cdb931 100644
--- a/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlTemplateTreePatcher.java
+++ b/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlTemplateTreePatcher.java
@@ -25,6 +25,7 @@
 import com.intellij.util.CharTable;
 
 public class XmlTemplateTreePatcher implements TreePatcher {
+  @Override
   public void insert(CompositeElement parent, TreeElement anchorBefore, OuterLanguageElement toInsert) {
     if(anchorBefore != null) {
       //[mike]
@@ -39,6 +40,7 @@
     else parent.rawAddChildren((TreeElement)toInsert);
   }
 
+  @Override
   public LeafElement split(LeafElement leaf, int offset, final CharTable table) {
     final CharSequence chars = leaf.getChars();
     final LeafElement leftPart = ASTFactory.leaf(leaf.getElementType(), table.intern(chars, 0, offset));
diff --git a/xml/xml-psi-impl/src/com/intellij/lexer/BaseHtmlLexer.java b/xml/xml-psi-impl/src/com/intellij/lexer/BaseHtmlLexer.java
index 7e2c172..3e01e20 100644
--- a/xml/xml-psi-impl/src/com/intellij/lexer/BaseHtmlLexer.java
+++ b/xml/xml-psi-impl/src/com/intellij/lexer/BaseHtmlLexer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -47,7 +47,7 @@
   private static final int SEEN_CONTENT_TYPE = 0x400;
   protected static final int BASE_STATE_SHIFT = 11;
   @Nullable
-  protected static Language ourDefaultLanguage = Language.findLanguageByID("JavaScript");
+  protected static final Language ourDefaultLanguage = Language.findLanguageByID("JavaScript");
 
   private boolean seenTag;
   private boolean seenAttribute;
diff --git a/xml/xml-psi-impl/src/com/intellij/lexer/HtmlHighlightingLexer.java b/xml/xml-psi-impl/src/com/intellij/lexer/HtmlHighlightingLexer.java
index 1303d56..eeae1d3 100644
--- a/xml/xml-psi-impl/src/com/intellij/lexer/HtmlHighlightingLexer.java
+++ b/xml/xml-psi-impl/src/com/intellij/lexer/HtmlHighlightingLexer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -35,7 +35,7 @@
   protected Lexer elLexer;
   private boolean hasNoEmbeddments;
   private final FileType ourStyleFileType;// = FileTypeManager.getInstance().getStdFileType("CSS");
-  private static FileType ourInlineScriptFileType = null;
+  private static final FileType ourInlineScriptFileType;
 
 
   static {
diff --git a/xml/xml-psi-impl/src/com/intellij/lexer/XHtmlLexer.java b/xml/xml-psi-impl/src/com/intellij/lexer/XHtmlLexer.java
index 784198c..b108e9c 100644
--- a/xml/xml-psi-impl/src/com/intellij/lexer/XHtmlLexer.java
+++ b/xml/xml-psi-impl/src/com/intellij/lexer/XHtmlLexer.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.
@@ -27,6 +27,7 @@
     this(new XmlLexer(true));
   }
 
+  @Override
   protected boolean isHtmlTagState(int state) {
     return state == __XmlLexer.TAG || state == __XmlLexer.END_TAG;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/lexer/XmlHighlightingLexer.java b/xml/xml-psi-impl/src/com/intellij/lexer/XmlHighlightingLexer.java
index e485774..6548523 100644
--- a/xml/xml-psi-impl/src/com/intellij/lexer/XmlHighlightingLexer.java
+++ b/xml/xml-psi-impl/src/com/intellij/lexer/XmlHighlightingLexer.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.
@@ -26,6 +26,7 @@
     super(new XmlLexer());
   }
 
+  @Override
   public IElementType getTokenType() {
     IElementType tokenType = getDelegate().getTokenType();
 
diff --git a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/XmlAspectChangeSetImpl.java b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/XmlAspectChangeSetImpl.java
index eb9da7b..9aa3054 100644
--- a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/XmlAspectChangeSetImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/XmlAspectChangeSetImpl.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.
@@ -46,15 +46,18 @@
     }
   }
 
+  @Override
   public List<XmlChange> getChanges(){
     return Collections.unmodifiableList(myChanges);
   }
 
+  @Override
   @NotNull
   public PomModelAspect getAspect() {
     return myModel.getModelAspect(XmlAspect.class);
   }
 
+  @Override
   public void merge(@NotNull PomChangeSet blocked) {
     final List<XmlChange> changes = ((XmlAspectChangeSetImpl)blocked).myChanges;
     for (XmlChange xmlChange : changes) {
@@ -62,21 +65,24 @@
     }
   }
 
+  @Override
   public void add(XmlChange xmlChange) {
     myChanges.add(xmlChange);
   }
 
+  @Override
   public void clear() {
     myChanges.clear();
   }
 
+  @Override
   @NotNull
   public Iterable<XmlFile> getChangedFiles() {
     return myChangedFiles;
   }
 
   public String toString(){
-    final StringBuffer buffer = new StringBuffer();
+    final StringBuilder buffer = new StringBuilder();
     final Iterator<XmlChange> iterator = myChanges.iterator();
     while (iterator.hasNext()) {
       XmlChange xmlChange = iterator.next();
@@ -88,6 +94,7 @@
     return buffer.toString();
   }
 
+  @Override
   public void addChangedFile(@NotNull final XmlFile xmlFile) {
     myChangedFiles.add(xmlFile);
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/XmlAspectImpl.java b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/XmlAspectImpl.java
new file mode 100644
index 0000000..1afcdb7
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/XmlAspectImpl.java
@@ -0,0 +1,214 @@
+/*
+ * 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.pom.xml.impl;
+
+import com.intellij.lang.ASTNode;
+import com.intellij.pom.PomModel;
+import com.intellij.pom.PomModelAspect;
+import com.intellij.pom.event.PomModelEvent;
+import com.intellij.pom.tree.TreeAspect;
+import com.intellij.pom.tree.events.ChangeInfo;
+import com.intellij.pom.tree.events.ReplaceChangeInfo;
+import com.intellij.pom.tree.events.TreeChange;
+import com.intellij.pom.tree.events.TreeChangeEvent;
+import com.intellij.pom.tree.events.impl.ChangeInfoImpl;
+import com.intellij.pom.tree.events.impl.TreeChangeImpl;
+import com.intellij.pom.xml.XmlAspect;
+import com.intellij.pom.xml.impl.events.*;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.TokenType;
+import com.intellij.psi.XmlElementVisitor;
+import com.intellij.psi.impl.source.tree.FileElement;
+import com.intellij.psi.tree.IElementType;
+import com.intellij.psi.xml.*;
+import com.intellij.util.CharTable;
+
+import java.util.Collections;
+
+public class XmlAspectImpl implements XmlAspect {
+  private final PomModel myModel;
+  private final TreeAspect myTreeAspect;
+
+  public XmlAspectImpl(PomModel model, TreeAspect aspect) {
+    myModel = model;
+    myTreeAspect = aspect;
+    myModel.registerAspect(XmlAspect.class, this, Collections.singleton((PomModelAspect)myTreeAspect));
+  }
+
+  @Override
+  public void update(PomModelEvent event) {
+    if (!event.getChangedAspects().contains(myTreeAspect)) return;
+    final TreeChangeEvent changeSet = (TreeChangeEvent)event.getChangeSet(myTreeAspect);
+    if (changeSet == null) return;
+    final ASTNode rootElement = changeSet.getRootElement();
+    final PsiFile file = (PsiFile)rootElement.getPsi();
+    if (!(file instanceof XmlFile)) return;
+    final XmlAspectChangeSetImpl xmlChangeSet = event.registerChangeSetIfAbsent(this, new XmlAspectChangeSetImpl(myModel));
+    xmlChangeSet.addChangedFile((XmlFile)file);
+
+    final ASTNode[] changedElements = changeSet.getChangedElements();
+    final CharTable table = ((FileElement)changeSet.getRootElement()).getCharTable();
+    for (ASTNode changedElement : changedElements) {
+      TreeChange changesByElement = changeSet.getChangesByElement(changedElement);
+      PsiElement psiElement = null;
+      while (changedElement != null && (psiElement = changedElement.getPsi()) == null) {
+        final ASTNode parent = changedElement.getTreeParent();
+        final ChangeInfoImpl changeInfo = ChangeInfoImpl.create(ChangeInfo.CONTENTS_CHANGED, changedElement);
+        changeInfo.compactChange(changesByElement);
+        changesByElement = new TreeChangeImpl(parent);
+        changesByElement.addChange(changedElement, changeInfo);
+        changedElement = parent;
+      }
+      if (changedElement == null) continue;
+      final TreeChange finalChangedElement = changesByElement;
+      psiElement.accept(new XmlElementVisitor() {
+        TreeChange myChange = finalChangedElement;
+
+        @Override
+        public void visitElement(PsiElement element) {
+          final ASTNode child = element.getNode();
+          final ASTNode treeParent = child.getTreeParent();
+          if (treeParent == null) return;
+          final PsiElement parent = treeParent.getPsi();
+          final ChangeInfoImpl changeInfo = ChangeInfoImpl.create(ChangeInfo.CONTENTS_CHANGED, child);
+
+          changeInfo.compactChange(myChange);
+          myChange = new TreeChangeImpl(treeParent);
+
+          myChange.addChange(child, changeInfo);
+          parent.accept(this);
+        }
+
+        @Override
+        public void visitXmlAttribute(XmlAttribute attribute) {
+          final ASTNode[] affectedChildren = myChange.getAffectedChildren();
+          String oldName = null;
+          String oldValue = null;
+          for (final ASTNode treeElement : affectedChildren) {
+            final ChangeInfo changeByChild = myChange.getChangeByChild(treeElement);
+            final int changeType = changeByChild.getChangeType();
+            if (treeElement.getElementType() == XmlTokenType.XML_NAME) {
+              if (changeType == ChangeInfo.REMOVED) {
+                oldName = treeElement.getText();
+              }
+              else if (changeType == ChangeInfo.REPLACE) {
+                oldName = ((ReplaceChangeInfo)changeByChild).getReplaced().getText();
+              }
+            }
+            if (treeElement.getElementType() == XmlElementType.XML_ATTRIBUTE_VALUE) {
+              if (changeType == ChangeInfo.REMOVED) {
+                oldValue = treeElement.getText();
+              }
+              else if (changeType == ChangeInfo.REPLACE) {
+                oldValue = ((ReplaceChangeInfo)changeByChild).getReplaced().getText();
+              }
+            }
+          }
+          if (oldName != null && !oldName.equals(attribute.getName())) {
+            xmlChangeSet.add(new XmlAttributeSetImpl(attribute.getParent(), oldName, null));
+            xmlChangeSet.add(new XmlAttributeSetImpl(attribute.getParent(), attribute.getName(), attribute.getValue()));
+          }
+          else if (oldValue != null) {
+            xmlChangeSet.add(new XmlAttributeSetImpl(attribute.getParent(), attribute.getName(), attribute.getValue()));
+          }
+          else {
+            xmlChangeSet.add(new XmlElementChangedImpl(attribute));
+          }
+        }
+
+        @Override
+        public void visitXmlTag(XmlTag tag) {
+          ASTNode[] affectedChildren = shortenChange(myChange.getAffectedChildren(), changeSet);
+
+          for (final ASTNode treeElement : affectedChildren) {
+            /*final IElementType type = treeElement.getElementType();
+            if (type == ElementType.WHITE_SPACE) continue;
+            if (type == ElementType.XML_NAME) {
+              if (myChange.getChangeByChild(treeElement).getChangeType() == ChangeInfo.REPLACE) {
+                continue;
+              }
+            }*/
+
+            if (!(treeElement.getPsi() instanceof XmlTagChild)) {
+              visitElement(tag);
+              return;
+            }
+          }
+
+          for (final ASTNode treeElement : affectedChildren) {
+            final ChangeInfo changeByChild = myChange.getChangeByChild(treeElement);
+            final int changeType = changeByChild.getChangeType();
+            final IElementType type = treeElement.getElementType();
+            if (type == TokenType.WHITE_SPACE) continue;
+            /*
+            if (type == ElementType.XML_NAME) {
+              final XmlToken xmlToken = (XmlToken)((ReplaceChangeInfo)changeByChild).getReplaced();
+              xmlChangeSet.add(new XmlTagNameChangedImpl(tag, xmlToken.getText()));
+              continue;
+            }
+            */
+
+            final PsiElement element = treeElement.getPsi();
+
+            switch (changeType) {
+              case ChangeInfo.ADD:
+                xmlChangeSet.add(new XmlTagChildAddImpl(tag, (XmlTagChild)element));
+                break;
+              case ChangeInfo.REMOVED:
+                treeElement.putUserData(CharTable.CHAR_TABLE_KEY, table);
+                xmlChangeSet.add(new XmlTagChildRemovedImpl(tag, (XmlTagChild)element));
+                break;
+              case ChangeInfo.CONTENTS_CHANGED:
+                xmlChangeSet.add(new XmlTagChildChangedImpl(tag, (XmlTagChild)element));
+                break;
+              case ChangeInfo.REPLACE:
+                final PsiElement psi = ((ReplaceChangeInfo)changeByChild).getReplaced().getPsi();
+                if (psi instanceof XmlTagChild) {
+                  final XmlTagChild replaced = (XmlTagChild)psi;
+                  replaced.putUserData(CharTable.CHAR_TABLE_KEY, table);
+                  xmlChangeSet.add(new XmlTagChildRemovedImpl(tag, replaced));
+                  xmlChangeSet.add(new XmlTagChildAddImpl(tag, (XmlTagChild)element));
+                }
+                break;
+            }
+          }
+        }
+
+        @Override
+        public void visitXmlDocument(XmlDocument document) {
+          xmlChangeSet.clear();
+          xmlChangeSet.add(new XmlDocumentChangedImpl(document));
+        }
+
+        @Override
+        public void visitFile(PsiFile file) {
+          final XmlDocument document = ((XmlFile)file).getDocument();
+
+          if (document != null) {
+            xmlChangeSet.clear();
+            xmlChangeSet.add(new XmlDocumentChangedImpl(document));
+          }
+        }
+      });
+    }
+  }
+
+  private ASTNode[] shortenChange(ASTNode[] affectedChildren, TreeChangeEvent event) {
+    // TODO
+    return affectedChildren;
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlAttributeSetImpl.java b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlAttributeSetImpl.java
index 2f9f08e..4f2a013 100644
--- a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlAttributeSetImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlAttributeSetImpl.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.
@@ -35,14 +35,17 @@
     myTag = xmlTag;
   }
 
+  @Override
   public String getName() {
     return myName;
   }
 
+  @Override
   public String getValue() {
     return myValue;
   }
 
+  @Override
   public XmlTag getTag() {
     return myTag;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlDocumentChangedImpl.java b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlDocumentChangedImpl.java
index 2bad3d2..3b40655 100644
--- a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlDocumentChangedImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlDocumentChangedImpl.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.
@@ -32,6 +32,7 @@
     myDocument = document;
   }
 
+  @Override
   public XmlDocument getDocument() {
     return myDocument;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlElementChangedImpl.java b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlElementChangedImpl.java
new file mode 100644
index 0000000..bd117c9
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlElementChangedImpl.java
@@ -0,0 +1,36 @@
+/*
+ * 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.pom.xml.impl.events;
+
+import com.intellij.pom.xml.events.XmlElementChanged;
+import com.intellij.psi.xml.XmlElement;
+
+public class XmlElementChangedImpl implements XmlElementChanged {
+  private final XmlElement myElement;
+
+  public XmlElementChangedImpl(XmlElement treeElement) {
+    myElement = treeElement;
+  }
+
+  @Override
+  public XmlElement getElement() {
+    return myElement;
+  }
+
+  public String toString() {
+    return "Xml element changed: " + myElement;
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagChildAddImpl.java b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagChildAddImpl.java
index 21024aa..94b4e06 100644
--- a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagChildAddImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagChildAddImpl.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.
@@ -27,10 +27,12 @@
     myChild = treeElement;
   }
 
+  @Override
   public XmlTag getTag() {
     return myTag;
   }
 
+  @Override
   public XmlTagChild getChild() {
     return myChild;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagChildChangedImpl.java b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagChildChangedImpl.java
new file mode 100644
index 0000000..bff9d46
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagChildChangedImpl.java
@@ -0,0 +1,57 @@
+/*
+ * 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.pom.xml.impl.events;
+
+import com.intellij.pom.PomModel;
+import com.intellij.pom.event.PomModelEvent;
+import com.intellij.pom.xml.XmlAspect;
+import com.intellij.pom.xml.events.XmlTagChildChanged;
+import com.intellij.pom.xml.impl.XmlAspectChangeSetImpl;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.xml.XmlFile;
+import com.intellij.psi.xml.XmlTag;
+import com.intellij.psi.xml.XmlTagChild;
+
+public class XmlTagChildChangedImpl implements XmlTagChildChanged {
+  private final XmlTag myTag;
+  private final XmlTagChild myChild;
+  public XmlTagChildChangedImpl(XmlTag context, XmlTagChild treeElement) {
+    myTag = context;
+    myChild = treeElement;
+  }
+
+  @Override
+  public XmlTag getTag() {
+    return myTag;
+  }
+
+  @Override
+  public XmlTagChild getChild() {
+    return myChild;
+  }
+
+  public static PomModelEvent createXmlTagChildChanged(PomModel source, XmlTag context, XmlTagChild treeElement) {
+    final PomModelEvent event = new PomModelEvent(source);
+    final XmlAspectChangeSetImpl xmlAspectChangeSet = new XmlAspectChangeSetImpl(source, PsiTreeUtil.getParentOfType(context, XmlFile.class));
+    xmlAspectChangeSet.add(new XmlTagChildChangedImpl(context, treeElement));
+    event.registerChangeSet(source.getModelAspect(XmlAspect.class), xmlAspectChangeSet);
+    return event;
+  }
+  @SuppressWarnings({"HardCodedStringLiteral"})
+  public String toString() {
+    return "child changed in " + getTag().getName() + " child: " + myChild.toString();
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagChildRemovedImpl.java b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagChildRemovedImpl.java
new file mode 100644
index 0000000..cd20f8c
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagChildRemovedImpl.java
@@ -0,0 +1,44 @@
+/*
+ * 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.pom.xml.impl.events;
+
+import com.intellij.pom.xml.events.XmlTagChildRemoved;
+import com.intellij.psi.xml.XmlTag;
+import com.intellij.psi.xml.XmlTagChild;
+
+public class XmlTagChildRemovedImpl implements XmlTagChildRemoved {
+  private final XmlTag myTag;
+  private final XmlTagChild myChild;
+  public XmlTagChildRemovedImpl(XmlTag context, XmlTagChild treeElement) {
+    myTag = context;
+    myChild = treeElement;
+  }
+
+  @Override
+  public XmlTag getTag() {
+    return myTag;
+  }
+
+  @Override
+  public XmlTagChild getChild() {
+    return myChild;
+  }
+
+  @SuppressWarnings({"HardCodedStringLiteral"})
+  public String toString() {
+    return "child removed from " + getTag().getName() + " child: " + myChild.toString();
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagNameChangedImpl.java b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagNameChangedImpl.java
index db972eb..35a65c9 100644
--- a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagNameChangedImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagNameChangedImpl.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.
@@ -33,10 +33,12 @@
     myTag = tag;
   }
 
+  @Override
   public String getOldName() {
     return myOldName;
   }
 
+  @Override
   public XmlTag getTag() {
     return myTag;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTextChangedImpl.java b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTextChangedImpl.java
index 78fa37e..77d0899 100644
--- a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTextChangedImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTextChangedImpl.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.
@@ -33,10 +33,12 @@
     myText = xmlText;
   }
 
+  @Override
   public String getOldText() {
     return myOldText;
   }
 
+  @Override
   public XmlText getText() {
     return myText;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/XmlElementFactoryImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/XmlElementFactoryImpl.java
new file mode 100644
index 0000000..6f40f85
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/psi/XmlElementFactoryImpl.java
@@ -0,0 +1,118 @@
+/*
+ * 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.psi;
+
+import com.intellij.ide.highlighter.HtmlFileType;
+import com.intellij.ide.highlighter.XHtmlFileType;
+import com.intellij.ide.highlighter.XmlFileType;
+import com.intellij.lang.ASTFactory;
+import com.intellij.lang.Language;
+import com.intellij.lang.xml.XMLLanguage;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.xml.*;
+import com.intellij.util.IncorrectOperationException;
+import com.intellij.xml.util.XmlTagUtil;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Dmitry Avdeev
+ */
+public class XmlElementFactoryImpl extends XmlElementFactory {
+
+  private final Project myProject;
+
+  public XmlElementFactoryImpl(Project project) {
+    myProject = project;
+  }
+
+  @Override
+  @NotNull
+  public XmlTag createTagFromText(@NotNull @NonNls CharSequence text, @NotNull Language language) throws IncorrectOperationException {
+    assert language instanceof XMLLanguage:"Tag can be created only for xml language";
+    FileType type = language.getAssociatedFileType();
+    if (type == null) type = XmlFileType.INSTANCE;
+    final XmlDocument document = createXmlDocument(text, "dummy."+ type.getDefaultExtension(), type);
+    final XmlTag tag = document.getRootTag();
+    if (tag == null) throw new IncorrectOperationException("Incorrect tag text");
+    return tag;
+  }
+
+  @Override
+  @NotNull
+  public XmlTag createTagFromText(@NotNull CharSequence text) throws IncorrectOperationException {
+    return createTagFromText(text, XMLLanguage.INSTANCE);
+  }
+
+  @Override
+  @NotNull
+  public XmlAttribute createXmlAttribute(@NotNull String name, @NotNull String value) throws IncorrectOperationException {
+    final char quoteChar;
+    if (!value.contains("\"")) {
+      quoteChar = '"';
+    } else if (!value.contains("'")) {
+      quoteChar = '\'';
+    } else {
+      quoteChar = '"';
+      value = StringUtil.replace(value, "\"", "&quot;");
+    }
+    final XmlDocument document = createXmlDocument("<tag " + name + "=" + quoteChar + value + quoteChar + "/>", "dummy.xml",
+                                                   XmlFileType.INSTANCE);
+    XmlTag tag = document.getRootTag();
+    assert tag != null;
+    XmlAttribute[] attributes = tag.getAttributes();
+    LOG.assertTrue(attributes.length == 1, document.getText());
+    return attributes[0];
+  }
+
+  @Override
+  @NotNull
+  public XmlText createDisplayText(@NotNull String s) throws IncorrectOperationException {
+    final XmlTag tagFromText = createTagFromText("<a>" + XmlTagUtil.getCDATAQuote(s) + "</a>");
+    final XmlText[] textElements = tagFromText.getValue().getTextElements();
+    if (textElements.length == 0) return (XmlText)ASTFactory.composite(XmlElementType.XML_TEXT);
+    return textElements[0];
+  }
+
+  @Override
+  @NotNull
+  public XmlTag createXHTMLTagFromText(@NotNull String text) throws IncorrectOperationException {
+    final XmlDocument document = createXmlDocument(text, "dummy.xhtml", XHtmlFileType.INSTANCE);
+    final XmlTag tag = document.getRootTag();
+    assert tag != null;
+    return tag;
+  }
+
+  @Override
+  @NotNull
+  public XmlTag createHTMLTagFromText(@NotNull String text) throws IncorrectOperationException {
+    final XmlDocument document = createXmlDocument(text, "dummy.html", HtmlFileType.INSTANCE);
+    final XmlTag tag = document.getRootTag();
+    assert tag != null;
+    return tag;
+  }
+
+  private XmlDocument createXmlDocument(@NonNls final CharSequence text, @NonNls final String fileName, FileType fileType) {
+    final XmlDocument document = ((XmlFile)PsiFileFactory.getInstance(myProject).createFileFromText(fileName, fileType, text)).getDocument();
+    assert document != null;
+    return document;
+  }
+
+  private static final Logger LOG = Logger.getInstance(XmlElementFactoryImpl.class);
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/filters/TextContainFilter.java b/xml/xml-psi-impl/src/com/intellij/psi/filters/TextContainFilter.java
new file mode 100644
index 0000000..9af97cf
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/psi/filters/TextContainFilter.java
@@ -0,0 +1,55 @@
+/*
+ * 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.psi.filters;
+
+import com.intellij.psi.PsiElement;
+
+/**
+ * @author spleaner
+ */
+public class TextContainFilter extends XmlTextFilter {
+  public TextContainFilter(String[] values){
+    super(values);
+  }
+
+  public TextContainFilter(String value1, String value2){
+    super(value1, value2);
+  }
+
+  public TextContainFilter(String value){
+    super(value);
+  }
+
+  public TextContainFilter(){}
+
+  @Override
+  public boolean isAcceptable(Object element, PsiElement context){
+    if(element != null) {
+      for (final String value : myValue) {
+        if (value == null) {
+          return true;
+        }
+        String elementValue = getTextByElement(element);
+        if (elementValue == null) return false;
+        if (elementValue.contains(value)) return true;
+      }
+    }
+
+    return false;
+  }
+
+
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/filters/TextStartFilter.java b/xml/xml-psi-impl/src/com/intellij/psi/filters/TextStartFilter.java
new file mode 100644
index 0000000..1ccac50
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/psi/filters/TextStartFilter.java
@@ -0,0 +1,57 @@
+/*
+ * 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.psi.filters;
+
+import com.intellij.psi.PsiElement;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: ik
+ * Date: 27.08.2003
+ * Time: 18:18:38
+ * To change this template use Options | File Templates.
+ */
+public class TextStartFilter extends XmlTextFilter{
+  public TextStartFilter(String[] values){
+    super(values);
+  }
+
+  public TextStartFilter(String value1, String value2){
+    super(value1, value2);
+  }
+
+  public TextStartFilter(String value){
+    super(value);
+  }
+
+  public TextStartFilter(){}
+
+  @Override
+  public boolean isAcceptable(Object element, PsiElement context){
+    if(element != null) {
+      for (final String value : myValue) {
+        if (value == null) {
+          return true;
+        }
+        String elementValue = getTextByElement(element);
+        if (elementValue == null) return false;
+        if (elementValue.startsWith(value)) return true;
+      }
+    }
+
+    return false;
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/filters/XmlTagFilter.java b/xml/xml-psi-impl/src/com/intellij/psi/filters/XmlTagFilter.java
index 2b2e773..7dd7727 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/filters/XmlTagFilter.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/filters/XmlTagFilter.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.
@@ -27,10 +27,12 @@
 
   private XmlTagFilter() {}
 
+  @Override
   public boolean isAcceptable(Object element, PsiElement context) {
     return element instanceof XmlTag;
   }
 
+  @Override
   public boolean isClassAcceptable(Class hintClass) {
     return true;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/filters/XmlTextFilter.java b/xml/xml-psi-impl/src/com/intellij/psi/filters/XmlTextFilter.java
index 9f63343..2659119 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/filters/XmlTextFilter.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/filters/XmlTextFilter.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.
@@ -56,10 +56,12 @@
     myValue[1] = value2;
   }
 
+  @Override
   public boolean isClassAcceptable(Class hintClass){
     return true;
   }
 
+  @Override
   public boolean isAcceptable(Object element, PsiElement context){
     if(element != null) {
       for (final String value : myValue) {
@@ -91,6 +93,7 @@
     return ret;
   }
 
+  @Override
   public void init(Object[] fromGetter){
     try{
       myValue = new String[fromGetter.length];
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/filters/position/RootTagFilter.java b/xml/xml-psi-impl/src/com/intellij/psi/filters/position/RootTagFilter.java
new file mode 100644
index 0000000..8d53d2d
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/psi/filters/position/RootTagFilter.java
@@ -0,0 +1,48 @@
+/*
+ * 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.psi.filters.position;
+
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.filters.ElementFilter;
+import com.intellij.psi.xml.XmlDocument;
+import com.intellij.psi.xml.XmlTag;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: ik
+ * Date: 03.02.2003
+ * Time: 18:29:13
+ * To change this template use Options | File Templates.
+ */
+public class RootTagFilter extends PositionElementFilter{
+  public RootTagFilter(ElementFilter filter){
+    setFilter(filter);
+  }
+
+  public RootTagFilter(){}
+  @Override
+  public boolean isAcceptable(Object element, PsiElement scope){
+    if (!(element instanceof XmlDocument)) return false;
+    final XmlTag rootTag = ((XmlDocument)element).getRootTag();
+    if(rootTag == null) return false;
+
+    return getFilter().isAcceptable(rootTag, (PsiElement)element);
+  }
+
+  public String toString(){
+    return "roottag(" + getFilter().toString() + ")";
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/filters/position/TargetNamespaceFilter.java b/xml/xml-psi-impl/src/com/intellij/psi/filters/position/TargetNamespaceFilter.java
index 1c5e2ca..c738f45 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/filters/position/TargetNamespaceFilter.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/filters/position/TargetNamespaceFilter.java
@@ -37,10 +37,12 @@
     super(strs);
   }
 
+  @Override
   public boolean isClassAcceptable(Class hintClass){
     return ReflectionUtil.isAssignable(XmlTag.class, hintClass) || ReflectionUtil.isAssignable(XmlDocument.class, hintClass);
   }
 
+  @Override
   public boolean isAcceptable(Object element, PsiElement context){
     if(element instanceof XmlTag){
       final String attributeValue = ((XmlTag)element).getAttributeValue("targetNamespace");
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/filters/position/XmlTokenTypeFilter.java b/xml/xml-psi-impl/src/com/intellij/psi/filters/position/XmlTokenTypeFilter.java
index fca6f89..bd96f5c 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/filters/position/XmlTokenTypeFilter.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/filters/position/XmlTokenTypeFilter.java
@@ -38,10 +38,12 @@
     myType = type;
   }
 
+  @Override
   public boolean isClassAcceptable(Class hintClass){
     return ReflectionUtil.isAssignable(XmlToken.class, hintClass);
   }
 
+  @Override
   public boolean isAcceptable(Object element, PsiElement context){
     if(element instanceof PsiElement) {
       final ASTNode node = ((PsiElement)element).getNode();
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlFilterLexer.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlFilterLexer.java
new file mode 100644
index 0000000..3663fb7
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlFilterLexer.java
@@ -0,0 +1,64 @@
+/*
+ * 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.psi.impl.cache.impl.idCache;
+
+import com.intellij.lang.Language;
+import com.intellij.lang.xml.XMLLanguage;
+import com.intellij.lexer.Lexer;
+import com.intellij.psi.impl.cache.CacheUtil;
+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;
+import com.intellij.psi.xml.XmlTokenType;
+
+public class XHtmlFilterLexer extends BaseFilterLexer {
+
+  public XHtmlFilterLexer(Lexer originalLexer, OccurrenceConsumer table) {
+    super(originalLexer, table);
+  }
+
+  @Override
+  public void advance() {
+    final IElementType tokenType = myDelegate.getTokenType();
+
+    if (tokenType == XmlTokenType.XML_COMMENT_CHARACTERS) {
+      scanWordsInToken(UsageSearchContext.IN_COMMENTS, false, false);
+      advanceTodoItemCountsInToken();
+    } else if (tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN ||
+        tokenType == XmlTokenType.XML_NAME ||
+        tokenType == XmlTokenType.XML_TAG_NAME
+       ) {
+      scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT | UsageSearchContext.IN_FOREIGN_LANGUAGES, tokenType ==
+                                                                                                   XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN,
+                       false);
+    } else if (tokenType.getLanguage() != XMLLanguage.INSTANCE &&
+      tokenType.getLanguage() != Language.ANY         
+    ) {
+      boolean inComments = CacheUtil.isInComments(tokenType);
+      scanWordsInToken((inComments)?UsageSearchContext.IN_COMMENTS:UsageSearchContext.IN_PLAIN_TEXT | UsageSearchContext.IN_FOREIGN_LANGUAGES, true,
+                       false);
+      
+      if (inComments) advanceTodoItemCountsInToken();
+    }
+    else if (!XmlFilterLexer.ourNoWordsTokenSet.contains(tokenType)) {
+      scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT, false, false);
+    }
+
+    myDelegate.advance();
+  }
+
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlIdIndexer.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlIdIndexer.java
new file mode 100644
index 0000000..be9c394
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlIdIndexer.java
@@ -0,0 +1,32 @@
+/*
+ * 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.psi.impl.cache.impl.idCache;
+
+import com.intellij.lexer.Lexer;
+import com.intellij.lexer.XHtmlHighlightingLexer;
+import com.intellij.psi.impl.cache.impl.OccurrenceConsumer;
+import com.intellij.psi.impl.cache.impl.id.LexerBasedIdIndexer;
+
+public class XHtmlIdIndexer extends LexerBasedIdIndexer {
+  @Override
+  public Lexer createLexer(final OccurrenceConsumer consumer) {
+    return createIndexingLexer(consumer);
+  }
+
+  static XHtmlFilterLexer createIndexingLexer(OccurrenceConsumer consumer) {
+    return new XHtmlFilterLexer(new XHtmlHighlightingLexer(), consumer);
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlTodoIndexer.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlTodoIndexer.java
new file mode 100644
index 0000000..a445d1a
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlTodoIndexer.java
@@ -0,0 +1,27 @@
+/*
+ * 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.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;
+
+public class XHtmlTodoIndexer extends LexerBasedTodoIndexer {
+  @Override
+  public Lexer createLexer(OccurrenceConsumer consumer) {
+    return XHtmlIdIndexer.createIndexingLexer(consumer);
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlFilterLexer.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlFilterLexer.java
index 0b4d5c2..c1dd31d 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlFilterLexer.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlFilterLexer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -49,6 +49,7 @@
     super(originalLexer, table);
   }
 
+  @Override
   public void advance() {
     final IElementType tokenType = myDelegate.getTokenType();
 
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlIdIndexer.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlIdIndexer.java
index ba04785..502f8af 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlIdIndexer.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlIdIndexer.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.
@@ -21,6 +21,7 @@
 import com.intellij.psi.impl.cache.impl.id.LexerBasedIdIndexer;
 
 public class XmlIdIndexer extends LexerBasedIdIndexer {
+  @Override
   public Lexer createLexer(final OccurrenceConsumer consumer) {
     return createIndexingLexer(consumer);
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlTodoIndexer.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlTodoIndexer.java
new file mode 100644
index 0000000..bd65378
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlTodoIndexer.java
@@ -0,0 +1,27 @@
+/*
+ * 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.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;
+
+public class XmlTodoIndexer extends LexerBasedTodoIndexer {
+  @Override
+  public Lexer createLexer(OccurrenceConsumer consumer) {
+    return XmlIdIndexer.createIndexingLexer(consumer);
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlConditionalCommentInjector.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlConditionalCommentInjector.java
index d78e941..395b40c 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlConditionalCommentInjector.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlConditionalCommentInjector.java
@@ -77,6 +77,7 @@
     return endOfEnd == null ? null : Pair.create(conditionalStart, conditionalEnd);
   }
   
+  @Override
   public void getLanguagesToInject(@NotNull final MultiHostRegistrar registrar, @NotNull final PsiElement host) {
     Pair<ASTNode, ASTNode> pair = parseConditionalCommentBoundaries(host);
     if (pair == null) {
@@ -93,6 +94,7 @@
     }
   }
 
+  @Override
   @NotNull
   public List<? extends Class<? extends PsiElement>> elementsToInjectIn() {
     return Arrays.asList(PsiComment.class);
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlDocumentImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlDocumentImpl.java
index 7aa9ce9..864a854 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlDocumentImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlDocumentImpl.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.
@@ -27,6 +27,7 @@
     super(XmlElementType.HTML_DOCUMENT);
   }
 
+  @Override
   public XmlTag getRootTag() {
     return (XmlTag)findElementByTokenType(XmlElementType.HTML_TAG);
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlEmbeddedContentImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlEmbeddedContentImpl.java
index 8cdeb23..7a37200 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlEmbeddedContentImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlEmbeddedContentImpl.java
@@ -33,24 +33,28 @@
     super(node);
   }
 
+  @Override
   public XmlTag getParentTag() {
     final PsiElement parent = getParent();
     if (parent instanceof XmlTag) return (XmlTag)parent;
     return null;
   }
 
+  @Override
   public XmlTagChild getNextSiblingInTag() {
     PsiElement nextSibling = getNextSibling();
     if (nextSibling instanceof XmlTagChild) return (XmlTagChild)nextSibling;
     return null;
   }
 
+  @Override
   public XmlTagChild getPrevSiblingInTag() {
     final PsiElement prevSibling = getPrevSibling();
     if (prevSibling instanceof XmlTagChild) return (XmlTagChild)prevSibling;
     return null;
   }
 
+  @Override
   public boolean processElements(PsiElementProcessor processor, PsiElement place) {
     // TODO
     return true;
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlTagImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlTagImpl.java
index 843514d..c6afcbe 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlTagImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlTagImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -34,6 +34,7 @@
     super(XmlElementType.HTML_TAG);
   }
 
+  @Override
   @NotNull
   public XmlTag[] findSubTags(String name, String namespace) {
     final XmlTag[] subTags = getSubTags();
@@ -66,25 +67,30 @@
     return result == null ? EMPTY : result.toArray(new XmlTag[result.size()]);
   }
 
+  @Override
   protected boolean isCaseSensitive() {
     return false;
   }
 
+  @Override
   public String getAttributeValue(String qname) {
     qname = qname.toLowerCase();
     return super.getAttributeValue(qname);
   }
 
+  @Override
   protected void cacheOneAttributeValue(String name, String value, final Map<String, String> attributesValueMap) {
     name = name.toLowerCase();
     super.cacheOneAttributeValue(name, value, attributesValueMap);
   }
 
+  @Override
   public String getAttributeValue(String name, String namespace) {
     name = name.toLowerCase();
     return super.getAttributeValue(name, namespace);
   }
 
+  @Override
   @NotNull
   public String getNamespace() {
     final String xmlNamespace = super.getNamespace();
@@ -101,6 +107,7 @@
     return xmlNamespace;
   }
 
+  @Override
   protected String getRealNs(final String value) {
     if (XmlUtil.XHTML_URI.equals(value)) return XmlUtil.HTML_URI;
     return value;
@@ -110,6 +117,7 @@
     return "HtmlTag:" + getName();
   }
 
+  @Override
   public String getPrefixByNamespace(String namespace) {
     if (XmlUtil.HTML_URI.equals(namespace)) namespace = XmlUtil.XHTML_URI;
     return super.getPrefixByNamespace(namespace);
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/TemplateHtmlScriptContentProvider.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/TemplateHtmlScriptContentProvider.java
new file mode 100644
index 0000000..203ee7e
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/TemplateHtmlScriptContentProvider.java
@@ -0,0 +1,40 @@
+/*
+ * 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.psi.impl.source.html;
+
+import com.intellij.ide.highlighter.HtmlFileType;
+import com.intellij.lang.HtmlScriptContentProvider;
+import com.intellij.lexer.HtmlHighlightingLexer;
+import com.intellij.lexer.Lexer;
+import com.intellij.psi.tree.IElementType;
+import com.intellij.psi.xml.XmlElementType;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author Dennis.Ushakov
+ */
+public class TemplateHtmlScriptContentProvider implements HtmlScriptContentProvider {
+  @Override
+  public IElementType getScriptElementType() {
+    return XmlElementType.HTML_EMBEDDED_CONTENT;
+  }
+
+  @Nullable
+  @Override
+  public Lexer getHighlightingLexer() {
+    return new HtmlHighlightingLexer(HtmlFileType.INSTANCE);
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlAttributeDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlAttributeDescriptorImpl.java
index 7204bf7..eaa52b8 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlAttributeDescriptorImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlAttributeDescriptorImpl.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.
@@ -34,56 +34,69 @@
     myCaseSensitive = caseSensitive;
   }
 
+  @Override
   public boolean isRequired() {
     return delegate.isRequired();
   }
 
+  @Override
   public boolean isFixed() {
     return delegate.isFixed();
   }
 
+  @Override
   public boolean hasIdType() {
     return delegate.hasIdType();
   }
 
+  @Override
   public boolean hasIdRefType() {
     return delegate.hasIdRefType();
   }
 
+  @Override
   public String getDefaultValue() {
     return delegate.getDefaultValue();
   }
 
   //todo: refactor to hierarchy of value descriptor?
+  @Override
   public boolean isEnumerated() {
     return delegate.isEnumerated();
   }
 
+  @Override
   public String[] getEnumeratedValues() {
     return delegate.getEnumeratedValues();
   }
 
+  @Override
   public String validateValue(XmlElement context, String value) {
     if (!myCaseSensitive) value = value.toLowerCase();
     return delegate.validateValue(context, value);
   }
 
+  @Override
   public PsiElement getDeclaration() {
     return delegate.getDeclaration();
   }
 
+  @Override
   public String getName(PsiElement context) {
     return delegate.getName(context);
   }
 
+  @Override
   public String getName() {
     return delegate.getName();
   }
 
+  @Override
   public void init(PsiElement element) {
     delegate.init(element);
   }
 
+  @Override
   public Object[] getDependences() {
     return ArrayUtil.EMPTY_OBJECT_ARRAY;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlElementDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlElementDescriptorImpl.java
index bd9085a..aec4216 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlElementDescriptorImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlElementDescriptorImpl.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.
@@ -42,15 +42,18 @@
     myCaseSensitive = caseSensitive;
   }
 
+  @Override
   public String getQualifiedName() {
     return myDelegate.getQualifiedName();
   }
 
+  @Override
   public String getDefaultName() {
     return myDelegate.getDefaultName();
   }
 
   // Read-only calculation
+  @Override
   protected final XmlElementDescriptor[] doCollectXmlDescriptors(final XmlTag context) {
     XmlElementDescriptor[] elementsDescriptors = myDelegate.getElementsDescriptors(context);
     XmlElementDescriptor[] temp = new XmlElementDescriptor[elementsDescriptors.length];
@@ -61,6 +64,7 @@
     return temp;
   }
 
+  @Override
   public XmlElementDescriptor getElementDescriptor(XmlTag element, XmlTag contextTag) {
     String name = element.getName();
     if (!myCaseSensitive) name = name.toLowerCase();
@@ -74,6 +78,7 @@
   }
 
   // Read-only calculation
+  @Override
   protected HashMap<String, XmlElementDescriptor> collectElementDescriptorsMap(final XmlTag element) {
     final HashMap<String, XmlElementDescriptor> hashMap = new HashMap<String, XmlElementDescriptor>();
     final XmlElementDescriptor[] elementDescriptors = myDelegate.getElementsDescriptors(element);
@@ -85,6 +90,7 @@
   }
 
   // Read-only calculation
+  @Override
   protected XmlAttributeDescriptor[] collectAttributeDescriptors(final XmlTag context) {
     final XmlAttributeDescriptor[] attributesDescriptors = myDelegate.getAttributesDescriptors(context);
     XmlAttributeDescriptor[] temp = new XmlAttributeDescriptor[attributesDescriptors.length];
@@ -95,6 +101,7 @@
     return temp;
   }
 
+  @Override
   public XmlAttributeDescriptor getAttributeDescriptor(String attributeName, final XmlTag context) {
     String caseSensitiveAttributeName =  !myCaseSensitive ? attributeName.toLowerCase() : attributeName;
     XmlAttributeDescriptor descriptor = super.getAttributeDescriptor(caseSensitiveAttributeName, context);
@@ -118,6 +125,7 @@
   }
 
   // Read-only calculation
+  @Override
   protected HashMap<String, XmlAttributeDescriptor> collectAttributeDescriptorsMap(final XmlTag context) {
     final HashMap<String, XmlAttributeDescriptor> hashMap = new HashMap<String, XmlAttributeDescriptor>();
     XmlAttributeDescriptor[] elementAttributeDescriptors = myDelegate.getAttributesDescriptors(context);
@@ -131,34 +139,42 @@
     return hashMap;
   }
 
+  @Override
   public XmlNSDescriptor getNSDescriptor() {
     return myDelegate.getNSDescriptor();
   }
 
+  @Override
   public int getContentType() {
     return myDelegate.getContentType();
   }
 
+  @Override
   public PsiElement getDeclaration() {
     return myDelegate.getDeclaration();
   }
 
+  @Override
   public String getName(PsiElement context) {
     return myDelegate.getName(context);
   }
 
+  @Override
   public String getName() {
     return myDelegate.getName();
   }
 
+  @Override
   public void init(PsiElement element) {
     myDelegate.init(element);
   }
 
+  @Override
   public Object[] getDependences() {
     return myDelegate.getDependences();
   }
 
+  @Override
   public XmlAttributeDescriptor[] getAttributesDescriptors(final XmlTag context) {
     return RelaxedHtmlFromSchemaElementDescriptor.addAttrDescriptorsForFacelets(context, super.getAttributesDescriptors(context));
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlNSDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlNSDescriptorImpl.java
index 368efbf..daf7de4 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlNSDescriptorImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlNSDescriptorImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -41,14 +41,17 @@
   private final boolean myCaseSensitive;
 
   private static final SimpleFieldCache<Map<String, XmlElementDescriptor>, HtmlNSDescriptorImpl> myCachedDeclsCache = new SimpleFieldCache<Map<String, XmlElementDescriptor>, HtmlNSDescriptorImpl>() {
+    @Override
     protected Map<String, XmlElementDescriptor> compute(final HtmlNSDescriptorImpl htmlNSDescriptor) {
       return htmlNSDescriptor.doBuildCachedMap();
     }
 
+    @Override
     protected Map<String, XmlElementDescriptor> getValue(final HtmlNSDescriptorImpl htmlNSDescriptor) {
       return htmlNSDescriptor.myCachedDecls;
     }
 
+    @Override
     protected void putValue(final Map<String, XmlElementDescriptor> map, final HtmlNSDescriptorImpl htmlNSDescriptor) {
       htmlNSDescriptor.myCachedDecls = map;
     }
@@ -84,6 +87,7 @@
     return decls;
   }
 
+  @Override
   public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) {
     String name = tag.getLocalName();
     if (!myCaseSensitive) name = name.toLowerCase();
@@ -95,36 +99,44 @@
     return xmlElementDescriptor;
   }
 
+  @Override
   @NotNull
   public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable final XmlDocument document) {
     return myDelegate == null ? XmlElementDescriptor.EMPTY_ARRAY : myDelegate.getRootElementsDescriptors(document);
   }
 
+  @Override
   @Nullable
   public XmlFile getDescriptorFile() {
     return myDelegate == null ? null : myDelegate.getDescriptorFile();
   }
 
+  @Override
   public boolean isHierarhyEnabled() {
     return false;
   }
 
+  @Override
   public PsiElement getDeclaration() {
     return myDelegate == null ? null : myDelegate.getDeclaration();
   }
 
+  @Override
   public String getName(PsiElement context) {
     return myDelegate == null ? "" : myDelegate.getName(context);
   }
 
+  @Override
   public String getName() {
     return myDelegate == null ? "" : myDelegate.getName();
   }
 
+  @Override
   public void init(PsiElement element) {
     myDelegate.init(element);
   }
 
+  @Override
   public Object[] getDependences() {
     return myDelegate == null ? null : myDelegate.getDependences();
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/HtmlBuilderDriver.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/HtmlBuilderDriver.java
index 571b1e4..8be807e 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/HtmlBuilderDriver.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/HtmlBuilderDriver.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.
@@ -31,6 +31,7 @@
     super(text);
   }
 
+  @Override
   protected PsiBuilder createBuilderAndParse() {
     final ParserDefinition htmlParserDef = LanguageParserDefinitions.INSTANCE.forLanguage(HTMLLanguage.INSTANCE);
     assert htmlParserDef != null;
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/XmlParser.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/XmlParser.java
index 8c5889d..b0edbda 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/XmlParser.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/XmlParser.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.
@@ -59,6 +59,7 @@
       }
     };
 
+  @Override
   @NotNull
   public ASTNode parse(final IElementType root, final PsiBuilder builder) {
     builder.enforceCommentTokens(TokenSet.EMPTY);
diff --git a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlAttributeManipulator.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlAttributeManipulator.java
similarity index 100%
rename from xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlAttributeManipulator.java
rename to xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlAttributeManipulator.java
diff --git a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlAttributeValueManipulator.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlAttributeValueManipulator.java
similarity index 100%
rename from xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlAttributeValueManipulator.java
rename to xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlAttributeValueManipulator.java
diff --git a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlProcessingInstructionManipulator.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlProcessingInstructionManipulator.java
similarity index 100%
rename from xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlProcessingInstructionManipulator.java
rename to xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlProcessingInstructionManipulator.java
diff --git a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlTagManipulator.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlTagManipulator.java
similarity index 100%
rename from xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlTagManipulator.java
rename to xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlTagManipulator.java
diff --git a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlTextManipulator.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlTextManipulator.java
similarity index 100%
rename from xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlTextManipulator.java
rename to xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlTextManipulator.java
diff --git a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlTokenManipulator.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlTokenManipulator.java
similarity index 100%
rename from xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlTokenManipulator.java
rename to xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/XmlTokenManipulator.java
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/BasicAttributeValueReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/BasicAttributeValueReference.java
index 6cd7479..efaf54a 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/BasicAttributeValueReference.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/BasicAttributeValueReference.java
@@ -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.
@@ -26,8 +26,8 @@
  * @author peter
 */
 public abstract class BasicAttributeValueReference implements PsiReference {
-  protected PsiElement myElement;
-  protected TextRange myRange;
+  protected final PsiElement myElement;
+  protected final TextRange myRange;
 
   public BasicAttributeValueReference(final PsiElement element) {
     this ( element, ElementManipulators.getValueTextRange(element));
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/DependentNSReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/DependentNSReference.java
new file mode 100644
index 0000000..944ca40
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/DependentNSReference.java
@@ -0,0 +1,66 @@
+/*
+ * 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.psi.impl.source.resolve.reference.impl.providers;
+
+import com.intellij.javaee.ExternalResourceManager;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.util.ArrayUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public class DependentNSReference extends BasicAttributeValueReference {
+  private final URLReference myReference;
+  private final boolean myForceFetchResultValid;
+
+  public DependentNSReference(final PsiElement element, TextRange range, URLReference ref) {
+    this(element, range, ref, false);
+  }
+
+  public DependentNSReference(final PsiElement element,
+                              TextRange range,
+                              URLReference ref,
+                              boolean valid) {
+    super(element, range);
+    myReference = ref;
+    myForceFetchResultValid = valid;
+  }
+
+  @Override
+  @Nullable
+  public PsiElement resolve() {
+    final String canonicalText = getCanonicalText();
+    final PsiFile file = ExternalResourceManager.getInstance().getResourceLocation(canonicalText, myElement.getContainingFile(), null);
+    if (file != null) return file;
+    return myReference.resolve();
+  }
+
+  @Override
+  @NotNull
+  public Object[] getVariants() {
+    return ArrayUtil.EMPTY_OBJECT_ARRAY;
+  }
+
+  @Override
+  public boolean isSoft() {
+    return false;
+  }
+
+  public boolean isForceFetchResultValid() {
+    return myForceFetchResultValid;
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferencesProvider.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferencesProvider.java
index 450ae10..97613a6 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferencesProvider.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferencesProvider.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -72,6 +72,7 @@
     private static final Pattern pattern = Pattern.compile("^(?:\\\\i|\\\\l)");
     private static final Pattern pattern2 = Pattern.compile("([^\\\\])(?:\\\\i|\\\\l)");
 
+    @Override
     @Nullable
     public PsiElement resolve() {
       try {
@@ -90,15 +91,18 @@
       }
     }
 
+    @Override
     @NotNull
     public Object[] getVariants() {
       return ArrayUtil.EMPTY_OBJECT_ARRAY;
     }
 
+    @Override
     public boolean isSoft() {
       return false;
     }
 
+    @Override
     @NotNull
     public String getUnresolvedMessagePattern() {
       return message;
@@ -112,25 +116,30 @@
       myElement = element;
     }
 
+    @Override
     public PsiElement getElement() {
       return myElement;
     }
 
+    @Override
     public TextRange getRangeInElement() {
       return ElementManipulators.getValueTextRange(myElement);
     }
 
+    @Override
     @Nullable
     public PsiElement resolve() {
       return myElement.getParent().getParent();
     }
 
+    @Override
     @NotNull
     public String getCanonicalText() {
       String text = myElement.getText();
       return text.substring(1,text.length()- 1);
     }
 
+    @Override
     public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
       return ElementManipulators.getManipulator(myElement).handleContentChange(
         myElement,
@@ -139,24 +148,29 @@
       );
     }
 
+    @Override
     public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
       return null;
     }
 
+    @Override
     public boolean isReferenceTo(PsiElement element) {
       return myElement.getManager().areElementsEquivalent(resolve(), element);
     }
 
+    @Override
     @NotNull
     public Object[] getVariants() {
       return ArrayUtil.EMPTY_OBJECT_ARRAY;
     }
 
+    @Override
     public boolean isSoft() {
       return true;
     }
   }
 
+  @Override
   @NotNull
   public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull final ProcessingContext context) {
     final PsiElement parent = element.getParent();
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/TypeOrElementOrAttributeReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/TypeOrElementOrAttributeReference.java
index df4b38a..47a77fe 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/TypeOrElementOrAttributeReference.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/TypeOrElementOrAttributeReference.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -108,14 +108,17 @@
     return null;
   }
 
+  @Override
   public PsiElement getElement() {
     return myElement;
   }
 
+  @Override
   public TextRange getRangeInElement() {
     return myRange;
   }
 
+  @Override
   @Nullable
   public PsiElement resolve() {
     final PsiElement psiElement = ResolveCache
@@ -216,6 +219,7 @@
       URLReference.processWsdlSchemas(
         document.getRootTag(),
         new Processor<XmlTag>() {
+          @Override
           public boolean process(final XmlTag xmlTag) {
             if (namespace.equals(xmlTag.getAttributeValue(TARGET_NAMESPACE))) {
               descrs[0] = (XmlNSDescriptor)xmlTag.getMetaData();
@@ -255,6 +259,7 @@
     return namespaceByPrefix;
   }
 
+  @Override
   @NotNull
   public String getCanonicalText() {
     final String text = myElement.getText();
@@ -265,6 +270,7 @@
     return name;
   }
 
+  @Override
   public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
     final String canonicalText = getCanonicalText();
 
@@ -274,14 +280,17 @@
     return element;
   }
 
+  @Override
   public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
     throw new IncorrectOperationException();
   }
 
+  @Override
   public boolean isReferenceTo(PsiElement element) {
     return myElement.getManager().areElementsEquivalent(resolve(), element);
   }
 
+  @Override
   @NotNull
   public Object[] getVariants() {
     final XmlTag tag = PsiTreeUtil.getContextOfType(myElement, XmlTag.class, true);
@@ -356,19 +365,21 @@
     );
   }
 
+  @Override
   public boolean isSoft() {
     return false;
   }
 
   private static class MyResolver implements ResolveCache.Resolver {
-    static MyResolver INSTANCE = new MyResolver();
+    static final MyResolver INSTANCE = new MyResolver();
+    @Override
     public PsiElement resolve(@NotNull PsiReference ref, boolean incompleteCode) {
       return ((TypeOrElementOrAttributeReference)ref).resolveInner();
     }
   }
 
   private static class CompletionProcessor implements PsiElementProcessor<XmlTag> {
-    List<String> myElements = new ArrayList<String>(1);
+    final List<String> myElements = new ArrayList<String>(1);
     String namespace;
     final XmlTag tag;
     private final String prefix;
@@ -378,6 +389,7 @@
       this.prefix = prefix;
     }
 
+    @Override
     public boolean execute(@NotNull final XmlTag element) {
       String name = element.getAttributeValue(SchemaReferencesProvider.NAME_ATTR_NAME);
       final String prefixByNamespace = tag.getPrefixByNamespace(namespace);
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/URIReferenceProvider.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/URIReferenceProvider.java
new file mode 100644
index 0000000..249edad
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/URIReferenceProvider.java
@@ -0,0 +1,113 @@
+/*
+ * 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.psi.impl.source.resolve.reference.impl.providers;
+
+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.psi.PsiReferenceProvider;
+import com.intellij.psi.filters.ElementFilter;
+import com.intellij.psi.xml.XmlAttribute;
+import com.intellij.util.ProcessingContext;
+import com.intellij.util.containers.ContainerUtil;
+import com.intellij.xml.util.XmlUtil;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+/**
+ * @by Maxim.Mossienko
+ */
+public class URIReferenceProvider extends PsiReferenceProvider {
+
+  public static final ElementFilter ELEMENT_FILTER = new ElementFilter() {
+    @Override
+    public boolean isAcceptable(Object element, PsiElement context) {
+      final PsiElement parent = context.getParent();
+      if (parent instanceof XmlAttribute) {
+        final XmlAttribute attribute = ((XmlAttribute)parent);
+        return attribute.isNamespaceDeclaration();
+      }
+      return false;
+    }
+
+    @Override
+    public boolean isClassAcceptable(Class hintClass) {
+      return true;
+    }
+  };
+  @NonNls
+  private static final String NAMESPACE_ATTR_NAME = "namespace";
+
+  @Override
+  @NotNull
+  public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull final ProcessingContext context) {
+    final String text = element.getText();
+    String s = StringUtil.stripQuotesAroundValue(text);
+    final PsiElement parent = element.getParent();
+
+    if (parent instanceof XmlAttribute &&
+        XmlUtil.SCHEMA_LOCATION_ATT.equals(((XmlAttribute)parent).getLocalName()) &&
+        XmlUtil.XML_SCHEMA_INSTANCE_URI.equals(((XmlAttribute)parent).getNamespace())) {
+      final List<PsiReference> refs = new ArrayList<PsiReference>(2);
+      final StringTokenizer tokenizer = new StringTokenizer(s);
+
+      while(tokenizer.hasMoreElements()) {
+        final String namespace = tokenizer.nextToken();
+        int offset = text.indexOf(namespace);
+        final URLReference urlReference = new URLReference(element, new TextRange(offset, offset + namespace.length()), true);
+        refs.add(urlReference);
+        if (!tokenizer.hasMoreElements()) break;
+        String url = tokenizer.nextToken();
+
+        offset = text.indexOf(url);
+        if (XmlUtil.isUrlText(url, element.getProject())) refs.add(new DependentNSReference(element, new TextRange(offset,offset + url.length()), urlReference));
+        else {
+          ContainerUtil.addAll(refs, new FileReferenceSet(url, element, offset, this, false).getAllReferences());
+        }
+      }
+
+      return refs.toArray(new PsiReference[refs.size()]);
+    }
+
+
+    if (XmlUtil.isUrlText(s, element.getProject()) ||
+        (parent instanceof XmlAttribute &&
+          ( ((XmlAttribute)parent).isNamespaceDeclaration() ||
+            NAMESPACE_ATTR_NAME.equals(((XmlAttribute)parent).getName())
+          )
+         )
+      ) {
+      if (!s.startsWith(XmlUtil.TAG_DIR_NS_PREFIX)) {
+        boolean namespaceSoftRef = parent instanceof XmlAttribute &&
+          NAMESPACE_ATTR_NAME.equals(((XmlAttribute)parent).getName()) &&
+          ((XmlAttribute)parent).getParent().getAttributeValue("schemaLocation") != null;
+        if (!namespaceSoftRef && parent instanceof XmlAttribute && ((XmlAttribute)parent).isNamespaceDeclaration()) {
+          namespaceSoftRef = parent.getContainingFile().getContext() != null;
+        }
+        return new URLReference[] { new URLReference(element, null, namespaceSoftRef)};
+      }
+    }
+
+    s = s.substring(XmlUtil.getPrefixLength(s));
+    return new FileReferenceSet(s,element,text.indexOf(s), this,true).getAllReferences();
+  }
+
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/URLReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/URLReference.java
index 557e8e0..3ae8bc8 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/URLReference.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/URLReference.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -64,14 +64,17 @@
     mySoft = soft;
   }
 
+  @Override
   public PsiElement getElement() {
     return myElement;
   }
 
+  @Override
   public TextRange getRangeInElement() {
     return myRange != null ? myRange : ElementManipulators.getValueTextRange(myElement);
   }
 
+  @Override
   @Nullable
   public PsiElement resolve() {
     myIncorrectResourceMapped = false;
@@ -134,6 +137,7 @@
 
       final PsiElement[] result = new PsiElement[1];
       processWsdlSchemas(rootTag,new Processor<XmlTag>() {
+        @Override
         public boolean process(final XmlTag t) {
           if (canonicalText.equals(t.getAttributeValue(TARGET_NAMESPACE_ATTR_NAME))) {
             result[0] = t;
@@ -156,6 +160,7 @@
     return null;
   }
 
+  @Override
   @NotNull
   public String getCanonicalText() {
     final String text = myElement.getText();
@@ -166,6 +171,7 @@
     return "";
   }
 
+  @Override
   public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
     final TextRange textRangeInElement = getRangeInElement();
     final PsiElement elementToChange = myElement.findElementAt(textRangeInElement.getStartOffset());
@@ -178,6 +184,7 @@
     return myElement;
   }
 
+  @Override
   public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
     assert element instanceof PsiFile;
 
@@ -190,10 +197,12 @@
     return myElement;
   }
 
+  @Override
   public boolean isReferenceTo(PsiElement element) {
     return myElement.getManager().areElementsEquivalent(resolve(),element);
   }
 
+  @Override
   @NotNull
   public Object[] getVariants() {
     final XmlFile file = (XmlFile)myElement.getContainingFile();
@@ -212,6 +221,7 @@
     XmlTag rootTag = document.getRootTag();
     final ArrayList<String> additionalNs = new ArrayList<String>();
     if (rootTag != null) processWsdlSchemas(rootTag, new Processor<XmlTag>() {
+      @Override
       public boolean process(final XmlTag xmlTag) {
         final String s = xmlTag.getAttributeValue(TARGET_NAMESPACE_ATTR_NAME);
         if (s != null) { additionalNs.add(s); }
@@ -222,10 +232,12 @@
     return resourceUrls;
   }
 
+  @Override
   public boolean isSoft() {
     return mySoft;
   }
 
+  @Override
   @NotNull
   public String getUnresolvedMessagePattern() {
     return XmlErrorMessages.message(myIncorrectResourceMapped ? "registered.resource.is.not.recognized":"uri.is.not.registered");
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/XmlValueReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/XmlValueReference.java
new file mode 100644
index 0000000..ba1e689
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/XmlValueReference.java
@@ -0,0 +1,70 @@
+/*
+ * 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.psi.impl.source.resolve.reference.impl.providers;
+
+import com.intellij.psi.PsiReference;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.ElementManipulators;
+import com.intellij.psi.ElementManipulator;
+import com.intellij.psi.xml.XmlTag;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Dmitry Avdeev
+*/
+public abstract class XmlValueReference implements PsiReference {
+  protected final XmlTag myTag;
+  protected TextRange myRange;
+
+  protected XmlValueReference(XmlTag tag) {
+    myTag = tag;
+    myRange = ElementManipulators.getValueTextRange(tag);
+  }
+
+  @Override
+  public PsiElement getElement() {
+    return myTag;
+  }
+
+  @Override
+  public TextRange getRangeInElement() {
+    return myRange;
+  }
+
+  @Override
+  @NotNull
+  public String getCanonicalText() {
+    return myRange.substring(myTag.getText());
+  }
+
+  protected void replaceContent(final String str) throws IncorrectOperationException {
+    final ElementManipulator<XmlTag> manipulator = ElementManipulators.getManipulator(myTag);
+    manipulator.handleContentChange(myTag, myRange, str);
+    myRange = manipulator.getRangeInElement(myTag);
+  }
+
+  @Override
+  public boolean isReferenceTo(PsiElement element) {
+    return myTag.getManager().areElementsEquivalent(element, resolve());
+  }
+
+  @Override
+  public boolean isSoft() {
+    return false;
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/HtmlFileElement.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/HtmlFileElement.java
index e1d0624..3ff9ed8 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/HtmlFileElement.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/HtmlFileElement.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.
@@ -28,6 +28,7 @@
     super(HTML_FILE, text);
   }
 
+  @Override
   public int getChildRole(ASTNode child) {
     LOG.assertTrue(child.getTreeParent() == this);
     if (child.getElementType() == HTML_DOCUMENT) {
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/XmlFileElement.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/XmlFileElement.java
index db3128d..1296afa 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/XmlFileElement.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/XmlFileElement.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.
@@ -33,6 +33,7 @@
     super(type, text);
   }
 
+  @Override
   public int getChildRole(ASTNode child) {
     LOG.assertTrue(child.getTreeParent() == this);
     if (child.getElementType() == XML_DOCUMENT ||
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlAttributeLiteralEscaper.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlAttributeLiteralEscaper.java
index 2160661..a4e0ce1 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlAttributeLiteralEscaper.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlAttributeLiteralEscaper.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.
@@ -33,6 +33,7 @@
     myXmlAttribute = (XmlAttribute)host.getParent();
   }
 
+  @Override
   public boolean decode(@NotNull final TextRange rangeInsideHost, @NotNull StringBuilder outChars) {
     ProperTextRange.assertProperRange(rangeInsideHost);
     TextRange valueTextRange = myXmlAttribute.getValueTextRange();
@@ -47,6 +48,7 @@
     return true;
   }
 
+  @Override
   public int getOffsetInHost(final int offsetInDecoded, @NotNull final TextRange rangeInsideHost) {
     TextRange valueTextRange = myXmlAttribute.getValueTextRange();
     int displayStart = myXmlAttribute.physicalToDisplay(rangeInsideHost.getStartOffset());
@@ -56,6 +58,7 @@
     return dp + valueTextRange.getStartOffset();
   }
 
+  @Override
   public boolean isOneLine() {
     return true;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlCommentLiteralEscaper.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlCommentLiteralEscaper.java
index 8426623..01b1158 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlCommentLiteralEscaper.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlCommentLiteralEscaper.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.
@@ -32,12 +32,14 @@
     super(host);
   }
 
+  @Override
   public boolean decode(@NotNull final TextRange rangeInsideHost, @NotNull final StringBuilder outChars) {
     ProperTextRange.assertProperRange(rangeInsideHost);
     outChars.append(myHost.getText(), rangeInsideHost.getStartOffset(), rangeInsideHost.getEndOffset());
     return true;
   }
 
+  @Override
   public int getOffsetInHost(final int offsetInDecoded, @NotNull final TextRange rangeInsideHost) {
     int offset = offsetInDecoded + rangeInsideHost.getStartOffset();
     if (offset < rangeInsideHost.getStartOffset()) offset = rangeInsideHost.getStartOffset();
@@ -45,6 +47,7 @@
     return offset;
   }
 
+  @Override
   public boolean isOneLine() {
     final Commenter commenter = LanguageCommenters.INSTANCE.forLanguage(myHost.getLanguage());
     if (commenter instanceof CodeDocumentationAwareCommenter) {
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlTextLiteralEscaper.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlTextLiteralEscaper.java
index ca61547..92a6b1f 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlTextLiteralEscaper.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlTextLiteralEscaper.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.
@@ -29,6 +29,7 @@
     super(xmlText);
   }
 
+  @Override
   public boolean decode(@NotNull final TextRange rangeInsideHost, @NotNull StringBuilder outChars) {
     ProperTextRange.assertProperRange(rangeInsideHost);
     int startInDecoded = myHost.physicalToDisplay(rangeInsideHost.getStartOffset());
@@ -37,6 +38,7 @@
     return true;
   }
 
+  @Override
   public int getOffsetInHost(final int offsetInDecoded, @NotNull final TextRange rangeInsideHost) {
     final int rangeInsideHostStartOffset = rangeInsideHost.getStartOffset();
     int displayStart = myHost.physicalToDisplay(rangeInsideHostStartOffset);
@@ -48,11 +50,13 @@
     return i;
   }
 
+  @Override
   @NotNull
   public TextRange getRelevantTextRange() {
     return myHost.getCDATAInterior();
   }
 
+  @Override
   public boolean isOneLine() {
     return false;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/LanguageXmlPsiPolicy.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/LanguageXmlPsiPolicy.java
index a67b460..2dfa64e 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/LanguageXmlPsiPolicy.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/LanguageXmlPsiPolicy.java
@@ -1,3 +1,18 @@
+/*
+ * 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.psi.impl.source.xml;
 
 import com.intellij.lang.LanguageExtension;
@@ -7,7 +22,7 @@
  * @author yole
  */
 public class LanguageXmlPsiPolicy extends LanguageExtension<XmlPsiPolicy> {
-  public static LanguageXmlPsiPolicy INSTANCE = new LanguageXmlPsiPolicy();
+  public static final LanguageXmlPsiPolicy INSTANCE = new LanguageXmlPsiPolicy();
 
   private LanguageXmlPsiPolicy() {
     super("com.intellij.xml.psiPolicy", new CDATAOnAnyEncodedPolicy());
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/SchemaPrefix.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/SchemaPrefix.java
index 5fbc795..a0e2725 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/SchemaPrefix.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/SchemaPrefix.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.
@@ -52,10 +52,12 @@
     };
   }
 
+  @Override
   public String getTypeName() {
     return "XML Namespace Prefix";
   }
 
+  @Override
   public Icon getIcon() {
     return PlatformIcons.VARIABLE_ICON;
   }
@@ -75,6 +77,7 @@
     return myName;
   }
 
+  @Override
   public XmlAttribute getDeclaration() {
     return (XmlAttribute)getParent();
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/SchemaPrefixReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/SchemaPrefixReference.java
index 4d4c3aa..64b9232 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/SchemaPrefixReference.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/SchemaPrefixReference.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.
@@ -67,10 +67,12 @@
     return myName;
   }
 
+  @Override
   public SchemaPrefix resolve() {
     return myPrefix == null ? resolvePrefix(myElement, myName) : myPrefix;
   }
 
+  @Override
   @NotNull
   public Object[] getVariants() {
     return ArrayUtil.EMPTY_OBJECT_ARRAY;
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/TagNameReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/TagNameReference.java
index 814b068..26fcc99 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/TagNameReference.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/TagNameReference.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -45,6 +45,7 @@
     myNameElement = nameElement;
   }
 
+  @Override
   public PsiElement getElement() {
     PsiElement element = myNameElement.getPsi();
     final PsiElement parent = element.getParent();
@@ -58,6 +59,7 @@
     return (XmlTag)element;
   }
 
+  @Override
   public TextRange getRangeInElement() {
     final ASTNode nameElement = getNameElement();
     if (nameElement == null){
@@ -89,6 +91,7 @@
     return myNameElement;
   }
 
+  @Override
   public PsiElement resolve() {
     final XmlTag tag = getTagElement();
     final XmlElementDescriptor descriptor = tag != null ? tag.getDescriptor():null;
@@ -104,11 +107,13 @@
     return null;
   }
 
+  @Override
   @NotNull
   public String getCanonicalText() {
     return getNameElement().getText();
   }
 
+  @Override
   @Nullable
   public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
     final XmlTag element = getTagElement();
@@ -136,6 +141,7 @@
     return newElementName;
   }
 
+  @Override
   public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
     PsiMetaData metaData = null;
 
@@ -162,15 +168,18 @@
     throw new IncorrectOperationException("Cant bind to not a xml element definition!"+element+","+metaData + "," + tag + "," + (tag != null ? tag.getDescriptor() : "unknown descriptor"));
   }
 
+  @Override
   public boolean isReferenceTo(PsiElement element) {
     return getElement().getManager().areElementsEquivalent(element, resolve());
   }
 
+  @Override
   @NotNull
   public Object[] getVariants(){
     return ArrayUtil.EMPTY_OBJECT_ARRAY;
   }
 
+  @Override
   public boolean isSoft() {
     return false;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttlistDeclImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttlistDeclImpl.java
index d65ea69..c53037c 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttlistDeclImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttlistDeclImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -39,6 +39,7 @@
     super(XmlElementType.XML_ATTLIST_DECL);
   }
 
+  @Override
   public int getChildRole(ASTNode child) {
     LOG.assertTrue(child.getTreeParent() == this);
     if (child.getElementType() == XmlTokenType.XML_NAME) {
@@ -49,13 +50,16 @@
     }
   }
 
+  @Override
   public XmlElement getNameElement() {
     return (XmlElement)findChildByRoleAsPsiElement(XmlChildRole.XML_NAME);
   }
 
+  @Override
   public XmlAttributeDecl[] getAttributeDecls() {
     final List<XmlAttributeDecl> result = new ArrayList<XmlAttributeDecl>();
     processElements(new FilterElementProcessor(new ClassFilter(XmlAttributeDecl.class), result) {
+      @Override
       public boolean execute(@NotNull final PsiElement element) {
         if (element instanceof XmlAttributeDecl) {
           if (element.getNextSibling() == null && element.getChildren().length == 1) {
@@ -69,11 +73,13 @@
     return result.toArray(new XmlAttributeDecl[result.size()]);
   }
 
+  @Override
   @NotNull
   public PsiReference[] getReferences() {
     return ReferenceProvidersRegistry.getReferencesFromProviders(this,XmlAttlistDecl.class);
   }
 
+  @Override
   public String getName() {
     XmlElement xmlElement = getNameElement();
     if (xmlElement != null) return xmlElement.getText();
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeDeclImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeDeclImpl.java
index 1d06081..f09b689 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeDeclImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeDeclImpl.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.
@@ -45,6 +45,7 @@
     super(XML_ATTRIBUTE_DECL);
   }
 
+  @Override
   public int getChildRole(ASTNode child) {
     LOG.assertTrue(child.getTreeParent() == this);
     IElementType i = child.getElementType();
@@ -71,26 +72,32 @@
     }
   }
 
+  @Override
   public XmlElement getNameElement() {
     return findElementByTokenType(XML_NAME);
   }
 
+  @Override
   public boolean isAttributeRequired() {
     return findElementByTokenType(XML_ATT_REQUIRED) != null;
   }
 
+  @Override
   public boolean isAttributeFixed() {
     return findElementByTokenType(XML_ATT_FIXED) != null;
   }
 
+  @Override
   public boolean isAttributeImplied() {
     return findElementByTokenType(XML_ATT_IMPLIED) != null;
   }
 
+  @Override
   public XmlAttributeValue getDefaultValue() {
     return (XmlAttributeValue)findElementByTokenType(XML_ATTRIBUTE_VALUE);
   }
 
+  @Override
   public String getDefaultValueText() {
     XmlAttributeValue value = getDefaultValue();
     if (value == null) return null;
@@ -99,6 +106,7 @@
 
     final StringBuilder builder = new StringBuilder();
     value.processElements(new PsiElementProcessor() {
+      @Override
       public boolean execute(@NotNull PsiElement element) {
         builder.append(element.getText());
         return true;
@@ -107,10 +115,12 @@
     return builder.toString();
   }
 
+  @Override
   public boolean isEnumerated() {
     return findElementByTokenType(XML_ENUMERATED_TYPE) != null;
   }
 
+  @Override
   public XmlElement[] getEnumeratedValues() {
     XmlEnumeratedType enumeratedType = (XmlEnumeratedType)findElementByTokenType(XML_ENUMERATED_TYPE);
     if (enumeratedType != null) {
@@ -121,6 +131,7 @@
     }
   }
 
+  @Override
   public boolean isIdAttribute() {
     final PsiElement elementType = findElementType();
 
@@ -135,32 +146,38 @@
     return elementType;
   }
 
+  @Override
   public boolean isIdRefAttribute() {
     final PsiElement elementType = findElementType();
 
     return elementType != null && elementType.getText().equals(IDREF_ATT);
   }
 
+  @Override
   public PsiMetaData getMetaData() {
     return MetaRegistry.getMeta(this);
   }
 
+  @Override
   public PsiElement setName(@NotNull String name) throws IncorrectOperationException {
     XmlElementChangeUtil.doNameReplacement(this, getNameElement(), name);
     return null;
   }
 
+  @Override
   public String getName() {
     XmlElement name = getNameElement();
     return (name != null) ? name.getText() : null;
   }
 
+  @Override
   public boolean canNavigate() {
     if (isPhysical()) return super.canNavigate();
     final PsiNamedElement psiNamedElement = XmlUtil.findRealNamedElement(this);
     return psiNamedElement != null && psiNamedElement != this && ((Navigatable)psiNamedElement).canNavigate();
   }
 
+  @Override
   public void navigate(final boolean requestFocus) {
     if (isPhysical()) {
       super.navigate(requestFocus);
@@ -181,6 +198,7 @@
     }
   }
 
+  @Override
   @NotNull
   public PsiElement getNavigationElement() {
     return this;
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeReference.java
index b3b29ce..44eec73 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeReference.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeReference.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -33,6 +33,7 @@
 
 public class XmlAttributeReference implements PsiReference {
   private final NullableLazyValue<XmlAttributeDescriptor> myDescriptor = new NullableLazyValue<XmlAttributeDescriptor>() {
+    @Override
     protected XmlAttributeDescriptor compute() {
       XmlTag parent = myAttribute.getParent();
       final XmlElementDescriptor descr = parent.getDescriptor();
@@ -48,10 +49,12 @@
     myAttribute = attribute;
   }
 
+  @Override
   public XmlAttribute getElement() {
     return myAttribute;
   }
 
+  @Override
   public TextRange getRangeInElement() {
     final int parentOffset = myAttribute.getNameElement().getStartOffsetInParent();
     int nsLen = myAttribute.getNamespacePrefix().length();
@@ -59,16 +62,19 @@
     return new TextRange(parentOffset + nsLen, parentOffset + myAttribute.getNameElement().getTextLength());
   }
 
+  @Override
   public PsiElement resolve() {
     final XmlAttributeDescriptor descriptor = getDescriptor();
     return descriptor != null ? descriptor.getDeclaration() : null;
   }
 
+  @Override
   @NotNull
   public String getCanonicalText() {
     return myAttribute.getName();
   }
 
+  @Override
   public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
     String newName = newElementName;
     if (getDescriptor() instanceof XmlAttributeDescriptorEx) {
@@ -82,6 +88,7 @@
     return myAttribute.setName(newName);
   }
 
+  @Override
   public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
     if (element instanceof PsiMetaOwner) {
       final PsiMetaOwner owner = (PsiMetaOwner)element;
@@ -92,15 +99,18 @@
     throw new IncorrectOperationException("Cant bind to not a xml element definition!");
   }
 
+  @Override
   public boolean isReferenceTo(PsiElement element) {
     return myAttribute.getManager().areElementsEquivalent(element, resolve());
   }
 
+  @Override
   @NotNull
   public Object[] getVariants() {
     return ArrayUtil.EMPTY_OBJECT_ARRAY;  // moved to XmlAttributeReferenceCompletionProvider
   }
 
+  @Override
   public boolean isSoft() {
     return getDescriptor() == null;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeValueImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeValueImpl.java
index 29e4dab..690ec23 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeValueImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeValueImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -50,6 +50,7 @@
     super(XmlElementType.XML_ATTRIBUTE_VALUE);
   }
 
+  @Override
   public void accept(@NotNull PsiElementVisitor visitor) {
     if (visitor instanceof XmlElementVisitor) {
       ((XmlElementVisitor)visitor).visitXmlAttributeValue(this);
@@ -59,6 +60,7 @@
     }
   }
 
+  @Override
   public String getValue() {
     // it is more correct way to strip quotes since injected xml may have quotes encoded
     String text = getText();
@@ -73,6 +75,7 @@
     return text;
   }
 
+  @Override
   public TextRange getValueTextRange() {
     final TextRange range = getTextRange();
     final String value = getValue();
@@ -84,11 +87,13 @@
     return new TextRange(start, end);
   }
 
+  @Override
   public void clearCaches() {
     super.clearCaches();
     myCachedReferences = null;
   }
 
+  @Override
   @NotNull
   public PsiReference[] getReferences() {
     PsiReference[] cachedReferences = myCachedReferences;
@@ -102,6 +107,7 @@
     return cachedReferences;
   }
 
+  @Override
   public PsiReference getReference() {
     final PsiReference[] refs = getReferences();
     if (refs.length > 0) return refs[0];
@@ -109,6 +115,7 @@
   }
 
 
+  @Override
   public int getTextOffset() {
     return getTextRange().getStartOffset() + 1;
   }
@@ -118,6 +125,7 @@
     return getParent() instanceof XmlAttributeImpl;
   }
 
+  @Override
   public PsiLanguageInjectionHost updateText(@NotNull String text) {
     try {
       final String quoteChar = getTextLength() > 0 ? getText().substring(0, 1) : "";
@@ -135,30 +143,37 @@
     return this;
   }
 
+  @Override
   @NotNull
   public LiteralTextEscaper<XmlAttributeValueImpl> createLiteralTextEscaper() {
     return new XmlAttributeLiteralEscaper(this);
   }
 
+  @Override
   public PsiMetaData getMetaData() {
     return this;
   }
 
+  @Override
   public PsiElement getDeclaration() {
     return this;
   }
 
+  @Override
   public String getName(final PsiElement context) {
     return getValue();
   }
 
+  @Override
   public String getName() {
     return getValue();
   }
 
+  @Override
   public void init(final PsiElement element) {
   }
 
+  @Override
   public Object[] getDependences() {
     return ArrayUtil.EMPTY_OBJECT_ARRAY;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlCommentImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlCommentImpl.java
index 9b3faa5..eb9f65b 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlCommentImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlCommentImpl.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.
@@ -35,10 +35,12 @@
     super(XML_COMMENT);
   }
 
+  @Override
   public IElementType getTokenType() {
     return XML_COMMENT;
   }
 
+  @Override
   public void accept(@NotNull PsiElementVisitor visitor) {
     if (visitor instanceof XmlElementVisitor) {
       ((XmlElementVisitor)visitor).visitXmlComment(this);
@@ -53,31 +55,37 @@
     return true;
   }
 
+  @Override
   public XmlTag getParentTag() {
     if(getParent() instanceof XmlTag) return (XmlTag)getParent();
     return null;
   }
 
+  @Override
   public XmlTagChild getNextSiblingInTag() {
     if(getParent() instanceof XmlTag) return (XmlTagChild)getNextSibling();
     return null;
   }
 
+  @Override
   public XmlTagChild getPrevSiblingInTag() {
     if(getParent() instanceof XmlTag) return (XmlTagChild)getPrevSibling();
     return null;
   }
 
+  @Override
   @NotNull
   public PsiReference[] getReferences() {
     return ReferenceProvidersRegistry.getReferencesFromProviders(this, XmlComment.class);
   }
 
+  @Override
   @Nullable
   public PsiMetaData getMetaData() {
     return MetaRegistry.getMetaBase(this);
   }
 
+  @Override
   public PsiLanguageInjectionHost updateText(@NotNull final String text) {
     final PsiFile psiFile = getContainingFile();
 
@@ -93,6 +101,7 @@
     return this;
   }
 
+  @Override
   @NotNull
   public LiteralTextEscaper<? extends PsiLanguageInjectionHost> createLiteralTextEscaper() {
     return new XmlCommentLiteralEscaper(this);
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlConditionalSectionImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlConditionalSectionImpl.java
index 26c0bec..976eb4f 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlConditionalSectionImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlConditionalSectionImpl.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.
@@ -31,6 +31,7 @@
     super(XmlElementType.XML_CONDITIONAL_SECTION);
   }
 
+  @Override
   public boolean isIncluded(PsiFile targetFile) {
     ASTNode child = findChildByType(XmlTokenType.XML_CONDITIONAL_SECTION_START);
 
@@ -72,6 +73,7 @@
     return false;
   }
 
+  @Override
   public PsiElement getBodyStart() {
     ASTNode child = findChildByType(XmlTokenType.XML_MARKUP_START);
     if (child != null) child = child.getTreeNext();
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDeclImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDeclImpl.java
index da165b6..2022c14 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDeclImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDeclImpl.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.
@@ -29,6 +29,7 @@
     super(XmlElementType.XML_DECL);
   }
 
+  @Override
   public void accept(@NotNull PsiElementVisitor visitor) {
     if (visitor instanceof XmlElementVisitor) {
       ((XmlElementVisitor)visitor).visitXmlDecl(this);
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDoctypeImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDoctypeImpl.java
index 14d0771..b2e5192 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDoctypeImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDoctypeImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -41,6 +41,7 @@
     super(XmlElementType.XML_DOCTYPE);
   }
 
+  @Override
   public void clearCaches() {
     final XmlDocument doc = getContainingDocument();
     if (doc != null) {
@@ -64,6 +65,7 @@
     return null;
   }
   
+  @Override
   public int getChildRole(ASTNode child) {
     LOG.assertTrue(child.getTreeParent() == this);
     IElementType i = child.getElementType();
@@ -81,6 +83,7 @@
     }
   }
 
+  @Override
   @Nullable
   public String getDtdUri() {
     final PsiElement dtdUrlElement = getDtdUrlElement();
@@ -119,6 +122,7 @@
     return false;
   }
 
+  @Override
   @Nullable
   public PsiElement getDtdUrlElement() {
     PsiElement docTypePublic = findChildByRoleAsPsiElement(XmlChildRole.XML_DOCTYPE_PUBLIC);
@@ -162,15 +166,18 @@
     return null;
   }
 
+  @Override
   public XmlElement getNameElement() {
     return (XmlElement)findChildByRoleAsPsiElement(XmlChildRole.XML_NAME);
   }
 
+  @Override
   @Nullable
   public String getPublicId() {
     return getSomeId(XmlChildRole.XML_DOCTYPE_PUBLIC);
   }
 
+  @Override
   public String getSystemId() {
     return getSomeId(XmlChildRole.XML_DOCTYPE_SYSTEM);
   }
@@ -195,6 +202,7 @@
     return null;
   }
 
+  @Override
   public void accept(@NotNull PsiElementVisitor visitor) {
     if (visitor instanceof XmlElementVisitor) {
       ((XmlElementVisitor)visitor).visitXmlDoctype(this);
@@ -204,6 +212,7 @@
     }
   }
 
+  @Override
   public XmlMarkupDecl getMarkupDecl() {
     for(PsiElement child = getFirstChild(); child != null; child = child.getNextSibling()){
       if (child instanceof XmlMarkupDecl){
@@ -214,6 +223,7 @@
     return null;
   }
 
+  @Override
   @NotNull
   public PsiReference[] getReferences() {
     final PsiElement dtdUrlElement = getDtdUrlElement();
@@ -230,15 +240,18 @@
 
   protected PsiReference createUrlReference(final PsiElement dtdUrlElement) {
     return new URLReference(XmlDoctypeImpl.this) {
+      @Override
       @NotNull
       public Object[] getVariants() {
         return findChildByRoleAsPsiElement(XmlChildRole.XML_DOCTYPE_PUBLIC) != null ?
                super.getVariants(): EMPTY_ARRAY;
       }
+      @Override
       @NotNull
       public String getCanonicalText() {
         return extractValue(dtdUrlElement);
       }
+      @Override
       public TextRange getRangeInElement() {
         return TextRange.from(dtdUrlElement.getTextRange().getStartOffset() - getTextRange().getStartOffset() + 1, Math.max(dtdUrlElement.getTextRange().getLength() - 2, 0));
       }
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDocumentImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDocumentImpl.java
index 29d2124..c86139c 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDocumentImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDocumentImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -82,6 +82,7 @@
     super(type);
   }
 
+  @Override
   public void accept(@NotNull PsiElementVisitor visitor) {
     if (visitor instanceof XmlElementVisitor) {
       ((XmlElementVisitor)visitor).visitXmlDocument(this);
@@ -91,6 +92,7 @@
     }
   }
 
+  @Override
   public int getChildRole(ASTNode child) {
     LOG.assertTrue(child.getTreeParent() == this);
     IElementType i = child.getElementType();
@@ -105,6 +107,7 @@
     }
   }
 
+  @Override
   public XmlProlog getProlog() {
     XmlProlog prolog = myProlog;
 
@@ -121,6 +124,7 @@
     return myProlog;
   }
 
+  @Override
   public XmlTag getRootTag() {
     XmlTag rootTag = myRootTag;
 
@@ -137,6 +141,7 @@
     return myRootTag;
   }
 
+  @Override
   @SuppressWarnings("ConstantConditions")
   public XmlNSDescriptor getRootTagNSDescriptor() {
     XmlTag rootTag = getRootTag();
@@ -146,6 +151,7 @@
   private ConcurrentHashMap<String, CachedValue<XmlNSDescriptor>> myDefaultDescriptorsCacheStrict = new ConcurrentHashMap<String, CachedValue<XmlNSDescriptor>>();
   private ConcurrentHashMap<String, CachedValue<XmlNSDescriptor>> myDefaultDescriptorsCacheNotStrict = new ConcurrentHashMap<String, CachedValue<XmlNSDescriptor>>();
 
+  @Override
   public void clearCaches() {
     myDefaultDescriptorsCacheStrict.clear();
     myDefaultDescriptorsCacheNotStrict.clear();
@@ -154,6 +160,7 @@
     super.clearCaches();
   }
 
+  @Override
   public XmlNSDescriptor getDefaultNSDescriptor(final String namespace, final boolean strict) {
     long curExtResourcesModCount = ExternalResourceManagerEx.getInstanceEx().getModificationCount(getProject());
     if (myExtResourcesModCount != curExtResourcesModCount) {
@@ -173,6 +180,7 @@
     CachedValue<XmlNSDescriptor> cachedValue = defaultDescriptorsCache.get(namespace);
     if (cachedValue == null) {
       defaultDescriptorsCache.put(namespace, cachedValue = new PsiCachedValueImpl<XmlNSDescriptor>(getManager(), new CachedValueProvider<XmlNSDescriptor>() {
+        @Override
         public Result<XmlNSDescriptor> compute() {
           final XmlNSDescriptor defaultNSDescriptorInner = getDefaultNSDescriptorInner(namespace, strict);
 
@@ -339,6 +347,7 @@
     return descriptor;
   }
 
+  @Override
   public CompositePsiElement clone() {
     HashMap<String, CachedValue<XmlNSDescriptor>> cacheStrict = new HashMap<String, CachedValue<XmlNSDescriptor>>(
       myDefaultDescriptorsCacheStrict
@@ -351,6 +360,7 @@
     return copy;
   }
 
+  @Override
   public PsiElement copy() {
     HashMap<String, CachedValue<XmlNSDescriptor>> cacheStrict = new HashMap<String, CachedValue<XmlNSDescriptor>>(
       myDefaultDescriptorsCacheStrict
@@ -383,6 +393,7 @@
     }
   }
 
+  @Override
   public PsiMetaData getMetaData() {
     return MetaRegistry.getMeta(this);
   }
@@ -418,12 +429,14 @@
     }
   }
 
+  @Override
   public TreeElement addInternal(final TreeElement first, final ASTNode last, final ASTNode anchor, final Boolean before) {
     final PomModel model = PomManager.getModel(getProject());
     final XmlAspect aspect = model.getModelAspect(XmlAspect.class);
     final TreeElement[] holder = new TreeElement[1];
     try{
       model.runTransaction(new PomTransactionBase(this, aspect) {
+        @Override
         public PomModelEvent runInner() {
           holder[0] = XmlDocumentImpl.super.addInternal(first, last, anchor, before);
           return XmlDocumentChangedImpl.createXmlDocumentChanged(model, XmlDocumentImpl.this);
@@ -434,11 +447,13 @@
     return holder[0];
   }
 
+  @Override
   public void deleteChildInternal(@NotNull final ASTNode child) {
     final PomModel model = PomManager.getModel(getProject());
     final XmlAspect aspect = model.getModelAspect(XmlAspect.class);
     try{
       model.runTransaction(new PomTransactionBase(this, aspect) {
+        @Override
         public PomModelEvent runInner() {
           XmlDocumentImpl.super.deleteChildInternal(child);
           return XmlDocumentChangedImpl.createXmlDocumentChanged(model, XmlDocumentImpl.this);
@@ -448,11 +463,13 @@
     catch(IncorrectOperationException ignored){}
   }
 
+  @Override
   public void replaceChildInternal(@NotNull final ASTNode child, @NotNull final TreeElement newElement) {
     final PomModel model = PomManager.getModel(getProject());
     final XmlAspect aspect = model.getModelAspect(XmlAspect.class);
     try{
       model.runTransaction(new PomTransactionBase(this, aspect) {
+        @Override
         public PomModelEvent runInner() {
           XmlDocumentImpl.super.replaceChildInternal(child, newElement);
           return XmlDocumentChangedImpl.createXmlDocumentChanged(model, XmlDocumentImpl.this);
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementContentSpecImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementContentSpecImpl.java
index c060c43..6b041ac 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementContentSpecImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementContentSpecImpl.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.
@@ -39,6 +39,7 @@
     super(XML_ELEMENT_CONTENT_SPEC);
   }
 
+  @Override
   public int getChildRole(ASTNode child) {
     LOG.assertTrue(child.getTreeParent() == this);
     IElementType i = child.getElementType();
@@ -56,19 +57,23 @@
     }
   }
 
+  @Override
   public boolean isEmpty() {
     return findElementByTokenType(XML_CONTENT_EMPTY) != null;
   }
 
+  @Override
   public boolean isAny() {
     return findElementByTokenType(XML_CONTENT_ANY) != null;
   }
 
+  @Override
   public boolean isMixed() {
     XmlElementContentGroup topGroup = getTopGroup();
     return topGroup != null && ((XmlElementImpl)topGroup).findElementByTokenType(XML_PCDATA) != null;
   }
 
+  @Override
   public boolean hasChildren() {
     return !(isEmpty() || isAny() || isMixed());
   }
@@ -78,11 +83,13 @@
     return (XmlElementContentGroup)findElementByTokenType(XML_ELEMENT_CONTENT_GROUP);
   }
 
+  @Override
   @NotNull
   public PsiReference[] getReferences() {
     return ReferenceProvidersRegistry.getReferencesFromProviders(this,XmlElementContentSpec.class);
   }
 
+  @Override
   public void accept(@NotNull final PsiElementVisitor visitor) {
     if (visitor instanceof XmlElementVisitor) {
       ((XmlElementVisitor)visitor).visitXmlElement(this);
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementDeclImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementDeclImpl.java
index c45e649..39e9d62 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementDeclImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementDeclImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -41,6 +41,7 @@
     super(XML_ELEMENT_DECL);
   }
 
+  @Override
   public int getChildRole(ASTNode child) {
     LOG.assertTrue(child.getTreeParent() == this);
     IElementType i = child.getElementType();
@@ -55,34 +56,41 @@
     }
   }
 
+  @Override
   public int getTextOffset() {
     final XmlElement name = getNameElement();
     return name != null ? name.getTextOffset() : super.getTextOffset();
   }
 
+  @Override
   public XmlElement getNameElement() {
     return (XmlElement)findChildByRoleAsPsiElement(XmlChildRole.XML_NAME);
   }
 
+  @Override
   public XmlElementContentSpec getContentSpecElement() {
     return (XmlElementContentSpec)findChildByRoleAsPsiElement(XmlChildRole.XML_ELEMENT_CONTENT_SPEC);
   }
 
+  @Override
   public PsiMetaData getMetaData() {
     return MetaRegistry.getMeta(this);
   }
 
+  @Override
   public PsiElement setName(@NotNull String name) throws IncorrectOperationException {
     XmlElementChangeUtil.doNameReplacement(this, getNameElement(), name);
 
     return null;
   }
 
+  @Override
   @NotNull
   public PsiReference[] getReferences() {
     return ReferenceProvidersRegistry.getReferencesFromProviders(this,XmlElementDecl.class);
   }
   
+  @Override
   public PsiElement getOriginalElement() {
     if (isPhysical()) return super.getOriginalElement();
 
@@ -95,6 +103,7 @@
     return this;
   }
 
+  @Override
   public boolean canNavigate() {
     if (!isPhysical()) {
       return getOriginalElement() != this;
@@ -103,6 +112,7 @@
     return super.canNavigate();
   }
 
+  @Override
   public void navigate(boolean requestFocus) {
     if (!isPhysical()) {
       PsiElement element = getOriginalElement();
@@ -116,6 +126,7 @@
     super.navigate(requestFocus);
   }
 
+  @Override
   public String getName() {
     XmlElement xmlElement = getNameElement();
     if (xmlElement != null) return xmlElement.getText();
@@ -134,10 +145,12 @@
     return element1 == element2;
   }
 
+  @Override
   public PsiElement getNameIdentifier() {
     return null;
   }
 
+  @Override
   @NotNull
   public PsiElement getNavigationElement() {
     return this;
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementImpl.java
index e0ec1ad..ec5f1d9 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementImpl.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.
@@ -47,6 +47,7 @@
     super(type);
   }
 
+  @Override
   public boolean processElements(PsiElementProcessor processor, PsiElement place){
     return XmlPsiUtil.processXmlElements(this, processor, false);
   }
@@ -60,6 +61,7 @@
     result[0] = null;
 
     processElements(new PsiElementProcessor(){
+      @Override
       public boolean execute(@NotNull PsiElement element){
         if(element instanceof TreeElement && ((ASTNode)element).getElementType() == type){
           result[0] = (XmlElement)element;
@@ -72,6 +74,7 @@
     return result[0];
   }
 
+  @Override
   public PsiElement getContext() {
     final XmlElement data = getUserData(INCLUDING_ELEMENT);
     if(data != null) return data;
@@ -82,6 +85,7 @@
     return super.getParent();
   }
 
+  @Override
   @NotNull
   public PsiElement getNavigationElement() {
     if (!isPhysical()) {
@@ -97,10 +101,12 @@
     return super.getNavigationElement();
   }
 
+  @Override
   public PsiElement getParent(){
     return getContext();
   }
 
+  @Override
   @NotNull
   public Language getLanguage() {
     return getContainingFile().getLanguage();
@@ -120,6 +126,7 @@
       final StringBuilder builder = new StringBuilder();
 
       ((XmlElement)name.getPsi()).processElements(new PsiElementProcessor() {
+        @Override
         public boolean execute(@NotNull final PsiElement element) {
           builder.append(element.getText());
           return true;
@@ -130,6 +137,7 @@
     return null;
   }
 
+  @Override
   @NotNull
   public SearchScope getUseScope() {
     return GlobalSearchScope.allScope(getProject());
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityCache.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityCache.java
index 8f91c22..8b3052d 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityCache.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityCache.java
@@ -1,3 +1,18 @@
+/*
+ * 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.psi.impl.source.xml;
 
 import com.intellij.openapi.util.Key;
@@ -23,6 +38,7 @@
 
       cachingMap.put(
         name, CachedValuesManager.getManager(file.getProject()).createCachedValue(new CachedValueProvider<XmlEntityDecl>() {
+          @Override
           public Result<XmlEntityDecl> compute() {
             PsiElement declElement = declPointer.getElement();
             if (declElement instanceof XmlEntityDecl && declElement.isValid() && name.equals(((XmlEntityDecl)declElement).getName()))
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityDeclImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityDeclImpl.java
index deff9ba..1eb615f 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityDeclImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityDeclImpl.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.
@@ -39,6 +39,7 @@
     super(XML_ENTITY_DECL);
   }
 
+  @Override
   public PsiElement getNameElement() {
     for (ASTNode e = getFirstChildNode(); e != null; e = e.getTreeNext()) {
       if (e instanceof XmlTokenImpl) {
@@ -51,6 +52,7 @@
     return null;
   }
 
+  @Override
   public XmlAttributeValue getValueElement() {
     if (isInternalReference()) {
       for (ASTNode e = getFirstChildNode(); e != null; e = e.getTreeNext()) {
@@ -70,11 +72,13 @@
     return null;
   }
 
+  @Override
   public String getName() {
     PsiElement nameElement = getNameElement();
     return nameElement != null ? nameElement.getText() : "";
   }
 
+  @Override
   public PsiElement setName(@NotNull String name) throws IncorrectOperationException {
     final PsiElement nameElement = getNameElement();
 
@@ -88,6 +92,7 @@
     return null;
   }
 
+  @Override
   public PsiElement parse(PsiFile baseFile, EntityContextType contextType, final XmlEntityRef originalElement) {
     PsiElement dep = XmlElement.DEPENDING_ELEMENT.get(getParent());
     PsiElement dependsOnElement = getValueElement(dep instanceof PsiFile ? (PsiFile)dep : baseFile);
@@ -153,6 +158,7 @@
     return null;
   }
 
+  @Override
   public boolean isInternalReference() {
     for (ASTNode e = getFirstChildNode(); e != null; e = e.getTreeNext()) {
       if (e.getElementType() instanceof IXmlLeafElementType) {
@@ -167,22 +173,26 @@
     return true;
   }
 
+  @Override
   @NotNull
   public PsiElement getNavigationElement() {
     return getNameElement();
   }
 
+  @Override
   public int getTextOffset() {
     final PsiElement name = getNameElement();
     return name != null ? name.getTextOffset() : super.getTextOffset();
   }
 
+  @Override
   public boolean canNavigate() {
     if (isPhysical()) return super.canNavigate();
     final PsiNamedElement psiNamedElement = XmlUtil.findRealNamedElement(this);
     return psiNamedElement != null;
   }
 
+  @Override
   public void navigate(final boolean requestFocus) {
     if (!isPhysical()) {
       ((Navigatable)XmlUtil.findRealNamedElement(this)).navigate(requestFocus);
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityRefImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityRefImpl.java
index 8bd3997..b74834a 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityRefImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityRefImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -51,6 +51,7 @@
 
   private static final Key<String> EVALUATION_IN_PROCESS = Key.create("EvalKey");
 
+  @Override
   public XmlEntityDecl resolve(PsiFile targetFile) {
     String text = getText();
     if (text.equals(GT_ENTITY) || text.equals(QUOT_ENTITY)) return null;
@@ -79,6 +80,7 @@
           return resolveEntity(targetElement, entityName, containingFile).getValue();
         }
         value = CachedValuesManager.getManager(manager.getProject()).createCachedValue(new CachedValueProvider<XmlEntityDecl>() {
+          @Override
           public Result<XmlEntityDecl> compute() {
             return resolveEntity(targetElement, entityName, containingFile);
           }
@@ -103,6 +105,7 @@
       final XmlEntityDecl[] result = {null};
 
       PsiElementProcessor processor = new PsiElementProcessor() {
+        @Override
         public boolean execute(@NotNull PsiElement element) {
           if (element instanceof XmlDoctype) {
             XmlDoctype xmlDoctype = (XmlDoctype)element;
@@ -187,29 +190,34 @@
     return HtmlUtil.isHtml5Doctype(xmlDoctype) ? Html5SchemaProvider.getCharsDtdLocation() : XmlUtil.getDtdUri(xmlDoctype);
   }
 
+  @Override
   public XmlTag getParentTag() {
     final XmlElement parent = (XmlElement)getParent();
     if(parent instanceof XmlTag) return (XmlTag)parent;
     return null;
   }
 
+  @Override
   public XmlTagChild getNextSiblingInTag() {
     PsiElement nextSibling = getNextSibling();
     if(nextSibling instanceof XmlTagChild) return (XmlTagChild)nextSibling;
     return null;
   }
 
+  @Override
   public XmlTagChild getPrevSiblingInTag() {
     final PsiElement prevSibling = getPrevSibling();
     if(prevSibling instanceof XmlTagChild) return (XmlTagChild)prevSibling;
     return null;
   }
 
+  @Override
   @NotNull
   public PsiReference[] getReferences() {
     return ReferenceProvidersRegistry.getReferencesFromProviders(this,XmlEntityRef.class);
   }
 
+  @Override
   public void accept(@NotNull PsiElementVisitor visitor) {
     if (visitor instanceof XmlElementVisitor) {
       ((XmlElementVisitor)visitor).visitXmlElement(this);
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEnumeratedTypeImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEnumeratedTypeImpl.java
index 2390f7f..6cdd068 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEnumeratedTypeImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEnumeratedTypeImpl.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.
@@ -33,6 +33,7 @@
     super(XML_ENUMERATED_TYPE);
   }
 
+  @Override
   public XmlElement[] getEnumeratedValues() {
     final List<XmlElement> result = new ArrayList<XmlElement>();
     processElements(new FilterElementProcessor(new XmlTokenTypeFilter(XmlTokenType.XML_NAME), result), this);
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlMarkupDeclImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlMarkupDeclImpl.java
index a022992..a490a55 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlMarkupDeclImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlMarkupDeclImpl.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.
@@ -28,6 +28,7 @@
     super(XmlElementType.XML_MARKUP_DECL);
   }
 
+  @Override
   public PsiMetaData getMetaData(){
     return MetaRegistry.getMeta(this);
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlNotationDeclImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlNotationDeclImpl.java
index e7e07a2..3a52fe8 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlNotationDeclImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlNotationDeclImpl.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.
@@ -30,6 +30,7 @@
     super(XML_NOTATION_DECL);
   }
 
+  @Override
   public int getChildRole(ASTNode child) {
     LOG.assertTrue(child.getTreeParent() == this);
     if (child.getElementType() == XML_ELEMENT_CONTENT_SPEC) {
@@ -40,10 +41,12 @@
     }
   }
 
+  @Override
   public XmlElement getNameElement() {
     return (XmlElement)findChildByRoleAsPsiElement(XmlChildRole.XML_NAME);
   }
 
+  @Override
   public XmlElementContentSpec getContentSpecElement() {
     return (XmlElementContentSpec)findChildByRoleAsPsiElement(XmlChildRole.XML_ELEMENT_CONTENT_SPEC);
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlProcessingInstructionImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlProcessingInstructionImpl.java
index 9289115..d0d67bf 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlProcessingInstructionImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlProcessingInstructionImpl.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.
@@ -37,6 +37,7 @@
     super(XmlElementType.XML_PROCESSING_INSTRUCTION);
   }
 
+  @Override
   public void accept(@NotNull PsiElementVisitor visitor) {
     if (visitor instanceof XmlElementVisitor) {
       ((XmlElementVisitor)visitor).visitXmlProcessingInstruction(this);
@@ -46,18 +47,21 @@
     }
   }
 
+  @Override
   public XmlTag getParentTag() {
     final PsiElement parent = getParent();
     if(parent instanceof XmlTag) return (XmlTag)parent;
     return null;
   }
 
+  @Override
   public XmlTagChild getNextSiblingInTag() {
     PsiElement nextSibling = getNextSibling();
     if(nextSibling instanceof XmlTagChild) return (XmlTagChild)nextSibling;
     return null;
   }
 
+  @Override
   public XmlTagChild getPrevSiblingInTag() {
     final PsiElement prevSibling = getPrevSibling();
     if(prevSibling instanceof XmlTagChild) return (XmlTagChild)prevSibling;
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlPrologImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlPrologImpl.java
index 88b5349..ee78a74 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlPrologImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlPrologImpl.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.
@@ -36,6 +36,7 @@
     super(XML_PROLOG);
   }
 
+  @Override
   public void accept(@NotNull PsiElementVisitor visitor) {
     if (visitor instanceof XmlElementVisitor) {
       ((XmlElementVisitor)visitor).visitXmlProlog(this);
@@ -45,6 +46,7 @@
     }
   }
 
+  @Override
   public int getChildRole(ASTNode child) {
     LOG.assertTrue(child.getTreeParent() == this);
     if (child.getElementType() == XML_DOCTYPE) {
@@ -55,6 +57,7 @@
     }
   }
 
+  @Override
   public XmlDoctype getDoctype() {
     return (XmlDoctype)findChildByRoleAsPsiElement(XmlChildRole.XML_DOCTYPE);
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java
index ddbd368..dbfb181 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.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.
@@ -45,11 +45,13 @@
     myElements = bodyElements;
   }
 
+  @Override
   @NotNull
   public XmlTagChild[] getChildren() {
     return myElements;
   }
 
+  @Override
   @NotNull
   public XmlText[] getTextElements() {
     XmlText[] textElements = myTextElements;
@@ -61,6 +63,7 @@
     return myTextElements = textElementsList.isEmpty() ? XmlText.EMPTY_ARRAY : ContainerUtil.toArray(textElementsList, new XmlText[textElementsList.size()]);
   }
 
+  @Override
   @NotNull
   public String getText() {
     String text = myText;
@@ -72,6 +75,7 @@
     return myText = consolidatedText.toString();
   }
 
+  @Override
   @NotNull
   public TextRange getTextRange() {
     if(myElements.length == 0){
@@ -83,6 +87,7 @@
     return new TextRange(myElements[0].getTextRange().getStartOffset(), myElements[myElements.length - 1].getTextRange().getEndOffset());
   }
 
+  @Override
   @NotNull
   public String getTrimmedText() {
     String trimmedText = myTrimmedText;
@@ -159,6 +164,7 @@
 
     tag.processElements(new PsiElementProcessor() {
       boolean insideBody = false;
+      @Override
       public boolean execute(@NotNull PsiElement element) {
         final ASTNode treeElement = element.getNode();
         if (insideBody) {
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTextImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTextImpl.java
index c640e27..9a8b11a 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTextImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTextImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -67,6 +67,7 @@
     return true;
   }
 
+  @Override
   @Nullable
   public XmlText split(int displayIndex) {
     try {
@@ -77,6 +78,7 @@
     }
   }
 
+  @Override
   public String getValue() {
     String displayText = myDisplayText;
     if (displayText != null) return displayText;
@@ -133,6 +135,7 @@
     return text;
   }
 
+  @Override
   public int physicalToDisplay(int physicalIndex) {
     getValue();
     if (myGapPhysicalStarts.length == 0) return physicalIndex;
@@ -157,6 +160,7 @@
     return physicalIndex - prevPhysGapStart + prevDisplayGapStart;
   }
 
+  @Override
   public int displayToPhysical(int displayIndex) {
     getValue();
     if (myGapDisplayStarts.length == 0) return displayIndex;
@@ -170,6 +174,7 @@
     return displayIndex - prevDisplayGapStart + prevPhysGapStart;
   }
 
+  @Override
   public void setValue(String s) throws IncorrectOperationException {
     doSetValue(s, getPolicy());
   }
@@ -178,6 +183,7 @@
     final PomModel model = PomManager.getModel(getProject());
     final XmlAspect aspect = model.getModelAspect(XmlAspect.class);
     model.runTransaction(new PomTransactionBase(this, aspect) {
+      @Override
       public PomModelEvent runInner() {
         final String oldText = getText();
         final ASTNode firstEncodedElement = policy.encodeXmlTextContents(s, XmlTextImpl.this);
@@ -192,6 +198,7 @@
     });
   }
 
+  @Override
   public XmlElement insertAtOffset(final XmlElement element, final int displayOffset) throws IncorrectOperationException {
     if (element instanceof XmlText) {
       insertText(((XmlText)element).getValue(), displayOffset);
@@ -200,6 +207,7 @@
       final PomModel model = PomManager.getModel(getProject());
       final XmlAspect aspect = model.getModelAspect(XmlAspect.class);
       model.runTransaction(new PomTransactionBase(getParent(), aspect) {
+        @Override
         public PomModelEvent runInner() throws IncorrectOperationException {
           final XmlTag tag = getParentTag();
           assert tag != null;
@@ -224,6 +232,7 @@
     return LanguageXmlPsiPolicy.INSTANCE.forLanguage(getLanguage());
   }
 
+  @Override
   public void insertText(String text, int displayOffset) throws IncorrectOperationException {
     if (text == null || text.isEmpty()) return;
 
@@ -241,6 +250,7 @@
       final PomModel model = PomManager.getModel(getProject());
       final XmlAspect aspect = model.getModelAspect(XmlAspect.class);
       model.runTransaction(new PomTransactionBase(this, aspect) {
+        @Override
         public PomModelEvent runInner() {
           final String oldText = getText();
 
@@ -265,6 +275,7 @@
     }
   }
 
+  @Override
   public void removeText(int displayStart, int displayEnd) throws IncorrectOperationException {
     final String value = getValue();
 
@@ -291,6 +302,7 @@
           final PomModel model = PomManager.getModel(getProject());
           final XmlAspect aspect = model.getModelAspect(XmlAspect.class);
           model.runTransaction(new PomTransactionBase(this, aspect) {
+            @Override
             public PomModelEvent runInner() throws IncorrectOperationException {
               final String oldText = getText();
 
@@ -321,28 +333,33 @@
     }
   }
 
+  @Override
   public XmlTag getParentTag() {
     final PsiElement parent = getParent();
     if (parent instanceof XmlTag) return (XmlTag)parent;
     return null;
   }
 
+  @Override
   public XmlTagChild getNextSiblingInTag() {
     PsiElement nextSibling = getNextSibling();
     if (nextSibling instanceof XmlTagChild) return (XmlTagChild)nextSibling;
     return null;
   }
 
+  @Override
   public XmlTagChild getPrevSiblingInTag() {
     PsiElement prevSibling = getPrevSibling();
     if (prevSibling instanceof XmlTagChild) return (XmlTagChild)prevSibling;
     return null;
   }
 
+  @Override
   public TreeElement addInternal(TreeElement first, ASTNode last, ASTNode anchor, Boolean before) {
     throw new RuntimeException("Clients must not use operations with direct children of XmlText!");
   }
 
+  @Override
   public void accept(@NotNull PsiElementVisitor visitor) {
     if (visitor instanceof XmlElementVisitor) {
       ((XmlElementVisitor)visitor).visitXmlText(this);
@@ -352,6 +369,7 @@
     }
   }
 
+  @Override
   public void clearCaches() {
     super.clearCaches();
     myDisplayText = null;
@@ -387,6 +405,7 @@
     return new TextRange(start, end);
   }
 
+  @Override
   public PsiLanguageInjectionHost updateText(@NotNull final String text) {
     try {
       doSetValue(text, new DefaultXmlPsiPolicy());
@@ -416,6 +435,7 @@
         super(xmlTag, aspect);
       }
 
+      @Override
       @Nullable
       public PomModelEvent runInner() throws IncorrectOperationException {
         final String oldText = getValue();
@@ -506,6 +526,7 @@
     return event;
   }
 
+  @Override
   @NotNull
   public LiteralTextEscaper<XmlTextImpl> createLiteralTextEscaper() {
     return new XmlTextLiteralEscaper(this);
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/CDATAOnAnyEncodedPolicy.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/CDATAOnAnyEncodedPolicy.java
index 69f8c40..b3425e8 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/CDATAOnAnyEncodedPolicy.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/CDATAOnAnyEncodedPolicy.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -30,6 +30,7 @@
 import com.intellij.xml.util.XmlUtil;
 
 public class CDATAOnAnyEncodedPolicy extends DefaultXmlPsiPolicy{
+  @Override
   public ASTNode encodeXmlTextContents(String displayText, PsiElement text) {
     final ASTNode firstChild = text.getNode().getFirstChildNode();
     boolean textAlreadyHasCDATA = firstChild != null && firstChild.getElementType() == XmlElementType.XML_CDATA;
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/DefaultXmlPsiPolicy.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/DefaultXmlPsiPolicy.java
index a5bfb19..23f0cf1 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/DefaultXmlPsiPolicy.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/DefaultXmlPsiPolicy.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.
@@ -34,6 +34,7 @@
 public class DefaultXmlPsiPolicy implements XmlPsiPolicy{
   private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.xml.behavior.DefaultXmlPsiPolicy");
 
+  @Override
   public ASTNode encodeXmlTextContents(String displayText, PsiElement text) {
     final PsiFile containingFile = text.getContainingFile();
     CharTable charTable = SharedImplUtil.findCharTableByTree(text.getNode());
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/EncodeEachSymbolPolicy.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/EncodeEachSymbolPolicy.java
new file mode 100644
index 0000000..8b78261
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/EncodeEachSymbolPolicy.java
@@ -0,0 +1,90 @@
+/*
+ * 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.psi.impl.source.xml.behavior;
+
+import com.intellij.lang.ASTFactory;
+import com.intellij.lang.ASTNode;
+import com.intellij.psi.impl.GeneratedMarkerVisitor;
+import com.intellij.psi.impl.source.DummyHolderFactory;
+import com.intellij.psi.impl.source.tree.FileElement;
+import com.intellij.psi.impl.source.tree.TreeElement;
+import com.intellij.psi.impl.source.tree.SharedImplUtil;
+import com.intellij.psi.xml.XmlTokenType;
+import com.intellij.psi.PsiElement;
+import com.intellij.util.CharTable;
+
+public class EncodeEachSymbolPolicy extends DefaultXmlPsiPolicy{
+  @Override
+  public ASTNode encodeXmlTextContents(String displayText, PsiElement text) {
+    if(!toCode(displayText)) return super.encodeXmlTextContents(displayText, text);
+    final FileElement dummyParent = DummyHolderFactory.createHolder(text.getManager(), null, SharedImplUtil.findCharTableByTree(text.getNode())).getTreeElement();
+    int sectionStartOffset = 0;
+    int offset = 0;
+    while (offset < displayText.length()) {
+      if (toCode(displayText.charAt(offset))) {
+        final String plainSection = displayText.substring(sectionStartOffset, offset);
+        if (!plainSection.isEmpty()) {
+          dummyParent.rawAddChildren((TreeElement)super.encodeXmlTextContents(plainSection, text));
+        }
+        dummyParent.rawAddChildren(createCharEntity(displayText.charAt(offset), dummyParent.getCharTable()));
+        sectionStartOffset = offset + 1;
+      }
+      offset++;
+    }
+    final String plainSection = displayText.substring(sectionStartOffset, offset);
+    if (!plainSection.isEmpty()) {
+      dummyParent.rawAddChildren((TreeElement)super.encodeXmlTextContents(plainSection, text));
+    }
+
+    dummyParent.acceptTree(new GeneratedMarkerVisitor());
+    return dummyParent.getFirstChildNode();
+  }
+
+  @SuppressWarnings({"HardCodedStringLiteral"})
+  private static TreeElement createCharEntity(char ch, CharTable charTable) {
+    switch (ch) {
+      case '<':
+        return ASTFactory.leaf(XmlTokenType.XML_CHAR_ENTITY_REF, "&lt;");
+      case '\'':
+        return ASTFactory.leaf(XmlTokenType.XML_CHAR_ENTITY_REF, "&apos;");
+      case '"':
+        return ASTFactory.leaf(XmlTokenType.XML_CHAR_ENTITY_REF, "&quot;");
+      case '>':
+        return ASTFactory.leaf(XmlTokenType.XML_CHAR_ENTITY_REF, "&gt;");
+      case '&':
+        return ASTFactory.leaf(XmlTokenType.XML_CHAR_ENTITY_REF, "&amp;");
+      case '\u00a0':
+        return ASTFactory.leaf(XmlTokenType.XML_CHAR_ENTITY_REF, "&nbsp;");
+
+      default:
+        final String charEncoding = "&#" + (int)ch + ";";
+        return ASTFactory.leaf(XmlTokenType.XML_CHAR_ENTITY_REF, charTable.intern(charEncoding));
+    }
+  }
+
+  private static boolean toCode(String str) {
+    for (int i = 0; i < str.length(); i++) {
+      final char ch = str.charAt(i);
+      if ( toCode(ch)) return true;
+    }
+    return false;
+  }
+
+  private static boolean toCode(final char ch) {
+    return "<&>\u00a0'\"".indexOf(ch) >= 0;
+  }
+
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/xml/XmlChildRole.java b/xml/xml-psi-impl/src/com/intellij/psi/xml/XmlChildRole.java
index 02cb1fe..4a4f66c 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/xml/XmlChildRole.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/xml/XmlChildRole.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -28,6 +28,7 @@
 public interface XmlChildRole {
 
   RoleFinder START_TAG_NAME_FINDER = new RoleFinder() {
+    @Override
     public ASTNode findChild(@NotNull ASTNode parent) {
       final PsiElement element = XmlTagUtil.getStartTagNameElement((XmlTag)parent.getPsi());
       return element == null ? null : element.getNode();
@@ -35,6 +36,7 @@
   };
 
   RoleFinder CLOSING_TAG_NAME_FINDER = new RoleFinder() {
+    @Override
     @Nullable
     public ASTNode findChild(@NotNull ASTNode parent) {
       final PsiElement element = XmlTagUtil.getEndTagNameElement((XmlTag)parent.getPsi());
@@ -43,6 +45,7 @@
   };
 
   RoleFinder DOCUMENT_FINDER = new RoleFinder() {
+    @Override
     public ASTNode findChild(@NotNull ASTNode parent) {
       ASTNode oldDocument = parent.findChildByType(XmlElementType.XML_DOCUMENT);
       if(oldDocument == null) oldDocument = parent.findChildByType(XmlElementType.HTML_DOCUMENT);
diff --git a/xml/xml-psi-impl/src/com/intellij/psi/xml/XmlElementType.java b/xml/xml-psi-impl/src/com/intellij/psi/xml/XmlElementType.java
index 6e3d2db..04f5d67 100644
--- a/xml/xml-psi-impl/src/com/intellij/psi/xml/XmlElementType.java
+++ b/xml/xml-psi-impl/src/com/intellij/psi/xml/XmlElementType.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.
@@ -67,6 +67,7 @@
   IFileElementType DTD_FILE = new IFileElementType("DTD_FILE", DTDLanguage.INSTANCE);
 
   IElementType XML_MARKUP_DECL = new CustomParsingType("XML_MARKUP_DECL", XMLLanguage.INSTANCE){
+    @Override
     public ASTNode parse(CharSequence text, CharTable table) {
       return new DtdParsing(text, XML_MARKUP_DECL, DtdParsing.TYPE_FOR_MARKUP_DECL, null).parse();
     }
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/DefaultXmlExtension.java b/xml/xml-psi-impl/src/com/intellij/xml/DefaultXmlExtension.java
index 2a29eea..de06f8c 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/DefaultXmlExtension.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/DefaultXmlExtension.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 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.
@@ -37,10 +37,12 @@
  */
 public class DefaultXmlExtension extends XmlExtension {
   
+  @Override
   public boolean isAvailable(final PsiFile file) {
     return true;
   }
 
+  @Override
   @NotNull
   public List<TagInfo> getAvailableTagNames(@NotNull final XmlFile file, @NotNull final XmlTag context) {
 
@@ -110,6 +112,7 @@
     return false;
   }
 
+  @Override
   public SchemaPrefix getPrefixDeclaration(final XmlTag context, String namespacePrefix) {
     @NonNls String nsDeclarationAttrName = null;
     for(XmlTag t = context; t != null; t = t.getParentTag()) {
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/XmlChangeLocalityDetector.java b/xml/xml-psi-impl/src/com/intellij/xml/XmlChangeLocalityDetector.java
new file mode 100644
index 0000000..db3bba7
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/xml/XmlChangeLocalityDetector.java
@@ -0,0 +1,36 @@
+/*
+ * 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.xml;
+
+import com.intellij.codeInsight.daemon.ChangeLocalityDetector;
+import com.intellij.codeInspection.DefaultXmlSuppressionProvider;
+import com.intellij.lang.xml.XMLLanguage;
+import com.intellij.psi.PsiComment;
+import com.intellij.psi.PsiElement;
+import org.jetbrains.annotations.NotNull;
+
+public class XmlChangeLocalityDetector implements ChangeLocalityDetector {
+  @Override
+  public PsiElement getChangeHighlightingDirtyScopeFor(@NotNull PsiElement changedElement) {
+    // rehighlight everything when inspection suppress comment changed
+    if (changedElement.getLanguage() instanceof XMLLanguage
+        && changedElement instanceof PsiComment
+        && changedElement.getText().contains(DefaultXmlSuppressionProvider.SUPPRESS_MARK)) {
+      return changedElement.getContainingFile();
+    }
+    return null;
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/XmlCoreEnvironment.java b/xml/xml-psi-impl/src/com/intellij/xml/XmlCoreEnvironment.java
index 5ae81dd..b7704fb 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/XmlCoreEnvironment.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/XmlCoreEnvironment.java
@@ -1,5 +1,24 @@
+/*
+ * 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.xml;
 
+import com.intellij.application.options.PathMacrosImpl;
+import com.intellij.application.options.editor.XmlFoldingSettings;
+import com.intellij.codeInsight.highlighting.ReadWriteAccessDetector;
+import com.intellij.codeInsight.highlighting.XmlReadWriteAccessDetector;
 import com.intellij.codeInspection.XmlSuppressionProvider;
 import com.intellij.core.CoreApplicationEnvironment;
 import com.intellij.core.CoreProjectEnvironment;
@@ -8,37 +27,47 @@
 import com.intellij.ide.highlighter.XHtmlFileType;
 import com.intellij.ide.highlighter.XmlFileType;
 import com.intellij.javaee.*;
+import com.intellij.lang.Language;
 import com.intellij.lang.LanguageASTFactory;
 import com.intellij.lang.LanguageParserDefinitions;
 import com.intellij.lang.dtd.DTDLanguage;
 import com.intellij.lang.dtd.DTDParserDefinition;
 import com.intellij.lang.dtd.DtdSyntaxHighlighterFactory;
+import com.intellij.lang.findUsages.LanguageFindUsages;
+import com.intellij.lang.folding.LanguageFolding;
 import com.intellij.lang.html.HTMLLanguage;
 import com.intellij.lang.html.HTMLParserDefinition;
 import com.intellij.lang.html.HtmlSyntaxHighlighterFactory;
 import com.intellij.lang.xhtml.XHTMLLanguage;
 import com.intellij.lang.xhtml.XHTMLParserDefinition;
 import com.intellij.lang.xhtml.XhtmlSyntaxHighlighterFactory;
-import com.intellij.lang.xml.XMLLanguage;
-import com.intellij.lang.xml.XMLParserDefinition;
-import com.intellij.lang.xml.XmlASTFactory;
-import com.intellij.lang.xml.XmlSyntaxHighlighterFactory;
+import com.intellij.lang.xml.*;
 import com.intellij.lexer.HtmlEmbeddedTokenTypesProvider;
+import com.intellij.openapi.application.PathMacros;
 import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory;
+import com.intellij.psi.XmlElementFactory;
+import com.intellij.psi.XmlElementFactoryImpl;
 import com.intellij.psi.impl.cache.impl.id.IdIndexers;
+import com.intellij.psi.impl.cache.impl.idCache.XHtmlTodoIndexer;
 import com.intellij.psi.impl.cache.impl.idCache.XmlIdIndexer;
+import com.intellij.psi.impl.cache.impl.idCache.XmlTodoIndexer;
+import com.intellij.psi.impl.cache.impl.todo.TodoIndexers;
 import com.intellij.psi.impl.source.xml.XmlElementDescriptorProvider;
 import com.intellij.psi.meta.MetaDataContributor;
 import com.intellij.psi.xml.StartTagEndTokenProvider;
 import com.intellij.psi.xml.XmlFileNSInfoProvider;
 import com.intellij.util.indexing.FileBasedIndexExtension;
+import com.intellij.xml.index.SchemaTypeInheritanceIndex;
 import com.intellij.xml.index.XmlNamespaceIndex;
+import com.intellij.xml.index.XmlTagNamesIndex;
+import com.intellij.xml.util.HtmlFileNSInfoProvider;
 import com.intellij.xml.util.XmlApplicationComponent;
 
 /**
  * @author yole
  */
+@SuppressWarnings("UnusedDeclaration") //upsource
 public class XmlCoreEnvironment {
   public static class ApplicationEnvironment {
     public ApplicationEnvironment(CoreApplicationEnvironment appEnvironment) {
@@ -58,18 +87,21 @@
       appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, HTMLLanguage.INSTANCE, new HTMLParserDefinition());
       appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, XHTMLLanguage.INSTANCE, new XHTMLParserDefinition());
 
-      XmlASTFactory astFactory = new XmlASTFactory();
-      appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, XMLLanguage.INSTANCE, astFactory);
-      appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, HTMLLanguage.INSTANCE, astFactory);
-      appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, XHTMLLanguage.INSTANCE, astFactory);
-      appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, DTDLanguage.INSTANCE, astFactory);
-
       appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, XmlFileType.INSTANCE, new XmlIdIndexer());
       appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, DTDFileType.INSTANCE, new XmlIdIndexer());
+      appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, XmlFileType.INSTANCE, new XmlTodoIndexer());
+      appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, DTDFileType.INSTANCE, new XmlTodoIndexer());
+      appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, XHtmlFileType.INSTANCE, new XHtmlTodoIndexer());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ReadWriteAccessDetector.EP_NAME,
+                                                        ReadWriteAccessDetector.class);
+      appEnvironment.addExtension(ReadWriteAccessDetector.EP_NAME, new XmlReadWriteAccessDetector());
+
+      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), XmlFileNSInfoProvider.EP_NAME, XmlFileNSInfoProvider.class);
+      appEnvironment.addExtension(XmlFileNSInfoProvider.EP_NAME, new HtmlFileNSInfoProvider());
 
       CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), StartTagEndTokenProvider.EP_NAME, StartTagEndTokenProvider.class);
       CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), XmlSuppressionProvider.EP_NAME, XmlSuppressionProvider.class);
-      CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), XmlFileNSInfoProvider.EP_NAME, XmlFileNSInfoProvider.class);
       CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), XmlSchemaProvider.EP_NAME, XmlSchemaProvider.class);
       CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ImplicitNamespaceDescriptorProvider.EP_NAME, ImplicitNamespaceDescriptorProvider.class);
       CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), XmlElementDescriptorProvider.EP_NAME, XmlElementDescriptorProvider.class);
@@ -82,9 +114,19 @@
 
       appEnvironment.addExtension(MetaDataContributor.EP_NAME, new XmlApplicationComponent());
       appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new XmlNamespaceIndex());
+      appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new SchemaTypeInheritanceIndex());
+      appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new XmlTagNamesIndex());
       appEnvironment.addExtension(StandardResourceProvider.EP_NAME, new InternalResourceProvider());
 
-      appEnvironment.registerApplicationService(ExternalResourceManager.class, createExternalResourceManager());
+      appEnvironment.registerApplicationComponent(PathMacros.class, new PathMacrosImpl());
+      appEnvironment.registerApplicationService(ExternalResourceManager.class, new ExternalResourceManagerExImpl(PathMacrosImpl.getInstanceEx()));
+      appEnvironment.registerApplicationService(XmlFoldingSettings.class, new XmlFoldingSettings());
+      Language[] myLanguages = new Language[]{XMLLanguage.INSTANCE, HTMLLanguage.INSTANCE, XHTMLLanguage.INSTANCE, DTDLanguage.INSTANCE};
+      for (Language myLanguage : myLanguages) {
+        appEnvironment.addExplicitExtension(LanguageFolding.INSTANCE, myLanguage, new XmlFoldingBuilder());
+        appEnvironment.addExplicitExtension(LanguageFindUsages.INSTANCE, myLanguage, new XmlFindUsagesProvider());
+        appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, myLanguage, new XmlASTFactory());
+      }
     }
 
     protected ExternalResourceManagerEx createExternalResourceManager() {
@@ -94,6 +136,9 @@
 
   public static class ProjectEnvironment {
     public ProjectEnvironment(CoreProjectEnvironment projectEnvironment) {
+      projectEnvironment.getProject().registerService(XmlElementFactory.class, new XmlElementFactoryImpl(projectEnvironment.getProject()));
+      projectEnvironment.getProject().registerService(ExternalResourceManagerExImpl.class,
+                                                      new ProjectResources(PathMacrosImpl.getInstanceEx()));
     }
   }
 }
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/XmlPsiManager.java b/xml/xml-psi-impl/src/com/intellij/xml/XmlPsiManager.java
new file mode 100644
index 0000000..3525a00
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/xml/XmlPsiManager.java
@@ -0,0 +1,57 @@
+/*
+ * 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.xml;
+
+import com.intellij.lang.xml.XMLLanguage;
+import com.intellij.openapi.components.AbstractProjectComponent;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFileSystemItem;
+import com.intellij.psi.impl.PsiManagerImpl;
+import com.intellij.psi.impl.PsiTreeChangePreprocessorBase;
+
+/**
+ * Created by fedorkorotkov.
+ */
+public class XmlPsiManager extends AbstractProjectComponent {
+
+  private final PsiManagerImpl myPsiManager;
+
+  protected XmlPsiManager(Project project, PsiManagerImpl psiManager) {
+    super(project);
+    myPsiManager = psiManager;
+  }
+
+  @Override
+  public void initComponent() {
+    super.initComponent();
+    new PsiTreeChangePreprocessorBase(myPsiManager) {
+      @Override
+      protected boolean isInsideCodeBlock(PsiElement element) {
+        if (element instanceof PsiFileSystemItem) {
+          return false;
+        }
+
+        if (element == null || element.getParent() == null) return true;
+
+        final boolean isXml = element.getLanguage() instanceof XMLLanguage;
+        // any xml element isn't inside a "code block"
+        // cause we display even attributes and tag values in structure view
+        return !isXml;
+      }
+    };
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/actions/validate/ValidateXmlActionHandler.java b/xml/xml-psi-impl/src/com/intellij/xml/actions/validate/ValidateXmlActionHandler.java
index 1495efb..2e851e5 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/actions/validate/ValidateXmlActionHandler.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/actions/validate/ValidateXmlActionHandler.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.
@@ -138,24 +138,29 @@
   public void doParse() {
     try {
       myParser.parse(new InputSource(new StringReader(myFile.getText())), new DefaultHandler() {
+        @Override
         public void warning(SAXParseException e) throws SAXException {
           if (myErrorReporter.isUniqueProblem(e)) myErrorReporter.processError(e, ProblemType.WARNING);
         }
 
+        @Override
         public void error(SAXParseException e) throws SAXException {
           if (myErrorReporter.isUniqueProblem(e)) myErrorReporter.processError(e, ProblemType.ERROR);
         }
 
+        @Override
         public void fatalError(SAXParseException e) throws SAXException {
           if (myErrorReporter.isUniqueProblem(e)) myErrorReporter.processError(e, ProblemType.FATAL);
         }
 
+        @Override
         public InputSource resolveEntity(String publicId, String systemId) {
           final PsiFile psiFile = myXmlResourceResolver.resolve(null, systemId);
           if (psiFile == null) return null;
           return new InputSource(new StringReader(psiFile.getText()));
         }
 
+        @Override
         public void startDocument() throws SAXException {
           super.startDocument();
           myParser.setProperty(
@@ -173,7 +178,7 @@
         }
 
         myFile.putUserData(DEPENDENT_FILES_KEY, files);
-        myFile.putUserData(GRAMMAR_POOL_TIME_STAMP_KEY, new Long(calculateTimeStamp(files, myProject)));
+        myFile.putUserData(GRAMMAR_POOL_TIME_STAMP_KEY, calculateTimeStamp(files, myProject));
       }
        myFile.putUserData(KNOWN_NAMESPACES_KEY, getNamespaces(myFile));
     }
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/BasicXmlAttributeDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/BasicXmlAttributeDescriptor.java
index 4e2055d..541ab9a 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/impl/BasicXmlAttributeDescriptor.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/BasicXmlAttributeDescriptor.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.
@@ -31,10 +31,12 @@
 import org.jetbrains.annotations.Nullable;
 
 public abstract class BasicXmlAttributeDescriptor extends XmlEnumerationDescriptor implements XmlAttributeDescriptor {
+  @Override
   public String validateValue(XmlElement context, String value) {
     return null;
   }
 
+  @Override
   public String getName(PsiElement context){
     return getName();
   }
@@ -54,12 +56,14 @@
     return getName();
   }
 
+  @Override
   protected PsiElement getEnumeratedValueDeclaration(XmlElement xmlElement, String value) {
     String[] values = getEnumeratedValues();
     if (values == null || values.length == 0) return getDeclaration();
     return ArrayUtilRt.find(values, value) != -1 ? getDeclaration() : null;
   }
 
+  @Override
   protected PsiElement getDefaultValueDeclaration() {
     return getDeclaration();
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/BaseXmlElementDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/BaseXmlElementDescriptorImpl.java
index 5e144f7..97e3b04 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/BaseXmlElementDescriptorImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/BaseXmlElementDescriptorImpl.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.
@@ -25,9 +25,6 @@
 
 import java.util.HashMap;
 
-/**
- * @by maxim
- */
 public abstract class BaseXmlElementDescriptorImpl implements XmlElementDescriptor {
   private volatile XmlElementDescriptor[] myElementDescriptors = null;
   private volatile XmlAttributeDescriptor[] myAttributeDescriptors;
@@ -51,38 +48,46 @@
 
   static final FieldCache<XmlElementDescriptor[],BaseXmlElementDescriptorImpl,Object, XmlTag> myElementDescriptorsCache =
     new FieldCache<XmlElementDescriptor[], BaseXmlElementDescriptorImpl, Object, XmlTag>() {
+    @Override
     protected final XmlElementDescriptor[] compute(final BaseXmlElementDescriptorImpl xmlElementDescriptor, XmlTag tag) {
       return xmlElementDescriptor.doCollectXmlDescriptors(tag);
     }
 
+    @Override
     protected final XmlElementDescriptor[] getValue(final BaseXmlElementDescriptorImpl xmlElementDescriptor, Object o) {
       return xmlElementDescriptor.myElementDescriptors;
     }
 
+    @Override
     protected final void putValue(final XmlElementDescriptor[] xmlElementDescriptors, final BaseXmlElementDescriptorImpl xmlElementDescriptor,Object o) {
       xmlElementDescriptor.myElementDescriptors = xmlElementDescriptors;
     }
   };
 
+  @Override
   public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) {
     return myElementDescriptorsCache.get(null, this, context);
   }
 
   private static final SimpleFieldCache<XmlAttributeDescriptor[],BaseXmlElementDescriptorImpl> myAttributeDescriptorsCache =
     new SimpleFieldCache<XmlAttributeDescriptor[], BaseXmlElementDescriptorImpl>() {
+    @Override
     protected final XmlAttributeDescriptor[] compute(final BaseXmlElementDescriptorImpl xmlElementDescriptor) {
       return xmlElementDescriptor.collectAttributeDescriptors(null);
     }
 
+    @Override
     protected final XmlAttributeDescriptor[] getValue(final BaseXmlElementDescriptorImpl xmlElementDescriptor) {
       return xmlElementDescriptor.myAttributeDescriptors;
     }
 
+    @Override
     protected final void putValue(final XmlAttributeDescriptor[] xmlAttributeDescriptors, final BaseXmlElementDescriptorImpl xmlElementDescriptor) {
       xmlElementDescriptor.myAttributeDescriptors = xmlAttributeDescriptors;
     }
   };
 
+  @Override
   public XmlAttributeDescriptor[] getAttributesDescriptors(final XmlTag context) {
     return myAttributeDescriptorsCache.get(this);
   }
@@ -92,19 +97,23 @@
 
   private static final SimpleFieldCache<HashMap<String,XmlAttributeDescriptor>, BaseXmlElementDescriptorImpl> attributeDescriptorsMapCache =
     new SimpleFieldCache<HashMap<String, XmlAttributeDescriptor>, BaseXmlElementDescriptorImpl>() {
+      @Override
       protected final HashMap<String, XmlAttributeDescriptor> compute(final BaseXmlElementDescriptorImpl baseXmlElementDescriptor) {
         return baseXmlElementDescriptor.collectAttributeDescriptorsMap(null);
       }
 
+      @Override
       protected final HashMap<String, XmlAttributeDescriptor> getValue(final BaseXmlElementDescriptorImpl baseXmlElementDescriptor) {
         return baseXmlElementDescriptor.attributeDescriptorsMap;
       }
 
+      @Override
       protected final void putValue(final HashMap<String, XmlAttributeDescriptor> hashMap, final BaseXmlElementDescriptorImpl baseXmlElementDescriptor) {
         baseXmlElementDescriptor.attributeDescriptorsMap = hashMap;
       }
     };
 
+  @Override
   public XmlAttributeDescriptor getAttributeDescriptor(String attributeName, final XmlTag context) {
     return attributeDescriptorsMapCache.get(this).get(attributeName);
   }
@@ -114,20 +123,24 @@
 
   private static final FieldCache<HashMap<String,XmlElementDescriptor>,BaseXmlElementDescriptorImpl,Object,XmlTag> myElementDescriptorsMapCache =
     new FieldCache<HashMap<String, XmlElementDescriptor>, BaseXmlElementDescriptorImpl, Object, XmlTag>() {
+    @Override
     protected final HashMap<String, XmlElementDescriptor> compute(final BaseXmlElementDescriptorImpl baseXmlElementDescriptor, final XmlTag p) {
       return baseXmlElementDescriptor.collectElementDescriptorsMap(p);
     }
 
+    @Override
     protected final HashMap<String, XmlElementDescriptor> getValue(final BaseXmlElementDescriptorImpl baseXmlElementDescriptor, final Object p) {
       return baseXmlElementDescriptor.myElementDescriptorsMap;
     }
 
+    @Override
     protected final void putValue(final HashMap<String, XmlElementDescriptor> hashMap,
                             final BaseXmlElementDescriptorImpl baseXmlElementDescriptor, final Object p) {
       baseXmlElementDescriptor.myElementDescriptorsMap = hashMap;
     }
   };
 
+  @Override
   public XmlElementDescriptor getElementDescriptor(XmlTag element, XmlTag contextTag){
     return myElementDescriptorsMapCache.get(null, this, element).get(element.getName());
   }
@@ -139,6 +152,7 @@
   // Read-only calculation
   protected abstract HashMap<String, XmlElementDescriptor> collectElementDescriptorsMap(final XmlTag element);
 
+  @Override
   public final XmlAttributeDescriptor getAttributeDescriptor(XmlAttribute attr){
     return getAttributeDescriptor(attr.getName(), attr.getParent());
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlAttributeDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlAttributeDescriptorImpl.java
index 1471fc4..fe0a8ab 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlAttributeDescriptorImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlAttributeDescriptorImpl.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.
@@ -44,14 +44,17 @@
     init(decl);
   }
 
+  @Override
   public boolean isRequired() {
     return myRequired;
   }
 
+  @Override
   public PsiElement getDeclaration(){
     return myDecl;
   }
 
+  @Override
   public String getName() {
     if (myName!=null) {
       return myName;
@@ -60,6 +63,7 @@
     return myName;
   }
 
+  @Override
   public void init(PsiElement element){
     myDecl = (XmlAttributeDecl) element;
     myRequired = myDecl.isAttributeRequired();
@@ -67,22 +71,27 @@
     myEnumerated = myDecl.isEnumerated();
   }
 
+  @Override
   public Object[] getDependences(){
     return new Object[]{myDecl};
   }
 
+  @Override
   public boolean isFixed() {
     return myFixed;
   }
 
+  @Override
   public boolean hasIdType() {
     return myDecl.isIdAttribute();
   }
 
+  @Override
   public boolean hasIdRefType() {
     return myDecl.isIdRefAttribute();
   }
 
+  @Override
   public String getDefaultValue() {
     String text = myDecl.getDefaultValueText();
     if (text != null) {
@@ -92,10 +101,12 @@
     return null;
   }
 
+  @Override
   public boolean isEnumerated() {
     return myEnumerated;
   }
 
+  @Override
   public String[] getEnumeratedValues() {
 
     XmlElement[] values = myDecl.getEnumeratedValues();
@@ -111,6 +122,7 @@
     return getName();
   }
 
+  @Override
   public void setName(String name) throws IncorrectOperationException {
     myName = name;
     ((PsiNamedElement)getDeclaration()).setName(name);
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlElementDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlElementDescriptorImpl.java
index 551856d..46ce5b4 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlElementDescriptorImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlElementDescriptorImpl.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.
@@ -64,8 +64,10 @@
   }
 
   private static final UserDataCache<CachedValue<XmlAttlistDecl[]>,XmlElement, Object> myAttlistDeclCache = new UserDataCache<CachedValue<XmlAttlistDecl[]>,XmlElement, Object>() {
+    @Override
     protected final CachedValue<XmlAttlistDecl[]> compute(final XmlElement owner, Object o) {
       return CachedValuesManager.getManager(owner.getProject()).createCachedValue(new CachedValueProvider<XmlAttlistDecl[]>() {
+        @Override
         public Result<XmlAttlistDecl[]> compute() {
           return new Result<XmlAttlistDecl[]>(doCollectAttlistDeclarations(owner),owner);
         }
@@ -73,28 +75,34 @@
     }
   };
 
+  @Override
   public PsiElement getDeclaration(){
     return myElementDecl;
   }
 
+  @Override
   public String getName(PsiElement context){
     return getName();
   }
 
+  @Override
   public String getName() {
     if (myName!=null) return myName;
     return myName = myElementDecl.getName();
   }
 
+  @Override
   public void init(PsiElement element){
     myElementDecl = (XmlElementDecl) element;
   }
 
+  @Override
   @SuppressWarnings("SpellCheckingInspection")
   public Object[] getDependences(){
     return new Object[]{myElementDecl, ExternalResourceManager.getInstance()};
   }
 
+  @Override
   public XmlNSDescriptor getNSDescriptor() {
     return getNsDescriptorFrom(myElementDecl);
   }
@@ -112,6 +120,7 @@
   }
 
   // Read-only action
+  @Override
   protected final XmlElementDescriptor[] doCollectXmlDescriptors(final XmlTag context) {
     final LinkedHashSet<XmlElementDescriptor> result = new LinkedHashSet<XmlElementDescriptor>();
     final XmlElementContentSpec contentSpecElement = myElementDecl.getContentSpecElement();
@@ -119,6 +128,7 @@
     final XmlNSDescriptor NSDescriptor = nsDescriptor != null? nsDescriptor:getNsDescriptorFrom(context);
     
     XmlUtil.processXmlElements(contentSpecElement, new PsiElementProcessor(){
+      @Override
       public boolean execute(@NotNull PsiElement child){
         if (child instanceof XmlToken) {
           final XmlToken token = (XmlToken)child;
@@ -172,6 +182,7 @@
   }
 
   // Read-only calculation
+  @Override
   protected final XmlAttributeDescriptor[] collectAttributeDescriptors(final XmlTag context) {
     final List<XmlAttributeDescriptor> result = new SmartList<XmlAttributeDescriptor>();
     for (XmlAttlistDecl attlistDecl : findAttlistDeclarations(getName())) {
@@ -185,6 +196,7 @@
   }
 
   // Read-only calculation
+  @Override
   protected HashMap<String, XmlAttributeDescriptor> collectAttributeDescriptorsMap(final XmlTag context) {
     final HashMap<String, XmlAttributeDescriptor> localADM;
     final XmlAttributeDescriptor[] xmlAttributeDescriptors = getAttributesDescriptors(context);
@@ -230,6 +242,7 @@
     return topGroup == null ? null : new XmlElementsGroupImpl(topGroup, null);
   }
 
+  @Override
   public int getContentType() {
     if (myElementDecl.getContentSpecElement().isAny()) {
       return CONTENT_TYPE_ANY;
@@ -248,6 +261,7 @@
   }
 
   // Read-only calculation
+  @Override
   protected HashMap<String, XmlElementDescriptor> collectElementDescriptorsMap(final XmlTag element) {
     final HashMap<String, XmlElementDescriptor> elementDescriptorsMap;
     final XmlElementDescriptor[] descriptors = getElementsDescriptors(element);
@@ -259,14 +273,17 @@
     return elementDescriptorsMap;
   }
 
+  @Override
   public String getQualifiedName() {
     return getName();
   }
 
+  @Override
   public String getDefaultName() {
     return getName();
   }
 
+  @Override
   public void setName(final String name) throws IncorrectOperationException {
     // IDEADEV-11439
     myName = null;
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlNSDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlNSDescriptorImpl.java
index b95ac5d..18ea646 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlNSDescriptorImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlNSDescriptorImpl.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.
@@ -46,14 +46,17 @@
 
   private static final SimpleFieldCache<CachedValue<Map<String, XmlElementDescriptor>>, XmlNSDescriptorImpl> myCachedDeclsCache = new
     SimpleFieldCache<CachedValue<Map<String, XmlElementDescriptor>>, XmlNSDescriptorImpl>() {
+    @Override
     protected final CachedValue<Map<String, XmlElementDescriptor>> compute(final XmlNSDescriptorImpl xmlNSDescriptor) {
       return xmlNSDescriptor.doBuildDeclarationMap();
     }
 
+    @Override
     protected final CachedValue<Map<String, XmlElementDescriptor>> getValue(final XmlNSDescriptorImpl xmlNSDescriptor) {
       return xmlNSDescriptor.myCachedDecls;
     }
 
+    @Override
     protected final void putValue(final CachedValue<Map<String, XmlElementDescriptor>> cachedValue, final XmlNSDescriptorImpl xmlNSDescriptor) {
       xmlNSDescriptor.myCachedDecls = cachedValue;
     }
@@ -61,15 +64,18 @@
 
   private volatile CachedValue<Map<String, XmlElementDescriptor>> myCachedDecls;
   private static final XmlUtil.DuplicationInfoProvider<XmlElementDecl> XML_ELEMENT_DECL_PROVIDER = new XmlUtil.DuplicationInfoProvider<XmlElementDecl>() {
+    @Override
     public String getName(@NotNull final XmlElementDecl psiElement) {
       return psiElement.getName();
     }
 
+    @Override
     @NotNull
     public String getNameKey(@NotNull final XmlElementDecl psiElement, @NotNull final String name) {
       return name;
     }
 
+    @Override
     @NotNull
     public PsiElement getNodeForMessage(@NotNull final XmlElementDecl psiElement) {
       return psiElement.getNameElement();
@@ -78,10 +84,12 @@
 
   public XmlNSDescriptorImpl() {}
 
+  @Override
   public XmlFile getDescriptorFile() {
     return myDescriptorFile;
   }
 
+  @Override
   public boolean isHierarhyEnabled() {
     return false;
   }
@@ -98,6 +106,7 @@
   // Read-only calculation
   private CachedValue<Map<String, XmlElementDescriptor>> doBuildDeclarationMap() {
     return CachedValuesManager.getManager(myElement.getProject()).createCachedValue(new CachedValueProvider<Map<String, XmlElementDescriptor>>() {
+      @Override
       public Result<Map<String, XmlElementDescriptor>> compute() {
         final List<XmlElementDecl> result = new ArrayList<XmlElementDecl>();
         myElement.processElements(new FilterElementProcessor(new ClassFilter(XmlElementDecl.class), result), getDeclaration());
@@ -116,11 +125,13 @@
      }, false);
   }
 
+  @Override
   public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) {
     String name = tag.getName();
     return getElementDescriptor(name);
   }
 
+  @Override
   @NotNull
   public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable final XmlDocument document) {
     // Suggest more appropriate variant if DOCTYPE <element_name> exists
@@ -147,18 +158,22 @@
     return buildDeclarationMap().get(name);
   }
 
+  @Override
   public PsiElement getDeclaration() {
     return myElement;
   }
 
+  @Override
   public String getName(PsiElement context){
     return getName();
   }
 
+  @Override
   public String getName(){
     return myDescriptorFile.getName();
   }
 
+  @Override
   public void init(PsiElement element){
     myElement = (XmlElement)element;
     myDescriptorFile = (XmlFile)element.getContainingFile();
@@ -168,15 +183,18 @@
     }
   }
 
+  @Override
   public Object[] getDependences(){
     return new Object[]{myElement, ExternalResourceManager.getInstance()};
   }
 
+  @Override
   public void validate(@NotNull XmlDocument document, @NotNull ValidationHost host) {
     if (document.getLanguage() == DTDLanguage.INSTANCE) {
       final List<XmlElementDecl> decls = new ArrayList<XmlElementDecl>(3);
 
       XmlUtil.processXmlElements(document, new PsiElementProcessor() {
+        @Override
         public boolean execute(@NotNull final PsiElement element) {
           if (element instanceof XmlElementDecl) decls.add((XmlElementDecl)element);
           return true;
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/AnyXmlAttributeDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/AnyXmlAttributeDescriptor.java
index 986ea48..2a73abf 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/AnyXmlAttributeDescriptor.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/AnyXmlAttributeDescriptor.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.
@@ -42,21 +42,26 @@
     myCanContainAttributeType = canContainAttributeType;
   }
 
+  @Override
   public PsiElement getDeclaration(){
     return null;
   }
 
+  @Override
   public String getName(PsiElement context){
     return myAttributeName;
   }
 
+  @Override
   public String getName() {
     return myAttributeName;
   }
 
+  @Override
   public void init(PsiElement element){
   }
 
+  @Override
   public Object[] getDependences(){
     return ArrayUtil.EMPTY_OBJECT_ARRAY;
   }
@@ -69,35 +74,43 @@
     return myAttributeName;
   }
 
+  @Override
   public boolean isRequired() {
     return false;
   }
 
+  @Override
   public boolean isFixed() {
     return false;
   }
 
+  @Override
   public boolean hasIdType() {
     return false;
   }
 
+  @Override
   public boolean hasIdRefType() {
     return false;
   }
 
+  @Override
   public String getDefaultValue() {
     return null;
   }
 
   //todo: refactor to hierarchy of value descriptor?
+  @Override
   public boolean isEnumerated() {
     return false;
   }
 
+  @Override
   public String[] getEnumeratedValues() {
     return ArrayUtil.EMPTY_STRING_ARRAY;
   }
 
+  @Override
   public String validateValue(XmlElement context, String value) {
     return null;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/AnyXmlElementDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/AnyXmlElementDescriptor.java
index 7343adf..a50c3a0 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/AnyXmlElementDescriptor.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/AnyXmlElementDescriptor.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.
@@ -42,6 +42,7 @@
     myXmlNSDescriptor = xmlNSDescriptor;
   }
 
+  @Override
   public XmlNSDescriptor getNSDescriptor() {
     return myXmlNSDescriptor;
   }
@@ -51,53 +52,66 @@
     return null;
   }
 
+  @Override
   public PsiElement getDeclaration(){
     return null;
   }
 
+  @Override
   public String getName(PsiElement context){
     return getName();
   }
 
+  @Override
   public String getName() {
     return myParentDescriptor.getName();
   }
 
+  @Override
   public void init(PsiElement element){
   }
 
+  @Override
   public Object[] getDependences(){
     return ArrayUtil.EMPTY_OBJECT_ARRAY;
   }
 
+  @Override
   public String getQualifiedName() {
     return myParentDescriptor.getQualifiedName();
   }
 
+  @Override
   public String getDefaultName() {
     return myParentDescriptor.getDefaultName();
   }
 
+  @Override
   public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) {
     return myParentDescriptor.getElementsDescriptors(context);
   }
 
+  @Override
   public XmlElementDescriptor getElementDescriptor(XmlTag tag, XmlTag contextTag){
     return new AnyXmlElementDescriptor(this, myXmlNSDescriptor);
   }
 
+  @Override
   public XmlAttributeDescriptor[] getAttributesDescriptors(final XmlTag context) {
     return new XmlAttributeDescriptor[0];
   }
 
+  @Override
   public XmlAttributeDescriptor getAttributeDescriptor(final String attributeName, final XmlTag context) {
     return new AnyXmlAttributeDescriptor(attributeName);
   }
 
+  @Override
   public XmlAttributeDescriptor getAttributeDescriptor(XmlAttribute attr){
     return myParentDescriptor.getAttributeDescriptor(attr);
   }
 
+  @Override
   public int getContentType() {
     return CONTENT_TYPE_UNKNOWN;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/ComplexTypeDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/ComplexTypeDescriptor.java
index f4d468e..09a5101 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/ComplexTypeDescriptor.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/ComplexTypeDescriptor.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.
@@ -49,14 +49,17 @@
   private static final FieldCache<XmlElementDescriptor[],ComplexTypeDescriptor,Object, XmlElement> myElementDescriptorsCache =
     new FieldCache<XmlElementDescriptor[],ComplexTypeDescriptor,Object, XmlElement>() {
 
+    @Override
     protected XmlElementDescriptor[] compute(final ComplexTypeDescriptor complexTypeDescriptor, final XmlElement p) {
       return complexTypeDescriptor.doCollectElements(p);
     }
 
+    @Override
     protected XmlElementDescriptor[] getValue(final ComplexTypeDescriptor complexTypeDescriptor, final Object p) {
       return complexTypeDescriptor.myElementDescriptors;
     }
 
+    @Override
     protected void putValue(final XmlElementDescriptor[] xmlElementDescriptors,
                             final ComplexTypeDescriptor complexTypeDescriptor, final Object p) {
       complexTypeDescriptor.myElementDescriptors = xmlElementDescriptors;
@@ -65,14 +68,17 @@
 
   private static final FieldCache<XmlAttributeDescriptor[], ComplexTypeDescriptor, Object, XmlElement> myAttributeDescriptorsCache =
     new FieldCache<XmlAttributeDescriptor[], ComplexTypeDescriptor, Object, XmlElement>() {
+    @Override
     protected final XmlAttributeDescriptor[] compute(final ComplexTypeDescriptor complexTypeDescriptor, XmlElement p) {
       return complexTypeDescriptor.doCollectAttributes(p);
     }
 
+    @Override
     protected final XmlAttributeDescriptor[] getValue(final ComplexTypeDescriptor complexTypeDescriptor, Object o) {
       return complexTypeDescriptor.myAttributeDescriptors;
     }
 
+    @Override
     protected final void putValue(final XmlAttributeDescriptor[] xmlAttributeDescriptors,
                             final ComplexTypeDescriptor complexTypeDescriptor, final Object p) {
       complexTypeDescriptor.myAttributeDescriptors = xmlAttributeDescriptors;
@@ -233,6 +239,9 @@
           else {
             XmlAttributeDescriptorImpl descriptor = myDocumentDescriptor.createAttributeDescriptor(tag);
             descriptor.myUse = use;
+            if (ref != null) {
+              descriptor.myReferenceName = ref.getAttributeValue(REF_ATTR_NAME);
+            }
             addAttributeDescriptor(result, descriptor);
           }
         }
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/NamedObjectDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/NamedObjectDescriptor.java
index 04779f1..be1801d 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/NamedObjectDescriptor.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/NamedObjectDescriptor.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.
@@ -31,6 +31,7 @@
 
   public NamedObjectDescriptor() {}
 
+  @Override
   public void setName(String name) throws IncorrectOperationException {
     setName(myDcl, name);
   }
@@ -47,22 +48,27 @@
     }
   }
 
+  @Override
   public PsiElement getDeclaration() {
     return myDcl;
   }
 
+  @Override
   public String getName(PsiElement context) {
     return getName();
   }
 
+  @Override
   public String getName() {
     return myDcl.getAttributeValue("name");
   }
 
+  @Override
   public void init(PsiElement element) {
     myDcl = (XmlTag)element;
   }
 
+  @Override
   public Object[] getDependences() {
     return new Object[] { myDcl };
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/NullElementDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/NullElementDescriptor.java
index 3704042..63a0c2d 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/NullElementDescriptor.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/NullElementDescriptor.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.
@@ -38,35 +38,43 @@
   private NullElementDescriptor() {
   }
 
+  @Override
   public String getQualifiedName() {
     return null;
   }
 
+  @Override
   public String getDefaultName() {
     return null;
   }
 
   //todo: refactor to support full DTD spec
+  @Override
   public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) {
     return new XmlElementDescriptor[0];
   }
 
+  @Override
   public XmlElementDescriptor getElementDescriptor(XmlTag childTag, XmlTag contextTag) {
     return null;
   }
 
+  @Override
   public XmlAttributeDescriptor[] getAttributesDescriptors(final XmlTag context) {
     return new XmlAttributeDescriptor[0];
   }
 
+  @Override
   public XmlAttributeDescriptor getAttributeDescriptor(String attributeName, final XmlTag context) {
     return null;
   }
 
+  @Override
   public XmlAttributeDescriptor getAttributeDescriptor(XmlAttribute attribute) {
     return null;
   }
 
+  @Override
   public XmlNSDescriptor getNSDescriptor() {
     return null;
   }
@@ -76,6 +84,7 @@
     return null;
   }
 
+  @Override
   public int getContentType() {
     return 0;
   }
@@ -85,21 +94,26 @@
     return null;
   }
 
+  @Override
   public PsiElement getDeclaration() {
     return null;
   }
 
+  @Override
   public String getName(PsiElement context) {
     return null;
   }
 
+  @Override
   public String getName() {
     return null;
   }
 
+  @Override
   public void init(PsiElement element) {
   }
 
+  @Override
   public Object[] getDependences() {
     return ArrayUtil.EMPTY_OBJECT_ARRAY;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/SchemaNSDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/SchemaNSDescriptor.java
index f29bf32..65a91cc 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/SchemaNSDescriptor.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/SchemaNSDescriptor.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.
@@ -42,6 +42,7 @@
   @NonNls private static final String NAME_ATTR_NAME = "name";
 
   private static final Validator<XmlTag> ELEMENT_VALIDATOR = new Validator<XmlTag>() {
+    @Override
     public void validate(@NotNull final XmlTag tag, @NotNull ValidationHost host) {
       if (!isFromSchemaNs(tag)) return;
       final boolean hasRefAttribute = tag.getAttributeValue(REF_ATTR_NAME) != null;
@@ -95,6 +96,7 @@
   };
 
   private static final Validator<XmlTag> ATTRIBUTE_VALIDATOR = new Validator<XmlTag>() {
+    @Override
     public void validate(@NotNull final XmlTag tag, @NotNull ValidationHost host) {
       if (!isFromSchemaNs(tag)) return;
 
@@ -123,15 +125,18 @@
   };
 
   private static final XmlUtil.DuplicationInfoProvider<XmlTag> SCHEMA_ATTR_DUP_INFO_PROVIDER = new XmlUtil.DuplicationInfoProvider<XmlTag>() {
+    @Override
     public String getName(@NotNull final XmlTag t) {
       return t.getAttributeValue(NAME_ATTR_NAME);
     }
 
+    @Override
     @NotNull
     public String getNameKey(@NotNull final XmlTag t, @NotNull String name) {
       return name;
     }
 
+    @Override
     @NotNull
     public PsiElement getNodeForMessage(@NotNull final XmlTag t) {
       return t.getAttribute(NAME_ATTR_NAME, null).getValueElement();
@@ -139,6 +144,7 @@
   };
 
   private static final Validator<XmlTag> ELEMENT_AND_ATTR_VALIDATOR = new Validator<XmlTag>() {
+    @Override
     public void validate(@NotNull final XmlTag tag, @NotNull ValidationHost host) {
       if (!isFromSchemaNs(tag)) return;
       final String nsPrefix = tag.getNamespacePrefix();
@@ -166,6 +172,7 @@
     return XmlUtil.XML_SCHEMA_URI.equals(tag.getNamespace());
   }
 
+  @Override
   protected XmlElementDescriptor createElementDescriptor(final XmlTag tag) {
     final XmlElementDescriptor descriptor = super.createElementDescriptor(tag);
     String localName = tag.getAttributeValue(NAME_ATTR_NAME);
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlAttributeDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlAttributeDescriptorImpl.java
index c8179cc..b463e92 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlAttributeDescriptorImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlAttributeDescriptorImpl.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.
@@ -33,6 +33,7 @@
 public class XmlAttributeDescriptorImpl extends XsdEnumerationDescriptor implements PsiWritableMetaData, XmlAttributeDescriptor {
   private XmlTag myTag;
   String myUse;
+  String myReferenceName;
 
   @NonNls
   public static final String REQUIRED_ATTR_VALUE = "required";
@@ -46,23 +47,28 @@
 
   public XmlAttributeDescriptorImpl() {}
 
+  @Override
   public XmlTag getDeclaration(){
     return myTag;
   }
 
+  @Override
   public String getName() {
     return myTag.getAttributeValue("name");
   }
 
+  @Override
   public void init(PsiElement element){
     myTag = (XmlTag) element;
     myUse = myTag.getAttributeValue("use");
   }
 
+  @Override
   public Object[] getDependences(){
     return ArrayUtil.EMPTY_OBJECT_ARRAY;
   }
 
+  @Override
   public boolean isRequired() {
     return REQUIRED_ATTR_VALUE.equals(myUse);
   }
@@ -90,14 +96,17 @@
     return myTag.getAttributeValue("type");
   }
 
+  @Override
   public boolean hasIdType() {
     return hasSimpleSchemaType("ID");
   }
 
+  @Override
   public boolean hasIdRefType() {
     return hasSimpleSchemaType("IDREF");
   }
 
+  @Override
   public boolean isEnumerated() {
     return isEnumerated(null);
   }
@@ -108,47 +117,23 @@
     return null;
   }
 
+  @Override
   public String getName(PsiElement context) {
 
+    String name = getName();
     if (context == null) {
-      return getName();
+      return name;
     }
-    final String form = myTag.getAttributeValue("form");
-    boolean isQualifiedAttr = QUALIFIED_ATTR_VALUE.equals(form);
 
     final XmlTag rootTag = (((XmlFile) myTag.getContainingFile())).getRootTag();
     assert rootTag != null;
     String targetNs = rootTag.getAttributeValue("targetNamespace");
+    if (targetNs == null) return name;
+
     XmlTag contextTag = (XmlTag)context;
-    String name = getName();
-
-    boolean attributeShouldBeQualified = false;
-
-    String contextNs = contextTag.getNamespace();
-    if (targetNs != null && !contextNs.equals(targetNs)) {
-      final XmlElementDescriptor xmlElementDescriptor = contextTag.getDescriptor();
-
-      if (xmlElementDescriptor instanceof XmlElementDescriptorImpl) {
-        final XmlElementDescriptorImpl elementDescriptor = (XmlElementDescriptorImpl)xmlElementDescriptor;
-        final TypeDescriptor type = elementDescriptor.getType();
-
-        if (type instanceof ComplexTypeDescriptor) {
-          final ComplexTypeDescriptor typeDescriptor = (ComplexTypeDescriptor)type;
-          attributeShouldBeQualified = typeDescriptor.canContainAttribute(targetNs, null) != ComplexTypeDescriptor.CanContainAttributeType.CanNotContain;
-        }
-
-        if (!attributeShouldBeQualified && contextNs.length() == 0 && targetNs.length() > 0) {
-          attributeShouldBeQualified = !targetNs.equals(elementDescriptor.getNamespace());
-        }
-      }
-    }
-
-    if (targetNs != null &&
-        ( isQualifiedAttr ||
-          QUALIFIED_ATTR_VALUE.equals(rootTag.getAttributeValue("attributeFormDefault")) ||
-          attributeShouldBeQualified
-        )
-      ) {
+    if (QUALIFIED_ATTR_VALUE.equals(myTag.getAttributeValue("form")) ||
+        QUALIFIED_ATTR_VALUE.equals(rootTag.getAttributeValue("attributeFormDefault")) ||
+        shouldBeQualified(targetNs, contextTag)) {
       final String prefixByNamespace = contextTag.getPrefixByNamespace(targetNs);
       if (prefixByNamespace!= null && prefixByNamespace.length() > 0) {
         name = prefixByNamespace + ":" + name;
@@ -158,6 +143,38 @@
     return name;
   }
 
+  private boolean shouldBeQualified(String targetNs, XmlTag contextTag) {
+    boolean attributeShouldBeQualified = false;
+
+    String contextNs = contextTag.getNamespace();
+    if (!contextNs.equals(targetNs)) {
+      final XmlElementDescriptor xmlElementDescriptor = contextTag.getDescriptor();
+
+      if (xmlElementDescriptor instanceof XmlElementDescriptorImpl) {
+        final XmlElementDescriptorImpl elementDescriptor = (XmlElementDescriptorImpl)xmlElementDescriptor;
+        final TypeDescriptor type = elementDescriptor.getType();
+
+        if (type instanceof ComplexTypeDescriptor) {
+          final ComplexTypeDescriptor typeDescriptor = (ComplexTypeDescriptor)type;
+          if (myReferenceName != null) {
+            return myReferenceName.indexOf(':') != 0;
+          }
+          XmlAttributeDescriptor[] attributes = ((ComplexTypeDescriptor)type).getAttributes(contextTag);
+          if (ArrayUtil.contains(this, attributes)) {
+            return false;
+          }
+          attributeShouldBeQualified = typeDescriptor.canContainAttribute(targetNs, null) != ComplexTypeDescriptor.CanContainAttributeType.CanNotContain;
+        }
+
+        if (!attributeShouldBeQualified && contextNs.length() == 0 && targetNs.length() > 0) {
+          attributeShouldBeQualified = !targetNs.equals(elementDescriptor.getNamespace());
+        }
+      }
+    }
+    return attributeShouldBeQualified;
+  }
+
+  @Override
   public void setName(String name) throws IncorrectOperationException {
     NamedObjectDescriptor.setName(myTag, name);
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorByType.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorByType.java
index 5e1bbd1..e901d59 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorByType.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorByType.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.
@@ -39,14 +39,17 @@
 
   public XmlElementDescriptorByType() {}
 
+  @Override
   public XmlTag getDeclaration(){
     return myDescriptorTag;
   }
 
+  @Override
   public String getName(PsiElement context){
     return myDescriptorTag.getName();
   }
 
+  @Override
   public XmlNSDescriptor getNSDescriptor() {
     XmlNSDescriptor nsDescriptor = NSDescriptor;
     if (nsDescriptor ==null) {
@@ -60,10 +63,12 @@
     return nsDescriptor;
   }
 
+  @Override
   public ComplexTypeDescriptor getType(XmlElement context) {
     return myType;
   }
 
+  @Override
   public String getDefaultName() {
     XmlTag rootTag = ((XmlFile)getType(null).getDeclaration().getContainingFile()).getDocument().getRootTag();
 
@@ -74,6 +79,7 @@
     return getName();
   }
   
+  @Override
   protected boolean askParentDescriptorViaXsi() {
     return false;
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorImpl.java
index 083512a..7bf9f02 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -59,10 +59,12 @@
 
   public XmlElementDescriptorImpl() {}
 
+  @Override
   public XmlTag getDeclaration(){
     return myDescriptorTag;
   }
 
+  @Override
   public String getName(PsiElement context){
     String value = myDescriptorTag.getAttributeValue("name");
 
@@ -93,6 +95,7 @@
   }
 
   /** getter for _local_ name */
+  @Override
   public String getName() {
     return XmlUtil.findLocalNameByQualifiedName(getName(null));
   }
@@ -122,6 +125,7 @@
            myDescriptorTag.getNamespaceByPrefix(namespacePrefix);
   }
 
+  @Override
   public void init(PsiElement element){
     if (myDescriptorTag!=element && myDescriptorTag!=null) {
       NSDescriptor = null;
@@ -129,6 +133,7 @@
     myDescriptorTag = (XmlTag) element;
   }
 
+  @Override
   public Object[] getDependences(){
     return new Object[]{myDescriptorTag};
   }
@@ -151,6 +156,7 @@
     return nsDescriptor;
   }
 
+  @Override
   public XmlNSDescriptor getNSDescriptor() {
     XmlNSDescriptor nsDescriptor = NSDescriptor;
     if (nsDescriptor == null || !NSDescriptor.getDeclaration().isValid()) {
@@ -185,7 +191,7 @@
       String substAttr = myDescriptorTag.getAttributeValue("substitutionGroup");
       if (substAttr != null) {
         final String namespacePrefix = XmlUtil.findPrefixByQualifiedName(substAttr);
-        final String namespace = "".equals(namespacePrefix) ?
+        final String namespace = namespacePrefix.isEmpty() ?
                                  ((XmlNSDescriptorImpl)getNSDescriptor()).getDefaultNamespace() :
                                  myDescriptorTag.getNamespaceByPrefix(namespacePrefix);
         final String local = XmlUtil.findLocalNameByQualifiedName(substAttr);
@@ -198,6 +204,7 @@
     return type;
   }
 
+  @Override
   public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) {
     if (context != null) {
       final XmlElementDescriptor parentDescriptorByType = XmlUtil.findXmlDescriptorByType(context);
@@ -272,6 +279,7 @@
     return EMPTY_ARRAY;
   }
 
+  @Override
   public XmlAttributeDescriptor[] getAttributesDescriptors(final XmlTag context) {
 
     TypeDescriptor type = getType(context);
@@ -318,6 +326,7 @@
     return attributeDescriptors;
   }
 
+  @Override
   public XmlAttributeDescriptor getAttributeDescriptor(String attributeName, final XmlTag context){
     return getAttributeDescriptorImpl(attributeName,context);
   }
@@ -327,7 +336,7 @@
     final String localName = XmlUtil.findLocalNameByQualifiedName(attributeName);
     final String namespacePrefix = XmlUtil.findPrefixByQualifiedName(attributeName);
     final XmlNSDescriptorImpl xmlNSDescriptor = (XmlNSDescriptorImpl)getNSDescriptor();
-    final String namespace = namespacePrefix != null && namespacePrefix.isEmpty() ?
+    final String namespace = namespacePrefix.isEmpty() ?
                              ((xmlNSDescriptor != null)?xmlNSDescriptor.getDefaultNamespace():"") :
                              context.getNamespaceByPrefix(namespacePrefix);
 
@@ -355,6 +364,7 @@
     return attribute;
   }
 
+  @Override
   public XmlAttributeDescriptor getAttributeDescriptor(XmlAttribute attribute){
     return getAttributeDescriptorImpl(attribute.getName(),attribute.getParent());
   }
@@ -377,11 +387,6 @@
       final ComplexTypeDescriptor.CanContainAttributeType containAttributeType = descriptor.canContainAttribute(namespace, qName);
 
       if (containAttributeType != ComplexTypeDescriptor.CanContainAttributeType.CanNotContain) {
-        for (XmlAttributeDescriptor attributeDescriptor : descriptors) {
-          if (attributeDescriptor.getName().equals(attributeName)) {
-            return attributeDescriptor;
-          }
-        }
         return new AnyXmlAttributeDescriptor(attributeName, containAttributeType);
       }
     }
@@ -389,6 +394,7 @@
     return null;
   }
 
+  @Override
   public int getContentType() {
     TypeDescriptor type = getType();
 
@@ -403,7 +409,7 @@
   public XmlElementDescriptor getElementDescriptor(final String name) {
       final String localName = XmlUtil.findLocalNameByQualifiedName(name);
       final String namespacePrefix = XmlUtil.findPrefixByQualifiedName(name);
-      final String namespace = "".equals(namespacePrefix) ?
+      final String namespace = namespacePrefix.isEmpty() ?
                                ((XmlNSDescriptorImpl)getNSDescriptor()).getDefaultNamespace() :
                                myDescriptorTag.getNamespaceByPrefix(namespacePrefix);
     return getElementDescriptor(localName, namespace, null, name);
@@ -453,6 +459,7 @@
     return null;
   }
 
+  @Override
   public XmlElementDescriptor getElementDescriptor(XmlTag element, XmlTag contextTag){
     final XmlElement context = (XmlElement)element.getParent();
 
@@ -480,6 +487,7 @@
     return true;
   }
 
+  @Override
   public String getQualifiedName() {
     String ns = getNS();
     if (ns != null && !ns.isEmpty()) {
@@ -494,6 +502,7 @@
     return XmlUtil.findNamespacePrefixByURI((XmlFile) myDescriptorTag.getContainingFile(), getNamespace());
   }
 
+  @Override
   public String getDefaultName() {
     final PsiFile psiFile = myDescriptorTag.getContainingFile();
     XmlTag rootTag = psiFile instanceof XmlFile ?((XmlFile)psiFile).getRootTag():null;
@@ -513,6 +522,7 @@
     return Boolean.valueOf(descriptorTag.getAttributeValue("abstract"));
   }
 
+  @Override
   public void setName(String name) throws IncorrectOperationException {
     NamedObjectDescriptor.setName(myDescriptorTag, name);
   }
@@ -521,6 +531,7 @@
     myValidator = validator;
   }
 
+  @Override
   public void validate(@NotNull XmlTag context, @NotNull ValidationHost host) {
     Validator<XmlTag> validator = myValidator;
     if (validator != null) {
@@ -538,6 +549,7 @@
     };
   }
 
+  @Override
   public boolean allowElementsFromNamespace(final String namespace, final XmlTag context) {
     final TypeDescriptor type = getType(context);
     
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlNSDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlNSDescriptorImpl.java
index 63633af..192c272 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlNSDescriptorImpl.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlNSDescriptorImpl.java
@@ -136,10 +136,12 @@
     }
   }
 
+  @Override
   public XmlFile getDescriptorFile() {
     return myFile;
   }
 
+  @Override
   public boolean isHierarhyEnabled() {
     return true;
   }
@@ -156,6 +158,7 @@
   private final Map<QNameKey, CachedValue<XmlElementDescriptor>> myDescriptorsMap = Collections.synchronizedMap(new HashMap<QNameKey, CachedValue<XmlElementDescriptor>>());
   private final Map<Pair<QNameKey, XmlTag>, CachedValue<TypeDescriptor>> myTypesMap = Collections.synchronizedMap(new HashMap<Pair<QNameKey,XmlTag>, CachedValue<TypeDescriptor>>());
 
+  @Override
   @Nullable
   public XmlElementDescriptor getElementDescriptor(String localName, String namespace) {
     return getElementDescriptor(localName, namespace, new HashSet<XmlNSDescriptorImpl>(),false);
@@ -185,6 +188,7 @@
         if (name != null) {
           if (checkElementNameEquivalence(localName, namespace, name, tag)) {
             final CachedValue<XmlElementDescriptor> cachedValue = CachedValuesManager.getManager(tag.getProject()).createCachedValue(new CachedValueProvider<XmlElementDescriptor>() {
+                @Override
                 public Result<XmlElementDescriptor> compute() {
                   final String name = tag.getAttributeValue("name");
 
@@ -324,6 +328,7 @@
                 if(attributeDescriptor != null){
                   final CachedValue<XmlAttributeDescriptor> value = CachedValuesManager.getManager(includedDocument.getProject()).createCachedValue(
                     new CachedValueProvider<XmlAttributeDescriptor>(){
+                      @Override
                       public Result<XmlAttributeDescriptor> compute() {
                         Object[] deps = attributeDescriptor.getDependences();
                         if (deps.length == 0) {
@@ -350,6 +355,7 @@
     return new XmlAttributeDescriptorImpl(tag);
   }
 
+  @Override
   public TypeDescriptor getTypeDescriptor(XmlTag descriptorTag) {
     String type = descriptorTag.getAttributeValue("type");
 
@@ -360,6 +366,7 @@
     return findTypeDescriptorImpl(descriptorTag, null, null, null);
   }
 
+  @Override
   public TypeDescriptor getTypeDescriptor(final String name, XmlTag context) {
     if(checkSchemaNamespace(name, context)){
       final String localNameByQualifiedName = XmlUtil.findLocalNameByQualifiedName(name);
@@ -526,6 +533,7 @@
             if (document != null) {
 
               final CachedValue<TypeDescriptor> value = CachedValuesManager.getManager(tag.getProject()).createCachedValue(new CachedValueProvider<TypeDescriptor>() {
+                  @Override
                   public Result<TypeDescriptor> compute() {
                     final String currentName = tag.getAttributeValue("name");
 
@@ -600,6 +608,7 @@
 
   private CachedValue<TypeDescriptor> createAndPutTypesCachedValueSimpleType(final XmlTag tag, final Pair<QNameKey, XmlTag> pair) {
     final CachedValue<TypeDescriptor> value = CachedValuesManager.getManager(tag.getProject()).createCachedValue(new CachedValueProvider<TypeDescriptor>() {
+      @Override
       public CachedValueProvider.Result<TypeDescriptor> compute() {
         final SimpleTypeDescriptor simpleTypeDescriptor = new SimpleTypeDescriptor(tag);
         return new Result<TypeDescriptor>(simpleTypeDescriptor, tag);
@@ -611,6 +620,7 @@
 
   private CachedValue<TypeDescriptor> createAndPutTypesCachedValue(final XmlTag tag, final Pair<QNameKey, XmlTag> pair) {
     final CachedValue<TypeDescriptor> value = CachedValuesManager.getManager(tag.getProject()).createCachedValue(new CachedValueProvider<TypeDescriptor>() {
+      @Override
       public CachedValueProvider.Result<TypeDescriptor> compute() {
         final String name = tag.getAttributeValue("name");
         
@@ -630,6 +640,7 @@
     return value;
   }
 
+  @Override
   public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) {
     PsiElement parent = tag.getParent();
     final String namespace = tag.getNamespace();
@@ -676,11 +687,13 @@
     return elementDescriptor;
   }
 
+  @Override
   @NotNull
   public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable final XmlDocument doc) {
     class CollectElementsProcessor implements PsiElementProcessor<XmlTag> {
       final List<XmlElementDescriptor> result = new ArrayList<XmlElementDescriptor>();
       
+      @Override
       public boolean execute(@NotNull final XmlTag element) {
         ContainerUtil.addIfNotNull(result, getElementDescriptor(element.getAttributeValue("name"), getDefaultNamespace()));
         return true;
@@ -688,6 +701,7 @@
     }
     
     CollectElementsProcessor processor = new CollectElementsProcessor() {
+      @Override
       public boolean execute(@NotNull final XmlTag element) {
         if (!XmlElementDescriptorImpl.isAbstractDeclaration(element)) return super.execute(element);
         return true;
@@ -702,6 +716,7 @@
     class CollectAttributesProcessor implements PsiElementProcessor<XmlTag> {
       final List<XmlAttributeDescriptor> result = new ArrayList<XmlAttributeDescriptor>();
 
+      @Override
       public boolean execute(@NotNull final XmlTag element) {
         result.add(createAttributeDescriptor(element));
         return true;
@@ -893,18 +908,22 @@
     return mySubstitutions != null;
   }
 
+  @Override
   public PsiElement getDeclaration(){
     return myFile.getDocument();
   }
 
+  @Override
   public String getName(PsiElement context){
     return getName();
   }
 
+  @Override
   public String getName(){
     return "";
   }
 
+  @Override
   public void init(PsiElement element){
     myFile = (XmlFile) element.getContainingFile();
     
@@ -931,6 +950,7 @@
     dependencies = ArrayUtil.toObjectArray(dependenciesSet);
   }
 
+  @Override
   public Object[] getDependences() {
     if (dependencies == null) dependencies = myFile == null ? ArrayUtil.EMPTY_OBJECT_ARRAY : new Object[] {myFile}; // init was not called
     return dependencies;
@@ -986,6 +1006,7 @@
     UNDECLARED_STD_TYPES.add("anySimpleType");
   }
 
+  @Override
   public void validate(@NotNull XmlDocument context, @NotNull Validator.ValidationHost host) {
     ExternalDocumentValidator.doValidation(context,host);
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XsdEnumerationDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XsdEnumerationDescriptor.java
index 26600b7..a436b22 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XsdEnumerationDescriptor.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XsdEnumerationDescriptor.java
@@ -1,3 +1,18 @@
+/*
+ * 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.xml.impl.schema;
 
 import com.intellij.openapi.util.Ref;
@@ -27,6 +42,7 @@
 
   public abstract XmlTag getDeclaration();
 
+  @Override
   public String getDefaultValue() {
     if (isFixed()) {
       return getDeclaration().getAttributeValue("fixed");
@@ -35,10 +51,12 @@
     return getDeclaration().getAttributeValue("default");
   }
 
+  @Override
   public boolean isFixed() {
     return getDeclaration().getAttributeValue("fixed") != null;
   }
 
+  @Override
   public String[] getEnumeratedValues() {
     return getEnumeratedValues(null);
   }
@@ -112,6 +130,7 @@
   }
 
 
+  @Override
   public boolean isEnumerated(@Nullable XmlElement context) {
     return processEnumeration(context, PairProcessor.TRUE);
   }
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/index/IndexedRelevantResource.java b/xml/xml-psi-impl/src/com/intellij/xml/index/IndexedRelevantResource.java
index 9005a94..ea1396c 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/index/IndexedRelevantResource.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/index/IndexedRelevantResource.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.
@@ -48,6 +48,7 @@
     final ArrayList<IndexedRelevantResource<K, V>> resources = new ArrayList<IndexedRelevantResource<K, V>>();
     final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
     FileBasedIndex.getInstance().processValues(indexId, key, null, new FileBasedIndex.ValueProcessor<V>() {
+      @Override
       public boolean process(VirtualFile file, V value) {
         ResourceRelevance relevance = ResourceRelevance.getRelevance(file, module, fileIndex, additionalScope);
         resources.add(new IndexedRelevantResource<K, V>(file, key, value, relevance));
@@ -104,6 +105,7 @@
     return myRelevance;
   }
 
+  @Override
   public int compareTo(IndexedRelevantResource<K, V> o) {
     int i = myRelevance.compareTo(o.getRelevance());
     return i == 0 ? myValue.compareTo(o.getValue()) : i;
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/index/SchemaTypeInfo.java b/xml/xml-psi-impl/src/com/intellij/xml/index/SchemaTypeInfo.java
new file mode 100644
index 0000000..0760587
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/xml/index/SchemaTypeInfo.java
@@ -0,0 +1,74 @@
+/*
+ * 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.xml.index;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: Irina.Chernushina
+ * Date: 7/4/12
+ * Time: 7:14 PM
+ */
+public class SchemaTypeInfo implements Comparable<SchemaTypeInfo> {
+  private final String myTagName;
+  private final String myNamespaceUri;
+//  private final String myFileUrl;
+  private final boolean myIsTypeName; // false -> enclosing element name
+
+  public SchemaTypeInfo(String tagName, final boolean isTypeName, String namespace) {
+    myNamespaceUri = namespace;
+    myTagName = tagName;
+    myIsTypeName = isTypeName;
+  }
+
+  public String getTagName() {
+    return myTagName;
+  }
+
+  public String getNamespaceUri() {
+    return myNamespaceUri;
+  }
+
+  public boolean isIsTypeName() {
+    return myIsTypeName;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+    if (o == null || getClass() != o.getClass()) return false;
+
+    SchemaTypeInfo info = (SchemaTypeInfo)o;
+
+    if (myIsTypeName != info.myIsTypeName) return false;
+    if (myNamespaceUri != null ? !myNamespaceUri.equals(info.myNamespaceUri) : info.myNamespaceUri != null) return false;
+    if (!myTagName.equals(info.myTagName)) return false;
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    int result = myTagName.hashCode();
+    result = 31 * result + (myNamespaceUri != null ? myNamespaceUri.hashCode() : 0);
+    result = 31 * result + (myIsTypeName ? 1 : 0);
+    return result;
+  }
+
+  @Override
+  public int compareTo(SchemaTypeInfo o) {
+    return myTagName.compareTo(o.getTagName());
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/index/SchemaTypeInheritanceIndex.java b/xml/xml-psi-impl/src/com/intellij/xml/index/SchemaTypeInheritanceIndex.java
new file mode 100644
index 0000000..fb9005d
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/xml/index/SchemaTypeInheritanceIndex.java
@@ -0,0 +1,180 @@
+/*
+ * 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.xml.index;
+
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Pair;
+import com.intellij.openapi.vfs.VfsUtilCore;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.util.PairConvertor;
+import com.intellij.util.containers.EncoderDecoder;
+import com.intellij.util.containers.MultiMap;
+import com.intellij.util.containers.hash.HashMap;
+import com.intellij.util.indexing.DataIndexer;
+import com.intellij.util.indexing.FileBasedIndex;
+import com.intellij.util.indexing.FileContent;
+import com.intellij.util.indexing.ID;
+import com.intellij.util.io.DataExternalizer;
+import com.intellij.util.text.CharArrayUtil;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: Irina.Chernushina
+ * Date: 7/4/12
+ * Time: 6:29 PM
+ *
+ * map: tag name->file url
+ */
+public class SchemaTypeInheritanceIndex extends XmlIndex<Set<SchemaTypeInfo>> {
+  private static final ID<String, Set<SchemaTypeInfo>> NAME = ID.create("SchemaTypeInheritance");
+  private static final Logger LOG = Logger.getInstance("#com.intellij.xml.index.SchemaTypeInheritanceIndex");
+
+  private static List<Set<SchemaTypeInfo>> getDirectChildrenOfType(final Project project,
+                                                                  final String ns,
+                                                                  final String name) {
+    GlobalSearchScope filter = createFilter(project);
+    final List<Set<SchemaTypeInfo>>
+      list = FileBasedIndex.getInstance().getValues(NAME, NsPlusTag.INSTANCE.encode(Pair.create(ns, name)), filter);
+    return list;
+  }
+
+  public static PairConvertor<String, String, List<Set<SchemaTypeInfo>>> getWorker(final Project project, final VirtualFile currentFile) {
+    return new MyWorker(currentFile, project);
+  }
+
+  private static class MyWorker implements PairConvertor<String, String, List<Set<SchemaTypeInfo>>> {
+    private final Project myProject;
+    private final VirtualFile myCurrentFile;
+    private final GlobalSearchScope myFilter;
+    private final boolean myShouldParseCurrent;
+    private MultiMap<SchemaTypeInfo,SchemaTypeInfo> myMap;
+
+    private MyWorker(VirtualFile currentFile, Project project) {
+      myCurrentFile = currentFile;
+      myProject = project;
+
+      myFilter = createFilter(project);
+      myShouldParseCurrent = (myCurrentFile != null && ! myFilter.contains(myCurrentFile));
+    }
+
+    @Override
+    public List<Set<SchemaTypeInfo>> convert(String ns, String name) {
+      List<Set<SchemaTypeInfo>> type = getDirectChildrenOfType(myProject, ns, name);
+      if (myShouldParseCurrent) {
+        if (myMap == null) {
+          try {
+            myMap = XsdComplexTypeInfoBuilder.parse(CharArrayUtil.readerFromCharSequence(VfsUtilCore.loadText(myCurrentFile)));
+            type.add(new HashSet<SchemaTypeInfo>(myMap.get(new SchemaTypeInfo(name, true, ns))));
+          }
+          catch (IOException e) {
+            LOG.info(e);
+          }
+        }
+      }
+      return type;
+    }
+  }
+
+  @Override
+  public boolean dependsOnFileContent() {
+    return true;
+  }
+
+  @Override
+  public int getVersion() {
+    return 0;
+  }
+
+  @NotNull
+  @Override
+  public ID<String, Set<SchemaTypeInfo>> getName() {
+    return NAME;
+  }
+
+  @NotNull
+  @Override
+  public DataIndexer<String, Set<SchemaTypeInfo>, FileContent> getIndexer() {
+    return new DataIndexer<String, Set<SchemaTypeInfo>, FileContent>() {
+      @NotNull
+      @Override
+      public Map<String, Set<SchemaTypeInfo>> map(@NotNull FileContent inputData) {
+        final Map<String, Set<SchemaTypeInfo>> map = new HashMap<String, Set<SchemaTypeInfo>>();
+        final MultiMap<SchemaTypeInfo,SchemaTypeInfo> multiMap =
+          XsdComplexTypeInfoBuilder.parse(CharArrayUtil.readerFromCharSequence(inputData.getContentAsText()));
+        for (SchemaTypeInfo key : multiMap.keySet()) {
+          map.put(NsPlusTag.INSTANCE.encode(Pair.create(key.getNamespaceUri(), key.getTagName())), new HashSet<SchemaTypeInfo>(multiMap.get(key)));
+        }
+        return map;
+      }
+    };
+  }
+
+  @NotNull
+  @Override
+  public DataExternalizer<Set<SchemaTypeInfo>> getValueExternalizer() {
+    return new DataExternalizer<Set<SchemaTypeInfo>>() {
+      @Override
+      public void save(@NotNull DataOutput out, Set<SchemaTypeInfo> value) throws IOException {
+        out.writeInt(value.size());
+        for (SchemaTypeInfo key : value) {
+          out.writeUTF(key.getNamespaceUri());
+          out.writeUTF(key.getTagName());
+          out.writeBoolean(key.isIsTypeName());
+        }
+      }
+
+      @Override
+      public Set<SchemaTypeInfo> read(@NotNull DataInput in) throws IOException {
+        final Set<SchemaTypeInfo> set = new HashSet<SchemaTypeInfo>();
+        final int size = in.readInt();
+        for (int i = 0; i < size; i++) {
+          final String nsUri = in.readUTF();
+          final String tagName = in.readUTF();
+          final boolean isType = in.readBoolean();
+          set.add(new SchemaTypeInfo(tagName, isType, nsUri));
+        }
+        return set;
+      }
+    };
+  }
+
+  private static class NsPlusTag implements EncoderDecoder<Pair<String, String>, String> {
+    private final static NsPlusTag INSTANCE = new NsPlusTag();
+    private final static char ourSeparator = ':';
+
+    @Override
+    public String encode(Pair<String, String> pair) {
+      return pair.getFirst() + ourSeparator + pair.getSecond();
+    }
+
+    @Override
+    public Pair<String, String> decode(String s) {
+      final int i = s.indexOf(ourSeparator);
+      return i <= 0 ? Pair.create("", s) : Pair.create(s.substring(0, i), s.substring(i + 1));
+    }
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/index/XmlIndex.java b/xml/xml-psi-impl/src/com/intellij/xml/index/XmlIndex.java
index fb5242c..28a43ab 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/index/XmlIndex.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/index/XmlIndex.java
@@ -45,10 +45,12 @@
   protected static GlobalSearchScope createFilter(final Project project) {
     final GlobalSearchScope projectScope = GlobalSearchScope.allScope(project);
     return new GlobalSearchScope(project) {
+      @Override
       public int compare(@NotNull VirtualFile file1, @NotNull VirtualFile file2) {
         return projectScope.compare(file1, file2);
       }
 
+      @Override
       public boolean isSearchInModuleContent(@NotNull Module aModule) {
         return true;
       }
@@ -71,6 +73,7 @@
 
     final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(module.getProject()).getFileIndex();
     return new VirtualFileFilter() {
+      @Override
       public boolean accept(final VirtualFile file) {
         Module moduleForFile = fileIndex.getModuleForFile(file);
         if (moduleForFile != null) { // in module content
@@ -95,14 +98,17 @@
     };
   }
 
+  @Override
   @NotNull
   public KeyDescriptor<String> getKeyDescriptor() {
     return KEY_DESCRIPTOR;
   }
 
+  @Override
   @NotNull
   public FileBasedIndex.InputFilter getInputFilter() {
     return new DefaultFileTypeSpecificInputFilter(XmlFileType.INSTANCE, DTDFileType.INSTANCE) {
+      @Override
       public boolean acceptInput(@NotNull final VirtualFile file) {
         FileType fileType = file.getFileType();
         final String extension = file.getExtension();
@@ -112,10 +118,12 @@
     };
   }
 
+  @Override
   public boolean dependsOnFileContent() {
     return true;
   }
 
+  @Override
   public int getVersion() {
     return 0;
   }
diff --git a/xml/impl/src/com/intellij/xml/index/XmlTagNamesIndex.java b/xml/xml-psi-impl/src/com/intellij/xml/index/XmlTagNamesIndex.java
similarity index 100%
rename from xml/impl/src/com/intellij/xml/index/XmlTagNamesIndex.java
rename to xml/xml-psi-impl/src/com/intellij/xml/index/XmlTagNamesIndex.java
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/index/XsdComplexTypeInfoBuilder.java b/xml/xml-psi-impl/src/com/intellij/xml/index/XsdComplexTypeInfoBuilder.java
new file mode 100644
index 0000000..21bc1c9
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/xml/index/XsdComplexTypeInfoBuilder.java
@@ -0,0 +1,225 @@
+/*
+ * 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.xml.index;
+
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.util.containers.MultiMap;
+import com.intellij.util.containers.hash.HashMap;
+import com.intellij.util.xml.NanoXmlUtil;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.Map;
+
+/**
+ * Created with IntelliJ IDEA.
+ * User: Irina.Chernushina
+ * Date: 7/4/12
+ * Time: 6:37 PM
+ */
+public class XsdComplexTypeInfoBuilder extends NanoXmlUtil.IXMLBuilderAdapter {
+  private final static String SIGN = "";
+  public static final String HTTP_WWW_W3_ORG_2001_XMLSCHEMA = "http://www.w3.org/2001/XMLSchema";
+  // base type -> inherited types
+  private final MultiMap<SchemaTypeInfo, SchemaTypeInfo> myMap;
+  private NameSpaceHelper myNameSpaceHelper;
+  private static final Logger LOG = Logger.getInstance("#com.intellij.xml.index.XsdComplexTypeInfoBuilder");
+
+  public void setNameSpaceHelper(NameSpaceHelper nameSpaceHelper) {
+    myNameSpaceHelper = nameSpaceHelper;
+  }
+
+  public static MultiMap<SchemaTypeInfo, SchemaTypeInfo> parse(final InputStream is) {
+    return parse(new InputStreamReader(is));
+  }
+
+  public static MultiMap<SchemaTypeInfo, SchemaTypeInfo> parse(final Reader reader) {
+    try {
+      final XsdComplexTypeInfoBuilder builder = new XsdComplexTypeInfoBuilder();
+      final NameSpaceHelper helper = new NameSpaceHelper();
+      builder.setNameSpaceHelper(helper);
+      NanoXmlUtil.parse(reader, builder, helper);
+      final MultiMap<SchemaTypeInfo,SchemaTypeInfo> map = builder.getMap();
+      return map;
+    } finally {
+      try {
+        if (reader != null) {
+          reader.close();
+        }
+      }
+      catch (IOException e) {
+        // can never happen
+      }
+    }
+  }
+
+  private XsdComplexTypeInfoBuilder() {
+    myMap = new MultiMap<SchemaTypeInfo, SchemaTypeInfo>();
+  }
+
+  public MultiMap<SchemaTypeInfo, SchemaTypeInfo> getMap() {
+    return myMap;
+  }
+
+  // todo work with substitution groups also!
+
+  private String myCurrentElementName;
+  private String myCurrentElementNsName;
+  private String myCurrentComplexTypeName;
+  private String myCurrentComplexTypeNsName;
+  private String myCurrentSimpleTypeName;
+  private String myCurrentSimpleTypeNsName;
+
+  private boolean myInsideSchema;
+  private boolean myInsideRestriction;
+  private boolean myInsideExtension;
+  private boolean myInsideContent;
+
+  @Override
+  public void startElement(String name, String nsPrefix, String nsURI, String systemID, int lineNr) throws Exception {
+    if (! HTTP_WWW_W3_ORG_2001_XMLSCHEMA.equals(nsURI)) return;
+    myInsideSchema = false;
+    if ("schema".equals(name)) {
+      myInsideSchema = true;
+    } else if ("complexType".equals(name)) {
+      myCurrentComplexTypeName = SIGN;
+      myCurrentComplexTypeNsName = nsURI;
+    } else if ("simpleType".equals(name)) {
+      myCurrentSimpleTypeName = SIGN;
+      myCurrentSimpleTypeNsName = nsURI;
+    } else if ("element".equals(name)) {
+      myCurrentElementNsName = nsURI;
+      myCurrentElementName = SIGN;
+    } else if ("restriction".equals(name)) {
+      myInsideRestriction = true;
+    } else if ("extension".equals(name)) {
+      myInsideExtension = true;
+    } else if ("simpleContent".equals(name) || "complexContent".equals(name)) {
+      myInsideContent = true;
+    }
+  }
+
+  @Override
+  public void endElement(String name, String nsPrefix, String nsURI) throws Exception {
+    if (! HTTP_WWW_W3_ORG_2001_XMLSCHEMA.equals(nsURI)) return;
+    if ("schema".equals(name)) {
+      myInsideSchema = false;
+    } else if ("complexType".equals(name)) {
+      myCurrentComplexTypeName = null;
+      myCurrentComplexTypeNsName = null;
+    } else if ("simpleType".equals(name)) {
+      myCurrentSimpleTypeName = null;
+      myCurrentSimpleTypeNsName = null;
+    } else if ("element".equals(name)) {
+      myCurrentElementNsName = null;
+      myCurrentElementName = null;
+    } else if ("restriction".equals(name)) {
+      myInsideRestriction = false;
+    } else if ("extension".equals(name)) {
+      myInsideExtension = false;
+    } else if ("simpleContent".equals(name) || "complexContent".equals(name)) {
+      myInsideContent = false;
+    }
+  }
+
+  @Override
+  public void addAttribute(String key, String nsPrefix, String nsURI, String value, String type) throws Exception {
+    if (! StringUtil.isEmptyOrSpaces(nsURI) && ! HTTP_WWW_W3_ORG_2001_XMLSCHEMA.equals(nsURI)) return;
+    if ("base".equals(key)) {
+      if (myCurrentComplexTypeName != null && myInsideContent && (myInsideExtension || myInsideRestriction)) {
+        putTypeDataToMap(nsURI, value, myCurrentComplexTypeName, myCurrentComplexTypeNsName);
+      } else if (myCurrentSimpleTypeName != null && myInsideRestriction) {
+        putTypeDataToMap(nsURI, value, myCurrentSimpleTypeName, myCurrentSimpleTypeNsName);
+      }
+    } else if (myInsideSchema) {
+    } else if ("name".equals(key) || "ref".equals(key)) {
+      if (SIGN.equals(myCurrentElementName) && ! myInsideContent && ! myInsideExtension && ! myInsideRestriction && ! myInsideSchema &&
+        myCurrentComplexTypeName == null && myCurrentSimpleTypeName == null) {
+        myCurrentElementName = value;
+      } else if (SIGN.equals(myCurrentComplexTypeName) && ! myInsideContent && ! myInsideExtension && ! myInsideRestriction && ! myInsideSchema &&
+              myCurrentSimpleTypeName == null) {
+        myCurrentComplexTypeName = value;
+      } else if (SIGN.equals(myCurrentSimpleTypeName) && ! myInsideContent && ! myInsideExtension && ! myInsideRestriction && ! myInsideSchema &&
+                 myCurrentComplexTypeName == null) {
+        myCurrentSimpleTypeName = value;
+      }
+    }
+  }
+
+  private void putTypeDataToMap(String nsURI, String value, final String typeName, final String typeNamespace) {
+    /*final int separatorIdx = value.indexOf(':');
+    final String ns = separatorIdx <= 0 ? "" : new String(value.substring(0, separatorIdx));
+    final String element = separatorIdx <= 0 ? value : new String(value.substring(separatorIdx + 1));
+    String nsUri = myNameSpaceHelper.getNamespaces().get(ns);
+    nsUri = (nsUri == null ? ns : nsURI);*/
+
+    final boolean isAnonymous = SIGN.equals(typeName);
+    if (isAnonymous && myCurrentElementName != null) {
+      myMap.putValue(createSchemaTypeInfo(value, true), createSchemaTypeInfo(myCurrentElementName, false));
+    } else {
+      myMap.putValue(createSchemaTypeInfo(value, true), createSchemaTypeInfo(typeName, true));
+      //myMap.putValue(new SchemaTypeInfo(element, true, nsURI), new SchemaTypeInfo(typeName, true, typeNamespace));
+    }
+  }
+
+  private SchemaTypeInfo createSchemaTypeInfo(final String value, final boolean isType) {
+    final int separatorIdx = value.indexOf(':');
+    final String ns = separatorIdx <= 0 ? "" : new String(value.substring(0, separatorIdx));
+    final String element = separatorIdx <= 0 ? value : new String(value.substring(separatorIdx + 1));
+    String nsUri = myNameSpaceHelper.getNamespaces().get(ns);
+    nsUri = nsUri == null ? ns : nsUri;
+    return new SchemaTypeInfo(element, isType, nsUri);
+  }
+
+  private static class NameSpaceHelper extends NanoXmlUtil.EmptyValidator {
+    public static final String XMLNS = "xmlns";
+    public static final String XMLNS_ = "xmlns:";
+    private boolean myInSchema;
+    private final Map<String, String> myNamespaces;
+
+    private NameSpaceHelper() {
+      myNamespaces = new HashMap<String, String>();
+    }
+
+    @Override
+    public void attributeAdded(String key, String value, String systemId, int lineNr) {
+      super.attributeAdded(key, value, systemId, lineNr);
+      if (myInSchema) {
+        if (key.startsWith(XMLNS)) {
+          if (key.length() == XMLNS.length()) {
+            myNamespaces.put("", value);
+          } else if (key.startsWith(XMLNS_)) {
+            final String prefix = new String(key.substring(XMLNS_.length()));
+            myNamespaces.put(prefix, value);
+          }
+        }
+      }
+    }
+
+    @Override
+    public void elementStarted(String name, String systemId, int lineNr) {
+      super.elementStarted(name, systemId, lineNr);
+      myInSchema = "schema".equals(name) || name.endsWith(":schema");
+    }
+
+    public Map<String, String> getNamespaces() {
+      return myNamespaces;
+    }
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/index/XsdTagNameBuilder.java b/xml/xml-psi-impl/src/com/intellij/xml/index/XsdTagNameBuilder.java
new file mode 100644
index 0000000..c8426b0
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/xml/index/XsdTagNameBuilder.java
@@ -0,0 +1,76 @@
+/*
+ * 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.xml.index;
+
+import com.intellij.util.xml.NanoXmlUtil;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * @author Dmitry Avdeev
+ */
+public class XsdTagNameBuilder extends NanoXmlUtil.IXMLBuilderAdapter {
+
+  @Nullable
+  public static Collection<String> computeTagNames(final InputStream is) {
+    return computeTagNames(new InputStreamReader(is));
+  }
+
+  @Nullable
+  public static Collection<String> computeTagNames(final Reader reader) {
+    try {
+      final XsdTagNameBuilder builder = new XsdTagNameBuilder();
+      NanoXmlUtil.parse(reader, builder);
+      return builder.myTagNames;
+    }
+    finally {
+      try {
+        if (reader != null) {
+          reader.close();
+        }
+      }
+      catch (IOException e) {
+        // can never happen
+      }
+    }
+  }
+
+  private final Collection<String> myTagNames = new ArrayList<String>();
+  private boolean myElementStarted;
+
+  @Override
+  public void startElement(@NonNls final String name, @NonNls final String nsPrefix, @NonNls final String nsURI, final String systemID, final int lineNr)
+      throws Exception {
+
+    myElementStarted = nsPrefix != null && nsURI.equals("http://www.w3.org/2001/XMLSchema") && name.equals("element");
+  }
+
+  @Override
+  public void addAttribute(@NonNls final String key, final String nsPrefix, final String nsURI, final String value, final String type)
+      throws Exception {
+    if (myElementStarted && key.equals("name")) {
+      myTagNames.add(value);
+      myElementStarted = false;
+    }
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/ColorIconCache.java b/xml/xml-psi-impl/src/com/intellij/xml/util/ColorIconCache.java
new file mode 100644
index 0000000..ae347b0
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/xml/util/ColorIconCache.java
@@ -0,0 +1,103 @@
+/*
+ * 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.xml.util;
+
+import com.intellij.util.containers.HashMap;
+import com.intellij.util.containers.SoftFactoryMap;
+import com.intellij.util.ui.EmptyIcon;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Map;
+
+/**
+ * @author spleaner
+ */
+public class ColorIconCache {
+  private static final ColorIconCache INSTANCE = new ColorIconCache();
+  private static final SoftFactoryMap<Color, Map<Integer, Icon>> ourCache = new SoftFactoryMap<Color, Map<Integer, Icon>>() {
+    @Override
+    protected Map<Integer, Icon> create(Color key) {
+      return new HashMap<Integer, Icon>();
+    }
+  };
+
+  private ColorIconCache() {
+  }
+
+  public static ColorIconCache getIconCache() {
+    return INSTANCE;
+  }
+
+  public Icon getIcon(@NotNull final Color color, final int size) {
+    Icon icon = ourCache.get(color).get(size);
+    if (icon == null) {
+      icon = new ColorIcon(size, color);
+      ourCache.get(color).put(size, icon);
+    }
+
+    return icon;
+  }
+
+  public static class ColorIcon extends EmptyIcon {
+    private Color myColor;
+    private Color[] myColours;
+
+    public ColorIcon(final int size, final Color color) {
+      super(size);
+      myColor = color;
+    }
+
+    public ColorIcon(final int size, final Color[] colours) {
+      super(size);
+      myColours = colours;
+    }
+
+    @Override
+    public void paintIcon(final Component component, final Graphics g, final int i, final int j) {
+      final int iconWidth = getIconWidth();
+      final int iconHeight = getIconHeight();
+      if (myColor != null) {
+        g.setColor(myColor);
+        g.fillRect(i, j, iconWidth, iconHeight);
+      }
+      else if (myColours != null) {
+        final Color top = myColours[0];
+        g.setColor(top);
+        g.fillRect(i, j, iconWidth, 2);
+
+        final Color right = myColours[1];
+        g.setColor(right);
+        g.fillRect(i + iconWidth / 2, j + 2, iconWidth / 2, iconHeight / 2);
+
+        final Color bottom = myColours[2];
+        g.setColor(bottom);
+        g.fillRect(i, j + iconHeight - 2, iconWidth, 2);
+
+        final Color left = myColours[3];
+        g.setColor(left);
+        g.fillRect(i, j + 2, iconWidth / 2, iconHeight / 2);
+      }
+
+      final Composite old = ((Graphics2D)g).getComposite();
+      ((Graphics2D)g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.1f));
+      g.setColor(Color.BLACK);
+      g.drawRect(i, j, iconWidth-1, iconHeight-1);
+      ((Graphics2D)g).setComposite(old);
+    }
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/HTMLControls.java b/xml/xml-psi-impl/src/com/intellij/xml/util/HTMLControls.java
index 1611b78..f8797c6 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/HTMLControls.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/util/HTMLControls.java
@@ -39,7 +39,7 @@
  * @author Dennis.Ushakov
  */
 public class HTMLControls {
-  private static Logger LOG = Logger.getInstance(HTMLControls.class);
+  private static final Logger LOG = Logger.getInstance(HTMLControls.class);
   private static Control[] ourControls;
 
   public static Control[] getControls() {
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/HtmlFileNSInfoProvider.java b/xml/xml-psi-impl/src/com/intellij/xml/util/HtmlFileNSInfoProvider.java
new file mode 100644
index 0000000..ce6b02a
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/xml/util/HtmlFileNSInfoProvider.java
@@ -0,0 +1,39 @@
+/*
+ * 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.xml.util;
+
+import com.intellij.ide.highlighter.HtmlFileType;
+import com.intellij.ide.highlighter.XHtmlFileType;
+import com.intellij.psi.xml.XmlFile;
+import com.intellij.psi.xml.XmlFileNSInfoProvider;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author yole
+ */
+public class HtmlFileNSInfoProvider implements XmlFileNSInfoProvider {
+  @Nullable
+  @Override
+  public String[][] getDefaultNamespaces(@NotNull XmlFile file) {
+    return null;
+  }
+
+  @Override
+  public boolean overrideNamespaceFromDocType(@NotNull XmlFile file) {
+    return file.getFileType() == HtmlFileType.INSTANCE || file.getFileType() == XHtmlFileType.INSTANCE;
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/IncludedXmlText.java b/xml/xml-psi-impl/src/com/intellij/xml/util/IncludedXmlText.java
index b98a360..51120a9 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/IncludedXmlText.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/util/IncludedXmlText.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.
@@ -51,34 +51,42 @@
     return getOriginal().getText();
   }
 
+  @Override
   public String getValue() {
     return getOriginal().getValue();
   }
 
+  @Override
   public void setValue(String s) throws IncorrectOperationException {
     throw new UnsupportedOperationException("Can't modify included elements");
   }
 
+  @Override
   public XmlElement insertAtOffset(XmlElement element, int displayOffset) throws IncorrectOperationException {
     throw new UnsupportedOperationException("Can't modify included elements");
   }
 
+  @Override
   public void insertText(String text, int displayOffset) throws IncorrectOperationException {
     throw new UnsupportedOperationException("Can't modify included elements");
   }
 
+  @Override
   public void removeText(int displayStart, int displayEnd) throws IncorrectOperationException {
     throw new UnsupportedOperationException("Can't modify included elements");
   }
 
+  @Override
   public int physicalToDisplay(int offset) {
     return getOriginal().physicalToDisplay(offset);
   }
 
+  @Override
   public int displayToPhysical(int offset) {
     return getOriginal().displayToPhysical(offset);
   }
 
+  @Override
   @Nullable
   public XmlText split(int displayIndex) {
     throw new UnsupportedOperationException("Can't modify included elements");
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/InclusionProvider.java b/xml/xml-psi-impl/src/com/intellij/xml/util/InclusionProvider.java
index 7c05a0a..d1fdde1 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/InclusionProvider.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/util/InclusionProvider.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.
@@ -46,6 +46,7 @@
     return CachedValuesManager.getCachedValue(xincludeTag, new InclusionProvider(xincludeTag));
   }
 
+  @Override
   public Result<PsiElement[]> compute() {
     PsiElement[] result = RecursionManager.doPreventingRecursion(myXincludeTag, true, new NullableComputable<PsiElement[]>() {
       @Override
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlApplicationComponent.java b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlApplicationComponent.java
index 764db5a..513d280 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlApplicationComponent.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlApplicationComponent.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.
@@ -32,6 +32,7 @@
  * @author Maxim.Mossienko
  */
 public class XmlApplicationComponent implements MetaDataContributor {
+  @Override
   public void contributeMetaData(final MetaDataRegistrar registrar) {
     {
       registrar.registerMetaData(
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlIconProvider.java b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlIconProvider.java
new file mode 100644
index 0000000..686b154
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlIconProvider.java
@@ -0,0 +1,57 @@
+/*
+ * 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.xml.util;
+
+import com.intellij.icons.AllIcons;
+import com.intellij.ide.IconProvider;
+import com.intellij.openapi.project.DumbAware;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.impl.ElementBase;
+import com.intellij.psi.xml.XmlFile;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+
+/**
+ * @author peter
+ */
+public class XmlIconProvider extends IconProvider implements DumbAware {
+  @NonNls private static final String XSD_FILE_EXTENSION = "xsd";
+  @NonNls private static final String WSDL_FILE_EXTENSION = "wsdl";
+
+  @Override
+  @Nullable
+  public Icon getIcon(@NotNull final PsiElement element, final int _flags) {
+    if (element instanceof XmlFile) {
+      final VirtualFile vf = ((XmlFile)element).getVirtualFile();
+      if (vf != null) {
+        final String extension = vf.getExtension();
+        
+        if (XSD_FILE_EXTENSION.equals(extension)) {
+          return ElementBase.createLayeredIcon(element, AllIcons.FileTypes.XsdFile, ElementBase.transformFlags(element, _flags));
+        }
+        if (WSDL_FILE_EXTENSION.equals(extension)) {
+          return ElementBase.createLayeredIcon(element, AllIcons.FileTypes.WsdlFile, ElementBase.transformFlags(element, _flags));
+        }
+      }
+    }
+    return null;
+  }
+
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlNSDescriptorSequence.java b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlNSDescriptorSequence.java
index 06ab056..ead67f6 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlNSDescriptorSequence.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlNSDescriptorSequence.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.
@@ -26,7 +26,6 @@
 import org.jetbrains.annotations.Nullable;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -43,8 +42,7 @@
   }
 
   public XmlNSDescriptorSequence(XmlNSDescriptor[] descriptors){
-    for(int i = 0; i < descriptors.length; i++){
-      final XmlNSDescriptor descriptor = descriptors[i];
+    for (final XmlNSDescriptor descriptor : descriptors) {
       add(descriptor);
     }
   }
@@ -53,34 +51,31 @@
     sequence.add(descriptor);
   }
 
+  @Override
   public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag){
-    final Iterator iterator = sequence.iterator();
-    while(iterator.hasNext()){
-      final XmlNSDescriptor descriptor = (XmlNSDescriptor) iterator.next();
+    for (XmlNSDescriptor descriptor : sequence) {
       final XmlElementDescriptor elementDescriptor = descriptor.getElementDescriptor(tag);
-      if(elementDescriptor != null) return elementDescriptor;
+      if (elementDescriptor != null) return elementDescriptor;
     }
     return null;
   }
 
+  @Override
   @NotNull
   public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable final XmlDocument document) {
     final List<XmlElementDescriptor> descriptors = new ArrayList<XmlElementDescriptor>();
-    final Iterator iterator = sequence.iterator();
-    while(iterator.hasNext()) {
-      final XmlNSDescriptor descriptor = (XmlNSDescriptor)iterator.next();
+    for (XmlNSDescriptor descriptor : sequence) {
       ContainerUtil.addAll(descriptors, descriptor.getRootElementsDescriptors(document));
     }
 
     return descriptors.toArray(new XmlElementDescriptor[descriptors.size()]);
   }
 
+  @Override
   public XmlFile getDescriptorFile(){
-    final Iterator iterator = sequence.iterator();
-    while(iterator.hasNext()){
-      final XmlNSDescriptor descriptor = (XmlNSDescriptor) iterator.next();
+    for (XmlNSDescriptor descriptor : sequence) {
       final XmlFile file = descriptor.getDescriptorFile();
-      if(file != null) return file;
+      if (file != null) return file;
     }
     return null;
   }
@@ -89,58 +84,52 @@
     return sequence;
   }
 
+  @Override
   public boolean isHierarhyEnabled() {
-    final Iterator iterator = sequence.iterator();
-    while(iterator.hasNext()){
-      final XmlNSDescriptor descriptor = (XmlNSDescriptor) iterator.next();
-      if(descriptor.isHierarhyEnabled()) return true;
+    for (XmlNSDescriptor descriptor : sequence) {
+      if (descriptor.isHierarhyEnabled()) return true;
     }
     return false;
   }
 
+  @Override
   public PsiElement getDeclaration(){
-    final Iterator iterator = sequence.iterator();
-    while(iterator.hasNext()){
-      final XmlNSDescriptor descriptor = (XmlNSDescriptor) iterator.next();
+    for (XmlNSDescriptor descriptor : sequence) {
       final PsiElement declaration = descriptor.getDeclaration();
-      if(declaration != null) return declaration;
+      if (declaration != null) return declaration;
     }
     return null;
   }
 
+  @Override
   public String getName(PsiElement context){
-    final Iterator iterator = sequence.iterator();
-    while(iterator.hasNext()){
-      final XmlNSDescriptor descriptor = (XmlNSDescriptor) iterator.next();
+    for (XmlNSDescriptor descriptor : sequence) {
       final String name = descriptor.getName(context);
-      if(name != null) return name;
+      if (name != null) return name;
     }
     return null;
   }
 
+  @Override
   public String getName(){
-    final Iterator iterator = sequence.iterator();
-    while(iterator.hasNext()){
-      final XmlNSDescriptor descriptor = (XmlNSDescriptor) iterator.next();
+    for (XmlNSDescriptor descriptor : sequence) {
       final String name = descriptor.getName();
-      if(name != null) return name;
+      if (name != null) return name;
     }
     return null;
   }
 
+  @Override
   public void init(PsiElement element){
-    final Iterator iterator = sequence.iterator();
-    while(iterator.hasNext()){
-      final XmlNSDescriptor descriptor = (XmlNSDescriptor) iterator.next();
+    for (XmlNSDescriptor descriptor : sequence) {
       descriptor.init(element);
     }
   }
 
+  @Override
   public Object[] getDependences(){
     final List<Object> ret = new ArrayList<Object>();
-    final Iterator iterator = sequence.iterator();
-    while(iterator.hasNext()) {
-      final XmlNSDescriptor descriptor = (XmlNSDescriptor)iterator.next();
+    for (XmlNSDescriptor descriptor : sequence) {
       ContainerUtil.addAll(ret, descriptor.getDependences());
     }
     return ret.toArray();
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlPrefixReferenceProvider.java b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlPrefixReferenceProvider.java
new file mode 100644
index 0000000..2af1bfe
--- /dev/null
+++ b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlPrefixReferenceProvider.java
@@ -0,0 +1,63 @@
+/*
+ * 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.xml.util;
+
+import com.intellij.openapi.util.TextRange;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiReference;
+import com.intellij.psi.PsiReferenceProvider;
+import com.intellij.psi.impl.source.xml.SchemaPrefixReference;
+import com.intellij.psi.xml.XmlAttribute;
+import com.intellij.psi.xml.XmlAttributeValue;
+import com.intellij.psi.xml.XmlTag;
+import com.intellij.util.ProcessingContext;
+import com.intellij.xml.XmlAttributeDescriptor;
+import com.intellij.xml.impl.schema.XmlAttributeDescriptorImpl;
+import com.intellij.xml.impl.schema.XmlNSDescriptorImpl;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Dmitry Avdeev
+ */
+public class XmlPrefixReferenceProvider extends PsiReferenceProvider {
+
+  @NotNull
+  @Override
+  public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
+    XmlAttributeValue attributeValue = (XmlAttributeValue)element;
+    String value = attributeValue.getValue();
+    if (value == null) return PsiReference.EMPTY_ARRAY;
+    int i = value.indexOf(':');
+    if (i <= 0) return PsiReference.EMPTY_ARRAY;
+    PsiElement parent = attributeValue.getParent();
+    if (parent instanceof XmlAttribute && !XmlNSDescriptorImpl.checkSchemaNamespace(((XmlAttribute)parent).getParent())) {
+      XmlAttributeDescriptor descriptor = ((XmlAttribute)parent).getDescriptor();
+      if (descriptor instanceof XmlAttributeDescriptorImpl) {
+        String type = ((XmlAttributeDescriptorImpl)descriptor).getType();
+        if (type != null && type.endsWith(":QName")) {
+          String prefix = XmlUtil.findPrefixByQualifiedName(type);
+          String ns = ((XmlTag)descriptor.getDeclaration()).getNamespaceByPrefix(prefix);
+          if (XmlNSDescriptorImpl.checkSchemaNamespace(ns)) {
+            return new PsiReference[] {
+              new SchemaPrefixReference(attributeValue, TextRange.from(1, i), value.substring(0, i), null)
+            };
+          }
+        }
+      }
+    }
+    return PsiReference.EMPTY_ARRAY;
+  }
+}
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlPsiUtil.java b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlPsiUtil.java
index 57cff1c..9f2453e 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlPsiUtil.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlPsiUtil.java
@@ -1,3 +1,18 @@
+/*
+ * 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.xml.util;
 
 import com.intellij.openapi.util.Key;
@@ -204,6 +219,7 @@
 
       if (value == null) {
         value = CachedValuesManager.getManager(entityDecl.getProject()).createCachedValue(new CachedValueProvider<PsiElement>() {
+          @Override
           public Result<PsiElement> compute() {
             final PsiElement res = entityDecl.parse(targetFile, type, entityRef);
             if (res == null) return new Result<PsiElement>(res, targetFile);
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlResourceResolver.java b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlResourceResolver.java
index fdd2690..cc3269f 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlResourceResolver.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlResourceResolver.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.
@@ -81,7 +81,7 @@
   @Nullable
   public PsiFile resolve(@Nullable final String baseSystemId, final String _systemId) {
     if (LOG.isDebugEnabled()) {
-      LOG.debug("enter: resolveEntity(baseSystemId='" + baseSystemId + "' systemId='" + _systemId + "," + super.toString() + "')");
+      LOG.debug("enter: resolveEntity(baseSystemId='" + baseSystemId + "' systemId='" + _systemId + "," + toString() + "')");
     }
 
     if (_systemId == null) return null;
@@ -95,6 +95,7 @@
 
     final PsiFile[] result = new PsiFile[] { null };
     final Runnable action = new Runnable() {
+      @Override
       public void run() {
         PsiFile baseFile = null;
         VirtualFile vFile = null;
@@ -213,7 +214,7 @@
       if (file != null) {
         final String url = file.getUrl();
         if (LOG.isDebugEnabled()) {
-          LOG.debug("Adding external resource ref:"+systemId+","+url+","+super.toString());
+          LOG.debug("Adding external resource ref:"+systemId+","+url+","+ toString());
         }
         myExternalResourcesMap.put(systemId,url);
       }
@@ -221,6 +222,7 @@
     return psiFile;
   }
 
+  @Override
   @Nullable
   public XMLInputSource resolveEntity(XMLResourceIdentifier xmlResourceIdentifier) throws XNIException, IOException {
     String publicId  = xmlResourceIdentifier.getLiteralSystemId() != null ?
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlUtil.java b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlUtil.java
index b82f69b..a513db4 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlUtil.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlUtil.java
@@ -284,6 +284,7 @@
       resources = XmlNamespaceIndex.getResourcesByNamespace(namespace, project, module);
     final PsiManager psiManager = PsiManager.getInstance(project);
     return ContainerUtil.mapNotNull(resources, new NullableFunction<IndexedRelevantResource<String, XsdNamespaceBuilder>, XmlFile>() {
+      @Override
       public XmlFile fun(IndexedRelevantResource<String, XsdNamespaceBuilder> resource) {
         PsiFile file = psiManager.findFile(resource.getFile());
         return file instanceof XmlFile ? (XmlFile)file : null;
@@ -427,6 +428,7 @@
         final XmlTag[] simpleContent = new XmlTag[1];
 
         processXmlElements(((ComplexTypeDescriptor)type).getDeclaration(), new PsiElementProcessor() {
+          @Override
           public boolean execute(@NotNull final PsiElement element) {
             if (element instanceof XmlTag) {
               final XmlTag tag = (XmlTag)element;
@@ -848,6 +850,7 @@
       final XmlAttribute[] attributes = tag.getAttributes();
       ContainerUtil.sort(list);
       Arrays.sort(attributes, new Comparator<XmlAttribute>() {
+        @Override
         public int compare(XmlAttribute attr1, XmlAttribute attr2) {
           return attr1.getName().compareTo(attr2.getName());
         }
@@ -890,6 +893,7 @@
     tagsMap.put(tagName, tags);
     PsiFile file = tag.isValid() ? tag.getContainingFile() : null;
     processXmlElements(tag, new FilterElementProcessor(XmlTagFilter.INSTANCE) {
+      @Override
       public void add(PsiElement element) {
         XmlTag tag = (XmlTag)element;
         if (!tags.contains(tag.getName())) {
@@ -953,6 +957,7 @@
 
   public static boolean collectEnumerationValues(final XmlTag element, final HashSet<String> variants) {
     return processEnumerationValues(element, new Processor<XmlTag>() {
+      @Override
       public boolean process(XmlTag xmlTag) {
         variants.add(xmlTag.getAttributeValue(VALUE_ATTR_NAME));
         return true;
@@ -1146,6 +1151,7 @@
       final PsiNamedElement[] result = new PsiNamedElement[1];
 
       processXmlElements((XmlFile)currentElement, new PsiElementProcessor() {
+        @Override
         public boolean execute(@NotNull final PsiElement element) {
           if (element instanceof PsiNamedElement) {
             final String elementName = ((PsiNamedElement)element).getName();
@@ -1196,6 +1202,7 @@
       myRequired = flag;
     }
 
+    @Override
     public int compareTo(Object o) {
       if (o instanceof MyAttributeInfo) {
         return myName.compareTo(((MyAttributeInfo)o).myName);
diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/CompositeAttributeTagDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/CompositeAttributeTagDescriptor.java
index 53fdca8..c23f353 100644
--- a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/CompositeAttributeTagDescriptor.java
+++ b/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/CompositeAttributeTagDescriptor.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,7 +24,7 @@
  * @author maxim
  */
 class CompositeAttributeTagDescriptor extends HtmlAttributeDescriptor {
-  List<HtmlAttributeDescriptor> attributes = new LinkedList<HtmlAttributeDescriptor>();
+  final List<HtmlAttributeDescriptor> attributes = new LinkedList<HtmlAttributeDescriptor>();
 
   HtmlAttributeDescriptor findHtmlAttributeInContext(XmlTag tag) {
     if (tag == null) return null;
diff --git a/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/AbstractXmlTagTreeElement.java b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/AbstractXmlTagTreeElement.java
index 2383784..55e994d 100644
--- a/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/AbstractXmlTagTreeElement.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/AbstractXmlTagTreeElement.java
@@ -36,6 +36,7 @@
       (XmlStructureViewElementProvider[])Extensions.getExtensions(XmlStructureViewElementProvider.EXTENSION_POINT_NAME);
 
     return ContainerUtil.map2List(subTags, new Function<XmlTag, StructureViewTreeElement>() {
+      @Override
       public StructureViewTreeElement fun(final XmlTag xmlTag) {
         for (final XmlStructureViewElementProvider provider : providers) {
           final StructureViewTreeElement element = provider.createCustomXmlTagTreeElement(xmlTag);
diff --git a/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java
index 8ca2b89..c1c811b 100644
--- a/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java
@@ -36,6 +36,7 @@
     super(file);
   }
 
+  @Override
   @NotNull
   public Collection<StructureViewTreeElement> getChildrenBase() {
     return collectElements(getElement().getDocument());
@@ -45,6 +46,7 @@
     final List<StructureViewTreeElement> elements = new ArrayList<StructureViewTreeElement>();
 
     XmlUtil.processXmlElements(element, new PsiElementProcessor() {
+      @Override
       public boolean execute(@NotNull final PsiElement element) {
         if (element instanceof XmlElementDecl ||
             element instanceof XmlEntityDecl) {
@@ -56,6 +58,7 @@
     return elements;
   }
 
+  @Override
   public String getPresentableText() {
     return getElement().getName();
   }
@@ -72,20 +75,24 @@
       super(element);
     }
 
+    @Override
     @NotNull
     public Collection<StructureViewTreeElement> getChildrenBase() {
       return Collections.emptyList();
     }
 
+    @Override
     public String getPresentableText() {
       final PsiNamedElement namedElement = getElement();
       return namedElement != null ? namedElement.getName():"";
     }
 
+    @Override
     public Icon getIcon(final boolean open) {
       return PlatformIcons.XML_TAG_ICON;
     }
 
+    @Override
     public String getLocationString() {
       final XmlElement owner = (XmlElement)getElement();
 
diff --git a/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/XmlFileTreeElement.java b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/XmlFileTreeElement.java
index f13fe1c..d9447ea 100644
--- a/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/XmlFileTreeElement.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/XmlFileTreeElement.java
@@ -29,6 +29,7 @@
     super(file);
   }
 
+  @Override
   @NotNull
   public Collection<StructureViewTreeElement> getChildrenBase() {
     final XmlDocument document = getElement().getDocument();
@@ -66,6 +67,7 @@
     return structureViewTreeElements;
   }
 
+  @Override
   public String getPresentableText() {
     return getElement().getName();
   }
diff --git a/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/Html5SectionsProcessor.java b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/Html5SectionsProcessor.java
index 2ca1c8b..fc5361b 100644
--- a/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/Html5SectionsProcessor.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/Html5SectionsProcessor.java
@@ -36,7 +36,7 @@
 
   private static class SectionHolder {
     private final XmlTag myTag;
-    private LinkedList<Section> myChildren = new LinkedList<Section>();
+    private final LinkedList<Section> myChildren = new LinkedList<Section>();
 
     private SectionHolder(final XmlTag tag) {
       myTag = tag;
@@ -63,6 +63,7 @@
       super(tag);
     }
 
+    @Override
     public void addChildSection(final Section section) {
       section.myParent = this;
       super.addChildSection(section);
@@ -87,6 +88,7 @@
   private static final String HGROUP_ELEMENT = "hgroup";
 
   private final Collection<SectionHolder> myRootSectionHolders = new SortedList<SectionHolder>(new Comparator<SectionHolder>() {
+    @Override
     public int compare(final SectionHolder first, final SectionHolder second) {
       return first.getTag().getTextRange().getStartOffset() - second.getTag().getTextRange().getStartOffset();
     }
@@ -216,6 +218,7 @@
 
   private static Computable<Collection<StructureViewTreeElement>> createChildrenComputable(final Collection<Section> children) {
     return new Computable<Collection<StructureViewTreeElement>>() {
+      @Override
       public Collection<StructureViewTreeElement> compute() {
         final Collection<StructureViewTreeElement> result = new ArrayList<StructureViewTreeElement>();
         for (Section section : children) {